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 */ 016package org.kuali.rice.krad.uif.field; 017 018import java.io.Serializable; 019import java.util.ArrayList; 020import java.util.HashMap; 021import java.util.List; 022import java.util.Map; 023 024import org.kuali.rice.krad.datadictionary.Copyable; 025 026/** 027 * Object that is returned for Ajax attribute queries and exposed 028 * as JSON 029 * 030 * @author Kuali Rice Team (rice.collab@kuali.org) 031 */ 032public class AttributeQueryResult implements Serializable, Copyable { 033 private static final long serialVersionUID = -6688384365943881516L; 034 035 private String resultMessage; 036 private String resultMessageStyleClasses; 037 038 private Map<String, String> resultFieldData; 039 private List<Object> resultData; 040 041 public AttributeQueryResult() { 042 resultFieldData = new HashMap<String, String>(); 043 resultData = new ArrayList<Object>(); 044 } 045 046 /** 047 * Message text that should display (if non empty) with the results. 048 * Can be used to given messages such as data not found 049 * 050 * @return text to display with results 051 */ 052 public String getResultMessage() { 053 return resultMessage; 054 } 055 056 /** 057 * Setter for the result message text 058 * 059 * @param resultMessage 060 */ 061 public void setResultMessage(String resultMessage) { 062 this.resultMessage = resultMessage; 063 } 064 065 /** 066 * CSS Style classes that should be applied to the result message text 067 * 068 * @return CSS style classes 069 */ 070 public String getResultMessageStyleClasses() { 071 return resultMessageStyleClasses; 072 } 073 074 /** 075 * Setter for the CSS style classes to use for the return message 076 * 077 * @param resultMessageStyleClasses 078 */ 079 public void setResultMessageStyleClasses(String resultMessageStyleClasses) { 080 this.resultMessageStyleClasses = resultMessageStyleClasses; 081 } 082 083 /** 084 * Returns data for multiple fields as a Map where key is the field 085 * name and map value is the field value 086 * 087 * @return result field data 088 */ 089 public Map<String, String> getResultFieldData() { 090 return resultFieldData; 091 } 092 093 /** 094 * Setter for the map field data 095 * 096 * @param resultFieldData 097 */ 098 public void setResultFieldData(Map<String, String> resultFieldData) { 099 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}