*
* @param rAlert
* @return SimpleObject the representation of Raxa Alert
*/
private SimpleObject getFieldsFromRaxaAlert(RaxaAlert rAlert) {
SimpleObject obj = new SimpleObject();
obj.add("uuid", rAlert.getUuid());
obj.add("name", rAlert.getName());
obj.add("description", rAlert.getDescription());
SimpleObject pRecipientObj = new SimpleObject();
Provider pRecipient = rAlert.getProviderRecipient();
if (pRecipient != null) {
pRecipientObj.add("uuid", pRecipient.getUuid());
pRecipientObj.add("display", pRecipient.getName());
}
obj.add("providerRecipient", pRecipientObj);
SimpleObject pSentObj = new SimpleObject();
Provider pSent = rAlert.getProviderSent();
if (pSent != null) {
pSentObj.add("uuid", pSent.getUuid());
pSentObj.add("display", pSent.getName());
}
obj.add("providerSent", pSentObj);
SimpleObject toLocationObj = new SimpleObject();
Location toLocation = rAlert.getToLocation();
if (toLocation != null) {
toLocationObj.add("uuid", toLocation.getUuid());
toLocationObj.add("display", toLocation.getName());
}
obj.add("toLocation", toLocationObj);
SimpleObject fromLocationObj = new SimpleObject();
Location fromLocation = rAlert.getFromLocation();
if (fromLocation != null) {
fromLocationObj.add("uuid", fromLocation.getUuid());
fromLocationObj.add("display", fromLocation.getName());
}
obj.add("fromLocation", fromLocationObj);
obj.add("alertType", rAlert.getAlertType());
obj.add("defaultTask", rAlert.getDefaultTask());
obj.add("seen", rAlert.getSeen());