use of com.evolveum.midpoint.prism.delta.PlusMinusZero in project midpoint by Evolveum.
the class PolicyRulesContext method addToPendingAssignmentPolicyStateModifications.
void addToPendingAssignmentPolicyStateModifications(@NotNull AssignmentType assignment, @NotNull PlusMinusZero mode, @NotNull ItemDelta<?, ?> modification) {
AssignmentSpec spec = new AssignmentSpec(assignment, mode);
pendingAssignmentPolicyStateModifications.computeIfAbsent(spec, k -> new ArrayList<>()).add(modification);
}
use of com.evolveum.midpoint.prism.delta.PlusMinusZero in project midpoint by Evolveum.
the class PayloadEvaluation method collectFocusMappings.
private void collectFocusMappings() throws SchemaException {
MappingsType mappingsBean = segment.assignment.getFocusMappings();
if (mappingsBean != null) {
LOGGER.trace("Request evaluation of focus mappings '{}' in {} ({} mappings)", mappingsBean.getDescription(), segment.source, mappingsBean.getMapping().size());
@NotNull AssignmentPathVariables assignmentPathVariables = LensUtil.computeAssignmentPathVariables(ctx.assignmentPath);
for (MappingType mappingBean : mappingsBean.getMapping()) {
PlusMinusZero relativityMode = segment.getRelativeAssignmentRelativityMode();
/* TODO */
if (relativityMode != null) {
AssignedFocusMappingEvaluationRequest request = new AssignedFocusMappingEvaluationRequest(mappingBean, segment.source, ctx.evalAssignment, relativityMode, assignmentPathVariables, segment.sourceDescription);
ctx.evalAssignment.addFocusMappingEvaluationRequest(request);
} else {
// This can occur because overall condition state can be "true,false->false", making relative
// condition state to be false->false.
}
}
}
}
use of com.evolveum.midpoint.prism.delta.PlusMinusZero in project midpoint by Evolveum.
the class AbstractModificationConverter method convert.
public void convert() throws SchemaException {
PropertyDelta<QName> auxiliaryObjectClassDelta = determineAuxilaryObjectClassDelta(changes);
ResourceObjectDefinition structuralObjectClassDefinition = resourceSchema.findDefinitionForObjectClass(objectDefinition.getTypeName());
if (structuralObjectClassDefinition == null) {
throw new SchemaException("No definition of structural object class " + objectDefinition.getTypeName() + " in " + connectorDescription);
}
Map<QName, ResourceObjectDefinition> auxiliaryObjectClassMap = new HashMap<>();
if (auxiliaryObjectClassDelta != null) {
// Auxiliary object class change means modification of __AUXILIARY_OBJECT_CLASS__ attribute
collect(PredefinedAttributes.AUXILIARY_OBJECT_CLASS_NAME, auxiliaryObjectClassDelta, null, (pvals, midPointAttributeName) -> covertAuxiliaryObjectClassValuesToConnId(pvals, midPointAttributeName, auxiliaryObjectClassMap));
}
for (Operation operation : changes) {
if (operation instanceof PropertyModificationOperation) {
PropertyModificationOperation change = (PropertyModificationOperation) operation;
PropertyDelta<?> delta = change.getPropertyDelta();
if (delta.getParentPath().equivalent(ShadowType.F_ATTRIBUTES)) {
if (delta.getDefinition() == null || !(delta.getDefinition() instanceof ResourceAttributeDefinition)) {
ResourceAttributeDefinition def = objectDefinition.findAttributeDefinition(delta.getElementName());
if (def == null) {
String message = "No definition for attribute " + delta.getElementName() + " used in modification delta";
throw new SchemaException(message);
}
try {
delta.applyDefinition(def);
} catch (SchemaException e) {
throw e;
}
}
PlusMinusZero isInModifiedAuxilaryClass = null;
ResourceAttributeDefinition<?> structAttrDef = structuralObjectClassDefinition.findAttributeDefinition(delta.getElementName());
// aux object class, we cannot add/remove it with the object class unless it is normally requested
if (structAttrDef == null) {
if (auxiliaryObjectClassDelta != null && auxiliaryObjectClassDelta.isDelete()) {
// is removed, the attributes must be removed as well.
for (PrismPropertyValue<QName> auxPval : auxiliaryObjectClassDelta.getValuesToDelete()) {
ResourceObjectDefinition auxDef = auxiliaryObjectClassMap.get(auxPval.getValue());
ResourceAttributeDefinition<?> attrDef = auxDef.findAttributeDefinition(delta.getElementName());
if (attrDef != null) {
// means: is in removed auxiliary class
isInModifiedAuxilaryClass = PlusMinusZero.MINUS;
break;
}
}
}
if (auxiliaryObjectClassDelta != null && auxiliaryObjectClassDelta.isAdd()) {
// is added, the attributes must be added as well.
for (PrismPropertyValue<QName> auxPval : auxiliaryObjectClassDelta.getValuesToAdd()) {
ResourceObjectDefinition auxOcDef = auxiliaryObjectClassMap.get(auxPval.getValue());
ResourceAttributeDefinition<?> auxAttrDef = auxOcDef.findAttributeDefinition(delta.getElementName());
if (auxAttrDef != null) {
// means: is in added auxiliary class
isInModifiedAuxilaryClass = PlusMinusZero.PLUS;
break;
}
}
}
}
// Change in (ordinary) attributes. Transform to the ConnId attributes.
String connIdAttrName = connIdNameMapper.convertAttributeNameToConnId(delta, objectDefinition);
collect(connIdAttrName, delta, isInModifiedAuxilaryClass);
} else if (delta.getParentPath().equivalent(ShadowType.F_ACTIVATION)) {
convertFromActivation(delta);
} else if (delta.getParentPath().equivalent(SchemaConstants.PATH_PASSWORD)) {
convertFromPassword((PropertyDelta<ProtectedStringType>) delta);
} else if (delta.getPath().equivalent(ShadowType.F_AUXILIARY_OBJECT_CLASS)) {
// already processed
} else {
throw new SchemaException("Change of unknown attribute " + delta.getPath());
}
} else {
throw new IllegalArgumentException("Unknown operation type " + operation.getClass().getName() + ": " + operation);
}
}
}
use of com.evolveum.midpoint.prism.delta.PlusMinusZero in project midpoint by Evolveum.
the class CombinatorialEvaluation method createDomainsForSets.
private List<Collection<PrismValue>> createDomainsForSets(List<PlusMinusZero> sets) {
List<Collection<PrismValue>> domains = new ArrayList<>();
Iterator<PlusMinusZero> setsIterator = sets.iterator();
for (SourceTriple<?, ?> sourceTriple : sourceTripleList) {
PlusMinusZero set = setsIterator.next();
Collection<PrismValue> domain;
if (set != null) {
// noinspection unchecked
domain = (Collection<PrismValue>) sourceTriple.getSet(set);
} else {
// This is a special value ensuring that the tuple computation will run at least once
// even for empty sources.
domain = Collections.singleton(null);
}
domains.add(domain);
}
return domains;
}
Aggregations