-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1203 from opensrp/update-plans-after-stock-creati…
…on-or-update update plans after stock and structure mutation
- Loading branch information
Showing
4 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/org/opensrp/web/listener/StructureRepositoryEventListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters