View Javadoc
1   /**
2    * Copyright 2005-2016 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.krad.datadictionary;
17  
18  import java.util.ArrayList;
19  import java.util.HashMap;
20  import java.util.List;
21  import java.util.Map;
22  
23  import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition;
24  import org.kuali.rice.krad.datadictionary.parse.BeanTag;
25  import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
26  import org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase;
27  import org.kuali.rice.krad.datadictionary.validator.ValidationTrace;
28  
29  /**
30   * A container that holds all of the {@link WorkflowAttributeDefinition} for a document for both document searches
31   * and routing that depends on the values that exist on the document.
32   *
33   * @author Kuali Rice Team (rice.collab@kuali.org)
34   */
35  @BeanTag(name = "workflowAttributes")
36  public class WorkflowAttributes extends UifDictionaryBeanBase {
37      private static final long serialVersionUID = 6435015497886060280L;
38  
39      private List<SearchingTypeDefinition> searchingTypeDefinitions;
40      private Map<String, RoutingTypeDefinition> routingTypeDefinitions;
41  
42      public WorkflowAttributes() {
43          searchingTypeDefinitions = new ArrayList<SearchingTypeDefinition>();
44          routingTypeDefinitions = new HashMap<String, RoutingTypeDefinition>();
45      }
46  
47      /**
48       * @return the searchingTypeDefinitions
49       */
50      @BeanTagAttribute(name = "searchingTypeDefinitions", type = BeanTagAttribute.AttributeType.LISTBEAN)
51      public List<SearchingTypeDefinition> getSearchingTypeDefinitions() {
52          return this.searchingTypeDefinitions;
53      }
54  
55      /**
56       * @param searchingTypeDefinitions the searchingTypeDefinitions to set
57       */
58      public void setSearchingTypeDefinitions(List<SearchingTypeDefinition> searchingTypeDefinitions) {
59          this.searchingTypeDefinitions = searchingTypeDefinitions;
60      }
61  
62      @BeanTagAttribute(name = "routingTypeDefinitions", type = BeanTagAttribute.AttributeType.MAPBEAN)
63      public Map<String, RoutingTypeDefinition> getRoutingTypeDefinitions() {
64          return this.routingTypeDefinitions;
65      }
66  
67      public void setRoutingTypeDefinitions(Map<String, RoutingTypeDefinition> routingTypeDefinitions) {
68          this.routingTypeDefinitions = routingTypeDefinitions;
69      }
70  
71      /**
72       * This overridden method ...
73       *
74       * @see org.kuali.rice.krad.datadictionary.DictionaryBeanBase#dataDictionaryPostProcessing()
75       */
76      @Override
77      public void dataDictionaryPostProcessing() {
78          for (SearchingTypeDefinition definition : searchingTypeDefinitions) {
79              definition.dataDictionaryPostProcessing();
80          }
81          for (RoutingTypeDefinition definition : routingTypeDefinitions.values()) {
82              definition.dataDictionaryPostProcessing();
83          }
84      }
85  
86      public void completeValidation(Class<?> rootBusinessObjectClass, Class<?> otherBusinessObjectClass, ValidationTrace tracer) {
87          for (SearchingTypeDefinition definition : searchingTypeDefinitions) {
88              definition.completeValidation(rootBusinessObjectClass, otherBusinessObjectClass,tracer);
89          }
90          for (RoutingTypeDefinition definition : routingTypeDefinitions.values()) {
91              definition.completeValidation(rootBusinessObjectClass, otherBusinessObjectClass,tracer);
92          }
93      }
94  
95  }