use of com.sun.identity.entitlement.LogicalCondition in project OpenAM by OpenRock.
the class PolicyConditionUpgrader method migrateEnvironmentConditions.
private void migrateEnvironmentConditions(Privilege privilege, MigrationReport migrationReport) throws UpgradeException, EntitlementException {
if (privilege.getCondition() == null) {
return;
}
if (privilege.getCondition() instanceof LogicalCondition) {
LogicalCondition logicalCondition = (LogicalCondition) privilege.getCondition();
Set<EntitlementCondition> conditions = logicalCondition.getEConditions();
Set<EntitlementCondition> migratedConditions = new HashSet<EntitlementCondition>();
for (EntitlementCondition condition : conditions) {
if (!(condition instanceof PolicyCondition)) {
//This should never happen due to check in initialise
throw new UpgradeException("Cannot upgrade a environment condition that is not of PolicyCondition type!");
}
migratedConditions.add(migrateEnvironmentCondition((PolicyCondition) condition, migrationReport));
}
logicalCondition.setEConditions(migratedConditions);
} else if (privilege.getCondition() instanceof PolicyCondition) {
privilege.setCondition(migrateEnvironmentCondition((PolicyCondition) privilege.getCondition(), migrationReport));
} else {
//This should never happen due to check in initialise
throw new UpgradeException("Cannot upgrade a environment condition that is not of PolicyCondition type!");
}
}
use of com.sun.identity.entitlement.LogicalCondition in project OpenAM by OpenRock.
the class PolicyConditionUpgrader method isEnvironmentConditionUpgradable.
private boolean isEnvironmentConditionUpgradable(EntitlementCondition condition) {
if (condition == null) {
return true;
}
if (condition instanceof LogicalCondition) {
LogicalCondition logicalCondition = (LogicalCondition) condition;
boolean upgradable = true;
for (EntitlementCondition c : logicalCondition.getEConditions()) {
upgradable &= isUpgradablePolicyCondition(c);
}
return upgradable;
}
return isUpgradablePolicyCondition(condition);
}
Aggregations