Foren

Activity Workflow with custom Portlet

thumbnail
Gnaniyar Zubair, geändert vor 11 Jahren.

Activity Workflow with custom Portlet

Liferay Master Beiträge: 722 Beitrittsdatum: 19.12.07 Neueste 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
thumbnail
Gnaniyar Zubair, geändert vor 11 Jahren.

RE: Activity Workflow with custom Portlet

Liferay Master Beiträge: 722 Beitrittsdatum: 19.12.07 Neueste Beiträge
WorkflowHandlerRegistryUtil.startWorkflowInstance
is not called my custom handler class of updateStatus.

Any idea?

- Gnaniyar Ziubair
thumbnail
Gnaniyar Zubair, geändert vor 11 Jahren.

RE: Activity Workflow with custom Portlet

Liferay Master Beiträge: 722 Beitrittsdatum: 19.12.07 Neueste 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:

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


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

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


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

public class ArticleWorkflowHandler extends BaseWorkflowHandler {

	public String CLASS_NAME = MyEntity.class.getName();
	
	public String getClassName() {
		// TODO Auto-generated method stub
		return CLASS_NAME;
	}

	
	public String getType(Locale locale) {
		// TODO Auto-generated method stub
		return ResourceActionsUtil.getModelResource(locale, CLASS_NAME);
	}

	public MyEntity updateStatus(int status,
			Map<string, serializable> workflowContext) throws PortalException,
			SystemException {
		// TODO Auto-generated method stub
		System.out.println("inside the workflow handler class &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;");
		long userId = GetterUtil.getLong(
				(String)workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
			long resourcePrimKey = GetterUtil.getLong(
				(String)workflowContext.get(
					WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));

			ServiceContext serviceContext = (ServiceContext)workflowContext.get(
				"serviceContext");

					
			return MyEntity.updateStatus(
				userId, resourcePrimKey, status, serviceContext);
	}
	

}</string,>


4. Added updatestatus method from my impl class:

public MyEntity updateStatus(
			long userId, long resourcePrimKey, int wStatus,
			ServiceContext serviceContext)
		throws PortalException, SystemException {
		
		System.out.print("inside the update status in Impl file");
		User user = userPersistence.findByPrimaryKey(userId);
		boolean main = false;
		Date now = new Date();

		if (wStatus == WorkflowConstants.STATUS_APPROVED) {
			main = true;
		}

		MyEntity entity= getLatestMyEntity(
			resourcePrimKey, WorkflowConstants.STATUS_ANY);

		entity.setModifiedDate(serviceContext.getModifiedDate(now));
		entity.setStatus(wStatus);
		entity.setWStatusByUserId(user.getUserId());
		entity.setWStatusByUserName(user.getFullName());
		entity.setWStatusDate(serviceContext.getModifiedDate(now));

		entityPersistence.update(realEstate,false);

		if (wStatus != WorkflowConstants.STATUS_APPROVED) {
			return entity;
		}
		
		return entity;

		
	}


5. Then called below method after adding my entity :

WorkflowHandlerRegistryUtil.startWorkflowInstance(
				themeDisplay.getCompanyId(), themeDisplay.getScopeGroupId(), themeDisplay.getUserId(), MyEntity.class.getName(),
				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 :

Method 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, geändert vor 11 Jahren.

RE: Activity Workflow with custom Portlet

Junior Member Beiträge: 92 Beitrittsdatum: 26.07.12 Neueste 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.
thumbnail
Gnaniyar Zubair, geändert vor 11 Jahren.

RE: Activity Workflow with custom Portlet

Liferay Master Beiträge: 722 Beitrittsdatum: 19.12.07 Neueste 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
thumbnail
Gnaniyar Zubair, geändert vor 11 Jahren.

RE: Activity Workflow with custom Portlet

Liferay Master Beiträge: 722 Beitrittsdatum: 19.12.07 Neueste Beiträge
Is it necessary to inject AssetEntry package in service.xml for implementing workflow with my custom portlet?


- Gnaniyar Zubair
Milan Kostoláni, geändert vor 11 Jahren.

RE: Activity Workflow with custom Portlet

Junior Member Beiträge: 92 Beitrittsdatum: 26.07.12 Neueste Beiträge
I did inject

<reference package-path="com.liferay.portal" entity="WorkflowInstanceLink" />
<reference package-path="com.liferay.portlet.asset" entity="AssetEntry" />
thumbnail
Gnaniyar Zubair, geändert vor 11 Jahren.

RE: Activity Workflow with custom Portlet

Liferay Master Beiträge: 722 Beitrittsdatum: 19.12.07 Neueste 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, geändert vor 10 Jahren.

RE: Activity Workflow with custom Portlet

Junior Member Beiträge: 34 Beitrittsdatum: 29.10.12 Neueste 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?
WorkflowHandlerRegistryUtil.startWorkflowInstance(
            themeDisplay.getCompanyId(), themeDisplay.getScopeGroupId(), themeDisplay.getUserId(), MyEntity.class.getName(),
             myEntityObject.getPropertyId(), myEntityObject, serviceContext);


I'm sorry that I can't answer your question.
thumbnail
Gnaniyar Zubair, geändert vor 10 Jahren.

RE: Activity Workflow with custom Portlet

Liferay Master Beiträge: 722 Beitrittsdatum: 19.12.07 Neueste Beiträge
you can get the service context like this :

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



or

new ServiceContext()
Umasankar Jeyaraj, geändert vor 10 Jahren.

RE: Activity Workflow with custom Portlet

New Member Beiträge: 7 Beitrittsdatum: 16.07.13 Neueste Beiträge
Hi,
Can you please provide me the sample workable workflow application.
thumbnail
sheela mk, geändert vor 10 Jahren.

RE: Activity Workflow with custom Portlet

Regular Member Beiträge: 111 Beitrittsdatum: 17.02.12 Neueste Beiträge
Hai..Zubair..


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

Thanks and regards,
Sheela
thumbnail
technology evangelist, geändert vor 10 Jahren.

RE: Activity Workflow with custom Portlet

Junior Member Beiträge: 35 Beitrittsdatum: 02.08.13 Neueste 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
thumbnail
Ahmed Hasan, geändert vor 10 Jahren.

RE: Activity Workflow with custom Portlet

Expert Beiträge: 306 Beitrittsdatum: 13.04.07 Neueste 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
thumbnail
Gnaniyar Zubair, geändert vor 10 Jahren.

RE: Activity Workflow with custom Portlet

Liferay Master Beiträge: 722 Beitrittsdatum: 19.12.07 Neueste Beiträge
I supposed to point out your book link. Thanks Hasan.