awips2/edexOsgi/com.raytheon.uf.common.tafqueue/src/com/raytheon/uf/common/tafqueue/ServerResponse.java
Steve Harris dc50bc8443 12.6.1-9 baseline
Former-commit-id: 7c064b6868 [formerly 2c0ff851ca] [formerly 27afa60345 [formerly 8f93efb93ec2d244fe599c16b3af5b33784c0232]]
Former-commit-id: 27afa60345
Former-commit-id: 4f7bb90bb0
2012-07-10 07:53:49 -05:00

110 lines
2.8 KiB
Java

/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.tafqueue;
import java.util.ArrayList;
import java.util.List;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* The class is used to return responses back to CAVE for information requested
* on the taf_queue table.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 2, 2012 14715 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
@DynamicSerialize
public class ServerResponse<T> implements ISerializableObject {
@DynamicSerializeElement
private List<String> messages;
@DynamicSerializeElement
boolean error;
@DynamicSerializeElement
private List<String> notifications;
@DynamicSerializeElement
private T payload;
public ServerResponse() {
this.messages = new ArrayList<String>();
this.notifications = new ArrayList<String>();
this.error = false;
}
public void addMessage(String message) {
messages.add(message);
}
public String toString() {
StringBuilder sb = new StringBuilder();
for (String message : messages) {
sb.append(message).append("\n");
}
return sb.toString();
}
public List<String> getMessages() {
return messages;
}
public void setMessages(List<String> messages) {
this.messages = messages;
}
public boolean isError() {
return error;
}
public void setError(boolean error) {
this.error = error;
}
public List<String> getNotifications() {
return notifications;
}
public void setNotifications(List<String> notifications) {
this.notifications = notifications;
}
public T getPayload() {
return payload;
}
public void setPayload(T payload) {
this.payload = payload;
}
}