001    /**
002     * Copyright 2005-2011 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.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/ecl2.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.rice.kew.xml.export;
017    
018    import java.util.Collections;
019    import java.util.LinkedHashMap;
020    import java.util.List;
021    import java.util.Map;
022    
023    import org.kuali.rice.kew.rule.GenericWorkflowAttribute;
024    
025    /**
026     * This is a test WorkflowAttribute which holds two values, fin_coa_cd and org_cd
027     * 
028     * @author Kuali Rice Team (rice.collab@kuali.org)
029     *
030     */
031    public class KualiOrgReviewAttribute extends GenericWorkflowAttribute {
032    
033            // We weant to provide support for these values:
034            /*
035                                            <ruleExtensionValues>
036                                                    <ruleExtensionValue>
037                                                            <key>fin_coa_cd</key>
038                                                            <value>KU</value>
039                                                    </ruleExtensionValue>
040                                                    <ruleExtensionValue>
041                                                            <key>org_cd</key>
042                                                            <value>KOOL</value>
043                                                    </ruleExtensionValue>
044                                            </ruleExtensionValues>
045             */
046            
047            private static final long serialVersionUID = 6717444752714424385L;
048            
049            private static final String FIN_COA_CD = "fin_coa_cd";
050            private static final String ORG_CD = "org_cd";
051            
052            private String finCoaCode;
053            private String orgCode;
054    
055            /**
056             * provide the attribute values as map entries
057             * 
058             * @see org.kuali.rice.kew.rule.GenericWorkflowAttribute#getProperties()
059             */
060            @Override
061            public Map<String, String> getProperties() {
062                    Map<String,String> properties = new LinkedHashMap<String, String>();
063                    properties.put(FIN_COA_CD, finCoaCode);
064                    properties.put(ORG_CD, orgCode);
065                    return properties;
066            }
067            
068            public List validateRoutingData(Map paramMap) {
069                    return validateInputMap(paramMap);
070            }
071    
072            public List validateRuleData(Map paramMap) {
073                    return validateInputMap(paramMap);
074            }
075    
076        private List validateInputMap(Map paramMap) {
077            this.finCoaCode = (String) paramMap.get(FIN_COA_CD);
078            this.orgCode = (String) paramMap.get(ORG_CD);
079            return Collections.emptyList();
080        }
081    
082            /**
083             * @return the finCoaCode
084             */
085            public String getFinCoaCode() {
086                    return this.finCoaCode;
087            }
088    
089            /**
090             * @param finCoaCode the finCoaCode to set
091             */
092            public void setFinCoaCode(String finCoaCode) {
093                    this.finCoaCode = finCoaCode;
094            }
095    
096            /**
097             * @return the orgCode
098             */
099            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    }