Skip to content

Commit

Permalink
A test for multi-stage campaign, plus a couple of fixes.
Browse files Browse the repository at this point in the history
Quite heavy refactoring of existing code.
  • Loading branch information
mederly committed May 27, 2015
1 parent 54b861c commit 54f03c0
Show file tree
Hide file tree
Showing 28 changed files with 3,632 additions and 1,046 deletions.
Expand Up @@ -324,6 +324,18 @@ public static <T> PropertyDelta<T> createModificationReplaceProperty(ItemPath pr
propertyDelta.setValuesToReplace(pValues);
return propertyDelta;
}

public static <T> PropertyDelta<T> createModificationReplaceProperty(ItemPath propertyPath, PrismObjectDefinition<?> objectDefinition,
Collection<T> propertyValues) {
PrismPropertyDefinition propDef = objectDefinition.findPropertyDefinition(propertyPath);
PropertyDelta<T> propertyDelta = new PropertyDelta<T>(propertyPath, propDef, objectDefinition.getPrismContext()); // hoping the prismContext is there
Collection<PrismPropertyValue<T>> pValues = new ArrayList<PrismPropertyValue<T>>(propertyValues.size());
for (T val: propertyValues) {
pValues.add(new PrismPropertyValue<T>(val));
}
propertyDelta.setValuesToReplace(pValues);
return propertyDelta;
}

public static <T> PropertyDelta<T> createModificationReplaceProperty(ItemPath propertyPath, PrismPropertyDefinition propertyDefinition,
T... propertyValues) {
Expand Down
Expand Up @@ -158,6 +158,8 @@ public abstract class SchemaConstants {
public static final String NS_MODEL_WS = NS_MODEL + "/model-3";

public static final String NS_REPORT = NS_MIDPOINT_PUBLIC + "/report";

public static final String NS_CERTIFICATION = NS_MIDPOINT_PUBLIC + "/certification";

public static final String NS_MODEL_CHANNEL = NS_MODEL + "/channels-3";
public static final QName CHANNEL_WEB_SERVICE_QNAME = new QName(NS_MODEL_CHANNEL, "webService");
Expand Down
Expand Up @@ -19,6 +19,8 @@
import com.evolveum.midpoint.prism.PrismReferenceValue;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignStateType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationDecisionType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationDefinitionType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationRemediationStyleType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationStageDefinitionType;
Expand Down Expand Up @@ -49,6 +51,33 @@ public static AccessCertificationStageDefinitionType findStageDefinition(AccessC
throw new IllegalStateException("No stage " + stageNumber + " in " + ObjectTypeUtil.toShortString(campaign));
}

public static AccessCertificationStageType findStage(AccessCertificationCampaignType campaign, int stageNumber) {
for (AccessCertificationStageType stage : campaign.getStage()) {
if (stage.getNumber() == stageNumber) {
return stage;
}
}
throw new IllegalStateException("No stage " + stageNumber + " in " + ObjectTypeUtil.toShortString(campaign));
}

public static AccessCertificationCaseType findCase(AccessCertificationCampaignType campaign, long caseId) {
for (AccessCertificationCaseType _case : campaign.getCase()) {
if (_case.asPrismContainerValue().getId() != null && _case.asPrismContainerValue().getId() == caseId) {
return _case;
}
}
return null;
}

public static AccessCertificationDecisionType findDecision(AccessCertificationCaseType _case, int stageNumber, String reviewerOid) {
for (AccessCertificationDecisionType d : _case.getDecision()) {
if (d.getStageNumber() == stageNumber && d.getReviewerRef().getOid().equals(reviewerOid)) {
return d;
}
}
return null;
}

public static int getNumberOfStages(AccessCertificationCampaignType campaign) {
return campaign.getStageDefinition().size();
}
Expand Down
14 changes: 14 additions & 0 deletions infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd
Expand Up @@ -11321,6 +11321,20 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="useSubjectOwner" type="xsd:boolean" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Indicates that subject (Org, Role) owner(s) should be used as reviewer(s).
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="useSubjectApprover" type="xsd:boolean" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Indicates that subject (Org, Role) approver(s) should be used as reviewer(s).
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="useSubjectManager" type="xsd:boolean" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Expand Down

0 comments on commit 54f03c0

Please sign in to comment.