* Refactored addPolicy

revert-70aa11f8
Dulitha Wijewantha 10 years ago
parent c703b5070f
commit acc159d132

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

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

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

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

Loading…
Cancel
Save