Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Nov 9, 2017
2 parents 530a22e + 0c50970 commit 2d2c391
Show file tree
Hide file tree
Showing 33 changed files with 1,368 additions and 249 deletions.
Expand Up @@ -99,7 +99,7 @@ public ObjectListPanel(String id, Class<? extends O> defaultType, TableId tableI
* @param defaultType specifies type of the object that will be selected by default. It can be changed.
*/
ObjectListPanel(String id, Class<? extends O> defaultType, boolean multiselect, PageBase parentPage) {
this(id, defaultType, null, false, parentPage, null);
this(id, defaultType, null, multiselect, parentPage, null);
}

public ObjectListPanel(String id, Class<? extends O> defaultType, Collection<SelectorOptions<GetOperationOptions>> options,
Expand Down
Expand Up @@ -31,6 +31,8 @@
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CapabilityType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.PagedSearchCapabilityType;
import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;

import org.apache.commons.collections.CollectionUtils;
import org.jetbrains.annotations.NotNull;

import javax.xml.namespace.QName;
Expand Down Expand Up @@ -466,6 +468,14 @@ public Collection<? extends QName> getNamesOfAssociationsWithOutboundExpressions
.map(a -> a.getName())
.collect(Collectors.toCollection(HashSet::new));
}

@Override
public Collection<? extends QName> getNamesOfAssociationsWithInboundExpressions() {
return getAssociationDefinitions().stream()
.filter(assocDef -> CollectionUtils.isNotEmpty(assocDef.getInboundMappingTypes()))
.map(a -> a.getName())
.collect(Collectors.toCollection(HashSet::new));
}

@Override
public ResourceBidirectionalMappingAndDefinitionType getAuxiliaryObjectClassMappings() {
Expand Down Expand Up @@ -698,4 +708,5 @@ public boolean isShared() {
public boolean isReferenceMarker() {
return structuralObjectClassDefinition.isReferenceMarker();
}

}
Expand Up @@ -498,6 +498,11 @@ public <ID extends ItemDefinition> ID findItemDefinition(@NotNull QName name, @N
public Collection<? extends QName> getNamesOfAssociationsWithOutboundExpressions() {
return refinedObjectClassDefinition.getNamesOfAssociationsWithOutboundExpressions();
}

@Override
public Collection<? extends QName> getNamesOfAssociationsWithInboundExpressions() {
return refinedObjectClassDefinition.getNamesOfAssociationsWithOutboundExpressions();
}

@Override
public boolean matches(ShadowType shadowType) {
Expand Down Expand Up @@ -637,4 +642,5 @@ public boolean isShared() {
return true; // ok?
}
}

}
Expand Up @@ -20,18 +20,25 @@
import org.apache.commons.lang.BooleanUtils;

import com.evolveum.midpoint.prism.util.ItemPathUtil;
import com.evolveum.midpoint.schema.util.MiscSchemaUtil;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.xml.ns._public.common.common_3.LayerType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.PropertyLimitationsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectAssociationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType;
import org.jetbrains.annotations.NotNull;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

public class RefinedAssociationDefinition implements Serializable {
private static final long serialVersionUID = 1L;

private Map<LayerType, PropertyLimitations> limitationsMap;

private ResourceObjectAssociationType resourceObjectAssociationType;
private RefinedObjectClassDefinition associationTarget;

Expand Down Expand Up @@ -71,15 +78,41 @@ public QName getAuxiliaryObjectClass() {
public MappingType getOutboundMappingType() {
return resourceObjectAssociationType.getOutbound();
}

public List<MappingType> getInboundMappingTypes() {
return resourceObjectAssociationType.getInbound();
}

public boolean isExclusiveStrong() {
return BooleanUtils.isTrue(resourceObjectAssociationType.isExclusiveStrong());
}

public boolean isIgnored() {
return false; // todo implement!
return false; // todo implement!
}


public boolean isIgnored(LayerType layer) {
RefinedAttributeDefinition<?> assocationAttributeDef = associationTarget.findAttributeDefinition(resourceObjectAssociationType.getAssociationAttribute());
if (assocationAttributeDef == null) {
throw new IllegalStateException("No such attribute :" + resourceObjectAssociationType.getAssociationAttribute()
+ " in kind: " + associationTarget.getKind() + ", intent: " + associationTarget.getIntent()
+ " as defined for association: " + resourceObjectAssociationType.getDisplayName());
}

return assocationAttributeDef.isIgnored(layer);
}

public PropertyLimitations getLimitations(LayerType layer) {
RefinedAttributeDefinition<?> assocationAttributeDef = associationTarget.findAttributeDefinition(resourceObjectAssociationType.getAssociationAttribute());
if (assocationAttributeDef == null) {
throw new IllegalStateException("No such attribute :" + resourceObjectAssociationType.getAssociationAttribute()
+ " in kind: " + associationTarget.getKind() + ", intent: " + associationTarget.getIntent()
+ " as defined for association: " + resourceObjectAssociationType.getDisplayName());
}

return assocationAttributeDef.getLimitations(layer);
}

public boolean isTolerant() {
return BooleanUtils.isNotFalse(resourceObjectAssociationType.isTolerant());
}
Expand Down
Expand Up @@ -106,6 +106,8 @@ default Collection<? extends RefinedAttributeDefinition<?>> getAllIdentifiers()
Collection<QName> getNamesOfAssociations();

Collection<? extends QName> getNamesOfAssociationsWithOutboundExpressions();

Collection<? extends QName> getNamesOfAssociationsWithInboundExpressions();
//endregion

//region General information ========================================================
Expand Down
Expand Up @@ -225,6 +225,15 @@ public Collection<? extends QName> getNamesOfAssociationsWithOutboundExpressions
.map(a -> a.getName())
.collect(Collectors.toCollection(HashSet::new));
}

@Override
public Collection<? extends QName> getNamesOfAssociationsWithInboundExpressions() {
return getAssociationDefinitions().stream()
.filter(assocDef -> CollectionUtils.isNotEmpty(assocDef.getInboundMappingTypes()))
.map(a -> a.getName())
.collect(Collectors.toCollection(HashSet::new));
}

//endregion

//region General information ========================================================
Expand Down Expand Up @@ -995,7 +1004,7 @@ private void parseAttributesFrom(RefinedResourceSchema rSchema, ObjectClassCompl
// well with them. They may also be mandatory. We cannot pretend that they do not exist.

// TODO !!!! fix the cast
RefinedAttributeDefinition<?> rAttrDef = (RefinedAttributeDefinition<?>) RefinedAttributeDefinitionImpl.parse(road, attrDefType, ocDef,
RefinedAttributeDefinition<?> rAttrDef = RefinedAttributeDefinitionImpl.parse(road, attrDefType, ocDef,
rSchema.getPrismContext(), "in "+kind+" type " + intent + ", in " + contextDescription);
if (!auxiliary) {
processIdentifiers(rAttrDef, ocDef);
Expand Down Expand Up @@ -1296,4 +1305,5 @@ public void trimTo(@NotNull Collection<ItemPath> paths) {
public boolean isShared() {
return shared;
}

}
Expand Up @@ -241,8 +241,14 @@ public static <X, V extends PrismValue> boolean containsRealValue(Collection<X>
if (collection == null) {
return false;
}

for (X colVal: collection) {
if (colVal == null) {
return value == null;
}

if (valueExtractor.apply(colVal).equalsRealValue(value)) {

return true;
}
}
Expand Down
Expand Up @@ -235,7 +235,7 @@ public boolean presentInZeroSet(T item) {
return presentInSet(zeroSet, item);
}

private boolean presentInSet(Collection<T> set, T item) {
protected boolean presentInSet(Collection<T> set, T item) {
return set != null && set.contains(item);
}

Expand Down
Expand Up @@ -73,6 +73,11 @@ public <O extends PrismValue> void distributeAs(V myMember, PrismValueDeltaSetTr
minusSet.add(myMember);
}
}

@Override
protected boolean presentInSet(Collection<V> set, V item) {
return set != null && PrismValue.containsRealValue(set, item);
}

public Class<V> getValueClass() {
V anyValue = getAnyValue();
Expand Down
Expand Up @@ -45,6 +45,7 @@ public class ExpressionConstants {
public static final QName VAR_MODEL_CONTEXT = new QName(SchemaConstants.NS_C, "modelContext");
public static final QName VAR_PRISM_CONTEXT = new QName(SchemaConstants.NS_C, "prismContext");
public static final QName VAR_CONFIGURATION = new QName(SchemaConstants.NS_C, "configuration");
public static final QName VAR_ENTITLEMENT = new QName(SchemaConstants.NS_C, "entitlement");

/**
* User that is currently executing the operation.
Expand Down
15 changes: 14 additions & 1 deletion infra/schema/src/main/resources/localization/schema.properties
Expand Up @@ -508,4 +508,17 @@ DefaultPolicyConstraint.Short.situation=Situation constraint matched
PolicyRuleType.policyConstraints=Constraints
AssignmentType.policyRule=Policy rule
ShadowType.attributes=Attributes
ShadowType.association=Associations
ShadowType.association=Associations
MetadataType.requestTimestamt=Requested at
MetadataType.requestorRef=Requester
MetadataType.createTimestamp=Created at
MetadataType.creatorRef=Creator
MetadataType.createApproverRef=Creation approved by
MetadataType.createApprovalTimestamp=Creation approved at
MetadataType.createChannel=Creation channel
MetadataType.modifyTimestamp=Modified at
MetadataType.modifierRef=Modifier
MetadataType.modifyApproverRef=Last modification approved by
MetadataType.modifyApprovalTimestamp=Modify approved at
MetadataType.modifyChannel=Modification channel
MetadataType.lastProvisioningTimestamp=Last provisioning at
Expand Up @@ -770,6 +770,7 @@
</p>
</xsd:documentation>
<xsd:appinfo>
<a:displayName>MetadataType.requestTimestamp</a:displayName>
<a:operational>true</a:operational>
<a:since>3.5</a:since>
</xsd:appinfo>
Expand All @@ -781,6 +782,7 @@
Reference to the user that requested the operation.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>MetadataType.requestorRef</a:displayName>
<a:operational>true</a:operational>
<a:objectReferenceTargetType>tns:UserType</a:objectReferenceTargetType>
</xsd:appinfo>
Expand All @@ -799,6 +801,7 @@
</p>
</xsd:documentation>
<xsd:appinfo>
<a:displayName>MetadataType.createTimestamp</a:displayName>
<a:operational>true</a:operational>
<a:indexed>true</a:indexed>
<a:since>3.5</a:since>
Expand All @@ -811,6 +814,7 @@
Reference to the user that created the data.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>MetadataType.creatorRef</a:displayName>
<a:operational>true</a:operational>
<a:indexed>true</a:indexed>
<a:objectReferenceTargetType>tns:UserType</a:objectReferenceTargetType>
Expand All @@ -825,6 +829,7 @@
hierarchy of the approvers is lost.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>MetadataType.createApproverRef</a:displayName>
<a:operational>true</a:operational>
<a:indexed>true</a:indexed>
<a:objectReferenceTargetType>tns:UserType</a:objectReferenceTargetType>
Expand All @@ -849,6 +854,7 @@
The timestamp of creation approval.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>MetadataType.createApprovalTimestamp</a:displayName>
<a:operational>true</a:operational>
<a:since>3.5</a:since>
</xsd:appinfo>
Expand All @@ -860,6 +866,7 @@
Channel in which the object was created.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>MetadataType.createChannel</a:displayName>
<a:operational>true</a:operational>
<a:indexed>true</a:indexed>
</xsd:appinfo>
Expand All @@ -886,6 +893,7 @@
modify timestamp.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>MetadataType.modifyTimestamp</a:displayName>
<a:operational>true</a:operational>
<a:indexed>true</a:indexed>
</xsd:appinfo>
Expand All @@ -897,6 +905,7 @@
Reference to the user that modified the data.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>MetadataType.modifierRef</a:displayName>
<a:operational>true</a:operational>
<a:indexed>true</a:indexed>
<a:objectReferenceTargetType>tns:UserType</a:objectReferenceTargetType>
Expand All @@ -919,6 +928,7 @@
</p>
</xsd:documentation>
<xsd:appinfo>
<a:displayName>MetadataType.modifyApproverRef</a:displayName>
<a:operational>true</a:operational>
<a:indexed>true</a:indexed>
<a:objectReferenceTargetType>tns:UserType</a:objectReferenceTargetType>
Expand Down Expand Up @@ -948,6 +958,7 @@
The timestamp of last modification approval.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>MetadataType.modifyApprovalTimestamp</a:displayName>
<a:operational>true</a:operational>
<a:since>3.5</a:since>
</xsd:appinfo>
Expand All @@ -959,6 +970,7 @@
Channel in which the object was last modified.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>MetadataType.modifyChannel</a:displayName>
<a:operational>true</a:operational>
<a:indexed>true</a:indexed>
</xsd:appinfo>
Expand Down Expand Up @@ -995,6 +1007,7 @@
</p>
</xsd:documentation>
<xsd:appinfo>
<a:displayName>MetadataType.lastProvisioningTimestamp</a:displayName>
<a:operational>true</a:operational>
<a:since>3.6.1</a:since>
</xsd:appinfo>
Expand Down
Expand Up @@ -1078,6 +1078,8 @@ List<ObjectReferenceType> getMembersAsReferences(String orgOid)
String createAccountActivationLink(UserType userType);

String getConst(String name);

ShadowType resolveEntitlement(ShadowAssociationType shadowAssociationType);

ExtensionType collectExtensions(AssignmentPathType path, int startAt)
throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException,
Expand Down
Expand Up @@ -469,6 +469,7 @@ private <IV extends PrismValue, ID extends ItemDefinition, C extends Containerab
context.setDefaultTargetContext(params.getDefaultTargetContext());
context.setSkipEvaluationMinus(true);
context.setSkipEvaluationPlus(false);
context.setVariableProducer(params.getVariableProducer());
PrismValueDeltaSetTriple<IV> outputTriple = expression.evaluate(context);
LOGGER.trace("output triple: {}", outputTriple.debugDump());
Collection<IV> pvalues = outputTriple.getNonNegativeValues();
Expand Down
Expand Up @@ -15,6 +15,16 @@
*/
package com.evolveum.midpoint.model.common.expression.evaluator;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import javax.xml.namespace.QName;

import com.evolveum.midpoint.prism.Item;
import com.evolveum.midpoint.prism.ItemDefinition;
import com.evolveum.midpoint.prism.PrismPropertyValue;
Expand Down Expand Up @@ -53,10 +63,6 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.TransformExpressionEvaluatorType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.TransformExpressionRelativityModeType;

import javax.xml.namespace.QName;
import java.util.*;
import java.util.Map.Entry;

/**
* @author Radovan Semancik
*/
Expand Down Expand Up @@ -361,6 +367,10 @@ private PrismValueDeltaSetTriple<V> evaluateRelativeExpression(final List<Source
} else if (sourceTriple.presentInMinusSet(pval)) {
hasMinus = true;
}
if (evaluationContext != null && evaluationContext.getVariableProducer() != null) {
LOGGER.trace("$$$$$$$$$variable producer for {}", pval);
evaluationContext.getVariableProducer().produce(pval, variables);
}
}
if (!hasPlus && !hasMinus && !hasZero && !MiscUtil.isAllNull(pvalues)) {
throw new IllegalStateException("Internal error! The impossible has happened! pvalues="+pvalues+"; source triples: "+sourceTriples+"; in "+contextDescription);
Expand Down

0 comments on commit 2d2c391

Please sign in to comment.