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