掲示板

Kaleo Work flow configuration for custom portlet

10年前 に Mahesh Narke によって更新されました。

Kaleo Work flow configuration for custom portlet

Regular Member 投稿: 105 参加年月日: 13/10/11 最新の投稿
hi

For creating a custom portlet with kaleo workflow configuration:
1. I have created the service.xml and built it successfully and I can see the entity created in the DB.
2. I can also save a workflow configuration to the portlet.
3. I can see the relevant entries for workflow in the database.
But I can’t see the tasks in the workflow tasks.

Do I need to add the configuration explicitly from the code or is it set automatically? Also the methods like assignWorkFlowToUser need to be called somewhere or are handled by itself as already explained in the workflow.xml file?

Thanks
thumbnail
10年前 に Mreetunjay Sharma によって更新されました。

RE: Kaleo Work flow configuration for custom portlet

Junior Member 投稿: 29 参加年月日: 13/05/20 最新の投稿
Hi Mahesh,
did you get any solution ? please share it with me. because I am stucked and I have already wasted 4 days and still I have not get any proper solution for applying kaleo workflow on custom portlet.

Thanks & Regards,
Mreetunjay Sharma
thumbnail
10年前 に Harish Kumar によって更新されました。

RE: Kaleo Work flow configuration for custom portlet

Expert 投稿: 483 参加年月日: 10/07/31 最新の投稿
Hi Mahesh,

I have posted the step by step solution to achieve the same in my blog post here http://liferayzone.wordpress.com/2013/11/29/kaleo-workflow-configuration-for-custom-portlet-in-liferay-6-1/

Hope this helps!!
thumbnail
10年前 に Charu Babbar によって更新されました。

RE: Kaleo Work flow configuration for custom portlet

Regular Member 投稿: 167 参加年月日: 11/09/13 最新の投稿
Yes you do the code for configure the portlet in java class as per your requirement and like Kaleo gives us appropriate updatation in table as well In similar way you manage your code as per the requirement otherwise write your requirement throughly and share your portlet code i will help you .its working for me.
9年前 に Nwawel Nwawel A Iroume によって更新されました。

RE: Kaleo Work flow configuration for custom portlet

New Member 投稿: 9 参加年月日: 14/09/28 最新の投稿
I followed Your tutorial for my custom portlet. but it is not working please i need help

