View Javadoc
1   /**
2    * Copyright 2005-2014 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.rule;
17  
18  import org.kuali.rice.core.api.uif.RemotableAttributeError;
19  import org.kuali.rice.core.api.uif.RemotableAttributeField;
20  import org.kuali.rice.kew.framework.rule.attribute.WorkflowRuleAttributeFields;
21  import org.kuali.rice.kns.util.FieldUtils;
22  import org.kuali.rice.kns.web.ui.Row;
23  
24  import java.util.List;
25  import java.util.Map;
26  
27  /**
28   * This class wraps a {@link WorkflowRuleAttributeFields} object and provides a KNS-compatible view to the data
29   * contained therein. Primarily, this means that RemotableAttributeField objects are transformed to KNS Row objects.
30   *
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   */
33  public class WorkflowRuleAttributeRows {
34  
35      private final WorkflowRuleAttributeFields fields;
36      private final List<Row> rows;
37  
38      public WorkflowRuleAttributeRows(WorkflowRuleAttributeFields fields) {
39          this.fields = fields;
40          this.rows = convertToRows(fields.getAttributeFields());
41      }
42  
43      private static List<Row> convertToRows(List<RemotableAttributeField> attributeFields) {
44          return FieldUtils.convertRemotableAttributeFields(attributeFields);
45      }
46  
47      public List<Row> getRows() {
48          return rows;
49      }
50  
51      public List<RemotableAttributeError> getValidationErrors() {
52          return fields.getValidationErrors();
53      }
54  
55      public Map<String, String> getRuleExtensionValues() {
56          return fields.getRuleExtensionValues();
57      }
58  
59  }