Search in sources :

Example 1 with LogType

use of eu.europa.ec.fisheries.schema.exchange.v1.LogType in project UVMS-ExchangeModule-APP by UnionVMS.

the class ExchangeLogModelBean method enrichDtosWithRelatedLogsInfo.

private void enrichDtosWithRelatedLogsInfo(List<ExchangeLogType> exchangeLogList) {
    List<String> guids = new ArrayList<>();
    for (ExchangeLogType log : exchangeLogList) {
        guids.add(log.getGuid());
    }
    List<ExchangeLog> relatedLogs = logDao.getExchangeLogByRangeOfRefGuids(guids);
    if (CollectionUtils.isNotEmpty(relatedLogs)) {
        for (ExchangeLog logEntity : relatedLogs) {
            RelatedLogInfo refLogInfo = new RelatedLogInfo();
            refLogInfo.setGuid(logEntity.getGuid());
            refLogInfo.setType(logEntity.getTypeRefType().toString());
            for (ExchangeLogType logType : exchangeLogList) {
                if (StringUtils.equals(logEntity.getTypeRefGuid(), logType.getGuid())) {
                    logType.getRelatedLogData().add(refLogInfo);
                }
            }
        }
    }
}
Also used : RelatedLogInfo(eu.europa.ec.fisheries.schema.exchange.v1.RelatedLogInfo) ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) ArrayList(java.util.ArrayList) ExchangeLog(eu.europa.ec.fisheries.uvms.exchange.entity.exchangelog.ExchangeLog)

Example 2 with LogType

use of eu.europa.ec.fisheries.schema.exchange.v1.LogType in project UVMS-ExchangeModule-APP by UnionVMS.

the class LogMapper method toModel.

public static ExchangeLogType toModel(ExchangeLog entity) {
    ExchangeLogType model = new ExchangeLogType();
    LogType logType = entity.getType();
    if (logType.equals(LogType.RECEIVE_MOVEMENT)) {
        ReceiveMovementType type = new ReceiveMovementType();
        type.setSource(entity.getSource());
        type.setRecipient(entity.getRecipient());
        logType = LogType.RECEIVE_MOVEMENT;
        model = type;
    } else if (logType.equals(LogType.SEND_MOVEMENT)) {
        SendMovementType type = new SendMovementType();
        type.setFwdDate(entity.getFwdDate());
        type.setFwdRule(entity.getFwdRule());
        type.setRecipient(entity.getRecipient());
        logType = LogType.SEND_MOVEMENT;
        model = type;
    } else if (logType.equals(LogType.SEND_POLL)) {
        SendPollType type = new SendPollType();
        type.setFwdDate(entity.getFwdDate());
        type.setRecipient(entity.getRecipient());
        logType = LogType.SEND_POLL;
        model = type;
    } else if (logType.equals(LogType.SEND_EMAIL)) {
        SendEmailType type = new SendEmailType();
        type.setFwdRule(entity.getFwdRule());
        type.setFwdDate(entity.getFwdDate());
        type.setRecipient(entity.getRecipient());
        logType = LogType.SEND_EMAIL;
        model = type;
    }
    model.setDateRecieved(entity.getDateReceived());
    model.setGuid(entity.getGuid());
    model.setSenderReceiver(entity.getSenderReceiver());
    model.setIncoming(entity.getTransferIncoming());
    model.setStatus(entity.getStatus());
    model.setDestination(entity.getDestination());
    model.setType(logType);
    model.setSource(entity.getSource());
    model.setTypeRefType(entity.getTypeRefType());
    if (entity.getTypeRefType() != null) {
        LogRefType logRefType = new LogRefType();
        logRefType.setRefGuid(entity.getTypeRefGuid());
        logRefType.setType(entity.getTypeRefType());
        logRefType.setMessage(entity.getTypeRefMessage());
        model.setTypeRef(logRefType);
    }
    return model;
}
Also used : SendPollType(eu.europa.ec.fisheries.schema.exchange.v1.SendPollType) SendEmailType(eu.europa.ec.fisheries.schema.exchange.v1.SendEmailType) ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) LogType(eu.europa.ec.fisheries.schema.exchange.v1.LogType) LogRefType(eu.europa.ec.fisheries.schema.exchange.v1.LogRefType) ReceiveMovementType(eu.europa.ec.fisheries.schema.exchange.v1.ReceiveMovementType) SendMovementType(eu.europa.ec.fisheries.schema.exchange.v1.SendMovementType)

Example 3 with LogType

use of eu.europa.ec.fisheries.schema.exchange.v1.LogType in project UVMS-ExchangeModule-APP by UnionVMS.

the class ExchangeLogServiceBean method log.

@Override
public ExchangeLogType log(ExchangeBaseRequest request, LogType logType, ExchangeLogStatusTypeType status, TypeRefType messageType, String messageText, boolean incoming) throws ExchangeLogException {
    LogRefType ref = new LogRefType();
    ref.setMessage(messageText);
    ref.setRefGuid(request.getMessageGuid());
    ref.setType(messageType);
    ExchangeLogType log = new ExchangeLogType();
    log.setSenderReceiver(request.getSenderOrReceiver());
    log.setDateRecieved(request.getDate());
    log.setType(logType);
    log.setStatus(status);
    log.setIncoming(incoming);
    log.setTypeRef(ref);
    log.setDestination(request.getDestination());
    return log(log, request.getUsername());
}
Also used : ExchangeLogType(eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType) LogRefType(eu.europa.ec.fisheries.schema.exchange.v1.LogRefType)

Aggregations

ExchangeLogType (eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogType)3 LogRefType (eu.europa.ec.fisheries.schema.exchange.v1.LogRefType)2 LogType (eu.europa.ec.fisheries.schema.exchange.v1.LogType)1 ReceiveMovementType (eu.europa.ec.fisheries.schema.exchange.v1.ReceiveMovementType)1 RelatedLogInfo (eu.europa.ec.fisheries.schema.exchange.v1.RelatedLogInfo)1 SendEmailType (eu.europa.ec.fisheries.schema.exchange.v1.SendEmailType)1 SendMovementType (eu.europa.ec.fisheries.schema.exchange.v1.SendMovementType)1 SendPollType (eu.europa.ec.fisheries.schema.exchange.v1.SendPollType)1 ExchangeLog (eu.europa.ec.fisheries.uvms.exchange.entity.exchangelog.ExchangeLog)1 ArrayList (java.util.ArrayList)1