Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Kowbathullah Gnaniyar
Activity Workflow with custom Portlet
January 26, 2013 6:58 AM
Answer

Kowbathullah Gnaniyar

Rank: Liferay Master

Posts: 608

Join Date: December 19, 2007

Recent Posts

Hi,

I 've integrated Activity workflow with Liferay 6.1. Trying to configure the workflow with custom portlet .

Given all the entry in service.xml with reference package and overridden updateStatus method from custom workflow handler class which extends
BaseWorkflowHandler
as mentioned here:

http://www.liferay.com/web/jonas.yuan/blog/-/blogs/how-to-add-workflow-capabilities-on-knowledge-base-articles-or-any-custom-assets-in-plugins

But when i submit , i am getting this error:

[WorkflowTaskManagerImpl:568] Method is partially implemented


Any idea/suggestion would be very helpful if anybody implemented. Thanks in advance

- Gnaniyar Zubair
Kowbathullah Gnaniyar
RE: Activity Workflow with custom Portlet
January 29, 2013 2:13 AM
Answer

Kowbathullah Gnaniyar

Rank: Liferay Master

Posts: 608

Join Date: December 19, 2007

Recent Posts

1WorkflowHandlerRegistryUtil.startWorkflowInstance
is not called my custom handler class of updateStatus.

Any idea?

- Gnaniyar Ziubair
Kowbathullah Gnaniyar
RE: Activity Workflow with custom Portlet
January 29, 2013 11:02 PM
Answer

Kowbathullah Gnaniyar

Rank: Liferay Master

Posts: 608

Join Date: December 19, 2007

Recent Posts

HI,

WorkflowHandlerRegistryUtil.startWorkflowInstance
, this method will take care of workflow instance of custom plugin. As mentioned in "Liferay in Action", we dont need to detect manually whether workflow is enabled or not. see here:

The really nice thing about the startWorkflowInstance method is that it
automatically detects whether or not Workflow is installed and/or enabled for your entity
type. You don't have to do any checking for that yourself; you as a developer simply assume
that Workflow is enabled. If it isn't, the status of your entities get automatically set to the
approved status.


But it is not either detected or called updateStatus method . Is there any issue in Liferay 6.1 for workflow with custom plugin implementation..?

I have followed these steps:

1. Injected Workflow package in service.xml:

1<reference package-path="com.liferay.portal" entity="WorkflowInstanceLink"></reference>


2. Added this entry in liferay-portlet.xml :

1<workflow-handler>com.liferay.realestate.workflow.ArticleWorkflowHandler</workflow-handler>


