-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update default case notifier to correlation cases
The notifier was treating all cases as approval ones. This is now fixed, and the approval terminology will not be shown in correlation and manual provisioning cases. Work in progress: the content of notifications is still preliminary. Moreover, the notifier will be - most probably - replaced by a default message template. Related changes: - Renamed WorkflowEvent to CaseManagementEvent. - Renamed WorkflowProcessEvent to CaseEvent. - Introduced wf.caseOid auditing constant (replacing wf.processInstanceId). Unrelated changes: - Renamed NotificationFunctions#getObjectType to getObject.
- Loading branch information
Showing
27 changed files
with
386 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
infra/schema/src/main/java/com/evolveum/midpoint/schema/util/cases/CorrelationCaseUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (C) 2010-2022 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.schema.util.cases; | ||
|
||
import com.evolveum.midpoint.schema.constants.SchemaConstants; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import static com.evolveum.midpoint.util.QNameUtil.uriToQName; | ||
|
||
public class CorrelationCaseUtil { | ||
|
||
public static boolean isNewOwner(@NotNull String outcomeUri) { | ||
return SchemaConstants.CORRELATION_NONE.equals( | ||
getLocalPart(outcomeUri)); | ||
} | ||
|
||
private static String getLocalPart(@NotNull String outcomeUri) { | ||
return uriToQName(outcomeUri, true) | ||
.getLocalPart(); | ||
} | ||
|
||
public static String getExistingOwnerId(@NotNull String outcomeUri) { | ||
String localPart = getLocalPart(outcomeUri); | ||
if (localPart.startsWith(SchemaConstants.CORRELATION_OPTION_PREFIX)) { | ||
return localPart.substring(SchemaConstants.CORRELATION_OPTION_PREFIX.length()); | ||
} else { | ||
return null; | ||
} | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
infra/schema/src/main/java/com/evolveum/midpoint/schema/util/cases/ManualCaseUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (C) 2010-2022 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.schema.util.cases; | ||
|
||
import com.evolveum.midpoint.schema.constants.SchemaConstants; | ||
import com.evolveum.midpoint.schema.result.OperationResultStatus; | ||
import com.evolveum.midpoint.util.QNameUtil; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType; | ||
|
||
public class ManualCaseUtils { | ||
|
||
// TODO | ||
public static OperationResultStatus translateOutcomeToStatus(String outcome) { | ||
if (outcome == null) { | ||
return null; | ||
} | ||
for (OperationResultStatusType statusType : OperationResultStatusType.values()) { | ||
if (outcome.equals(statusType.value())) { | ||
return OperationResultStatus.parseStatusType(statusType); | ||
} | ||
} | ||
// This is a hack... FIXME | ||
if (QNameUtil.matchUri(outcome, SchemaConstants.MODEL_APPROVAL_OUTCOME_APPROVE)) { | ||
return OperationResultStatus.SUCCESS; | ||
} else if (QNameUtil.matchUri(outcome, SchemaConstants.MODEL_APPROVAL_OUTCOME_REJECT)) { | ||
return OperationResultStatus.FATAL_ERROR; | ||
} else if (QNameUtil.matchUri(outcome, SchemaConstants.MODEL_APPROVAL_OUTCOME_SKIP)) { | ||
// Better make this "unknown" than non-applicable. Non-applicable can be misinterpreted. | ||
return OperationResultStatus.UNKNOWN; | ||
} | ||
return OperationResultStatus.UNKNOWN; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
...api/src/main/java/com/evolveum/midpoint/notifications/api/events/CaseManagementEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* Copyright (c) 2020 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.notifications.api.events; | ||
|
||
import com.evolveum.midpoint.notifications.api.OperationStatus; | ||
import com.evolveum.midpoint.prism.delta.ChangeType; | ||
import com.evolveum.midpoint.schema.util.cases.CaseTypeUtil; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ApprovalContextType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.CorrelationContextType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ManualProvisioningContextType; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import static com.evolveum.midpoint.prism.polystring.PolyString.getOrig; | ||
|
||
/** | ||
* Event related to case management: either case-level or work-item-level. | ||
*/ | ||
public interface CaseManagementEvent extends Event { | ||
|
||
@NotNull CaseType getCase(); | ||
|
||
@Deprecated | ||
default String getProcessInstanceName1() { | ||
return getCaseName(); | ||
} | ||
|
||
default String getCaseName() { | ||
return getOrig(getCase().getName()); | ||
} | ||
|
||
OperationStatus getOperationStatus(); | ||
|
||
ChangeType getChangeType(); | ||
|
||
boolean isResultKnown(); | ||
|
||
boolean isApproved(); | ||
|
||
boolean isRejected(); | ||
|
||
@Nullable ApprovalContextType getApprovalContext(); | ||
|
||
default @Nullable ManualProvisioningContextType getManualProvisioningContext() { | ||
return getCase().getManualProvisioningContext(); | ||
} | ||
|
||
default @Nullable CorrelationContextType getCorrelationContext() { | ||
return getCase().getCorrelationContext(); | ||
} | ||
|
||
default boolean doesUseStages() { | ||
return getApprovalContext() != null; | ||
} | ||
|
||
/** Returns true if this event is related to an approval case. */ | ||
default boolean isApproval() { | ||
return CaseTypeUtil.isApprovalCase(getCase()); | ||
} | ||
|
||
@Deprecated | ||
default boolean isApprovalCase() { | ||
return isApproval(); | ||
} | ||
|
||
/** Returns true if this event is related to a manual provisioning case. */ | ||
default boolean isManualProvisioning() { | ||
return CaseTypeUtil.isManualProvisioningCase(getCase()); | ||
} | ||
|
||
@Deprecated | ||
default boolean isManualResourceCase() { | ||
return isManualProvisioning(); | ||
} | ||
|
||
/** Returns true if this event is related to a correlation case. */ | ||
default boolean isCorrelation() { | ||
return CaseTypeUtil.isCorrelationCase(getCase()); | ||
} | ||
} |
44 changes: 0 additions & 44 deletions
44
...tions-api/src/main/java/com/evolveum/midpoint/notifications/api/events/WorkflowEvent.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.