cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Workflow Java Class

sihnu
Champ in-the-making
Champ in-the-making
Hey,

we need to customize tasks list view so that tasks for every user are visible for everyone. First, I thought I could use webscript to fetch all the active tasks and return them but then I noticed there is no that kind of method that would return tasks of every user. So only solution seems to be to implement the feature using Java. My plan was to extend Workflow class and add a new method that returns the needed tasks. However, I'm quite clueless how to deploy/extend the changes to my local Alfresco server. Could anyone help me where to start? It seems not many ppl have created extensions using Java and I wanted to avoid it as well but this time it seems to be the only choice. Of course all suggestions/tips are welcome how to implement the described feature. Maybe there is an easier way. If I come with a solution I will explain it here in case someone needs the information. Any help would be greatly appreciated.

Thanks in advance,

Henri L
3 REPLIES 3

sihnu
Champ in-the-making
Champ in-the-making
Hey,

I built the Alfresco project using Maven. I added a custom class (CustomWorkflow that extends Workflow) to alfresco-repository module. I've then deployed the newly built alfresco.war to my Alfresco server. Then I added a dependency to alfresco-4.2.e/tomcat/shared/classes/alfresco/extension/custom-template-services-context.xml like this:


<beans>
    <bean id="workflowTemplateExtension" parent="baseTemplateImplementation" class="org.alfresco.repo.template.CustomWorkflow">
        <property name="extensionName">
            <value>workflow</value>
        </property>
        <property name="serviceRegistry">
            <ref bean="ServiceRegistry"/>
        </property>
    </bean>
</beans>


But when I start the server I get an class not found error. For some reason Alfresco doesn't find the class even though it should be included in alfresco.war. What I'm doing wrong?

You will need to create your own class and than inject the services which you want to use in that class.

In your example the class attributes value should be replaced with your own custom class.
<c>
<beans>
    <bean id="workflowTemplateExtension" parent="baseTemplateImplementation" class="org.alfresco.repo.template.CustomWorkflow">
        <property name="extensionName">
            <value>workflow</value>
        </property>
        <property name="serviceRegistry">
            <ref bean="ServiceRegistry"/>
        </property>
    </bean>
</beans>
</c>


Krutik Jayswal
Alfresco Developer
http://krutikjayswal-alfresco.blogspot.in