here is my workflow handler
public class WorkflowHandlerOrganizationType extends BaseWorkflowHandler{

public static final String CLASS_NAME = OrganizationType.class.getName();

@Override
public String getClassName() {
return CLASS_NAME;
}

@Override
public String getType(Locale locale) {
return LanguageUtil.get(locale, "model.resource.", CLASS_NAME);
}

@Override
public Object updateStatus(int status, Map<String, Serializable> workflowContext)
throws PortalException, SystemException {
System.out.println("Workflow -- --- --");
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 OrganizationTypeLocalServiceUtil.updateStatus(userId, resourcePrimKey, status, serviceContext);
}

next is my custom entityImpl class:
public class OrganizationTypeLocalServiceImpl
extends OrganizationTypeLocalServiceBaseImpl {

public OrganizationType addOrganizationType(long userId, String organizationTypeName, ServiceContext serviceContext) throws PortalException, SystemException{
User user = userPersistence.findByPrimaryKey(userId);
long organizationTypeId = counterLocalService.increment(OrganizationType.class.getName());
OrganizationType organizationType = organizationTypePersistence.create(organizationTypeId);
Date now = new Date();

organizationType.setGroupId(user.getGroupId());
organizationType.setCompanyId(user.getCompanyId());
organizationType.setUserId(user.getUserId());
organizationType.setStatus(WorkflowConstants.STATUS_DRAFT);
organizationType.setCreateDate(serviceContext.getCreateDate(now));
//organizationType.setModifiedDate(serviceContext.getModifiedDate(now));

organizationType.setOrganizationTypeName(organizationTypeName);

//super.addOrganizationType(organizationType);
organizationTypePersistence.update(organizationType, false);

/*resourceLocalService.addResources(organizationType.getCompanyId(),
organizationType.getGroupId(),
organizationType.getUserId(),
OrganizationType.class.getName(),
organizationType.getOrganizationTypeId(),
false,
serviceContext.isAddGroupPermissions(),
serviceContext.isAddGuestPermissions()
);
*/
assetEntryLocalService.updateEntry(
serviceContext.getUserId(),
serviceContext.getScopeGroupId(),
OrganizationType.class.getName(),
organizationType.getOrganizationTypeId(),
serviceContext.getAssetCategoryIds(),
serviceContext.getAssetTagNames());

WorkflowHandlerRegistryUtil.startWorkflowInstance(
organizationType.getCompanyId(),
organizationType.getGroupId(),
organizationType.getUserId(),
OrganizationType.class.getName(),
organizationType.getPrimaryKey(),
organizationType, serviceContext);

return organizationType;
}

public OrganizationType updateMyOrganizationType(long userId, long organizationTypeId, String organizationTypeName, ServiceContext serviceContext) throws PortalException, SystemException{

User user = userPersistence.findByPrimaryKey(userId);
Date now = new Date();

OrganizationType orgType = OrganizationTypeLocalServiceUtil.fetchOrganizationType(organizationTypeId);

orgType.setModifiedDate(serviceContext.getModifiedDate(now));
orgType.setGroupId(user.getGroupId());
orgType.setCompanyId(user.getCompanyId());
orgType.setUserId(user.getUserId());
orgType.setOrganizationTypeName(organizationTypeName);

super.updateOrganizationType(orgType);

return orgType;
}

public OrganizationType getOrganizationType(long organizationTypeId) throws PortalException, SystemException{
return organizationTypePersistence.findByPrimaryKey(organizationTypeId);
}
public List<OrganizationType> getOrganizationTypeAll() throws SystemException{
return organizationTypePersistence.findAll();
}

public OrganizationType deleteOrganizationType(OrganizationType organizationType) throws SystemException, PortalException{
assetEntryLocalService.deleteEntry(OrganizationType.class.getName(), organizationType.getOrganizationTypeId());
return organizationTypePersistence.remove(organizationType);
}

public OrganizationType deleteOrganizationType(long organizationTypeId) throws PortalException, SystemException{
OrganizationType orgType = organizationTypePersistence.findByPrimaryKey(organizationTypeId);
return deleteOrganizationType(orgType);
}

public OrganizationType updateStatus(
long userId,
long resourcePrimKey,
int status,
ServiceContext serviceContext) throws SystemException, PortalException{
User user = UserLocalServiceUtil.getUser(userId);
OrganizationType orgType = OrganizationTypeLocalServiceUtil.getOrganizationType(resourcePrimKey);
orgType.setStatus(status);
orgType.setStatusByUserId(userId);
orgType.setStatusByUserName(user.getFullName());
orgType.setStatusDate(serviceContext.getModifiedDate());
organizationTypePersistence.update(orgType, false);
if(status == WorkflowConstants.STATUS_APPROVED){
assetEntryLocalService.updateVisible(OrganizationType.class.getName(), resourcePrimKey, true);
}
else{
assetEntryLocalService.updateVisible(OrganizationType.class.getName(), resourcePrimKey, true);
}
return orgType;
}
}

here is the entry in liferay-portal.xml
<icon>/icon.png</icon>
<asset-renderer-factory>cm.egov.cameroon.sem.RendererFactoryOrganizationTypeAsset</asset-renderer-factory>
<workflow-handler>cm.egov.cameroon.sem.WorkflowHandlerOrganizationType</workflow-handler>


my AssetRendererFactory:
public class RendererFactoryOrganizationTypeAsset extends BaseAssetRendererFactory{

@Override
public AssetRenderer getAssetRenderer(long classPK, int type)
throws PortalException, SystemException {
OrganizationType organizationType = OrganizationTypeLocalServiceUtil.getOrganizationType(classPK);
return new AssetRendererOrganizationType(organizationType);
}

@Override
public String getClassName() {
return OrganizationType.class.getName();
}

@Override
public String getType() {
return "article";
}
}

Here is the AssetRenderer
public class AssetRendererOrganizationType extends BaseAssetRenderer{

private OrganizationType _organizationType;
@Override
public long getClassPK() {
return _organizationType.getOrganizationTypeId();
}

@Override
public long getGroupId() {
return _organizationType.getGroupId();
}

@Override
public String getSummary(Locale arg0) {
return _organizationType.getOrganizationTypeName();
}

@Override
public String getTitle(Locale arg0) {
return "Organization type context entry";
}

@Override
public long getUserId() {
return _organizationType.getUserId();
}

@Override
public String getUserName() {
// TODO Auto-generated method stub
return null;
}

@Override
public String getUuid() {
return _organizationType.getUuid();
}

@Override
public String render(RenderRequest request, RenderResponse response, String template)
throws Exception {
if (template.equals(TEMPLATE_FULL_CONTENT)) {
return "/html/sem/organizationType.jsp";
}
else
{
return null;
}
}

public AssetRendererOrganizationType(OrganizationType _organizationType) {
super();
this._organizationType = _organizationType;
}

}

When i insert my custom OrganizationType through form its got updated in a view displaying the list of organizationType but nothing is display to My workflow task to approve. Need help! If needed i can upload source code. thanks
thumbnail
9年前 に Mohammad Danish によって更新されました。

RE: Kaleo Work flow configuration for custom portlet

Regular Member 投稿: 187 参加年月日: 12/03/05 最新の投稿
You can find a sample project here. Also it includes a document which will be helpful for you
https://sourceforge.net/projects/meeralferay/files/LiferayWorkFlowPortlet/
thumbnail
8年前 に Raju Choppari によって更新されました。

RE: Kaleo Work flow configuration for custom portlet

Junior Member 投稿: 68 参加年月日: 14/08/04 最新の投稿
Hi
Have found the solutions for this, If yes, please share the source code of portlet