use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusTypeType 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");
}
}
use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusTypeType 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());
}
use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusTypeType 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);
}
}
use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusTypeType in project UVMS-ExchangeModule-APP by UnionVMS.
the class LogMapperTest method toNewEntityWhenLogTypeIsReceiveSalesReportAndUsernameIsNull.
@Test
public void toNewEntityWhenLogTypeIsReceiveSalesReportAndUsernameIsNull() throws Exception {
// data set
Date dateReceived = new Date();
String senderOrReceiver = "BEL";
ExchangeLogStatusTypeType status = ExchangeLogStatusTypeType.SUCCESSFUL;
String destination = "destination";
ExchangeLogType input = new ExchangeLogType();
input.setType(LogType.RECEIVE_SALES_REPORT);
input.setDateRecieved(dateReceived);
input.setSenderReceiver(senderOrReceiver);
input.setStatus(status);
input.setIncoming(true);
input.setDestination(destination);
// execute
ExchangeLog result = LogMapper.toNewEntity(input, null);
// assert
assertEquals(dateReceived, result.getDateReceived());
assertEquals(senderOrReceiver, result.getSenderReceiver());
assertEquals(status, result.getStatus());
assertEquals(1, result.getStatusHistory().size());
assertEquals(result, result.getStatusHistory().get(0).getLog());
assertEquals(status, result.getStatusHistory().get(0).getStatus());
assertNotNull(result.getStatusHistory().get(0).getStatusTimestamp());
assertEquals("SYSTEM", result.getStatusHistory().get(0).getUpdatedBy());
assertNotNull(result.getStatusHistory().get(0).getUpdateTime());
assertEquals("SYSTEM", result.getUpdatedBy());
assertNotNull(result.getUpdateTime());
assertTrue(result.getTransferIncoming());
assertEquals(LogType.RECEIVE_SALES_REPORT, result.getType());
assertEquals(destination, result.getDestination());
}
use of eu.europa.ec.fisheries.schema.exchange.v1.ExchangeLogStatusTypeType in project UVMS-ExchangeModule-APP by UnionVMS.
the class LogMapperTest method toNewEntityWhenLogTypeIsReceiveSalesReportAndTypeRefIsNotFilledIn.
@Test
public void toNewEntityWhenLogTypeIsReceiveSalesReportAndTypeRefIsNotFilledIn() throws Exception {
// data set
Date dateReceived = new Date();
String senderOrReceiver = "BEL";
ExchangeLogStatusTypeType status = ExchangeLogStatusTypeType.SUCCESSFUL;
String destination = "destination";
ExchangeLogType input = new ExchangeLogType();
input.setType(LogType.RECEIVE_SALES_REPORT);
input.setDateRecieved(dateReceived);
input.setSenderReceiver(senderOrReceiver);
input.setStatus(status);
input.setIncoming(true);
input.setDestination(destination);
String username = "stainii";
// execute
ExchangeLog result = LogMapper.toNewEntity(input, username);
// assert
assertEquals(dateReceived, result.getDateReceived());
assertEquals(senderOrReceiver, result.getSenderReceiver());
assertEquals(status, result.getStatus());
assertEquals(1, result.getStatusHistory().size());
assertEquals(result, result.getStatusHistory().get(0).getLog());
assertEquals(status, result.getStatusHistory().get(0).getStatus());
assertNotNull(result.getStatusHistory().get(0).getStatusTimestamp());
assertEquals(username, result.getStatusHistory().get(0).getUpdatedBy());
assertNotNull(result.getStatusHistory().get(0).getUpdateTime());
assertEquals(username, result.getUpdatedBy());
assertNotNull(result.getUpdateTime());
assertTrue(result.getTransferIncoming());
assertEquals(LogType.RECEIVE_SALES_REPORT, result.getType());
assertEquals(destination, result.getDestination());
}
Aggregations