Search in sources :

Example 16 with ExchangeModelException

use of eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException 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");
    }
}
Also used : PollStatus(eu.europa.ec.fisheries.schema.exchange.v1.PollStatus) ExchangeModelMapperException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMapperException) NotificationMessage(eu.europa.ec.fisheries.uvms.longpolling.notifications.NotificationMessage) ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) ExchangeLogException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException) ExchangeModelException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException)

Example 17 with ExchangeModelException

use of eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException 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");
    }
}
Also used : UnsentMessageType(eu.europa.ec.fisheries.schema.exchange.v1.UnsentMessageType) NotificationMessage(eu.europa.ec.fisheries.uvms.longpolling.notifications.NotificationMessage) ExchangeLogException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException) ExchangeModelException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException)

Example 18 with ExchangeModelException

use of eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException 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);
    }
}
Also used : ExchangeLogStatusType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusType) NotificationMessage(eu.europa.ec.fisheries.uvms.longpolling.notifications.NotificationMessage) ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) ExchangeLogException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException) ExchangeModelException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException)

Example 19 with ExchangeModelException

use of eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException 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.");
    }
}
Also used : NotificationMessage(eu.europa.ec.fisheries.uvms.longpolling.notifications.NotificationMessage) ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) ExchangeLogException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException) ExchangeModelException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException)

Example 20 with ExchangeModelException

use of eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException 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");
    }
}
Also used : NotificationMessage(eu.europa.ec.fisheries.uvms.longpolling.notifications.NotificationMessage) ExchangeLogException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException) ExchangeModelException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException)

Aggregations

ExchangeModelException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException)28 ExchangeDaoException (eu.europa.ec.fisheries.uvms.exchange.exception.ExchangeDaoException)12 InputArgumentException (eu.europa.ec.fisheries.uvms.exchange.model.exception.InputArgumentException)10 ExchangeLogType (eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType)9 ExchangeLogException (eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException)8 ExchangeLog (eu.europa.ec.fisheries.uvms.exchange.entity.exchangelog.ExchangeLog)7 NotificationMessage (eu.europa.ec.fisheries.uvms.longpolling.notifications.NotificationMessage)6 ArrayList (java.util.ArrayList)6 ExchangeLogStatusType (eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusType)5 ServiceResponseType (eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceResponseType)4 TypeRefType (eu.europa.ec.fisheries.schema.exchange.v1.TypeRefType)4 UnsentMessageType (eu.europa.ec.fisheries.schema.exchange.v1.UnsentMessageType)4 ExchangeServiceException (eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeServiceException)4 ExchangeLogStatus (eu.europa.ec.fisheries.uvms.exchange.entity.exchangelog.ExchangeLogStatus)3 UnsentMessage (eu.europa.ec.fisheries.uvms.exchange.entity.unsent.UnsentMessage)3 ExchangeSearchMapperException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeSearchMapperException)3 ParseException (java.text.ParseException)3 ListResponseDto (eu.europa.ec.fisheries.uvms.exchange.model.dto.ListResponseDto)2 ExchangeModelMapperException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMapperException)2 JMSException (javax.jms.JMSException)2