diff --git a/buildWithSonar.sh b/buildWithSonar.sh index 0d7e4fb11..0b2d81e3d 100755 --- a/buildWithSonar.sh +++ b/buildWithSonar.sh @@ -14,5 +14,8 @@ set -e . functions.sh + + +#### buildWithSonar diff --git a/hearing-command/hearing-command-api/pom.xml b/hearing-command/hearing-command-api/pom.xml index 7bb5a95ce..111d31643 100644 --- a/hearing-command/hearing-command-api/pom.xml +++ b/hearing-command/hearing-command-api/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-command - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-command-api war diff --git a/hearing-command/hearing-command-handler/pom.xml b/hearing-command/hearing-command-handler/pom.xml index 7714441b5..f3b75f73a 100644 --- a/hearing-command/hearing-command-handler/pom.xml +++ b/hearing-command/hearing-command-handler/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-command - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-command-handler war diff --git a/hearing-command/pom.xml b/hearing-command/pom.xml index 9bbaeaaaf..5b1e6172f 100644 --- a/hearing-command/pom.xml +++ b/hearing-command/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-parent - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-command pom diff --git a/hearing-common/pom.xml b/hearing-common/pom.xml index 5e08417f1..1a271a711 100644 --- a/hearing-common/pom.xml +++ b/hearing-common/pom.xml @@ -3,7 +3,7 @@ hearing-parent uk.gov.moj.cpp.hearing - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT 4.0.0 diff --git a/hearing-domain/hearing-domain-aggregate/pom.xml b/hearing-domain/hearing-domain-aggregate/pom.xml index 8e6c24628..031c0bf40 100644 --- a/hearing-domain/hearing-domain-aggregate/pom.xml +++ b/hearing-domain/hearing-domain-aggregate/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-domain - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-domain-aggregate diff --git a/hearing-domain/hearing-domain-common/pom.xml b/hearing-domain/hearing-domain-common/pom.xml index 4b5b63558..d0b7fbdbb 100644 --- a/hearing-domain/hearing-domain-common/pom.xml +++ b/hearing-domain/hearing-domain-common/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-domain - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-domain-common diff --git a/hearing-domain/hearing-domain-event/pom.xml b/hearing-domain/hearing-domain-event/pom.xml index 4d13bb640..ebcdc39f4 100644 --- a/hearing-domain/hearing-domain-event/pom.xml +++ b/hearing-domain/hearing-domain-event/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-domain - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-domain-event diff --git a/hearing-domain/hearing-domain-xhibit/pom.xml b/hearing-domain/hearing-domain-xhibit/pom.xml index bb1cd1583..326bd5e14 100644 --- a/hearing-domain/hearing-domain-xhibit/pom.xml +++ b/hearing-domain/hearing-domain-xhibit/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-domain - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT 4.0.0 diff --git a/hearing-domain/pom.xml b/hearing-domain/pom.xml index 495329377..8877c4a37 100644 --- a/hearing-domain/pom.xml +++ b/hearing-domain/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-parent - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-domain pom diff --git a/hearing-event-sources/pom.xml b/hearing-event-sources/pom.xml index 412717a4d..9e2214fe2 100644 --- a/hearing-event-sources/pom.xml +++ b/hearing-event-sources/pom.xml @@ -3,7 +3,7 @@ hearing-parent uk.gov.moj.cpp.hearing - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT ../pom.xml 4.0.0 diff --git a/hearing-event/hearing-event-listener/pom.xml b/hearing-event/hearing-event-listener/pom.xml index ee5e267e9..89cba9279 100644 --- a/hearing-event/hearing-event-listener/pom.xml +++ b/hearing-event/hearing-event-listener/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-event - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-event-listener war diff --git a/hearing-event/hearing-event-listener/src/test/java/uk/gov/moj/cpp/hearing/event/listener/HearingDeletedEventListenerTest.java b/hearing-event/hearing-event-listener/src/test/java/uk/gov/moj/cpp/hearing/event/listener/HearingDeletedEventListenerTest.java index 1657e9712..7ee0a438d 100644 --- a/hearing-event/hearing-event-listener/src/test/java/uk/gov/moj/cpp/hearing/event/listener/HearingDeletedEventListenerTest.java +++ b/hearing-event/hearing-event-listener/src/test/java/uk/gov/moj/cpp/hearing/event/listener/HearingDeletedEventListenerTest.java @@ -1,7 +1,7 @@ package uk.gov.moj.cpp.hearing.event.listener; import static java.util.UUID.randomUUID; -import static javax.json.Json.createObjectBuilder; +import static uk.gov.justice.services.messaging.JsonObjects.createObjectBuilder; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; diff --git a/hearing-event/hearing-event-processor/pom.xml b/hearing-event/hearing-event-processor/pom.xml index 7bf3a8208..5a8f3c9b9 100644 --- a/hearing-event/hearing-event-processor/pom.xml +++ b/hearing-event/hearing-event-processor/pom.xml @@ -3,7 +3,7 @@ hearing-event uk.gov.moj.cpp.hearing - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT 4.0.0 war diff --git a/hearing-event/hearing-event-processor/src/main/java/uk/gov/moj/cpp/hearing/pi/ProsecutionCaseRetriever.java b/hearing-event/hearing-event-processor/src/main/java/uk/gov/moj/cpp/hearing/pi/ProsecutionCaseRetriever.java index f7d2ef871..83b47f062 100644 --- a/hearing-event/hearing-event-processor/src/main/java/uk/gov/moj/cpp/hearing/pi/ProsecutionCaseRetriever.java +++ b/hearing-event/hearing-event-processor/src/main/java/uk/gov/moj/cpp/hearing/pi/ProsecutionCaseRetriever.java @@ -1 +1,53 @@ -package uk.gov.moj.cpp.hearing.pi; import static uk.gov.justice.services.messaging.JsonObjects.createObjectBuilder; import static uk.gov.justice.services.core.annotation.Component.EVENT_PROCESSOR; import static uk.gov.justice.services.messaging.JsonEnvelope.envelopeFrom; import static uk.gov.justice.services.messaging.JsonEnvelope.metadataBuilder; import uk.gov.justice.services.core.annotation.ServiceComponent; import uk.gov.justice.services.core.requester.Requester; import uk.gov.justice.services.messaging.JsonEnvelope; import uk.gov.moj.cpp.hearing.query.view.response.hearingresponse.ProsecutionCaseResponse; import java.util.Optional; import java.util.UUID; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.json.JsonObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @ApplicationScoped public class ProsecutionCaseRetriever { private static final Logger LOGGER = LoggerFactory.getLogger(ProsecutionCaseRetriever.class); private static final String HEARING_QUERY_PROSECUTIONCASE_BY_HEARINGID = "hearing.prosecution-case-by-hearingid"; @ServiceComponent(EVENT_PROCESSOR) @Inject private Requester requester; public Optional getProsecutionCaseForHearing(final UUID hearingId, final UUID hearingEventDefinitionId) { LOGGER.info(" getProsecutionCaseForHearing hearing id {} ", hearingId); final JsonObject query = createObjectBuilder() .add("hearingId", String.valueOf(hearingId)) .add("hearingEventDefinitionId", String.valueOf(hearingEventDefinitionId)) .build(); final JsonEnvelope jsonEnvelope = envelopeFrom( metadataBuilder() .withId(UUID.randomUUID()) .withName(HEARING_QUERY_PROSECUTIONCASE_BY_HEARINGID) .build(), query); if (!jsonEnvelope.payloadAsJsonObject().isEmpty()) { return Optional.of(requester.requestAsAdmin(jsonEnvelope, ProsecutionCaseResponse.class).payload()); } return Optional.empty(); } } \ No newline at end of file +package uk.gov.moj.cpp.hearing.pi; + +import static uk.gov.justice.services.messaging.JsonObjects.createObjectBuilder; +import static uk.gov.justice.services.core.annotation.Component.EVENT_PROCESSOR; +import static uk.gov.justice.services.messaging.JsonEnvelope.envelopeFrom; +import static uk.gov.justice.services.messaging.JsonEnvelope.metadataBuilder; + +import uk.gov.justice.services.core.annotation.ServiceComponent; +import uk.gov.justice.services.core.requester.Requester; +import uk.gov.justice.services.messaging.JsonEnvelope; +import uk.gov.moj.cpp.hearing.query.view.response.hearingresponse.ProsecutionCaseResponse; + +import java.util.Optional; +import java.util.UUID; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; +import javax.json.JsonObject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@ApplicationScoped +public class ProsecutionCaseRetriever { + + private static final Logger LOGGER = LoggerFactory.getLogger(ProsecutionCaseRetriever.class); + private static final String HEARING_QUERY_PROSECUTIONCASE_BY_HEARINGID = "hearing.prosecution-case-by-hearingid"; + + @ServiceComponent(EVENT_PROCESSOR) + @Inject + private Requester requester; + + public Optional getProsecutionCaseForHearing(final UUID hearingId, final UUID hearingEventDefinitionId) { + + LOGGER.info(" getProsecutionCaseForHearing hearing id {} ", hearingId); + final JsonObject query = createObjectBuilder() + .add("hearingId", String.valueOf(hearingId)) + .add("hearingEventDefinitionId", String.valueOf(hearingEventDefinitionId)) + .build(); + + final JsonEnvelope jsonEnvelope = envelopeFrom( + metadataBuilder() + .withId(UUID.randomUUID()) + .withName(HEARING_QUERY_PROSECUTIONCASE_BY_HEARINGID) + .build(), + query); + + if (!jsonEnvelope.payloadAsJsonObject().isEmpty()) { + return Optional.of(requester.requestAsAdmin(jsonEnvelope, ProsecutionCaseResponse.class).payload()); + } + return Optional.empty(); + } +} diff --git a/hearing-event/pom.xml b/hearing-event/pom.xml index eb6ef9b03..447996a0d 100644 --- a/hearing-event/pom.xml +++ b/hearing-event/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-parent - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-event pom diff --git a/hearing-healthchecks/pom.xml b/hearing-healthchecks/pom.xml index 86e051d41..b27c4fd96 100644 --- a/hearing-healthchecks/pom.xml +++ b/hearing-healthchecks/pom.xml @@ -3,7 +3,7 @@ hearing-parent uk.gov.moj.cpp.hearing - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT 4.0.0 diff --git a/hearing-integration-test/pom.xml b/hearing-integration-test/pom.xml index 689135c46..4a9254cdd 100644 --- a/hearing-integration-test/pom.xml +++ b/hearing-integration-test/pom.xml @@ -5,7 +5,7 @@ uk.gov.moj.cpp.hearing hearing-parent - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-integration-test diff --git a/hearing-json/pom.xml b/hearing-json/pom.xml index 1c6c94a57..ded5186c7 100644 --- a/hearing-json/pom.xml +++ b/hearing-json/pom.xml @@ -3,7 +3,7 @@ hearing-parent uk.gov.moj.cpp.hearing - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT 4.0.0 diff --git a/hearing-query/hearing-query-api/pom.xml b/hearing-query/hearing-query-api/pom.xml index 14ff426c5..a405441e9 100644 --- a/hearing-query/hearing-query-api/pom.xml +++ b/hearing-query/hearing-query-api/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-query - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-query-api war diff --git a/hearing-query/hearing-query-view/pom.xml b/hearing-query/hearing-query-view/pom.xml index bd386e85a..69f32724a 100644 --- a/hearing-query/hearing-query-view/pom.xml +++ b/hearing-query/hearing-query-view/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-query - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-query-view jar diff --git a/hearing-query/pom.xml b/hearing-query/pom.xml index 7d37f92e4..8b80fdb30 100644 --- a/hearing-query/pom.xml +++ b/hearing-query/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-parent - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-query pom diff --git a/hearing-service/pom.xml b/hearing-service/pom.xml index e5bccfb71..9699c868e 100644 --- a/hearing-service/pom.xml +++ b/hearing-service/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-parent - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT 4.0.0 diff --git a/hearing-viewstore/hearing-viewstore-liquibase/pom.xml b/hearing-viewstore/hearing-viewstore-liquibase/pom.xml index a396956e6..2f7bb50df 100644 --- a/hearing-viewstore/hearing-viewstore-liquibase/pom.xml +++ b/hearing-viewstore/hearing-viewstore-liquibase/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-viewstore - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-viewstore-liquibase diff --git a/hearing-viewstore/hearing-viewstore-persistence/pom.xml b/hearing-viewstore/hearing-viewstore-persistence/pom.xml index c91033eb1..3193dab0f 100644 --- a/hearing-viewstore/hearing-viewstore-persistence/pom.xml +++ b/hearing-viewstore/hearing-viewstore-persistence/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-viewstore - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-viewstore-persistence diff --git a/hearing-viewstore/pom.xml b/hearing-viewstore/pom.xml index cbab51eef..1ae1e7d33 100644 --- a/hearing-viewstore/pom.xml +++ b/hearing-viewstore/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-parent - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT hearing-viewstore pom diff --git a/pojo-plugin/pom.xml b/pojo-plugin/pom.xml index 588428fc1..388ac39e4 100644 --- a/pojo-plugin/pom.xml +++ b/pojo-plugin/pom.xml @@ -3,7 +3,7 @@ uk.gov.moj.cpp.hearing hearing-parent - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT pojo-plugin diff --git a/pom.xml b/pom.xml index dfc4f90bd..42da0b358 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ uk.gov.moj.cpp.hearing hearing-parent - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT pom Hearing Context - Parent Module diff --git a/test-utilities/pom.xml b/test-utilities/pom.xml index 0b21fd6df..72850e2fb 100644 --- a/test-utilities/pom.xml +++ b/test-utilities/pom.xml @@ -7,7 +7,7 @@ uk.gov.moj.cpp.hearing hearing-parent - 17.104.169-PEG-2848-R14-SNAPSHOT + 17.104.172-PEG-2848-R14-SNAPSHOT