| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
package org.kuali.rice.kew.util; |
| 18 | |
|
| 19 | |
import java.util.HashMap; |
| 20 | |
import java.util.Map; |
| 21 | |
|
| 22 | |
import org.kuali.rice.kew.api.action.ActionRequestPolicy; |
| 23 | |
import org.kuali.rice.kew.api.action.ActionRequestStatus; |
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | 0 | public class CodeTranslator { |
| 32 | 0 | public static final Map<String, String> arLabels = getArLabels(); |
| 33 | 0 | public static final Map<String, String> atLabels = getAtLabels(); |
| 34 | 0 | public static final Map<String, String> arStatusLabels = getArStatusLabels(); |
| 35 | 0 | public static final Map<String, String> routeStatusLabels = getRouteStatusLabels(); |
| 36 | 0 | public static final Map<Boolean, String> activeIndicatorLabels = getActiveIndicatorLabels(); |
| 37 | 0 | public static final Map<String, String> activationPolicyLabels = getActivationPolicyLabels(); |
| 38 | 0 | public static final Map<String, String> policyLabels = getPolicyLabels(); |
| 39 | 0 | public static final Map<String, String> approvePolicyLabels = getApprovePolicyLabels(); |
| 40 | |
|
| 41 | |
private static Map<String, String> getAtLabels() { |
| 42 | 0 | Map<String, String> newAtLabels = new HashMap<String, String>(); |
| 43 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_ACKNOWLEDGED_CD, KEWConstants.ACTION_TAKEN_ACKNOWLEDGED); |
| 44 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_ADHOC_CD, KEWConstants.ACTION_TAKEN_ADHOC); |
| 45 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_ADHOC_REVOKED_CD, KEWConstants.ACTION_TAKEN_ADHOC_REVOKED); |
| 46 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_APPROVED_CD, KEWConstants.ACTION_TAKEN_APPROVED); |
| 47 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_BLANKET_APPROVE_CD, KEWConstants.ACTION_TAKEN_BLANKET_APPROVE); |
| 48 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_CANCELED_CD, KEWConstants.ACTION_TAKEN_CANCELED); |
| 49 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_COMPLETED_CD, KEWConstants.ACTION_TAKEN_COMPLETED); |
| 50 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_ROUTED_CD, KEWConstants.ACTION_TAKEN_ROUTED); |
| 51 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_DENIED_CD, KEWConstants.ACTION_TAKEN_DENIED); |
| 52 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_FYI_CD, KEWConstants.ACTION_TAKEN_FYI); |
| 53 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_SAVED_CD, KEWConstants.ACTION_TAKEN_SAVED); |
| 54 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_RETURNED_TO_PREVIOUS_CD, KEWConstants.ACTION_TAKEN_RETURNED_TO_PREVIOUS); |
| 55 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_LOG_DOCUMENT_ACTION_CD, KEWConstants.ACTION_TAKEN_LOG_DOCUMENT_ACTION); |
| 56 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_MOVE_CD, KEWConstants.ACTION_TAKEN_MOVE); |
| 57 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_SU_APPROVED_CD, KEWConstants.ACTION_TAKEN_SU_APPROVED); |
| 58 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_SU_CANCELED_CD, KEWConstants.ACTION_TAKEN_SU_CANCELED); |
| 59 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_SU_DISAPPROVED_CD, KEWConstants.ACTION_TAKEN_SU_DISAPPROVED); |
| 60 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_SU_ROUTE_LEVEL_APPROVED_CD, KEWConstants.ACTION_TAKEN_SU_ROUTE_LEVEL_APPROVED); |
| 61 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_SU_ACTION_REQUEST_APPROVED_CD, KEWConstants.ACTION_TAKEN_SU_ACTION_REQUEST_APPROVED); |
| 62 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_SU_RETURNED_TO_PREVIOUS_CD, KEWConstants.ACTION_TAKEN_SU_RETURNED_TO_PREVIOUS); |
| 63 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_SU_ACTION_REQUEST_ACKNOWLEDGED_CD, KEWConstants.ACTION_TAKEN_SU_ACTION_REQUEST_ACKNOWLEDGED); |
| 64 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_SU_ACTION_REQUEST_FYI_CD, KEWConstants.ACTION_TAKEN_SU_ACTION_REQUEST_FYI); |
| 65 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_SU_ACTION_REQUEST_COMPLETED_CD, KEWConstants.ACTION_TAKEN_SU_ACTION_REQUEST_COMPLETED); |
| 66 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_TAKE_WORKGROUP_AUTHORITY_CD, KEWConstants.ACTION_TAKEN_TAKE_WORKGROUP_AUTHORITY); |
| 67 | 0 | newAtLabels.put(KEWConstants.ACTION_TAKEN_RELEASE_WORKGROUP_AUTHORITY_CD, KEWConstants.ACTION_TAKEN_RELEASE_WORKGROUP_AUTHORITY); |
| 68 | 0 | return newAtLabels; |
| 69 | |
} |
| 70 | |
|
| 71 | |
private static Map<String, String> getArLabels() { |
| 72 | 0 | Map<String, String> newArLabels = new HashMap<String, String>(); |
| 73 | 0 | newArLabels.put(KEWConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ, KEWConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ_LABEL); |
| 74 | 0 | newArLabels.put(KEWConstants.ACTION_REQUEST_APPROVE_REQ, KEWConstants.ACTION_REQUEST_APPROVE_REQ_LABEL); |
| 75 | 0 | newArLabels.put(KEWConstants.ACTION_REQUEST_COMPLETE_REQ, KEWConstants.ACTION_REQUEST_COMPLETE_REQ_LABEL); |
| 76 | 0 | newArLabels.put(KEWConstants.ACTION_REQUEST_FYI_REQ, KEWConstants.ACTION_REQUEST_FYI_REQ_LABEL); |
| 77 | 0 | return newArLabels; |
| 78 | |
} |
| 79 | |
|
| 80 | |
private static Map<String, String> getArStatusLabels() { |
| 81 | 0 | Map<String, String> newArStatusLabels = new HashMap<String, String>(); |
| 82 | 0 | newArStatusLabels.put(ActionRequestStatus.ACTIVATED.getCode(), KEWConstants.ACTIVE_LABEL); |
| 83 | 0 | newArStatusLabels.put(ActionRequestStatus.INITIALIZED.getCode(), ActionRequestStatus.INITIALIZED.getLabel()); |
| 84 | 0 | newArStatusLabels.put(ActionRequestStatus.DONE.getCode(), ActionRequestStatus.DONE.getLabel()); |
| 85 | 0 | return newArStatusLabels; |
| 86 | |
} |
| 87 | |
|
| 88 | |
private static Map<String, String> getRouteStatusLabels() { |
| 89 | 0 | Map<String, String> newRouteStatusLabels = new HashMap<String, String>(); |
| 90 | 0 | newRouteStatusLabels.put(KEWConstants.ROUTE_HEADER_CANCEL_CD, KEWConstants.ROUTE_HEADER_CANCEL_LABEL); |
| 91 | 0 | newRouteStatusLabels.put(KEWConstants.ROUTE_HEADER_DISAPPROVED_CD, KEWConstants.ROUTE_HEADER_DISAPPROVED_LABEL); |
| 92 | 0 | newRouteStatusLabels.put(KEWConstants.ROUTE_HEADER_ENROUTE_CD, KEWConstants.ROUTE_HEADER_ENROUTE_LABEL); |
| 93 | 0 | newRouteStatusLabels.put(KEWConstants.ROUTE_HEADER_EXCEPTION_CD, KEWConstants.ROUTE_HEADER_EXCEPTION_LABEL); |
| 94 | 0 | newRouteStatusLabels.put(KEWConstants.ROUTE_HEADER_FINAL_CD, KEWConstants.ROUTE_HEADER_FINAL_LABEL); |
| 95 | 0 | newRouteStatusLabels.put(KEWConstants.ROUTE_HEADER_INITIATED_CD, KEWConstants.ROUTE_HEADER_INITIATED_LABEL); |
| 96 | 0 | newRouteStatusLabels.put(KEWConstants.ROUTE_HEADER_PROCESSED_CD, KEWConstants.ROUTE_HEADER_PROCESSED_LABEL); |
| 97 | 0 | newRouteStatusLabels.put(KEWConstants.ROUTE_HEADER_SAVED_CD, KEWConstants.ROUTE_HEADER_SAVED_LABEL); |
| 98 | 0 | return newRouteStatusLabels; |
| 99 | |
} |
| 100 | |
|
| 101 | |
private static Map<Boolean, String> getActiveIndicatorLabels() { |
| 102 | 0 | Map<Boolean, String> newActiveIndicatorLabels = new HashMap<Boolean, String>(); |
| 103 | 0 | newActiveIndicatorLabels.put(Boolean.TRUE, KEWConstants.ACTIVE_LABEL_LOWER); |
| 104 | 0 | newActiveIndicatorLabels.put(Boolean.FALSE, KEWConstants.INACTIVE_LABEL_LOWER); |
| 105 | 0 | return newActiveIndicatorLabels; |
| 106 | |
} |
| 107 | |
|
| 108 | |
private static Map<String, String> getPolicyLabels() { |
| 109 | 0 | Map<String, String> newDocTypeActiveIndicatorLabels = new HashMap<String, String>(); |
| 110 | 0 | newDocTypeActiveIndicatorLabels.put(KEWConstants.TRUE_CD, KEWConstants.YES_LABEL); |
| 111 | 0 | newDocTypeActiveIndicatorLabels.put(KEWConstants.FALSE_CD, KEWConstants.NO_LABEL); |
| 112 | 0 | newDocTypeActiveIndicatorLabels.put(KEWConstants.INHERITED_CD, KEWConstants.INHERITED_LABEL); |
| 113 | 0 | return newDocTypeActiveIndicatorLabels; |
| 114 | |
} |
| 115 | |
|
| 116 | |
private static Map<String, String> getActivationPolicyLabels() { |
| 117 | 0 | Map<String, String> newActivationPolicyLabels = new HashMap<String, String>(); |
| 118 | 0 | newActivationPolicyLabels.put(KEWConstants.ROUTE_LEVEL_PARALLEL, KEWConstants.ROUTE_LEVEL_PARALLEL_LABEL); |
| 119 | 0 | newActivationPolicyLabels.put(KEWConstants.ROUTE_LEVEL_SEQUENCE, KEWConstants.ROUTE_LEVEL_SEQUENCE_LABEL); |
| 120 | 0 | return newActivationPolicyLabels; |
| 121 | |
} |
| 122 | |
|
| 123 | |
private static Map<String, String> getApprovePolicyLabels() { |
| 124 | 0 | Map<String, String> approvePolicyLabels = new HashMap<String, String>(); |
| 125 | 0 | approvePolicyLabels.put(ActionRequestPolicy.ALL.getCode(), ActionRequestPolicy.ALL.getLabel()); |
| 126 | 0 | approvePolicyLabels.put(ActionRequestPolicy.FIRST.getCode(), ActionRequestPolicy.FIRST.getLabel()); |
| 127 | 0 | return approvePolicyLabels; |
| 128 | |
} |
| 129 | |
|
| 130 | |
|
| 131 | |
|
| 132 | |
|
| 133 | |
|
| 134 | |
|
| 135 | |
|
| 136 | |
|
| 137 | |
static public String getActionRequestLabel(String actionRequestCode) { |
| 138 | 0 | return (String) arLabels.get(actionRequestCode); |
| 139 | |
} |
| 140 | |
|
| 141 | |
|
| 142 | |
|
| 143 | |
|
| 144 | |
|
| 145 | |
|
| 146 | |
|
| 147 | |
|
| 148 | |
static public String getActionTakenLabel(String actionTakenCode) { |
| 149 | 0 | return (String) atLabels.get(actionTakenCode); |
| 150 | |
} |
| 151 | |
|
| 152 | |
|
| 153 | |
|
| 154 | |
|
| 155 | |
|
| 156 | |
|
| 157 | |
|
| 158 | |
|
| 159 | |
static public String getActionRequestStatusLabel(String status) { |
| 160 | 0 | return (String) arStatusLabels.get(status); |
| 161 | |
} |
| 162 | |
|
| 163 | |
static public String getRouteStatusLabel(String status) { |
| 164 | 0 | return (String) routeStatusLabels.get(status); |
| 165 | |
} |
| 166 | |
|
| 167 | |
static public String getActiveIndicatorLabel(Boolean indicator) { |
| 168 | 0 | return (String) activeIndicatorLabels.get(indicator); |
| 169 | |
} |
| 170 | |
|
| 171 | |
static public String getActivationPolicyLabel(String code) { |
| 172 | 0 | return (String) activationPolicyLabels.get(code); |
| 173 | |
} |
| 174 | |
|
| 175 | |
static public String getPolicyLabel(String code) { |
| 176 | 0 | return (String) policyLabels.get(code); |
| 177 | |
} |
| 178 | |
|
| 179 | |
} |