3. implemented above mentioned ArticleWorkflowHandler class with update status as below:

 1public class ArticleWorkflowHandler extends BaseWorkflowHandler {
 2
 3    public String CLASS_NAME = MyEntity.class.getName();
 4   
 5    public String getClassName() {
 6        // TODO Auto-generated method stub
 7        return CLASS_NAME;
 8    }
 9
10   
11    public String getType(Locale locale) {
12        // TODO Auto-generated method stub
13        return ResourceActionsUtil.getModelResource(locale, CLASS_NAME);
14    }
15
16    public MyEntity updateStatus(int status,
17            Map<String, Serializable> workflowContext) throws PortalException,
18            SystemException {
19        // TODO Auto-generated method stub
20        System.out.println("inside the workflow handler class >>>>>>>>>>>>>>>>>");
21        long userId = GetterUtil.getLong(
22                (String)workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
23            long resourcePrimKey = GetterUtil.getLong(
24                (String)workflowContext.get(
25                    WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));
26
27            ServiceContext serviceContext = (ServiceContext)workflowContext.get(
28                "serviceContext");
29
30                   
31            return MyEntity.updateStatus(
32                userId, resourcePrimKey, status, serviceContext);
33    }
34   
35
36}


4. Added updatestatus method from my impl class:

 1public MyEntity updateStatus(
 2            long userId, long resourcePrimKey, int wStatus,
 3            ServiceContext serviceContext)
 4        throws PortalException, SystemException {
 5       
 6        System.out.print("inside the update status in Impl file");
 7        User user = userPersistence.findByPrimaryKey(userId);
 8        boolean main = false;
 9        Date now = new Date();
10
11        if (wStatus == WorkflowConstants.STATUS_APPROVED) {
12            main = true;
13        }
14
15        MyEntity entity= getLatestMyEntity(
16            resourcePrimKey, WorkflowConstants.STATUS_ANY);
17
18        entity.setModifiedDate(serviceContext.getModifiedDate(now));
19        entity.setStatus(wStatus);
20        entity.setWStatusByUserId(user.getUserId());
21        entity.setWStatusByUserName(user.getFullName());
22        entity.setWStatusDate(serviceContext.getModifiedDate(now));
23
24        entityPersistence.update(realEstate,false);
25
26        if (wStatus != WorkflowConstants.STATUS_APPROVED) {
27            return entity;
28        }
29       
30        return entity;
31
32       
33    }


5. Then called below method after adding my entity :

1WorkflowHandlerRegistryUtil.startWorkflowInstance(
2                themeDisplay.getCompanyId(), themeDisplay.getScopeGroupId(), themeDisplay.getUserId(), MyEntity.class.getName(),
3                myEntityObject.getPropertyId(), myEntityObject, serviceContext);


6. Enabled Single Approval Workflow for my entity from Control Panel.


when i give the workflow configuration for my CustomEntity, it gives the error like :

1Method is partially implemented


I am not sure whether problem with Activity Workflow plugin or my custom portlet configuration issue...?

Can anybody from Liferay throw some lights on this? Thanks in advance.

- Gnaniyar Zubair
Milan Kostoláni
RE: Activity Workflow with custom Portlet
January 30, 2013 7:20 AM
Answer

Milan Kostoláni

Rank: Junior Member

Posts: 92

Join Date: July 26, 2012

Recent Posts

If you did follow Liferay in Action and followed installation here: http://www.emforge.net/web/activiti-liferay/home.

Instructions to check: Make portlet with Kaleo Workflow - something simple

Install Activi - check some already installed portlet (not yours)

Then check your with Activi.



For me everything worked just fine.
Kowbathullah Gnaniyar
RE: Activity Workflow with custom Portlet
January 30, 2013 7:57 AM
Answer

Kowbathullah Gnaniyar

Rank: Liferay Master

Posts: 608

Join Date: December 19, 2007

Recent Posts

Hi,

Thanks for your reply. I have configured Kaleo / Activity workflow with Liferay and everything is working fine for webcontent other out-of-box portlets.

Here problem is , implementing activity workflow with custom portlet.

- Gnaniyar Zubair
Kowbathullah Gnaniyar
RE: Activity Workflow with custom Portlet
February 1, 2013 11:48 PM
Answer

Kowbathullah Gnaniyar

Rank: Liferay Master

Posts: 608

Join Date: December 19, 2007

Recent Posts

Is it necessary to inject AssetEntry package in service.xml for implementing workflow with my custom portlet?


- Gnaniyar Zubair
Milan Kostoláni
RE: Activity Workflow with custom Portlet
February 4, 2013 4:50 AM
Answer

Milan Kostoláni

Rank: Junior Member

Posts: 92

Join Date: July 26, 2012

Recent Posts

I did inject

<reference package-path="com.liferay.portal" entity="WorkflowInstanceLink" />
<reference package-path="com.liferay.portlet.asset" entity="AssetEntry" />
Kowbathullah Gnaniyar
RE: Activity Workflow with custom Portlet
February 4, 2013 5:10 AM
Answer

Kowbathullah Gnaniyar

Rank: Liferay Master

Posts: 608

Join Date: December 19, 2007

Recent Posts

Thanks Milan.

But My query was, why to inject not how to inject..? emoticon

BTW, i found the solution for injecting Asset. if you want to view the summary of your data or edit the data which you have submitted from your custom portlet for workflow , you have to implement all the methods from BaseAssetRenderer.


- Gnaniyar Zubair
Renata Siega
RE: Activity Workflow with custom Portlet
May 17, 2013 11:49 AM
Answer

Renata Siega

Rank: Junior Member

Posts: 34

Join Date: October 29, 2012

Recent Posts

I'm trying to follow what you did, because I want to do the same as you did.
How can I get the serviceContext to use in here?
1WorkflowHandlerRegistryUtil.startWorkflowInstance(
2            themeDisplay.getCompanyId(), themeDisplay.getScopeGroupId(), themeDisplay.getUserId(), MyEntity.class.getName(),
3             myEntityObject.getPropertyId(), myEntityObject, serviceContext);


I'm sorry that I can't answer your question.
Kowbathullah Gnaniyar
RE: Activity Workflow with custom Portlet
May 26, 2013 12:08 AM
Answer

Kowbathullah Gnaniyar

Rank: Liferay Master

Posts: 608

Join Date: December 19, 2007

Recent Posts

you can get the service context like this :

1ServiceContext serviceContext = ServiceContextFactory.getInstance(MyEntity.class.getName(), actionRequest);



or

1new ServiceContext()
Umasankar Jeyaraj
RE: Activity Workflow with custom Portlet
July 25, 2013 2:53 AM
Answer

Umasankar Jeyaraj

Rank: New Member

Posts: 7

Join Date: July 16, 2013

Recent Posts

Hi,
Can you please provide me the sample workable workflow application.
sheela mk
RE: Activity Workflow with custom Portlet
July 25, 2013 3:19 AM
Answer

sheela mk

Rank: Regular Member

Posts: 111

Join Date: February 16, 2012

Recent Posts

Hai..Zubair..


Even i also need sample custom portlet with Activity Workflow..
If possible share your portlet.

Thanks and regards,
Sheela
technology evangelist
RE: Activity Workflow with custom Portlet
September 20, 2013 5:00 AM
Answer

technology evangelist

Rank: Junior Member

Posts: 35

Join Date: August 1, 2013

Recent Posts

sheela mk:
Hai..Zubair..


Even i also need sample custom portlet with Activity Workflow..
If possible share your portlet.

Thanks and regards,
Sheela


Zubair can U paste custom portlet for further reference.
Advance Thanks


Best Wishes
Ahamed Hasan
RE: Activity Workflow with custom Portlet
September 20, 2013 5:13 AM
Answer

Ahamed Hasan

Rank: Expert

Posts: 306

Join Date: April 13, 2007

Recent Posts

Hi,

I have covered this aspect of integrating workflow engine (activiti or kaleo) with a custom portlet in my eBook on Liferay Portlet Development. You can download a free copy and refer to the relevant chapter number on this topic. You'll get the exact steps to achieve this.

Yours truly,
Ahamed Hasan
Author, Liferay Portlet Cookbook
Kowbathullah Gnaniyar
RE: Activity Workflow with custom Portlet
December 4, 2013 10:00 PM
Answer

Kowbathullah Gnaniyar

Rank: Liferay Master

Posts: 608

Join Date: December 19, 2007

Recent Posts

I supposed to point out your book link. Thanks Hasan.