Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Kowbathullah Gnaniyar
Activity Workflow with custom Portlet
26. Januar 2013 06:58
Antwort

Kowbathullah Gnaniyar

Rang: Liferay Master

Nachrichten: 608

Eintrittsdatum: 19. Dezember 2007

Neue Beiträge

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
29. Januar 2013 02:13
Antwort

Kowbathullah Gnaniyar

Rang: Liferay Master

Nachrichten: 608

Eintrittsdatum: 19. Dezember 2007

Neue Beiträge

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

Any idea?

- Gnaniyar Ziubair
Kowbathullah Gnaniyar
RE: Activity Workflow with custom Portlet
29. Januar 2013 23:02
Antwort

Kowbathullah Gnaniyar

Rang: Liferay Master

Nachrichten: 608

Eintrittsdatum: 19. Dezember 2007

Neue Beiträge

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
30. Januar 2013 07:20
Antwort

Milan Kostoláni

Rang: Junior Member

Nachrichten: 92

Eintrittsdatum: 26. Juli 2012

Neue Beiträge

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
30. Januar 2013 07:57
Antwort

Kowbathullah Gnaniyar

Rang: Liferay Master

Nachrichten: 608

Eintrittsdatum: 19. Dezember 2007

Neue Beiträge

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
1. Februar 2013 23:48
Antwort

Kowbathullah Gnaniyar

Rang: Liferay Master

Nachrichten: 608

Eintrittsdatum: 19. Dezember 2007

Neue Beiträge

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
4. Februar 2013 04:50
Antwort

Milan Kostoláni

Rang: Junior Member

Nachrichten: 92

Eintrittsdatum: 26. Juli 2012

Neue Beiträge

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
4. Februar 2013 05:10
Antwort

Kowbathullah Gnaniyar

Rang: Liferay Master

Nachrichten: 608

Eintrittsdatum: 19. Dezember 2007

Neue Beiträge

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
17. Mai 2013 11:49
Antwort

Renata Siega

Rang: Junior Member

Nachrichten: 34

Eintrittsdatum: 29. Oktober 2012

Neue Beiträge

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
26. Mai 2013 00:08
Antwort

Kowbathullah Gnaniyar

Rang: Liferay Master

Nachrichten: 608

Eintrittsdatum: 19. Dezember 2007

Neue Beiträge

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
25. Juli 2013 02:53
Antwort

Umasankar Jeyaraj

Rang: New Member

Nachrichten: 7

Eintrittsdatum: 16. Juli 2013

Neue Beiträge

Hi,
Can you please provide me the sample workable workflow application.
sheela mk
RE: Activity Workflow with custom Portlet
25. Juli 2013 03:19
Antwort

sheela mk

Rang: Regular Member

Nachrichten: 111

Eintrittsdatum: 16. Februar 2012

Neue Beiträge

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
20. September 2013 05:00
Antwort

technology evangelist

Rang: Junior Member

Nachrichten: 35

Eintrittsdatum: 1. August 2013

Neue Beiträge

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
20. September 2013 05:13
Antwort

Ahamed Hasan

Rang: Expert

Nachrichten: 306

Eintrittsdatum: 13. April 2007

Neue Beiträge

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
4. Dezember 2013 22:00
Antwort

Kowbathullah Gnaniyar

Rang: Liferay Master

Nachrichten: 608

Eintrittsdatum: 19. Dezember 2007

Neue Beiträge

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