use of eu.europa.ec.fisheries.uvms.longpolling.notifications.NotificationMessage in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeLogServiceBean method setPollStatus.
@Override
public PollStatus setPollStatus(String jmsCorrelationId, String pollId, ExchangeLogStatusTypeType logStatus, String username) throws ExchangeLogException {
try {
// Remove the message from cache, because legancy implementation
logCache.acknowledged(jmsCorrelationId);
PollStatus pollStatus = new PollStatus();
pollStatus.setPollGuid(pollId);
pollStatus.setStatus(logStatus);
ExchangeLogType exchangeLogType = exchangeLogModel.setPollStatus(pollStatus, username);
pollStatus.setExchangeLogGuid(exchangeLogType.getGuid());
sendAuditLogMessageForUpdatePollStatus(pollId, username);
// For long polling
exchangeLogEvent.fire(new NotificationMessage("guid", pollStatus.getExchangeLogGuid()));
return pollStatus;
} catch (ExchangeModelMapperException e) {
throw new ExchangeLogException("Couldn't update status of exchange log");
} catch (ExchangeModelException e) {
throw new ExchangeLogException("Couldn't update status of exchange log");
}
}
use of eu.europa.ec.fisheries.uvms.longpolling.notifications.NotificationMessage in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeLogServiceBean method createUnsentMessage.
@Override
public String createUnsentMessage(String senderReceiver, Date timestamp, String recipient, String message, List<UnsentMessageTypeProperty> properties, String username) throws ExchangeLogException {
log.debug("createUnsentMessage in service layer:{}", message);
try {
UnsentMessageType unsentMessage = new UnsentMessageType();
unsentMessage.setDateReceived(timestamp);
unsentMessage.setSenderReceiver(senderReceiver);
unsentMessage.setRecipient(recipient);
unsentMessage.setMessage(message);
unsentMessage.getProperties().addAll(properties);
String createdUnsentMessageId = unsentModel.createMessage(unsentMessage, username);
List<String> unsentMessageIds = Arrays.asList(createdUnsentMessageId);
sendAuditLogMessageForCreateUnsentMessage(createdUnsentMessageId, username);
sendingQueueEvent.fire(new NotificationMessage("messageIds", unsentMessageIds));
return createdUnsentMessageId;
} catch (ExchangeModelException e) {
log.error("Couldn't add message to unsent list: {} {}", message, e);
throw new ExchangeLogException("Couldn't add message to unsent list");
}
}
use of eu.europa.ec.fisheries.uvms.longpolling.notifications.NotificationMessage in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeLogServiceBean method updateStatus.
@Override
public ExchangeLogType updateStatus(String pluginMessageId, ExchangeLogStatusTypeType logStatus, String username) throws ExchangeLogException {
try {
String logGuid = logCache.acknowledged(pluginMessageId);
ExchangeLogStatusType exchangeLogStatusType = createExchangeLogStatusType(logStatus, logGuid);
ExchangeLogType updatedLog = exchangeLogModel.updateExchangeLogStatus(exchangeLogStatusType, username);
sendAuditLogMessageForUpdateExchangeLog(updatedLog.getGuid(), username);
// For long polling
exchangeLogEvent.fire(new NotificationMessage("guid", updatedLog.getGuid()));
return updatedLog;
} catch (ExchangeModelException e) {
throw new ExchangeLogException("Couldn't update status of exchange log", e);
}
}
use of eu.europa.ec.fisheries.uvms.longpolling.notifications.NotificationMessage in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeLogServiceBean method log.
@Override
public ExchangeLogType log(ExchangeLogType log, String username) throws ExchangeLogException {
try {
ExchangeLogType exchangeLog = exchangeLogModel.createExchangeLog(log, username);
String guid = exchangeLog.getGuid();
sendAuditLogMessageForCreateExchangeLog(guid, username);
exchangeLogEvent.fire(new NotificationMessage("guid", guid));
LOG.debug("[INFO] Logging message with guid : [ " + guid + " ]..");
return exchangeLog;
} catch (ExchangeModelException e) {
throw new ExchangeLogException("Couldn't create log exchange log.");
}
}
use of eu.europa.ec.fisheries.uvms.longpolling.notifications.NotificationMessage in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeLogServiceBean method removeUnsentMessage.
@Override
public void removeUnsentMessage(String unsentMessageId, String username) throws ExchangeLogException {
log.debug("removeUnsentMessage in service layer:{}", unsentMessageId);
try {
String removeMessageId = unsentModel.removeMessage(unsentMessageId);
List<String> removedMessageIds = Arrays.asList(removeMessageId);
sendAuditLogMessageForRemoveUnsentMessage(removeMessageId, username);
sendingQueueEvent.fire(new NotificationMessage("messageIds", removedMessageIds));
} catch (ExchangeModelException e) {
log.error("Couldn't add message to unsent list {} {}", unsentMessageId, e);
throw new ExchangeLogException("Couldn't add message to unsent list");
}
}
Aggregations