Skip to content

Commit

Permalink
Make CaseEventType containerable (experimental)
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Mar 13, 2019
1 parent 21e08dc commit 1652f8e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
Expand Up @@ -585,14 +585,14 @@ public static void computeAssignees(List<ObjectReferenceType> newAssignees, List
public static WorkItemDelegationEventType createDelegationEvent(WorkItemEscalationLevelType newEscalation,
List<ObjectReferenceType> assigneesBefore, List<ObjectReferenceType> delegatedTo,
@NotNull WorkItemDelegationMethodType method,
WorkItemEventCauseInformationType causeInformation) {
WorkItemEventCauseInformationType causeInformation, PrismContext prismContext) {
WorkItemDelegationEventType event;
if (newEscalation != null) {
WorkItemEscalationEventType escEvent = new WorkItemEscalationEventType();
WorkItemEscalationEventType escEvent = new WorkItemEscalationEventType(prismContext);
escEvent.setNewEscalationLevel(newEscalation);
event = escEvent;
} else {
event = new WorkItemDelegationEventType();
event = new WorkItemDelegationEventType(prismContext);
}
event.getAssigneeBefore().addAll(assigneesBefore);
event.getDelegatedTo().addAll(delegatedTo);
Expand Down
Expand Up @@ -420,6 +420,7 @@
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
Expand Down Expand Up @@ -530,6 +531,7 @@
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
Expand Down Expand Up @@ -589,6 +591,7 @@
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
Expand All @@ -607,6 +610,7 @@
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
Expand All @@ -627,6 +631,7 @@
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
Expand All @@ -651,6 +656,7 @@
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
Expand Down Expand Up @@ -710,6 +716,7 @@
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
Expand All @@ -728,6 +735,7 @@
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6</a:since>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
Expand Down
Expand Up @@ -172,7 +172,7 @@ void delegateWorkItems(String campaignOid, List<AccessCertificationWorkItemType>
List<ObjectReferenceType> delegatedTo = new ArrayList<>();
WfContextUtil.computeAssignees(newAssignees, delegatedTo, delegates, method, workItem.getAssigneeRef());
//noinspection ConstantConditions
WorkItemDelegationEventType event = WfContextUtil.createDelegationEvent(null, assigneesBefore, delegatedTo, method, causeInformation);
WorkItemDelegationEventType event = WfContextUtil.createDelegationEvent(null, assigneesBefore, delegatedTo, method, causeInformation, prismContext);
event.setTimestamp(now);
event.setInitiatorRef(initiator);
event.setAttorneyRef(attorney);
Expand Down Expand Up @@ -265,7 +265,7 @@ public void escalateCampaign(String campaignOid, EscalateWorkItemActionType esca
List<ObjectReferenceType> newAssignees = new ArrayList<>();
List<ObjectReferenceType> delegatedTo = new ArrayList<>();
WfContextUtil.computeAssignees(newAssignees, delegatedTo, delegates, method, workItem.getAssigneeRef());
WorkItemDelegationEventType event = WfContextUtil.createDelegationEvent(newEscalationLevel, assigneesBefore, delegatedTo, method, causeInformation);
WorkItemDelegationEventType event = WfContextUtil.createDelegationEvent(newEscalationLevel, assigneesBefore, delegatedTo, method, causeInformation, prismContext);
event.setTimestamp(now);
event.setInitiatorRef(initiator);
event.setAttorneyRef(attorney);
Expand Down
Expand Up @@ -194,7 +194,7 @@ private void createCaseDeltasOnStageClose(AccessCertificationCampaignType campai
.item(F_CASE, caseId, F_CURRENT_STAGE_OUTCOME).replace(newStageOutcomeUri)
.item(F_CASE, caseId, F_OUTCOME).replace(newOverallOutcomeUri)
.item(F_CASE, caseId, F_EVENT).add(
new StageCompletionEventType()
new StageCompletionEventType(prismContext)
.timestamp(clock.currentTimeXMLGregorianCalendar())
.stageNumber(campaign.getStageNumber())
.iteration(campaign.getIteration())
Expand Down
Expand Up @@ -509,7 +509,7 @@ private void onWorkItemClosure(EngineInvocationContext ctx, CaseWorkItemType wor

AbstractWorkItemOutputType output = workItem.getOutput();
if (realClosure || output != null) {
WorkItemCompletionEventType event = new WorkItemCompletionEventType();
WorkItemCompletionEventType event = new WorkItemCompletionEventType(prismContext);
fillInWorkItemEvent(event, user, workItemId, workItem, prismContext);
event.setCause(causeInformation);
event.setOutput(output);
Expand Down Expand Up @@ -732,7 +732,7 @@ public void executeDelegation(WorkItemId workItemId, List<ObjectReferenceType> d
newEscalationInfo = null;
}

WorkItemDelegationEventType event = WfContextUtil.createDelegationEvent(newEscalationInfo, assigneesBefore, delegatedTo, method, causeInformation);
WorkItemDelegationEventType event = WfContextUtil.createDelegationEvent(newEscalationInfo, assigneesBefore, delegatedTo, method, causeInformation, prismContext);
if (newEscalationInfo != null) {
workItemDeltas.add(
prismContext.deltaFor(CaseType.class)
Expand Down Expand Up @@ -901,7 +901,7 @@ private InformationType createInformationType(Object o) {

private void recordAutoCompletionDecision(String taskOid, ApprovalLevelOutcomeType outcome,
AutomatedCompletionReasonType reason, int stageNumber, OperationResult opResult) {
StageCompletionEventType event = new StageCompletionEventType();
StageCompletionEventType event = new StageCompletionEventType(prismContext);
event.setTimestamp(clock.currentTimeXMLGregorianCalendar());
event.setStageNumber(stageNumber);
event.setAutomatedDecisionReason(reason);
Expand Down
Expand Up @@ -87,7 +87,7 @@ public void prepareCommonAttributes(PrimaryChangeAspect aspect, ModelContext<?>

getProcessorSpecificState().setChangeAspect(aspect.getClass().getName());

CaseCreationEventType event = new CaseCreationEventType();
CaseCreationEventType event = new CaseCreationEventType(getPrismContext());
event.setTimestamp(XmlTypeConverter.createXMLGregorianCalendar(new Date()));
if (requester != null) {
event.setInitiatorRef(ObjectTypeUtil.createObjectRef(requester, getPrismContext()));
Expand Down

0 comments on commit 1652f8e

Please sign in to comment.