[JBoss Seam] - Re: Seam jBPM: use annotation or pages.xml to get next task?
by bsmithjj
"gavin.king(a)jboss.com" wrote : anonymous wrote : No, it's not a Seam component (no @Name(...)) annotation - does that work? I mean if I put @Name on my custom ActionHandlers, DecisionHandlers, will Seam inject resources into them on invokation of the execute(ExecutionContext executionContext) methods?
|
| No, of course not, Seam doesn't know anything about them.
|
| Why don't you just make it a seam component, and call it via the EL, instead of going behind Seam's back? It should be easy to do that, right? Just add an annotation and don't bother implementing the interface anymore...
I'm a bit lost on which class you're saying should be a seam component in your last paragraph. It sounds like you're saying I can't make an ActionHandler into a Seam component and then you're saying I should make it a Seam component...
Let me give a brief specific example of what I am trying to do and you can tell me what's wrong with it:
Here I have a state in my process definition:
| <state name="Provision Response">
| <event type="node-enter">
| <!-- on entry, fire the auto provision action -->
| <action class="com.evergreen.accesscontrol.jbpmaction.AutoProvisionAction"/>
| </event>
| <transition name="ProvisionSuccess" to="end approval request"></transition>
| <transition name="ProvisionFailure" to="end approval request"></transition>
| </state>
|
And here is the AutoProvisionAction:
| public class AutoProvisionAction implements ActionHandler {
|
| private Log log = LogFactory.getLog(AutoProvisionAction.class);
|
| public void execute(ExecutionContext executionContext) throws Exception {
| final EntityManager em = (EntityManager) Component.getInstance("accessControlDatabase");
| long accessRequestId = (Long) executionContext.getVariable("accessRequestId");
|
| AccessRequest accessRequest = null;
| User user = null;
|
| try {
| accessRequest = (AccessRequest) em.createQuery(
| "from AccessRequest a fetch all properties where a.id=:id"
| ).setParameter("id", accessRequestId)
| .getSingleResult();
| EntitlementStorageType entStorageType = accessRequest.getApplication().getEntitlementStorageType();
| if (accessRequest.getApplication().getEntitlementStorageType() != null) {
| log.info("EntitlementStorageType=" + accessRequest.getApplication().getEntitlementStorageType().getName());
| }
|
| if (AccessRequestType.Change == accessRequest.getRequestType()) {
| try {
| user = (User) em.createQuery
| ("from User u where u.application.id = :appId and userid = :userid")
| .setParameter("appId", accessRequest.getApplication().getId())
| .setParameter("userid", accessRequest.getUserId())
| .setHint("org.hibernate.readOnly", Boolean.TRUE)
| .getSingleResult();
| } catch (NoResultException e) {
| log.error(
| "Can't find User (userid=" + accessRequest.getUserId() +
| ") for AccessRequest.id=" + accessRequestId
| + ". Task should be completed in an error state..."
| );
| log.error("automatic provisioning will not be attempted");
| return;
| }
|
| }
| AccessOperationDocument accessOperationDocument = EvergreenSecurityAdaptorUtility
| .convertAccessRequestToAccessOperationDocument(
| accessRequest, String.valueOf(executionContext.getProcessInstance().getId()), user
| );
|
| if (accessOperationDocument == null) {
| log.error("There was a problem creating the AccessOperationDocument for Evergreen-Security Auto-Provisioning.");
| log.error("TODO - close task in an error state when this occurs");
| log.error("automatic provisioning will not be attempted");
| return;
| }
| JMSSender jmsSender = (JMSSender) Component.getInstance("simpleJmsSender");
| jmsSender.sendMessage(accessOperationDocument.xmlText());
| } catch (NoResultException e) {
| log.error("Can't load AccessRequest for id=" + accessRequestId + ". Task should be completed in an error state...");
| }
| }
|
| }
|
notice I need to acquire some resources that typically Seam would inject into a session bean - anywhere there is Component.getInstance(...) I use @In or @EJB in my Seam components. I was having so many NO_TRANSACTION issues when I tried to keep this logic in a session bean, I struggled with this for a while and ultimately I found that by using Component to get the desired resources and implementing the logic in place that you see here (which formerly was in a session bean), I was able to do what I needed without running into transactional issues. Basically, If I do all the work associated with an ActionHandler in place, I do not run into transaction problems, the moment that I cross the EJB-method invokation line, transaction issues arise.
It would be ideal if jBPM Handlers (ActionHandler, DecisionHandler, etc.) could be first class Seam components and have Seam intercept execute() invokations and @Inject/@Outject resources.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029986#4029986
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029986
19Â years, 1Â month
[JBoss Seam] - Re: Seam jBPM: use annotation or pages.xml to get next task?
by petemuir
"avbentem" wrote : But that might not be such a huge advantage at all: the jPDL XSD often accepts xsd:any, so probably allows for you additional viewId attribute without any changes. And one might also add Seam EL in the process definition, which makes them Seam-specific as well.
I didn't have to alter the xsd, just extend TaskInstance, extend its mapping file, and configure JBPM to create the extended TaskInstance in a factory
anonymous wrote : So: are you saying you prefer your solution, or Gavin's, or would you like some other enhancements to make things even be better?
Gavin's is less work :) - I wanted some other stuff stored on each task e.g. the task creator, the "package" (so I could easily say "Give me all recruitment tasks") so it was easy to add a viewId attribute as well (and also, I wanted to be able to include the task resolution page inside a tab, and not just navigate to it).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029981#4029981
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029981
19Â years, 1Â month
[JBoss Seam] - Seam Tools, Project Structures, and IDEs
by Delphi's Ghost
We are starting a new EJB project in Seam, and are wondering what type of project to use. Given the Exadel announcement we anticipate using Exadel initially until the formal release of RHDS as opposed to Netbeans. We felt that the final incarnation of Exadel studio as RHDS would be more in tune with our technology choices of JSF, Seam, Hibernate, Jbpm and probably JBoss.
However, we are somewhat perplexed as to what type of project to use. Using Seam-Gen, or a homebrew ant-driven project structure means we can manipulate the project however we want through ant, but within Eclipse, it looks crappy with jar files everywhere (I know about the filters, but I want to see the jars organized, not included as top level items).
Our other concern is with debugging the application within the IDE which is difficult/impossible? without using an IDE generated project as opposed to an ant based project.
We tried starting with an Java Enterprise Application project, but couldn't get Eclipse to deploy it with the jboss-seam.jar & other jars in the root directory of the ear. I can manually export the project to an ear file, and they get included. However, if I just publish it to the web server, the jars aren't included. I've tried just about every combination of importing jars, including them in the EarContent directory, putting the names in application.xml but with no luck.
Our only other concern is whether we need to go with an Ant driven project so we can get the benefits of exploded deployments.
Doing this in Netbeans was easy, it just works, but we have no idea when Netbeans will support Seam for things like autocompletion in JSF pages, and the visual editor in Netbeans has plenty of flaws, while the exadel visual editor is just enough for you to get an idea of how the page looks.
We have also considered bagging the idea of a visual editor in the IDE, and going with something like Dreamweaver with the Seam/JSF plugins.
So, I'm wondering if anyone has any suggestions for an IDE friendly project structure that will work well with Exadel/Eclipse, and deploy to an Ear, with an exploded deployment option?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029973#4029973
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029973
19Â years, 1Â month