View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.xml.export;
17  
18  import java.util.Collections;
19  import java.util.LinkedHashMap;
20  import java.util.List;
21  import java.util.Map;
22  
23  import org.kuali.rice.kew.rule.GenericWorkflowAttribute;
24  
25  /**
26   * This is a test WorkflowAttribute which holds two values, fin_coa_cd and org_cd
27   * 
28   * @author Kuali Rice Team (rice.collab@kuali.org)
29   *
30   */
31  public class KualiOrgReviewAttribute extends GenericWorkflowAttribute {
32  
33  	// We weant to provide support for these values:
34  	/*
35  	 				<ruleExtensionValues>
36  						<ruleExtensionValue>
37  							<key>fin_coa_cd</key>
38  							<value>KU</value>
39  						</ruleExtensionValue>
40  						<ruleExtensionValue>
41  							<key>org_cd</key>
42  							<value>KOOL</value>
43  						</ruleExtensionValue>
44  					</ruleExtensionValues>
45  	 */
46  	
47  	private static final long serialVersionUID = 6717444752714424385L;
48  	
49  	private static final String FIN_COA_CD = "fin_coa_cd";
50  	private static final String ORG_CD = "org_cd";
51  	
52  	private String finCoaCode;
53  	private String orgCode;
54  
55  	/**
56  	 * provide the attribute values as map entries
57  	 * 
58  	 * @see org.kuali.rice.kew.rule.GenericWorkflowAttribute#getProperties()
59  	 */
60  	@Override
61  	public Map<String, String> getProperties() {
62  		Map<String,String> properties = new LinkedHashMap<String, String>();
63  		properties.put(FIN_COA_CD, finCoaCode);
64  		properties.put(ORG_CD, orgCode);
65  		return properties;
66  	}
67  	
68  	public List validateRoutingData(Map paramMap) {
69  		return validateInputMap(paramMap);
70  	}
71  
72  	public List validateRuleData(Map paramMap) {
73  		return validateInputMap(paramMap);
74  	}
75  
76      private List validateInputMap(Map paramMap) {
77      	this.finCoaCode = (String) paramMap.get(FIN_COA_CD);
78      	this.orgCode = (String) paramMap.get(ORG_CD);
79      	return Collections.emptyList();
80      }
81  
82  	/**
83  	 * @return the finCoaCode
84  	 */
85  	public String getFinCoaCode() {
86  		return this.finCoaCode;
87  	}
88  
89  	/**
90  	 * @param finCoaCode the finCoaCode to set
91  	 */
92  	public void setFinCoaCode(String finCoaCode) {
93  		this.finCoaCode = finCoaCode;
94  	}
95  
96  	/**
97  	 * @return the orgCode
98  	 */
99  	public String getOrgCode() {
100 		return this.orgCode;
101 	}
102 
103 	/**
104 	 * @param orgCode the orgCode to set
105 	 */
106 	public void setOrgCode(String orgCode) {
107 		this.orgCode = orgCode;
108 	}
109 	
110 }