|
|
@ -21,13 +21,15 @@ package org.wso2.carbon.policy.mgt.core.mgt.impl;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.wso2.carbon.device.mgt.common.Feature;
|
|
|
|
import org.wso2.carbon.device.mgt.common.Feature;
|
|
|
|
import org.wso2.carbon.policy.mgt.common.FeatureManagementException;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.policy.mgt.Profile;
|
|
|
|
import org.wso2.carbon.device.mgt.common.policy.mgt.Profile;
|
|
|
|
import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature;
|
|
|
|
import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature;
|
|
|
|
|
|
|
|
import org.wso2.carbon.policy.mgt.common.FeatureManagementException;
|
|
|
|
import org.wso2.carbon.policy.mgt.core.dao.FeatureDAO;
|
|
|
|
import org.wso2.carbon.policy.mgt.core.dao.FeatureDAO;
|
|
|
|
import org.wso2.carbon.policy.mgt.core.dao.FeatureManagerDAOException;
|
|
|
|
import org.wso2.carbon.policy.mgt.core.dao.FeatureManagerDAOException;
|
|
|
|
import org.wso2.carbon.policy.mgt.core.dao.PolicyManagementDAOFactory;
|
|
|
|
import org.wso2.carbon.policy.mgt.core.dao.PolicyManagementDAOFactory;
|
|
|
|
import org.wso2.carbon.policy.mgt.core.dao.PolicyManagerDAOException;
|
|
|
|
import org.wso2.carbon.policy.mgt.core.dao.PolicyManagerDAOException;
|
|
|
|
|
|
|
|
import org.wso2.carbon.policy.mgt.core.dao.ProfileDAO;
|
|
|
|
|
|
|
|
import org.wso2.carbon.policy.mgt.core.dao.ProfileManagerDAOException;
|
|
|
|
import org.wso2.carbon.policy.mgt.core.mgt.FeatureManager;
|
|
|
|
import org.wso2.carbon.policy.mgt.core.mgt.FeatureManager;
|
|
|
|
|
|
|
|
|
|
|
|
import java.sql.SQLException;
|
|
|
|
import java.sql.SQLException;
|
|
|
@ -36,130 +38,28 @@ import java.util.List;
|
|
|
|
public class FeatureManagerImpl implements FeatureManager {
|
|
|
|
public class FeatureManagerImpl implements FeatureManager {
|
|
|
|
|
|
|
|
|
|
|
|
private FeatureDAO featureDAO;
|
|
|
|
private FeatureDAO featureDAO;
|
|
|
|
|
|
|
|
private ProfileDAO profileDAO;
|
|
|
|
private static Log log = LogFactory.getLog(FeatureManagerImpl.class);
|
|
|
|
private static Log log = LogFactory.getLog(FeatureManagerImpl.class);
|
|
|
|
|
|
|
|
|
|
|
|
public FeatureManagerImpl() {
|
|
|
|
public FeatureManagerImpl() {
|
|
|
|
featureDAO = PolicyManagementDAOFactory.getFeatureDAO();
|
|
|
|
featureDAO = PolicyManagementDAOFactory.getFeatureDAO();
|
|
|
|
}
|
|
|
|
profileDAO = PolicyManagementDAOFactory.getProfileDAO();
|
|
|
|
|
|
|
|
|
|
|
|
/*@Override
|
|
|
|
|
|
|
|
public Feature addFeature(Feature feature) throws FeatureManagementException {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
|
|
|
|
feature = featureDAO.addFeature(feature);
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e1) {
|
|
|
|
|
|
|
|
log.warn("Unable to roll back the transaction");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String msg = "Error occurred while adding feature (" + feature.getName() + ")";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new FeatureManagementException(msg, e);
|
|
|
|
|
|
|
|
} catch (FeatureManagerDAOException e) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e1) {
|
|
|
|
|
|
|
|
log.warn("Unable to roll back the transaction");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String msg = "Error occurred while adding feature (" + feature.getName() + ")";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new FeatureManagementException(msg, e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return feature;
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*@Override
|
|
|
|
|
|
|
|
public List<Feature> addFeatures(List<Feature> features) throws FeatureManagementException {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
|
|
|
|
features = featureDAO.addFeatures(features);
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e1) {
|
|
|
|
|
|
|
|
log.warn("Unable to roll back the transaction");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String msg = "Error occurred while adding feature (" + features.size()+ ")";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new FeatureManagementException(msg, e);
|
|
|
|
|
|
|
|
} catch (FeatureManagerDAOException e) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e1) {
|
|
|
|
|
|
|
|
log.warn("Unable to roll back the transaction");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String msg = "Error occurred while adding feature (" + features.size() + ")";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new FeatureManagementException(msg, e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return features;
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* @Override
|
|
|
|
|
|
|
|
public Feature updateFeature(Feature feature) throws FeatureManagementException {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
|
|
|
|
feature = featureDAO.updateFeature(feature);
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e1) {
|
|
|
|
|
|
|
|
log.warn("Unable to roll back the transaction");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String msg = "Error occurred while updating feature (" + feature.getName() + ")";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new FeatureManagementException(msg, e);
|
|
|
|
|
|
|
|
} catch (FeatureManagerDAOException e) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e1) {
|
|
|
|
|
|
|
|
log.warn("Unable to roll back the transaction");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String msg = "Error occurred while updating feature (" + feature.getName() + ")";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new FeatureManagementException(msg, e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return feature;
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean deleteFeature(Feature feature) throws FeatureManagementException {
|
|
|
|
|
|
|
|
boolean bool;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
|
|
|
|
bool = featureDAO.deleteFeature(feature.getId());
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
|
|
|
|
} catch (FeatureManagerDAOException e) {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
throw new FeatureManagementException("Error occurred while deleting the feature (" + feature.getName() +
|
|
|
|
|
|
|
|
")", e);
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
throw new FeatureManagementException("Error occurred while deleting the feature (" + feature.getName() +
|
|
|
|
|
|
|
|
") from database", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return bool;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ProfileFeature addProfileFeature(ProfileFeature feature, int profileId) throws FeatureManagementException {
|
|
|
|
public ProfileFeature addProfileFeature(ProfileFeature feature, int profileId) throws FeatureManagementException {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
|
|
|
|
Profile profile = profileDAO.getProfile(profileId);
|
|
|
|
|
|
|
|
if (profile == null) {
|
|
|
|
|
|
|
|
throw new FeatureManagementException(
|
|
|
|
|
|
|
|
"Could not find a profile with the profile id: " + profileId);
|
|
|
|
|
|
|
|
}
|
|
|
|
feature = featureDAO.addProfileFeature(feature, profileId);
|
|
|
|
feature = featureDAO.addProfileFeature(feature, profileId);
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
} catch (PolicyManagerDAOException | FeatureManagerDAOException e) {
|
|
|
|
} catch (ProfileManagerDAOException | PolicyManagerDAOException | FeatureManagerDAOException e) {
|
|
|
|
throw new FeatureManagementException("Error occurred while adding profile feature (" +
|
|
|
|
throw new FeatureManagementException("Error occurred while adding profile feature (" +
|
|
|
|
feature.getFeatureCode() + " - " + profileId + ")", e);
|
|
|
|
feature.getFeatureCode() + " - " + profileId + ")", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -168,16 +68,22 @@ public class FeatureManagerImpl implements FeatureManager {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ProfileFeature updateProfileFeature(ProfileFeature feature, int profileId) throws
|
|
|
|
public ProfileFeature updateProfileFeature(ProfileFeature feature, int profileId) throws
|
|
|
|
FeatureManagementException {
|
|
|
|
FeatureManagementException {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
|
|
|
|
Profile profile = profileDAO.getProfile(profileId);
|
|
|
|
|
|
|
|
if (profile == null) {
|
|
|
|
|
|
|
|
throw new FeatureManagementException(
|
|
|
|
|
|
|
|
"Could not find a profile with the profile id: " + profileId);
|
|
|
|
|
|
|
|
}
|
|
|
|
feature = featureDAO.updateProfileFeature(feature, profileId);
|
|
|
|
feature = featureDAO.updateProfileFeature(feature, profileId);
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
} catch (FeatureManagerDAOException | PolicyManagerDAOException e) {
|
|
|
|
} catch (ProfileManagerDAOException | FeatureManagerDAOException | PolicyManagerDAOException e) {
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
throw new FeatureManagementException("Error occurred while updating feature (" +
|
|
|
|
throw new FeatureManagementException("Error occurred while updating feature (" +
|
|
|
|
feature.getFeatureCode() + " - " + profileId + ") in database.", e);
|
|
|
|
feature.getFeatureCode() + " - " + profileId +
|
|
|
|
|
|
|
|
") in database.", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -186,19 +92,24 @@ public class FeatureManagerImpl implements FeatureManager {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<ProfileFeature> addProfileFeatures(List<ProfileFeature> features, int profileId) throws
|
|
|
|
public List<ProfileFeature> addProfileFeatures(List<ProfileFeature> features, int profileId) throws
|
|
|
|
FeatureManagementException {
|
|
|
|
FeatureManagementException {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
|
|
|
|
Profile profile = profileDAO.getProfile(profileId);
|
|
|
|
|
|
|
|
if (profile == null) {
|
|
|
|
|
|
|
|
throw new FeatureManagementException(
|
|
|
|
|
|
|
|
"Could not find a profile with the profile id: " + profileId);
|
|
|
|
|
|
|
|
}
|
|
|
|
features = featureDAO.addProfileFeatures(features, profileId);
|
|
|
|
features = featureDAO.addProfileFeatures(features, profileId);
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
} catch (FeatureManagerDAOException e) {
|
|
|
|
} catch (ProfileManagerDAOException | FeatureManagerDAOException e) {
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
throw new FeatureManagementException("Error occurred while adding the features to profile id (" +
|
|
|
|
throw new FeatureManagementException("Error occurred while adding the features to profile id (" +
|
|
|
|
profileId + ")", e);
|
|
|
|
profileId + ")", e);
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
throw new FeatureManagementException("Error occurred while adding the features to profile id (" +
|
|
|
|
throw new FeatureManagementException("Error occurred while adding the features to profile id (" +
|
|
|
|
profileId + ") to the database", e);
|
|
|
|
profileId + ") to the database", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -207,26 +118,30 @@ public class FeatureManagerImpl implements FeatureManager {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<ProfileFeature> updateProfileFeatures(List<ProfileFeature> features, int profileId) throws
|
|
|
|
public List<ProfileFeature> updateProfileFeatures(List<ProfileFeature> features, int profileId) throws
|
|
|
|
FeatureManagementException {
|
|
|
|
FeatureManagementException {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
|
|
|
|
Profile profile = profileDAO.getProfile(profileId);
|
|
|
|
|
|
|
|
if (profile == null) {
|
|
|
|
|
|
|
|
throw new FeatureManagementException(
|
|
|
|
|
|
|
|
"Could not find a profile with the profile id: " + profileId);
|
|
|
|
|
|
|
|
}
|
|
|
|
features = featureDAO.updateProfileFeatures(features, profileId);
|
|
|
|
features = featureDAO.updateProfileFeatures(features, profileId);
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
} catch (FeatureManagerDAOException e) {
|
|
|
|
} catch (ProfileManagerDAOException | FeatureManagerDAOException e) {
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
throw new FeatureManagementException("Error occurred while updating the features to profile id (" +
|
|
|
|
throw new FeatureManagementException("Error occurred while updating the features to profile id (" +
|
|
|
|
profileId + ")", e);
|
|
|
|
profileId + ")", e);
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
throw new FeatureManagementException("Error occurred while updating the features to profile id (" +
|
|
|
|
throw new FeatureManagementException("Error occurred while updating the features to profile id (" +
|
|
|
|
profileId + ") to the database", e);
|
|
|
|
profileId + ") to the database", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return features;
|
|
|
|
return features;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<Feature> getAllFeatures(String deviceType) throws FeatureManagementException {
|
|
|
|
public List<Feature> getAllFeatures(String deviceType) throws FeatureManagementException {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -245,8 +160,13 @@ public class FeatureManagerImpl implements FeatureManager {
|
|
|
|
public List<ProfileFeature> getFeaturesForProfile(int profileId) throws FeatureManagementException {
|
|
|
|
public List<ProfileFeature> getFeaturesForProfile(int profileId) throws FeatureManagementException {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
PolicyManagementDAOFactory.openConnection();
|
|
|
|
PolicyManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
Profile profile = profileDAO.getProfile(profileId);
|
|
|
|
|
|
|
|
if (profile == null) {
|
|
|
|
|
|
|
|
throw new FeatureManagementException(
|
|
|
|
|
|
|
|
"Could not find a profile with the profile id: " + profileId);
|
|
|
|
|
|
|
|
}
|
|
|
|
return featureDAO.getFeaturesForProfile(profileId);
|
|
|
|
return featureDAO.getFeaturesForProfile(profileId);
|
|
|
|
} catch (FeatureManagerDAOException e) {
|
|
|
|
} catch (ProfileManagerDAOException | FeatureManagerDAOException e) {
|
|
|
|
throw new FeatureManagementException("Error occurred while getting the features", e);
|
|
|
|
throw new FeatureManagementException("Error occurred while getting the features", e);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new FeatureManagementException("Error occurred while opening a connection to the data source", e);
|
|
|
|
throw new FeatureManagementException("Error occurred while opening a connection to the data source", e);
|
|
|
@ -255,27 +175,6 @@ public class FeatureManagerImpl implements FeatureManager {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean deleteFeature(int featureId) throws FeatureManagementException {
|
|
|
|
|
|
|
|
boolean bool;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
|
|
|
|
bool = featureDAO.deleteFeature(featureId);
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
|
|
|
|
} catch (FeatureManagerDAOException e) {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
throw new FeatureManagementException("Error occurred while deleting the feature - id (" +
|
|
|
|
|
|
|
|
featureId + ")", e);
|
|
|
|
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
throw new FeatureManagementException("Error occurred while deleting the feature - id (" + featureId +
|
|
|
|
|
|
|
|
") from database.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return bool;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean deleteFeaturesOfProfile(Profile profile) throws FeatureManagementException {
|
|
|
|
public boolean deleteFeaturesOfProfile(Profile profile) throws FeatureManagementException {
|
|
|
|
boolean bool;
|
|
|
|
boolean bool;
|
|
|
@ -286,11 +185,11 @@ public class FeatureManagerImpl implements FeatureManager {
|
|
|
|
} catch (FeatureManagerDAOException e) {
|
|
|
|
} catch (FeatureManagerDAOException e) {
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
throw new FeatureManagementException("Error occurred while deleting the feature of - profile (" +
|
|
|
|
throw new FeatureManagementException("Error occurred while deleting the feature of - profile (" +
|
|
|
|
profile.getProfileName() + ")", e);
|
|
|
|
profile.getProfileName() + ")", e);
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
} catch (PolicyManagerDAOException e) {
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
throw new FeatureManagementException("Error occurred while deleting the feature of - profile (" +
|
|
|
|
throw new FeatureManagementException("Error occurred while deleting the feature of - profile (" +
|
|
|
|
profile.getProfileName() + ") from database", e);
|
|
|
|
profile.getProfileName() + ") from database", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|