Skip to content

Commit

Permalink
Merge pull request #1203 from opensrp/update-plans-after-stock-creati…
Browse files Browse the repository at this point in the history
…on-or-update

update plans after stock and structure mutation
  • Loading branch information
ndegwamartin authored Jan 31, 2024
2 parents c19c84d + a3a3508 commit c295927
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion configs
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<artifactId>opensrp-server-web</artifactId>
<packaging>war</packaging>
<version>2.10.11-SNAPSHOT</version>
<version>2.10.12-SNAPSHOT</version>
<name>opensrp-server-web</name>
<description>OpenSRP Server Web Application</description>
<url>https://github.com/OpenSRP/opensrp-server-web</url>
Expand All @@ -24,7 +24,7 @@
<redis.jedis.version>3.8.0</redis.jedis.version>
<opensrp.updatePolicy>always</opensrp.updatePolicy>
<nexus-staging-maven-plugin.version>1.5.1</nexus-staging-maven-plugin.version>
<opensrp.core.version>2.14.8-SNAPSHOT</opensrp.core.version>
<opensrp.core.version>2.14.9-SNAPSHOT</opensrp.core.version>
<opensrp.connector.version>2.4.1-SNAPSHOT</opensrp.connector.version>
<opensrp.interface.version>2.0.1-SNAPSHOT</opensrp.interface.version>
<powermock.version>2.0.5</powermock.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -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<StructureCreateOrUpdateEvent> {
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);
}
}
3 changes: 3 additions & 0 deletions src/main/resources/spring/listener-context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<task:scheduler pool-size="1" id="dhis2Scheduler"/>
<task:scheduler pool-size="1" id="messageScheduler"/>

<bean id="structureRepositoryEventListener"
class="org.opensrp.web.listener.StructureRepositoryEventListener"/>

<beans profile="rapidpro">
<bean id="dhis2" class="org.opensrp.web.listener.DHIS2ConnectorListener"></bean>
<task:scheduled-tasks scheduler="dhis2Scheduler">
Expand Down

0 comments on commit c295927

Please sign in to comment.