Skip to content

Commit

Permalink
graceful conversions from outcome URIs to enums (QNameUtil.matchUri i…
Browse files Browse the repository at this point in the history
…nstead of equals)

timed actions available in the schema for certifications
  • Loading branch information
mederly committed Apr 7, 2017
1 parent 631c14b commit 4363f9f
Show file tree
Hide file tree
Showing 10 changed files with 388 additions and 391 deletions.
Expand Up @@ -21,6 +21,7 @@
import com.evolveum.midpoint.prism.query.builder.QueryBuilder;
import com.evolveum.midpoint.prism.xml.XmlTypeConverter;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.util.QNameUtil;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.lang.StringUtils;
Expand All @@ -29,8 +30,6 @@
import java.util.*;
import java.util.stream.Collectors;

import static com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationResponseType.*;

/**
* @author mederly
*/
Expand Down Expand Up @@ -209,9 +208,9 @@ public static float getCasesDecidedPercentage(List<AccessCertificationCaseType>
}
int decided = 0;
for (AccessCertificationCaseType aCase : caseList) {
if (SchemaConstants.MODEL_CERTIFICATION_OUTCOME_ACCEPT.equals(aCase.getOutcome())
|| SchemaConstants.MODEL_CERTIFICATION_OUTCOME_REVOKE.equals(aCase.getOutcome())
|| SchemaConstants.MODEL_CERTIFICATION_OUTCOME_REDUCE.equals(aCase.getOutcome())) {
if (QNameUtil.matchUri(aCase.getOutcome(), SchemaConstants.MODEL_CERTIFICATION_OUTCOME_ACCEPT)
|| QNameUtil.matchUri(aCase.getOutcome(), SchemaConstants.MODEL_CERTIFICATION_OUTCOME_REVOKE)
|| QNameUtil.matchUri(aCase.getOutcome(), SchemaConstants.MODEL_CERTIFICATION_OUTCOME_REDUCE)) {
decided++;
}
}
Expand Down
Expand Up @@ -570,4 +570,352 @@
</xsd:sequence>
</xsd:complexType>

<!-- =================================== TIMED ACTIONS =================================== -->

<xsd:complexType name="WorkItemTimedActionsType">
<xsd:annotation>
<xsd:documentation>
Actions that should be applied to a work item in given moments (relative to work item creation
or work item deadline).
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Name given to this "timed actions" entry.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="displayName" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Display name given to this "timed actions" entry.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="description" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Description of this "timed actions" entry.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="time" type="tns:TimedActionTimeSpecificationType" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
Time(s) at which these actions are to be executed. No time or zero time means they are executed
at the work item deadline.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="actions" type="tns:WorkItemActionsType" minOccurs="1">
<xsd:annotation>
<xsd:documentation>
What actions to execute.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="condition" type="tns:ExpressionType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Should these actions be scheduled?
NOT IMPLEMENTED YET.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="escalationLevelFrom" type="xsd:int" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Apply only if current escalation level is greater or equal to this value.
If both escalationLevelFrom and escalationLevelTo are missing, they are considered both to be 0.
If only escalationLevelFrom is missing, it is considered 0 (i.e. no restriction).
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="escalationLevelTo" type="xsd:int" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Apply only if current escalation level is not greater than this value.
If both escalationLevelFrom and escalationLevelTo are missing, they are considered both to be 0.
If only escalationLevelTo is missing, it is considered "infinity" (i.e. no restriction).
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="WorkItemActionsType">
<xsd:annotation>
<xsd:documentation>
Actions to execute.
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="complete" type="tns:CompleteWorkItemActionType" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>
Complete this work item with a given result.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<!-- TODO maybe also completeStage -->
<xsd:element name="notify" type="tns:WorkItemNotificationActionType" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
Send a notification.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="delegate" type="tns:DelegateWorkItemActionType" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>
Delegate this work item.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="escalate" type="tns:EscalateWorkItemActionType" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>
Escalate this work item. Basically the same as "delegate" but increases the escalation level.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="AbstractWorkItemActionType">
<xsd:annotation>
<xsd:documentation>
TODO
EXPERIMENTAL
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" minOccurs="0"/>
<xsd:element name="displayName" type="xsd:string" minOccurs="0"/>
<xsd:element name="description" type="xsd:string" minOccurs="0"/>
<xsd:element name="condition" type="tns:ExpressionType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Should this action be executed?
NOT IMPLEMENTED YET
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="CompleteWorkItemActionType">
<xsd:annotation>
<xsd:documentation>
TODO
EXPERIMENTAL
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container/>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="tns:AbstractWorkItemActionType">
<xsd:sequence>
<xsd:element name="outcome" type="xsd:anyURI" minOccurs="0" />
<xsd:element name="notifyBeforeAction" type="xsd:duration" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
If specified, sends a standard "action to be executed" notifications at given times.
(Unlike in timed action interval, here a positive time must be specified: just like for
notifyBeforeDeadline in certification.)
TODO other time units, like business days?
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="WorkItemNotificationActionType">
<xsd:annotation>
<xsd:documentation>
TODO
EXPERIMENTAL
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container/>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="tns:AbstractWorkItemActionType">
<xsd:sequence>
<xsd:element name="perAssignee" type="xsd:boolean" minOccurs="0" >
<xsd:annotation>
<xsd:documentation>
If true (the default) creates one notification event for each assignee. Otherwise,
creates a single notification event for the whole work item.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="handler" type="c:EventHandlerType" minOccurs="0" >
<xsd:annotation>
<xsd:documentation>
Ad-hoc event handler that will be used to process these event emitted. In addition to it,
a system-wide handler for workItemCustomEvent will be invoked.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="DelegateWorkItemActionType">
<xsd:annotation>
<xsd:documentation>
TODO
EXPERIMENTAL
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container/>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="tns:AbstractWorkItemActionType">
<xsd:sequence>
<xsd:element name="approverRef" type="c:ObjectReferenceType" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
Specific approver to replace the current one.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="approverExpression" type="c:ExpressionType" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
Expression giving an approver to replace the current one.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="outcomeIfNoApprovers" type="xsd:anyURI" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
What is the outcome (of this work item) if there is no approver to delegate/escalate to?
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="duration" type="xsd:duration" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Duration of the work item after delegation. If not specified, the deadline of the work item
is not changed (this is meaningful only if the delegation occurs before the original deadline).
TODO other time units, like business days?
TODO relative to original start time, original deadline, or current time?
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="delegationMethod" type="tns:WorkItemDelegationMethodType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
How to delegate the work item? Default is "replace assignees".
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="notifyBeforeAction" type="xsd:duration" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
If specified, sends a standard "action to be executed" notifications at given times.
(Unlike in timed action interval, here a positive time must be specified: just like for
notifyBeforeDeadline in certification.)
TODO other time units, like business days?
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="EscalateWorkItemActionType">
<xsd:annotation>
<xsd:documentation>
TODO
EXPERIMENTAL
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container/>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="tns:DelegateWorkItemActionType">
<xsd:sequence>
<xsd:element name="escalationLevelName" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Name for the new escalation level.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="escalationLevelDisplayName" type="xsd:string" minOccurs="0" >
<xsd:annotation>
<xsd:documentation>
Display name for the new escalation level.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:simpleType name="WorkItemDelegationMethodType">
<xsd:annotation>
<xsd:documentation>
How the delegation should be realized.
</xsd:documentation>
<xsd:appinfo>
<jaxb:typesafeEnumClass/>
<a:since>3.6</a:since>
</xsd:appinfo>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="addAssignees">
<xsd:annotation>
<xsd:documentation>
Delegate(s) should be added as new assignees, keeping original assignees and original candidates.
</xsd:documentation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="ADD_ASSIGNEES"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="replaceAssignees">
<xsd:annotation>
<xsd:documentation>
Delegate(s) should replace existing assignee(s). Candidates are removed.
</xsd:documentation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="REPLACE_ASSIGNEES"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<!-- TODO something like "replaceCurrentAssignee" ? -->
</xsd:restriction>
</xsd:simpleType>

</xsd:schema>

0 comments on commit 4363f9f

Please sign in to comment.