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);
}
}
}
}
}
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;
}
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());
}
Aggregations