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.kew.rule; 017 018 import org.kuali.rice.core.api.uif.RemotableAttributeError; 019 import org.kuali.rice.core.api.uif.RemotableAttributeField; 020 import org.kuali.rice.kew.framework.rule.attribute.WorkflowRuleAttributeFields; 021 import org.kuali.rice.kns.util.FieldUtils; 022 import org.kuali.rice.kns.web.ui.Row; 023 024 import java.util.List; 025 import java.util.Map; 026 027 /** 028 * This class wraps a {@link WorkflowRuleAttributeFields} object and provides a KNS-compatible view to the data 029 * contained therein. Primarily, this means that RemotableAttributeField objects are transformed to KNS Row objects. 030 * 031 * @author Kuali Rice Team (rice.collab@kuali.org) 032 */ 033 public class WorkflowRuleAttributeRows { 034 035 private final WorkflowRuleAttributeFields fields; 036 private final List<Row> rows; 037 038 public WorkflowRuleAttributeRows(WorkflowRuleAttributeFields fields) { 039 this.fields = fields; 040 this.rows = convertToRows(fields.getAttributeFields()); 041 } 042 043 private static List<Row> convertToRows(List<RemotableAttributeField> attributeFields) { 044 return FieldUtils.convertRemotableAttributeFields(attributeFields); 045 } 046 047 public List<Row> getRows() { 048 return rows; 049 } 050 051 public List<RemotableAttributeError> getValidationErrors() { 052 return fields.getValidationErrors(); 053 } 054 055 public Map<String, String> getRuleExtensionValues() { 056 return fields.getRuleExtensionValues(); 057 } 058 059 }