|
|
@ -236,12 +236,14 @@ public class PolicyManagerImpl implements PolicyManager {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean deletePolicy(Policy policy) throws PolicyManagementException {
|
|
|
|
public boolean deletePolicy(Policy policy) throws PolicyManagementException {
|
|
|
|
|
|
|
|
|
|
|
|
boolean bool;
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
bool = policyDAO.deletePolicy(policy);
|
|
|
|
policyDAO.deleteAllPolicyRelatedConfigs(policy.getId());
|
|
|
|
|
|
|
|
policyDAO.deletePolicy(policy.getId());
|
|
|
|
|
|
|
|
featureDAO.deleteFeaturesOfProfile(policy.getProfileId());
|
|
|
|
|
|
|
|
profileDAO.deleteProfile(policy.getProfileId());
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
@ -252,18 +254,48 @@ public class PolicyManagerImpl implements PolicyManager {
|
|
|
|
+ policy.getId() + " - " + policy.getPolicyName() + ")";
|
|
|
|
+ policy.getId() + " - " + policy.getPolicyName() + ")";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
throw new PolicyManagementException(msg, e);
|
|
|
|
throw new PolicyManagementException(msg, e);
|
|
|
|
|
|
|
|
} catch (ProfileManagerDAOException e) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e1) {
|
|
|
|
|
|
|
|
log.warn("Error occurred while roll backing the transaction.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bool;
|
|
|
|
String msg = "Error occurred while deleting the profile for policy ("
|
|
|
|
|
|
|
|
+ policy.getId() + ")";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new PolicyManagementException(msg, e);
|
|
|
|
|
|
|
|
} catch (FeatureManagerDAOException e) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e1) {
|
|
|
|
|
|
|
|
log.warn("Error occurred while roll backing the transaction.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String msg = "Error occurred while deleting the profile features for policy ("
|
|
|
|
|
|
|
|
+ policy.getId() + ")";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new PolicyManagementException(msg, e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean deletePolicy(int policyId) throws PolicyManagementException {
|
|
|
|
public boolean deletePolicy(int policyId) throws PolicyManagementException {
|
|
|
|
boolean bool;
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
|
|
|
|
Policy policy = policyDAO.getPolicy(policyId);
|
|
|
|
policyDAO.deleteAllPolicyRelatedConfigs(policyId);
|
|
|
|
policyDAO.deleteAllPolicyRelatedConfigs(policyId);
|
|
|
|
bool = policyDAO.deletePolicy(policyId);
|
|
|
|
policyDAO.deletePolicy(policyId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(log.isDebugEnabled()){
|
|
|
|
|
|
|
|
log.debug(policy.getProfileId() + " ----------------------------------");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
featureDAO.deleteFeaturesOfProfile(policy.getProfileId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
profileDAO.deleteProfile(policy.getProfileId());
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -275,8 +307,27 @@ public class PolicyManagerImpl implements PolicyManager {
|
|
|
|
+ policyId + ")";
|
|
|
|
+ policyId + ")";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
throw new PolicyManagementException(msg, e);
|
|
|
|
throw new PolicyManagementException(msg, e);
|
|
|
|
|
|
|
|
} catch (ProfileManagerDAOException e) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e1) {
|
|
|
|
|
|
|
|
log.warn("Error occurred while roll backing the transaction.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String msg = "Error occurred while deleting the profile for policy ("
|
|
|
|
|
|
|
|
+ policyId + ")";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new PolicyManagementException(msg, e);
|
|
|
|
|
|
|
|
} catch (FeatureManagerDAOException e) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e1) {
|
|
|
|
|
|
|
|
log.warn("Error occurred while roll backing the transaction.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String msg = "Error occurred while deleting the profile features for policy ("
|
|
|
|
|
|
|
|
+ policyId + ")";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new PolicyManagementException(msg, e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bool;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|