001    /**
002     * Copyright 2005-2014 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.krad.datadictionary;
017    
018    import java.util.ArrayList;
019    import java.util.HashMap;
020    import java.util.List;
021    import java.util.Map;
022    
023    import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition;
024    import org.kuali.rice.krad.datadictionary.parse.BeanTag;
025    import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
026    import org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase;
027    import org.kuali.rice.krad.datadictionary.validator.ValidationTrace;
028    
029    /**
030     * A container that holds all of the {@link WorkflowAttributeDefinition} for a document for both document searches
031     * and routing that depends on the values that exist on the document.
032     *
033     * @author Kuali Rice Team (rice.collab@kuali.org)
034     */
035    @BeanTag(name = "workflowAttributes-bean")
036    public class WorkflowAttributes extends UifDictionaryBeanBase {
037        private static final long serialVersionUID = 6435015497886060280L;
038    
039        private List<SearchingTypeDefinition> searchingTypeDefinitions;
040        private Map<String, RoutingTypeDefinition> routingTypeDefinitions;
041    
042        public WorkflowAttributes() {
043            searchingTypeDefinitions = new ArrayList<SearchingTypeDefinition>();
044            routingTypeDefinitions = new HashMap<String, RoutingTypeDefinition>();
045        }
046    
047        /**
048         * @return the searchingTypeDefinitions
049         */
050        @BeanTagAttribute(name = "searchingTypeDefinitions", type = BeanTagAttribute.AttributeType.LISTBEAN)
051        public List<SearchingTypeDefinition> getSearchingTypeDefinitions() {
052            return this.searchingTypeDefinitions;
053        }
054    
055        /**
056         * @param searchingTypeDefinitions the searchingTypeDefinitions to set
057         */
058        public void setSearchingTypeDefinitions(List<SearchingTypeDefinition> searchingTypeDefinitions) {
059            this.searchingTypeDefinitions = searchingTypeDefinitions;
060        }
061    
062        @BeanTagAttribute(name = "routingTypeDefinitions", type = BeanTagAttribute.AttributeType.MAPBEAN)
063        public Map<String, RoutingTypeDefinition> getRoutingTypeDefinitions() {
064            return this.routingTypeDefinitions;
065        }
066    
067        public void setRoutingTypeDefinitions(Map<String, RoutingTypeDefinition> routingTypeDefinitions) {
068            this.routingTypeDefinitions = routingTypeDefinitions;
069        }
070    
071        /**
072         * This overridden method ...
073         *
074         * @see org.kuali.rice.krad.datadictionary.DictionaryBeanBase#dataDictionaryPostProcessing()
075         */
076        @Override
077        public void dataDictionaryPostProcessing() {
078            for (SearchingTypeDefinition definition : searchingTypeDefinitions) {
079                definition.dataDictionaryPostProcessing();
080            }
081            for (RoutingTypeDefinition definition : routingTypeDefinitions.values()) {
082                definition.dataDictionaryPostProcessing();
083            }
084        }
085    
086        public void completeValidation(Class<?> rootBusinessObjectClass, Class<?> otherBusinessObjectClass, ValidationTrace tracer) {
087            for (SearchingTypeDefinition definition : searchingTypeDefinitions) {
088                definition.completeValidation(rootBusinessObjectClass, otherBusinessObjectClass,tracer);
089            }
090            for (RoutingTypeDefinition definition : routingTypeDefinitions.values()) {
091                definition.completeValidation(rootBusinessObjectClass, otherBusinessObjectClass,tracer);
092            }
093        }
094    
095    }