1 24 package org.ofbiz.order.task; 25 26 import java.util.Map ; 27 28 import org.ofbiz.base.util.Debug; 29 import org.ofbiz.base.util.UtilMisc; 30 import org.ofbiz.entity.GenericEntityException; 31 import org.ofbiz.entity.GenericValue; 32 33 40 public class TaskWorker { 41 42 public static final String module = TaskWorker.class.getName(); 43 44 public static String getCustomerName(GenericValue orderTaskList) { 45 String lastName = orderTaskList.getString("customerLastName"); 46 String firstName = orderTaskList.getString("customerFirstName"); 47 String groupName = null; if (groupName != null) { 50 return groupName; 51 } else if (lastName != null) { 52 String name = lastName; 53 if (firstName != null) 54 name = name + ", " + firstName; 55 return name; 56 } else { 57 return ""; 58 } 59 } 60 61 static Map statusMapping = UtilMisc.toMap("WF_NOT_STARTED", "Waiting", "WF_RUNNING", "Active", "WF_COMPLETE", "Complete", "WF_SUSPENDED", "Hold"); 62 63 public static String getPrettyStatus(GenericValue orderTaskList) { 64 String statusId = orderTaskList.getString("currentStatusId"); 65 String prettyStatus = (String ) statusMapping.get(statusId); 66 if (prettyStatus == null) 67 prettyStatus = "?"; 68 return prettyStatus; 69 } 70 71 72 public static String getRoleDescription(GenericValue orderTaskList) { 73 GenericValue role = null; 74 try { 75 Map pkFields = UtilMisc.toMap("roleTypeId", orderTaskList.getString("roleTypeId")); 76 role = orderTaskList.getDelegator().findByPrimaryKey("RoleType", pkFields); 77 } catch (GenericEntityException e) { 78 Debug.logError(e, "Cannot get RoleType entity value", module); 79 return orderTaskList.getString("roleTypeId"); 80 } 81 return role.getString("description"); 82 } 83 84 } 85 | Popular Tags |