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.krad.uif.field;
17  
18  import java.io.Serializable;
19  import java.util.ArrayList;
20  import java.util.HashMap;
21  import java.util.List;
22  import java.util.Map;
23  
24  import org.kuali.rice.krad.datadictionary.Copyable;
25  
26  /**
27   * Object that is returned for Ajax attribute queries and exposed
28   * as JSON
29   *
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   */
32  public class AttributeQueryResult implements Serializable, Copyable {
33      private static final long serialVersionUID = -6688384365943881516L;
34  
35      private String resultMessage;
36      private String resultMessageStyleClasses;
37  
38      private Map<String, String> resultFieldData;
39      private List<Object> resultData;
40  
41      public AttributeQueryResult() {
42          resultFieldData = new HashMap<String, String>();
43          resultData = new ArrayList<Object>();
44      }
45  
46      /**
47       * Message text that should display (if non empty) with the results.
48       * Can be used to given messages such as data not found
49       *
50       * @return text to display with results
51       */
52      public String getResultMessage() {
53          return resultMessage;
54      }
55  
56      /**
57       * Setter for the result message text
58       *
59       * @param resultMessage
60       */
61      public void setResultMessage(String resultMessage) {
62          this.resultMessage = resultMessage;
63      }
64  
65      /**
66       * CSS Style classes that should be applied to the result message text
67       *
68       * @return CSS style classes
69       */
70      public String getResultMessageStyleClasses() {
71          return resultMessageStyleClasses;
72      }
73  
74      /**
75       * Setter for the CSS style classes to use for the return message
76       *
77       * @param resultMessageStyleClasses
78       */
79      public void setResultMessageStyleClasses(String resultMessageStyleClasses) {
80          this.resultMessageStyleClasses = resultMessageStyleClasses;
81      }
82  
83      /**
84       * Returns data for multiple fields as a Map where key is the field
85       * name and map value is the field value
86       *
87       * @return result field data
88       */
89      public Map<String, String> getResultFieldData() {
90          return resultFieldData;
91      }
92  
93      /**
94       * Setter for the map field data
95       *
96       * @param resultFieldData
97       */
98      public void setResultFieldData(Map<String, String> resultFieldData) {
99          this.resultFieldData = resultFieldData;
100     }
101 
102     /**
103      * Result of an attribute query that will be sent back to the client
104      *
105      * @return result data
106      */
107     public List<Object> getResultData() {
108         return resultData;
109     }
110 
111     /**
112      * Setter for the attribute query result data
113      *
114      * @param resultData
115      */
116     public void setResultData(List<Object> resultData) {
117         this.resultData = resultData;
118     }
119 
120     /**
121      * @see Copyable#clone()
122      */
123     @Override
124     public AttributeQueryResult clone() throws CloneNotSupportedException {
125         return (AttributeQueryResult) super.clone();
126     }
127 
128 }