+ private void deleteEntityFromEsAndPolicyEntityTable(final PolicyController controller,
+ final PolicyRestController restController, final PolicyEntity policyEntity,
+ final String policyNamewithoutExtension) throws IOException {
+ // Delete the entity from Elastic Search Database
+ String searchFileName = policyEntity.getScope() + "." + policyEntity.getPolicyName();
+ restController.deleteElasticData(searchFileName);
+ // Delete the entity from Policy Entity table
+ controller.deleteData(policyEntity);
+ if (policyNamewithoutExtension.contains(CONFIG2)) {
+ Files.deleteIfExists(Paths.get(PolicyController.getConfigHome() + File.separator
+ + policyEntity.getConfigurationData().getConfigurationName()));
+ controller.deleteData(policyEntity.getConfigurationData());
+ restController.notifyOtherPapsToUpdateConfigurations(DELETE, null,
+ policyEntity.getConfigurationData().getConfigurationName());
+ } else if (policyNamewithoutExtension.contains(ACTION2)) {
+ Files.deleteIfExists(Paths.get(PolicyController.getActionHome() + File.separator
+ + policyEntity.getActionBodyEntity().getActionBodyName()));
+ controller.deleteData(policyEntity.getActionBodyEntity());
+ restController.notifyOtherPapsToUpdateConfigurations(DELETE, null,
+ policyEntity.getActionBodyEntity().getActionBodyName());
+ }
+ }
+