cancel
Showing results for 
Search instead for 
Did you mean: 

Java CDI Integration

alvim
Champ in-the-making
Champ in-the-making
Hi!

I'd like to know if there's any plan to integrate Activiti with the Java EE 6 CDI (Context Dependency Injection) Standard - similar to the Spring integration…

If not (I couldn't find that), anyone could give us any directions/help about how could we implement this integration?

Thanks in advance and congratulations for doing such a helpful product!

Paulo Alvim
Powerlogic - Brazil
5 REPLIES 5

jbarrez
Star Contributor
Star Contributor
Hi Paulo,

Thats currently not on our roadmap, so it'll not be coming in any release soon.
But if you are willing to look into it, the Spring integration is definitely the right place to go. The hardest part however, lies in the fact that CDI usesstandardized expressions, which might not match with the ones in Activiti.

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Paulo,

I started working on this. The issue is in ACT-541. For an initial release I have the following ideas

    - an 'Activiti' application scoped, auto start component that can be injected with @Inject. It is a small class that instantiates a default process engine. It is also a wrapper around a 'process engine' with identical methods
    - Components for the 'managament', 'repository', 'identity', 'runtime', 'task' services that can separately be injected. The activiti component will not provide the 'getXXXService methods'. These components will provide some convenience methods that can return information that normally has to be retrieved via the different very flexible query api's
    - @StartProcess(…) method annotation that takes a string and starts a process with the specified name if te method returns without an error. The process id will be put in the correct scope
    - @BeginTask method annotation that takes starts a task of which the id is to be retrieved somewhere. It also starts a new long running conversation. If the task is not assigned to the current user, it will also do that. What needs to be looked into is how/when/if a task form can be directly opened.
    - @EndTask method annotation that takes starts a task of which the id is to be retrieved somewhere. It also ends the long running conversation.
    -
The variables map for a process can be 'outjected' with the CDI '@Produces()'  annotation. Using one would go like #{variables.get['varname']}

In addition I'm going to provide JSF composite components for task management, task overview, kind of what the activiti-explorer does now. These will be based on Primefaces.

I also have some ideas for a second version:
    - @StartProcess also takes a second string as a parameter that is a reference to the field that contains the businesskey and a third parameter that is a reference to the field that contains the map of process variables. Another option is to implicitly use annotations on the fields. Things like @Businesskey, @Variables. Think I prefer the latter.
    - Make starting/ending the conversation with the task annotations optional/parameterized
    - Try to outject variables with there normal name and not in a map. So #{variables.get['varname']} would become #{varname}
    - support jsf for taskforms, in combination with the very powerful metawidget thing
Comments?

carlos1
Champ in-the-making
Champ in-the-making
I'm very interested in the CDI Extension for Activiti. I see there's already a JIRA Issue for this. I would like to be involved in the development of this feature.

Please let me know how I can help.

–
Carlos

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Carlos,

Great to hear. Yesterday I checked in some initial personal code in my branch It's just a start and nothing official (yet, I hope)

My (unfortunately many) checkins were noticed by Daniel Meyer of Camunda and he started a topic in the dev forum. I'll write a blog about this CDI/JSF initialve when I feel better (got the flu) summarizing what is already in the pipeline. But in the mean time you are welcome to have a look at the code, correct me where I went astray, enhance functionality (do not duplicate efforts started by Daniel :-)) etc…

The more the merrier, less effort per individual and the quicker we have something really useful.

jamsovaps
Champ in-the-making
Champ in-the-making
Login to your server and type the following to find java:

find . -iname java

This will tell you the correct path if you installed it in your home directory.

When you installed it did you pay attention to where the files were being installed?