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