Search in sources :

Example 31 with ExchangeLogException

use of eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException 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 32 with ExchangeLogException

use of eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException 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)

Example 33 with ExchangeLogException

use of eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException in project UVMS-ExchangeModule-APP by UnionVMS.

the class ExchangeLogMapper method getPollExchangeLog.

private static ExchangeLogType getPollExchangeLog(CommandType command) throws ExchangeLogException {
    if (command.getPoll() == null) {
        throw new ExchangeLogException("No poll");
    }
    // TODO fix in mobileterminal
    SendPollType log = new SendPollType();
    log.setType(LogType.SEND_POLL);
    log.setDateRecieved(command.getTimestamp());
    log.setRecipient(getRecipientOfPoll(command.getPoll().getPollReceiver()));
    log.setSenderReceiver("System");
    LogRefType logRefType = new LogRefType();
    logRefType.setRefGuid(command.getPoll().getPollId());
    logRefType.setType(TypeRefType.POLL);
    log.setFwdDate(command.getTimestamp());
    log.setTypeRef(logRefType);
    return log;
}
Also used : SendPollType(eu.europa.ec.fisheries.schema.exchange.v1.SendPollType) ExchangeLogException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException) LogRefType(eu.europa.ec.fisheries.schema.exchange.v1.LogRefType)

Aggregations

ExchangeLogException (eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException)33 ExchangeModelMarshallException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException)15 ExchangeLogType (eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType)14 NotificationMessage (eu.europa.ec.fisheries.uvms.longpolling.notifications.NotificationMessage)9 ExchangeModelException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException)8 ExchangeMessageException (eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException)7 JMSException (javax.jms.JMSException)6 ExchangeLogStatusTypeType (eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusTypeType)5 LogRefType (eu.europa.ec.fisheries.schema.exchange.v1.LogRefType)5 PluginType (eu.europa.ec.fisheries.schema.exchange.plugin.types.v1.PluginType)4 RulesModelMapperException (eu.europa.ec.fisheries.uvms.rules.model.exception.RulesModelMapperException)4 ServiceResponseType (eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceResponseType)3 UnsentMessageTypeProperty (eu.europa.ec.fisheries.schema.exchange.v1.UnsentMessageTypeProperty)3 RulesModelMarshallException (eu.europa.ec.fisheries.uvms.rules.model.exception.RulesModelMarshallException)3 ArrayList (java.util.ArrayList)3 AcknowledgeType (eu.europa.ec.fisheries.schema.exchange.common.v1.AcknowledgeType)2 SetFAQueryMessageRequest (eu.europa.ec.fisheries.schema.exchange.module.v1.SetFAQueryMessageRequest)2 SetFLUXFAReportMessageRequest (eu.europa.ec.fisheries.schema.exchange.module.v1.SetFLUXFAReportMessageRequest)2 SetReportMovementType (eu.europa.ec.fisheries.schema.exchange.movement.v1.SetReportMovementType)2 ExchangeLogStatusType (eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusType)2