mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Removing unnessaccery code blocks
This commit is contained in:
parent
1f507e4224
commit
3e37b73360
@ -88,47 +88,19 @@ public class PolicyInformationPointImpl implements PolicyInformationPoint {
|
|||||||
@Override
|
@Override
|
||||||
public List<Policy> getRelatedPolicies(PIPDevice pipDevice) throws PolicyManagementException {
|
public List<Policy> getRelatedPolicies(PIPDevice pipDevice) throws PolicyManagementException {
|
||||||
|
|
||||||
// List<List<Policy>> policies = new ArrayList<List<Policy>>();
|
List<Policy> policies = policyManager.getPoliciesOfDeviceType(pipDevice.getDeviceType().getName());
|
||||||
List<Policy> policies = new ArrayList<Policy>();
|
PolicyFilter policyFilter = new PolicyFilterImpl();
|
||||||
try {
|
policyFilter.filterDeviceTypeBasedPolicies(pipDevice.getDeviceType().getName(), policies);
|
||||||
// Get the device type related policies
|
policyFilter.filterOwnershipTypeBasedPolicies(pipDevice.getOwnershipType(), policies);
|
||||||
// policies.add(policyManager.getPoliciesOfDeviceType(pipDevice.getDeviceType().getName()));
|
policyFilter.filterRolesBasedPolicies(pipDevice.getRoles(), policies);
|
||||||
|
|
||||||
|
return policies;
|
||||||
// Commented out because these are already taken when device type based policies retrieved
|
|
||||||
|
|
||||||
// // Get the roles related policies
|
|
||||||
// for (String role : pipDevice.getRoles()) {
|
|
||||||
// policies.add(policyManager.getPoliciesOfRole(role));
|
|
||||||
// }
|
|
||||||
// // Get policy related to the device
|
|
||||||
// policies.add(policyManager.getPoliciesOfDevice(pipDevice.getDeviceIdentifier()));
|
|
||||||
|
|
||||||
policies = policyManager.getPoliciesOfDeviceType(pipDevice.getDeviceType().getName());
|
|
||||||
|
|
||||||
PolicyFilter policyFilter = new PolicyFilterImpl();
|
|
||||||
policyFilter.filterDeviceTypeBasedPolicies(pipDevice.getDeviceType().getName(), policies);
|
|
||||||
policyFilter.filterOwnershipTypeBasedPolicies(pipDevice.getOwnershipType(), policies);
|
|
||||||
policyFilter.filterRolesBasedPolicies(pipDevice.getRoles(), policies);
|
|
||||||
|
|
||||||
return policies;
|
|
||||||
} catch (PolicyManagementException e) {
|
|
||||||
String msg = "Error occurred when retrieving related to given device " +
|
|
||||||
pipDevice.getDeviceIdentifier().getId() + " " + pipDevice.getDeviceIdentifier().getType() + ".";
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new PolicyManagementException(msg, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Feature> getRelatedFeatures(String deviceType) throws FeatureManagementException {
|
public List<Feature> getRelatedFeatures(String deviceType) throws FeatureManagementException {
|
||||||
try {
|
return featureManager.getAllFeatures(deviceType);
|
||||||
return featureManager.getAllFeatures(deviceType);
|
|
||||||
} catch (FeatureManagementException e) {
|
|
||||||
String msg = "Error occurred when retrieving features related to device type.";
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new FeatureManagementException(msg, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] getRoleOfDevice(Device device) throws PolicyManagementException {
|
private String[] getRoleOfDevice(Device device) throws PolicyManagementException {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user