Skip to content

Commit

Permalink
[UNIONVMS-4660] WIP: activating rules for movement messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikos Paraskevopoulos authored and Nikos Paraskevopoulos committed Nov 26, 2020
1 parent 3aaf882 commit 6ffe624
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public void evaluate(List<MovementFact> factList, boolean justToAvoidErasure) {
@Lock(LockType.READ)
public void evaluate(List<RawMovementFact> facts) {
KieSession ksession = getKieSession();
ksession.setGlobal(LOGGER_STR, log);
// ksession.setGlobal(LOGGER_STR, log);
for (RawMovementFact fact : facts) {
ksession.insert(fact);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,9 @@ public void setMovementReportReceived(SetFLUXMovementReportRequest request, Stri
return;
}
// Decomment this one and comment the other when validation is working! Still work needs to be done after this!
// processReceivedMovementsAsBatch(movementReportsList, pluginType, userName, request.getLogGuid());
enrichAndSenMovementsAsBatch(movementReportsList, userName, request.getLogGuid());
EnrichedMovementWrapper enrichedWrapper = processReceivedMovementsAsBatch(movementReportsList, pluginType, userName, request.getLogGuid());
// enrichAndSenMovementsAsBatch(enrichedWrapper, movementReportsList, userName, request.getLogGuid());
// enrichAndSenMovementsAsBatch(null, movementReportsList, userName, request.getLogGuid());
// Send some response to Movement, if it originated from there (manual movement)
if (MovementSourceType.MANUAL.equals(movementReportsList.get(0).getSource())) {// A person has created a position
ProcessedMovementAck response = MovementModuleResponseMapper.mapProcessedMovementAck(eu.europa.ec.fisheries.schema.movement.common.v1.AcknowledgeTypeType.OK,
Expand All @@ -271,7 +272,7 @@ public void setMovementReportReceived(SetFLUXMovementReportRequest request, Stri
* @param exchangeLogGuid
* @throws RulesServiceException
*/
private void enrichAndSenMovementsAsBatch(List<RawMovementType> rawMovements, String username, String exchangeLogGuid) throws RulesServiceException {
private void enrichAndSenMovementsAsBatch(EnrichedMovementWrapper enrichedWrapper1, List<RawMovementType> rawMovements, String username, String exchangeLogGuid) throws RulesServiceException {
try {
// Enrich with MobilTerminal and Assets data. Get Mobile Terminal if it exists.
EnrichedMovementWrapper enrichedWrapper = enrichBatchWithMobileTerminalAndAssets(rawMovements);
Expand All @@ -290,7 +291,7 @@ private void enrichAndSenMovementsAsBatch(List<RawMovementType> rawMovements, St
}
}

private void processReceivedMovementsAsBatch(List<RawMovementType> rawMovements, String pluginType, String username, String exchangeLogGuid) throws RulesServiceException {
private EnrichedMovementWrapper processReceivedMovementsAsBatch(List<RawMovementType> rawMovements, String pluginType, String username, String exchangeLogGuid) throws RulesServiceException {
try {
// Enrich with MobilTerminal and Assets data. Get Mobile Terminal if it exists.
EnrichedMovementWrapper enrichedWrapper = enrichBatchWithMobileTerminalAndAssets(rawMovements);
Expand All @@ -317,6 +318,7 @@ private void processReceivedMovementsAsBatch(List<RawMovementType> rawMovements,
updateRequestMessageStatusInExchange(exchangeLogGuid, ExchangeLogStatusTypeType.FAILED);
sendBatchBackToExchange(exchangeLogGuid, rawMovements, MovementRefTypeType.ALARM, username);
}
return enrichedWrapper;
} catch (MessageException | MobileTerminalModelMapperException | MobileTerminalUnmarshallException | JMSException | AssetModelMapperException e) {
throw new RulesServiceException(e.getMessage());
}
Expand Down

0 comments on commit 6ffe624

Please sign in to comment.