Search in sources :

Example 6 with ExchangeModelException

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

the class ExchangeServiceBean method upsertSettings.

@Override
public ServiceResponseType upsertSettings(String serviceClassName, SettingListType settingListType, String username) throws ExchangeServiceException {
    LOG.info("Upsert settings in service layer: {} {} {}", serviceClassName, settingListType, username);
    try {
        ServiceResponseType updatedSettings = serviceRegistryModel.updatePluginSettings(serviceClassName, settingListType, username);
        sendAuditLogMessageForUpdateService(compressServiceClassName(serviceClassName), username);
        return updatedSettings;
    } catch (ExchangeModelException e) {
        throw new ExchangeServiceException(e.getMessage());
    }
}
Also used : ServiceResponseType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceResponseType) ExchangeModelException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException) ExchangeServiceException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeServiceException)

Example 7 with ExchangeModelException

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

the class ExchangeServiceBean method unregisterService.

/**
 * {@inheritDoc}
 *
 * @param data
 * @throws ExchangeServiceException
 */
@Override
public ServiceResponseType unregisterService(ServiceType data, String username) throws ExchangeServiceException {
    LOG.info("Unregister service invoked in service layer: {} {}", data, username);
    try {
        ServiceResponseType serviceResponseType = serviceRegistryModel.unregisterService(data, username);
        sendAuditLogMessageForUnregisterService(compressServiceClassName(serviceResponseType.getServiceClassName()), username);
        return serviceResponseType;
    } catch (ExchangeModelException ex) {
        throw new ExchangeServiceException(ex.getMessage());
    }
}
Also used : ServiceResponseType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceResponseType) ExchangeModelException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException) ExchangeServiceException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeServiceException)

Example 8 with ExchangeModelException

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

the class ExchangeServiceBean method updateServiceStatus.

@Override
public ServiceResponseType updateServiceStatus(String serviceClassName, StatusType status, String username) throws ExchangeServiceException {
    LOG.info("Update service status invoked in service layer: {} {} {}", serviceClassName, status, username);
    try {
        ServiceResponseType updatedServiceStatus = serviceRegistryModel.updatePluginStatus(serviceClassName, status, username);
        sendAuditLogMessageForUpdateServiceStatus(serviceClassName, status, username);
        return updatedServiceStatus;
    } catch (ExchangeModelException e) {
        throw new ExchangeServiceException(e.getMessage());
    }
}
Also used : ServiceResponseType(eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceResponseType) ExchangeModelException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException) ExchangeServiceException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeServiceException)

Example 9 with ExchangeModelException

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

the class ExchangeLogModelBean method createExchangeLog.

@Override
public ExchangeLogType createExchangeLog(ExchangeLogType log, String username) throws ExchangeModelException {
    if (log == null) {
        throw new InputArgumentException("No log to create");
    }
    if (log.getType() == null) {
        throw new InputArgumentException("No type in log to create");
    }
    try {
        ExchangeLog exchangeLog = LogMapper.toNewEntity(log, username);
        ExchangeLog persistedLog = logDao.createLog(exchangeLog);
        return LogMapper.toModel(persistedLog);
    } catch (ExchangeDaoException ex) {
        LOG.error("[ Error when creating Exchange log {} {}] {}", log, username, ex.getMessage());
        throw new ExchangeModelException("Error when creating Exchange log ");
    }
}
Also used : InputArgumentException(eu.europa.ec.fisheries.uvms.exchange.model.exception.InputArgumentException) ExchangeDaoException(eu.europa.ec.fisheries.uvms.exchange.exception.ExchangeDaoException) ExchangeModelException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException) ExchangeLog(eu.europa.ec.fisheries.uvms.exchange.entity.exchangelog.ExchangeLog)

Example 10 with ExchangeModelException

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

the class ExchangeLogModelBean method getExchangeLogByGuidAndType.

@Override
public ExchangeLogType getExchangeLogByGuidAndType(String guid, TypeRefType typeRefType) throws ExchangeModelException {
    ExchangeLogType exchangeLogType;
    try {
        ExchangeLog exchangeLogByGuid = logDao.getExchangeLogByGuid(guid, typeRefType);
        exchangeLogType = LogMapper.toModel(exchangeLogByGuid);
    } catch (Exception e) {
        LOG.error("[ Error when getting exchange log by GUID. {}] {}", guid, e.getMessage());
        exchangeLogType = null;
    }
    return exchangeLogType;
}
Also used : ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) ExchangeModelException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException) ParseException(java.text.ParseException) InputArgumentException(eu.europa.ec.fisheries.uvms.exchange.model.exception.InputArgumentException) ExchangeDaoException(eu.europa.ec.fisheries.uvms.exchange.exception.ExchangeDaoException) ExchangeSearchMapperException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeSearchMapperException) ExchangeLog(eu.europa.ec.fisheries.uvms.exchange.entity.exchangelog.ExchangeLog)

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