001: /*
002: * Copyright 2006-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.workflow.attribute;
017:
018: import edu.iu.uis.eden.exception.EdenUserNotFoundException;
019: import edu.iu.uis.eden.routetemplate.RuleBaseValues;
020: import edu.iu.uis.eden.web.UrlResolver;
021:
022: /**
023: * This class wraps the Org Review Values that we need in the lookup result set.
024: *
025: * @see org.kuali.module.chart.web.lookupable.OrgReviewLookupableImpl
026: */
027: public class OrgReviewLookupableResult {
028: private String ruleId;
029: private String documentTypeName;
030: private String activeIndicator;
031: private String fin_coa_cd;
032: private String org_cd;
033: private String overrideCd;
034: private String fromAmount;
035: private String toAmount;
036: private String responsibleParty;
037:
038: /**
039: * Constructs a OrgReviewLookupableResult.java. This default constructor does nothing.
040: */
041: public OrgReviewLookupableResult() {
042: }
043:
044: /**
045: * Constructs a OrgReviewLookupableResult.java.
046: *
047: * @param ruleBaseValues The source from which this instance's variables are initialized.
048: */
049: public OrgReviewLookupableResult(RuleBaseValues ruleBaseValues) {
050: this .ruleId = ruleBaseValues.getRuleBaseValuesId().toString();
051: this .documentTypeName = ruleBaseValues.getDocTypeName();
052: this .activeIndicator = ruleBaseValues.getActiveIndDisplay();
053: this .fin_coa_cd = ruleBaseValues.getRuleExtensionValue(
054: KualiOrgReviewAttribute.FIN_COA_CD_KEY).getValue();
055: this .org_cd = ruleBaseValues.getRuleExtensionValue(
056: KualiOrgReviewAttribute.ORG_CD_KEY).getValue();
057: if (ruleBaseValues
058: .getRuleExtensionValue(KualiOrgReviewAttribute.OVERRIDE_CD_KEY) != null) {
059: this .overrideCd = ruleBaseValues.getRuleExtensionValue(
060: KualiOrgReviewAttribute.OVERRIDE_CD_KEY).getValue();
061: }
062: if (ruleBaseValues
063: .getRuleExtensionValue(KualiOrgReviewAttribute.FROM_AMOUNT_KEY) != null) {
064: this .fromAmount = ruleBaseValues.getRuleExtensionValue(
065: KualiOrgReviewAttribute.FROM_AMOUNT_KEY).getValue();
066: }
067: if (ruleBaseValues
068: .getRuleExtensionValue(KualiOrgReviewAttribute.TO_AMOUNT_KEY) != null) {
069: this .toAmount = ruleBaseValues.getRuleExtensionValue(
070: KualiOrgReviewAttribute.TO_AMOUNT_KEY).getValue();
071: }
072: StringBuffer responsiblePartyBuffer = new StringBuffer(
073: "<a href=\"");
074: try {
075: if (ruleBaseValues.getResponsibility(0).isUsingWorkgroup()) {
076: responsiblePartyBuffer.append(
077: UrlResolver.getInstance()
078: .getWorkgroupReportUrl()
079: + "?methodToCall=report&workgroupId=")
080: .append(
081: ruleBaseValues.getResponsibility(0)
082: .getWorkgroup()
083: .getWorkflowGroupId());
084: } else {
085: responsiblePartyBuffer.append(
086: UrlResolver.getInstance().getUserReportUrl()
087: + "?methodToCall=report&workflowId=")
088: .append(
089: ruleBaseValues.getResponsibility(0)
090: .getWorkflowUser()
091: .getWorkflowId());
092: }
093: responsiblePartyBuffer.append("&showEdit=no")
094: .append("\" >");
095: if (ruleBaseValues.getResponsibility(0).isUsingWorkgroup()) {
096: responsiblePartyBuffer.append(ruleBaseValues
097: .getResponsibility(0).getWorkgroup()
098: .getDisplayName());
099: } else {
100: responsiblePartyBuffer.append(ruleBaseValues
101: .getResponsibility(0).getWorkflowUser()
102: .getDisplayName());
103: }
104: responsiblePartyBuffer.append("</a>");
105: this .responsibleParty = responsiblePartyBuffer.toString();
106: } catch (EdenUserNotFoundException e) {
107: throw new RuntimeException(
108: "Unable to find user for Rule Id: "
109: + ruleBaseValues.getRuleBaseValuesId(), e);
110: }
111: }
112:
113: /**
114: * Gets the activeIndicator attribute.
115: *
116: * @return Returns the activeIndicator.
117: */
118: public String getActiveIndicator() {
119: return activeIndicator;
120: }
121:
122: /**
123: * Sets the activeIndicator attribute value.
124: *
125: * @param activeIndicator The activeIndicator to set.
126: */
127: public void setActiveIndicator(String activeIndicator) {
128: this .activeIndicator = activeIndicator;
129: }
130:
131: /**
132: * Gets the chartOfAccountsCode attribute.
133: *
134: * @return Returns the chartOfAccountsCode.
135: */
136: public String getFin_coa_cd() {
137: return fin_coa_cd;
138: }
139:
140: /**
141: * Sets the chartOfAccountsCode attribute value.
142: *
143: * @param chartOfAccountsCode The chartOfAccountsCode to set.
144: */
145: public void setFin_coa_cd(String chartOfAccountsCode) {
146: this .fin_coa_cd = chartOfAccountsCode;
147: }
148:
149: /**
150: * Gets the documentTypeName attribute.
151: *
152: * @return Returns the documentTypeName.
153: */
154: public String getDocumentTypeName() {
155: return documentTypeName;
156: }
157:
158: /**
159: * Sets the documentTypeName attribute value.
160: *
161: * @param documentTypeName The documentTypeName to set.
162: */
163: public void setDocumentTypeName(String documentTypeName) {
164: this .documentTypeName = documentTypeName;
165: }
166:
167: /**
168: * Gets the fromAmount attribute.
169: *
170: * @return Returns the fromAmount.
171: */
172: public String getFromAmount() {
173: return fromAmount;
174: }
175:
176: /**
177: * Sets the fromAmount attribute value.
178: *
179: * @param fromAmount The fromAmount to set.
180: */
181: public void setFromAmount(String fromAmount) {
182: this .fromAmount = fromAmount;
183: }
184:
185: /**
186: * Gets the organizationCode attribute.
187: *
188: * @return Returns the organizationCode.
189: */
190: public String getOrg_cd() {
191: return org_cd;
192: }
193:
194: /**
195: * Sets the organizationCode attribute value.
196: *
197: * @param organizationCode The organizationCode to set.
198: */
199: public void setOrg_cd(String organizationCode) {
200: this .org_cd = organizationCode;
201: }
202:
203: /**
204: * Gets the overrideCode attribute.
205: *
206: * @return Returns the overrideCode.
207: */
208: public String getOverrideCd() {
209: return overrideCd;
210: }
211:
212: /**
213: * Sets the overrideCode attribute value.
214: *
215: * @param overrideCode The overrideCode to set.
216: */
217: public void setOverrideCd(String overrideCode) {
218: this .overrideCd = overrideCode;
219: }
220:
221: /**
222: * Gets the responsibleParty attribute.
223: *
224: * @return Returns the responsibleParty.
225: */
226: public String getResponsibleParty() {
227: return responsibleParty;
228: }
229:
230: /**
231: * Sets the responsibleParty attribute value.
232: *
233: * @param responsibleParty The responsibleParty to set.
234: */
235: public void setResponsibleParty(String responsibleParty) {
236: this .responsibleParty = responsibleParty;
237: }
238:
239: /**
240: * Gets the ruleId attribute.
241: *
242: * @return Returns the ruleId.
243: */
244: public String getRuleId() {
245: return ruleId;
246: }
247:
248: /**
249: * Sets the ruleId attribute value.
250: *
251: * @param ruleId The ruleId to set.
252: */
253: public void setRuleId(String ruleId) {
254: this .ruleId = ruleId;
255: }
256:
257: /**
258: * Gets the toAmount attribute.
259: *
260: * @return Returns the toAmount.
261: */
262: public String getToAmount() {
263: return toAmount;
264: }
265:
266: /**
267: * Sets the toAmount attribute value.
268: *
269: * @param toAmount The toAmount to set.
270: */
271: public void setToAmount(String toAmount) {
272: this.toAmount = toAmount;
273: }
274: }
|