1 25 package org.ofbiz.workeffort.workeffort; 26 27 import java.util.Map ; 28 29 import org.ofbiz.base.util.Debug; 30 import org.ofbiz.base.util.UtilMisc; 31 import org.ofbiz.entity.GenericDelegator; 32 import org.ofbiz.entity.GenericEntityException; 33 import org.ofbiz.entity.GenericValue; 34 import org.ofbiz.service.GenericServiceException; 35 import org.ofbiz.service.LocalDispatcher; 36 import org.ofbiz.service.ModelService; 37 38 46 public class WorkEffortPartyAssignmentServices { 47 48 public static final String module = WorkEffortPartyAssignmentServices.class.getName(); 49 50 public static void updateWorkflowEngine(GenericValue wepa, GenericValue userLogin, LocalDispatcher dispatcher) { 51 GenericDelegator delegator = wepa.getDelegator(); 53 GenericValue workEffort = null; 54 55 try { 56 workEffort = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", wepa.get("workEffortId"))); 57 } catch (GenericEntityException e) { 58 Debug.logWarning(e, module); 59 } 60 if (workEffort != null && "ACTIVITY".equals(workEffort.getString("workEffortTypeId"))) { 61 63 String statusId = (String ) wepa.get("statusId"); 64 Map context = UtilMisc.toMap("workEffortId", wepa.get("workEffortId"), "partyId", wepa.get("partyId"), 65 "roleTypeId", wepa.get("roleTypeId"), "fromDate", wepa.get("fromDate"), 66 "userLogin", userLogin); 67 68 if ("CAL_ACCEPTED".equals(statusId)) { 69 try { 71 Map results = dispatcher.runSync("wfAcceptAssignment", context); 72 73 if (results != null && results.get(ModelService.ERROR_MESSAGE) != null) 74 Debug.logWarning((String ) results.get(ModelService.ERROR_MESSAGE), module); 75 } catch (GenericServiceException e) { 76 Debug.logWarning(e, module); 77 } 78 } else if ("CAL_COMPLETED".equals(statusId)) { 79 try { 81 Map results = dispatcher.runSync("wfCompleteAssignment", context); 82 83 if (results != null && results.get(ModelService.ERROR_MESSAGE) != null) 84 Debug.logWarning((String ) results.get(ModelService.ERROR_MESSAGE), module); 85 } catch (GenericServiceException e) { 86 Debug.logWarning(e, module); 87 } 88 } else if ("CAL_DECLINED".equals(statusId)) { 89 try { 91 Map results = dispatcher.runSync("wfDeclineAssignment", context); 92 93 if (results != null && results.get(ModelService.ERROR_MESSAGE) != null) 94 Debug.logWarning((String ) results.get(ModelService.ERROR_MESSAGE), module); 95 } catch (GenericServiceException e) { 96 Debug.logWarning(e, module); 97 } 98 } else { } 100 } 101 } 102 } 103 | Popular Tags |