My workflow Tasks in liferay is empty every time -


i implementing custom portlet kaleo workflow in liferay 6.2 when save data, can see status=1 pending. nothing show in workflow tasks, pending or complete.

i have 2 users, first one(let x) admin tries add data, other(let y) has content reviewer role can approve workflow.

what missing: bellow code workflow handler class:

public class bookworkflowhandler extends baseworkflowhandler{      public string getclassname() {         return class_name;     }     public string gettype(locale locale) {         return languageutil.get(locale, "model.resource." + class_name);     }     public object updatestatus(int status,  map<string, serializable> workflowcontext)  throws portalexception, systemexception {         system.out.println("statu while updating in workflow handler"+status);         long userid = getterutil.getlong(workflowcontext.get(workflowconstants.context_user_id));         long resourceprimkey = getterutil.getlong(workflowcontext.get(workflowconstants.context_entry_class_pk));         servicecontext servicecontext = (servicecontext) workflowcontext.get("servicecontext");         system.out.println("statu while updating in workflow handler"+status);         return booklocalserviceutil.updatestatus(userid, resourceprimkey, status, servicecontext);      }     public static final string class_name = book.class.getname(); } 

and here booklocalseviceimpl:

public class booklocalserviceimpl extends booklocalservicebaseimpl {      @suppresswarnings("deprecation")     public book addbook(book newbook, long userid,             servicecontext servicecontext)                     throws systemexception, portalexception {         book book =                 bookpersistence.create(                         counterlocalservice.increment(book.class.getname()));         book.setcompanyid(newbook.getcompanyid());         system.out.println("********group id********"+newbook.getgroupid());         book.setgroupid(servicecontext.getscopegroupid());         book.setuserid(servicecontext.getuserid());         book.settitle(newbook.gettitle());         book.setauthor(newbook.getauthor());         book.setstatus(1);         bookpersistence.update(book, false);          assetentrylocalservice.updateentry(                 userid, book.getgroupid(), book.class.getname(),                 book.getbookid(), servicecontext.getassetcategoryids(),                 servicecontext.getassettagnames());         book.setstatus(workflowconstants.status_draft);         system.out.println("status while adding "+book.getstatus());         workflowhandlerregistryutil.startworkflowinstance(                 book.getcompanyid(), book.getgroupid(), userid,                 book.class.getname(), book.getprimarykey(), book,                 servicecontext);          return book;     }      @override     public book updatestatus(long userid, long resourceprimkey, int status, servicecontext servicecontext)throws portalexception, systemexception {             user user = userlocalservice.getuser(userid);             book book = getbook(resourceprimkey);             book.setstatusbyuserid(userid);             book.setstatusbyusername(user.getfullname());             book.setstatusdate(servicecontext.getmodifieddate());             bookpersistence.update(book, false);             system.out.println("status in updatestatus localservice******"+status);     if (status == workflowconstants.status_approved) {         system.out.println("workflow approved");         assetentrylocalservice.updatevisible(                 book.class.getname(), resourceprimkey, true);     }     else if(status==1) {         system.out.println("workflow pending");         assetentrylocalservice.updatevisible(                 book.class.getname(), resourceprimkey, false);     }     return book; }   } 

thanks in advance!

i don't know what's wrong, can troubleshooting/code optimization tips:

  1. don't set int "status" value yourself. let liferay it. in localserviceimpl add method, instead of book.setstatus(1); call book.setstatus(workflowconstants.status_draft);, int value '2'.

  2. in localserviceimpl updatestatusmethod, set visibility false assets not approved, instead of else if statement, use

    else {

       assetentrylocalservice.updatevisible(book.class.getname(),       resourceprimkey, false); } 
  3. neither step 1 or 2 solve problem though. using single approver definition comes liferay, or different definition? if different, can paste definition here? i'd want make sure proper roles assigned review task. i'd test workflow entity see if it's working properly.

  4. the liferay developer network (https://dev.liferay.com), official site liferay development documentation, has learning path on enabling entities workflow, might want @ code comparison purposes. https://dev.liferay.com/develop/learning-paths/mvc/-/knowledge_base/6-2/approving-content-with-workflow


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -