* Refactored addPolicy

This commit is contained in:
Dulitha Wijewantha 2015-05-13 22:04:15 +05:30
parent c703b5070f
commit acc159d132
4 changed files with 8 additions and 2 deletions

View File

@ -62,6 +62,8 @@ public interface PolicyAdministratorPoint {
List<Policy> getPolicies() throws PolicyManagementException;
Policy getPolicy(int policyId) throws PolicyManagementException;
/**
* This method gives the device specific policy.
*

View File

@ -445,11 +445,11 @@ public class PolicyDAOImpl implements PolicyDAO {
resultSet = stmt.executeQuery();
while (resultSet.next()) {
policy.setId(policyId);
policy.setPolicyName(resultSet.getString("NAME"));
policy.setTenantId(resultSet.getInt("TENANT_ID"));
policy.setPriorityId(resultSet.getInt("PRIORITY"));
policy.setProfileId(resultSet.getInt("PROFILE_ID"));
}
return policy;

View File

@ -83,6 +83,10 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint {
return policyManager.getPolicies();
}
@Override public Policy getPolicy(int policyId) throws PolicyManagementException {
return policyManager.getPolicy(policyId);
}
@Override
public List<Policy> getPoliciesOfDevice(DeviceIdentifier deviceIdentifier) throws PolicyManagementException {
return policyManager.getPoliciesOfDevice(deviceIdentifier);

View File

@ -372,7 +372,7 @@ public class PolicyManagerImpl implements PolicyManager {
policyDAO.getTimesOfPolicy(policy);
policyDAO.getLocationsOfPolicy(policy);
Profile profile = profileDAO.getProfiles(policy.getProfile().getProfileId());
Profile profile = profileDAO.getProfiles(policy.getProfileId());
policy.setProfile(profile);
policy.setRoles(roleNames);