diff --git a/configs b/configs index 3ad596261..c9552e1cf 160000 --- a/configs +++ b/configs @@ -1 +1 @@ -Subproject commit 3ad596261a3471198c870a39038076a5a61a12ff +Subproject commit c9552e1cfbc9438f7ee90416b8fd2e2e57989ed5 diff --git a/pom.xml b/pom.xml index 779b2fb1b..7cee447f2 100755 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ opensrp-server-web war - 2.10.11-SNAPSHOT + 2.10.12-SNAPSHOT opensrp-server-web OpenSRP Server Web Application https://github.com/OpenSRP/opensrp-server-web @@ -24,7 +24,7 @@ 3.8.0 always 1.5.1 - 2.14.8-SNAPSHOT + 2.14.9-SNAPSHOT 2.4.1-SNAPSHOT 2.0.1-SNAPSHOT 2.0.5 diff --git a/src/main/java/org/opensrp/web/listener/StructureRepositoryEventListener.java b/src/main/java/org/opensrp/web/listener/StructureRepositoryEventListener.java new file mode 100644 index 000000000..50515bf23 --- /dev/null +++ b/src/main/java/org/opensrp/web/listener/StructureRepositoryEventListener.java @@ -0,0 +1,23 @@ +package org.opensrp.web.listener; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.opensrp.domain.postgres.Structure; +import org.opensrp.repository.StructureCreateOrUpdateEvent; +import org.opensrp.service.PhysicalLocationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +@Component +public class StructureRepositoryEventListener implements ApplicationListener { + private static final Logger logger = LogManager.getLogger(StructureRepositoryEventListener.class.toString()); + @Autowired + private PhysicalLocationService physicalLocationService; + @Override + public void onApplicationEvent(StructureCreateOrUpdateEvent structureCreateOrUpdateEvent) { + Structure structure = (Structure) structureCreateOrUpdateEvent.getSource(); + logger.info("Receiving Structure Event"); + physicalLocationService.regenerateTasksForOperationalArea(structure); + } +} diff --git a/src/main/resources/spring/listener-context.xml b/src/main/resources/spring/listener-context.xml index f5537b86a..f53498a53 100644 --- a/src/main/resources/spring/listener-context.xml +++ b/src/main/resources/spring/listener-context.xml @@ -16,6 +16,9 @@ + +