use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class FocusLifecycleProcessor method executeDataReduction.
private <F extends AssignmentHolderType> void executeDataReduction(LensContext<F> context, LifecycleStateActionDataReductionType dataReduction) throws SchemaException {
if (dataReduction == null) {
return;
}
LensFocusContext<F> focusContext = context.getFocusContext();
PrismObjectDefinition<F> focusDefinition = focusContext.getObjectDefinition();
for (ItemPathType purgeItemPathType : dataReduction.getPurgeItem()) {
ItemPath purgeItemPath = purgeItemPathType.getItemPath();
LOGGER.trace("Purging item {} from {}", purgeItemPath, focusContext.getObjectNew());
ItemDefinition purgeItemDef = focusDefinition.findItemDefinition(purgeItemPath);
ItemDelta purgeItemDelta = purgeItemDef.createEmptyDelta(purgeItemPath);
purgeItemDelta.setValueToReplace();
focusContext.swallowToSecondaryDelta(purgeItemDelta);
}
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class ModelInteractionServiceImpl method getPath.
private ItemPath getPath(PolicyItemDefinitionType policyItemDefinition) {
PolicyItemTargetType target = policyItemDefinition.getTarget();
if (target == null) {
return null;
}
ItemPathType itemPathType = target.getPath();
return itemPathType != null ? itemPathType.getItemPath() : null;
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class SchemaTransformer method getVisibilityPolicy.
@NotNull
private <O extends ObjectType> List<VisibilityPolicyEntry> getVisibilityPolicy(ArchetypePolicyType archetypePolicy, Object contextDesc) throws SchemaException {
List<VisibilityPolicyEntry> visibilityPolicy = new ArrayList<>();
for (ItemConstraintType itemConstraint : archetypePolicy.getItemConstraint()) {
UserInterfaceElementVisibilityType visibility = itemConstraint.getVisibility();
if (visibility != null) {
ItemPathType itemPathType = itemConstraint.getPath();
if (itemPathType == null) {
throw new SchemaException("No 'path' in item definition in archetype policy for " + contextDesc);
}
UniformItemPath itemPath = prismContext.toUniformPath(itemPathType);
visibilityPolicy.add(new VisibilityPolicyEntry(itemPath, visibility));
}
}
return visibilityPolicy;
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class TestAssignmentProcessor2 method createCondition.
private MappingType createCondition(String conditionName, char conditionType) {
ScriptExpressionEvaluatorType script = new ScriptExpressionEvaluatorType();
switch(conditionType) {
case '+':
script.setCode("basic.stringify(name) == 'jack1'");
break;
case '-':
script.setCode("basic.stringify(name) == 'jack'");
break;
case '0':
script.setCode("basic.stringify(name) == 'never there'");
break;
case '!':
script.setCode(createDumpConditionCode(conditionName));
break;
default:
throw new AssertionError(conditionType);
}
ExpressionType expression = new ExpressionType();
expression.getExpressionEvaluator().add(new ObjectFactory().createScript(script));
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(UserType.F_NAME));
MappingType rv = new MappingType();
rv.setName(conditionName);
rv.setExpression(expression);
rv.getSource().add(source);
return rv;
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class TestAssignmentProcessor2 method prepareAbstractRole.
private <R extends AbstractRoleType> R prepareAbstractRole(R abstractRole, String name) {
String oid = getRoleOid(name);
abstractRole.setName(PolyStringType.fromOrig(name));
abstractRole.setOid(oid);
// constructions
for (int i = 0; i <= constructionLevels; i++) {
ConstructionType c = new ConstructionType(prismContext);
c.setDescription(name + "-" + i);
c.setResourceRef(ObjectTypeUtil.createObjectRef(RESOURCE_DUMMY_EMPTY_OID, ObjectTypes.RESOURCE));
AssignmentType a = new AssignmentType(prismContext);
a.setDescription("Assignment for " + c.getDescription());
a.setConstruction(c);
addAssignmentOrInducement(abstractRole, i, a);
}
// focus mappings
for (int i = 0; i <= focusMappingLevels; i++) {
MappingType mapping = new MappingType();
mapping.setName(name + "-" + i);
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(UserType.F_NAME));
mapping.getSource().add(source);
VariableBindingDefinitionType target = new VariableBindingDefinitionType();
target.setPath(new ItemPathType(UserType.F_DESCRIPTION));
mapping.setTarget(target);
MappingsType mappings = new MappingsType(prismContext);
mappings.getMapping().add(mapping);
AssignmentType a = new AssignmentType(prismContext);
a.setFocusMappings(mappings);
addAssignmentOrInducement(abstractRole, i, a);
}
// policy rules
for (int i = 0; i <= policyRulesLevels; i++) {
PolicyRuleType rule = new PolicyRuleType(prismContext);
rule.setName(name + "-" + i);
AssignmentType a = new AssignmentType(prismContext);
a.setPolicyRule(rule);
addAssignmentOrInducement(abstractRole, i, a);
}
// authorization
AuthorizationType authorization = new AuthorizationType(prismContext);
authorization.getAction().add(name);
abstractRole.getAuthorization().add(authorization);
// admin gui config
AdminGuiConfigurationType guiConfig = new AdminGuiConfigurationType();
guiConfig.setPreferredDataLanguage(name);
abstractRole.setAdminGuiConfiguration(guiConfig);
return abstractRole;
}
Aggregations