1 25 package org.ofbiz.workflow; 26 27 import java.util.Map ; 28 29 import org.ofbiz.base.util.UtilMisc; 30 31 38 public final class WfUtil { 39 40 private static final Map typeMap = UtilMisc.toMap("WDT_BOOLEAN", "java.lang.Boolean", 41 "WDT_STRING", "java.lang.String", "WDT_INTEGER", "java.lang.Long", 42 "WDT_FLOAT", "java.lang.Double", "WDT_DATETIME", "java.sql.Timestamp"); 43 44 49 public static final String getJavaType(String xpdlType) { 50 if (typeMap.containsKey(xpdlType)) 51 return (String ) typeMap.get(xpdlType); 52 else 53 return "java.lang.Object"; 54 } 55 56 61 public static String getOFBStatus(String state) { 62 String statesArr[] = {"open.running", "open.not_running.not_started", "open.not_running.suspended", 63 "closed.completed", "closed.terminated", "closed.aborted"}; 64 String entityArr[] = {"WF_RUNNING", "WF_NOT_STARTED", "WF_SUSPENDED", "WF_COMPLETED", 65 "WF_TERMINATED", "WF_ABORTED"}; 66 67 for (int i = 0; i < statesArr.length; i++) { 68 if (statesArr[i].equals(state)) 69 return entityArr[i]; 70 } 71 return null; 72 } 73 74 79 public static String getOMGStatus(String state) { 80 String statesArr[] = {"open.running", "open.not_running.not_started", "open.not_running.suspended", 81 "closed.completed", "closed.terminated", "closed.aborted"}; 82 String entityArr[] = {"WF_RUNNING", "WF_NOT_STARTED", "WF_SUSPENDED", "WF_COMPLETED", 83 "WF_TERMINATED", "WF_ABORTED"}; 84 85 for (int i = 0; i < entityArr.length; i++) { 86 if (entityArr[i].equals(state)) 87 return statesArr[i]; 88 } 89 return null; 90 } 91 92 93 } 94 | Popular Tags |