-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DTSAM-183 SSCS Multi-region for CTSC (#1841)
* DTSAM-183 SSCS Multi-region for CTSC [DTSAM-183](https://tools.hmcts.net/jira/browse/DTSAM-183) SSCS CTSC Multi-region for England & Wales. NB: Also updates SSCS Judicial Multi-region for South West & Wales. * DTSAM-183 SSCS Multi-region refactor [DTSAM-183](https://tools.hmcts.net/jira/browse/DTSAM-183) SSCS Multi-region refactor for both CTSC and non-CTSC roles. * DTSAM-183 SSCS FTA change for CTSC regions [DTSAM-183](https://tools.hmcts.net/jira/browse/DTSAM-183) SSCS FTA change for CTSC regions. --------- Co-authored-by: mikebrownccd <104495891+mikebrownccd@users.noreply.github.com>
- Loading branch information
1 parent
8b4638f
commit 75d4825
Showing
9 changed files
with
829 additions
and
205 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
161 changes: 161 additions & 0 deletions
161
src/main/resources/validationrules/sscs/sscs-mulit-region.drl
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,161 @@ | ||
package validationrules.sscs; | ||
|
||
import uk.gov.hmcts.reform.orgrolemapping.domain.model.RoleAssignment; | ||
import uk.gov.hmcts.reform.orgrolemapping.domain.model.enums.RoleCategory; | ||
import uk.gov.hmcts.reform.orgrolemapping.domain.model.enums.FeatureFlagEnum; | ||
import function uk.gov.hmcts.reform.orgrolemapping.domain.service.RequestMappingService.logMsg; | ||
import function uk.gov.hmcts.reform.orgrolemapping.helper.AssignmentRequestBuilder.cloneNewRoleAssignmentAndChangeRegion; | ||
|
||
/* | ||
* SSCS "multi-region" Org role mapping. (non-CTSC) | ||
*/ | ||
|
||
rule "sscs_multi_region_dependency_org_role_wales" | ||
when | ||
$f: FeatureFlag(status && flagName == FeatureFlagEnum.SSCS_WA_1_0.getValue()) | ||
$ra: RoleAssignment(roleCategory != RoleCategory.CTSC, | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() in ("6")) | ||
not RoleAssignment(actorId == $ra.getActorId(), | ||
roleName == $ra.getRoleName(), | ||
roleCategory == $ra.getRoleCategory(), | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() == "7") | ||
then | ||
insert(cloneNewRoleAssignmentAndChangeRegion($ra, "7")); | ||
logMsg("Rule : sscs_multi_region_dependency_org_role_wales"); | ||
end; | ||
|
||
rule "sscs_multi_region_dependency_org_role_southwest" | ||
when | ||
$f: FeatureFlag(status && flagName == FeatureFlagEnum.SSCS_WA_1_0.getValue()) | ||
$ra: RoleAssignment(roleCategory != RoleCategory.CTSC, | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() in ("7")) | ||
not RoleAssignment(actorId == $ra.getActorId(), | ||
roleName == $ra.getRoleName(), | ||
roleCategory == $ra.getRoleCategory(), | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() == "6" ) | ||
then | ||
insert(cloneNewRoleAssignmentAndChangeRegion($ra, "6")); | ||
logMsg("Rule : sscs_multi_region_dependency_org_role_southwest"); | ||
end; | ||
|
||
|
||
|
||
/* | ||
* SSCS "multi-region" Org role mapping. (CTSC only) | ||
*/ | ||
|
||
rule "sscs_multi_region_dependency_org_role__ctsc__region_1" | ||
when | ||
$f: FeatureFlag(status && flagName == FeatureFlagEnum.SSCS_WA_1_0.getValue()) | ||
$ra: RoleAssignment(roleCategory == RoleCategory.CTSC, | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() in ("2","3","4","5","6","7")) | ||
not RoleAssignment(actorId == $ra.getActorId(), | ||
roleName == $ra.getRoleName(), | ||
roleCategory == $ra.getRoleCategory(), | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() == "1") | ||
then | ||
insert(cloneNewRoleAssignmentAndChangeRegion($ra, "1")); | ||
logMsg("Rule : sscs_multi_region_dependency_org_role__ctsc__region_1"); | ||
end; | ||
|
||
rule "sscs_multi_region_dependency_org_role__ctsc__region_2" | ||
when | ||
$f: FeatureFlag(status && flagName == FeatureFlagEnum.SSCS_WA_1_0.getValue()) | ||
$ra: RoleAssignment(roleCategory == RoleCategory.CTSC, | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() in ("1","3","4","5","6","7")) | ||
not RoleAssignment(actorId == $ra.getActorId(), | ||
roleName == $ra.getRoleName(), | ||
roleCategory == $ra.getRoleCategory(), | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() == "2") | ||
then | ||
insert(cloneNewRoleAssignmentAndChangeRegion($ra, "2")); | ||
logMsg("Rule : sscs_multi_region_dependency_org_role__ctsc__region_2"); | ||
end; | ||
|
||
rule "sscs_multi_region_dependency_org_role__ctsc__region_3" | ||
when | ||
$f: FeatureFlag(status && flagName == FeatureFlagEnum.SSCS_WA_1_0.getValue()) | ||
$ra: RoleAssignment(roleCategory == RoleCategory.CTSC, | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() in ("1","2","4","5","6","7")) | ||
not RoleAssignment(actorId == $ra.getActorId(), | ||
roleName == $ra.getRoleName(), | ||
roleCategory == $ra.getRoleCategory(), | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() == "3") | ||
then | ||
insert(cloneNewRoleAssignmentAndChangeRegion($ra, "3")); | ||
logMsg("Rule : sscs_multi_region_dependency_org_role__ctsc__region_3"); | ||
end; | ||
|
||
rule "sscs_multi_region_dependency_org_role__ctsc__region_4" | ||
when | ||
$f: FeatureFlag(status && flagName == FeatureFlagEnum.SSCS_WA_1_0.getValue()) | ||
$ra: RoleAssignment(roleCategory == RoleCategory.CTSC, | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() in ("1","2","3","5","6","7")) | ||
not RoleAssignment(actorId == $ra.getActorId(), | ||
roleName == $ra.getRoleName(), | ||
roleCategory == $ra.getRoleCategory(), | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() == "4") | ||
then | ||
insert(cloneNewRoleAssignmentAndChangeRegion($ra, "4")); | ||
logMsg("Rule : sscs_multi_region_dependency_org_role__ctsc__region_4"); | ||
end; | ||
|
||
rule "sscs_multi_region_dependency_org_role__ctsc__region_5" | ||
when | ||
$f: FeatureFlag(status && flagName == FeatureFlagEnum.SSCS_WA_1_0.getValue()) | ||
$ra: RoleAssignment(roleCategory == RoleCategory.CTSC, | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() in ("1","2","3","4","6","7")) | ||
not RoleAssignment(actorId == $ra.getActorId(), | ||
roleName == $ra.getRoleName(), | ||
roleCategory == $ra.getRoleCategory(), | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() == "5") | ||
then | ||
insert(cloneNewRoleAssignmentAndChangeRegion($ra, "5")); | ||
logMsg("Rule : sscs_multi_region_dependency_org_role__ctsc__region_5"); | ||
end; | ||
|
||
rule "sscs_multi_region_dependency_org_role__ctsc__region_6" | ||
when | ||
$f: FeatureFlag(status && flagName == FeatureFlagEnum.SSCS_WA_1_0.getValue()) | ||
$ra: RoleAssignment(roleCategory == RoleCategory.CTSC, | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() in ("1","2","3","4","5","7")) | ||
not RoleAssignment(actorId == $ra.getActorId(), | ||
roleName == $ra.getRoleName(), | ||
roleCategory == $ra.getRoleCategory(), | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() == "6") | ||
then | ||
insert(cloneNewRoleAssignmentAndChangeRegion($ra, "6")); | ||
logMsg("Rule : sscs_multi_region_dependency_org_role__ctsc__region_6"); | ||
end; | ||
|
||
rule "sscs_multi_region_dependency_org_role__ctsc__region_7" | ||
when | ||
$f: FeatureFlag(status && flagName == FeatureFlagEnum.SSCS_WA_1_0.getValue()) | ||
$ra: RoleAssignment(roleCategory == RoleCategory.CTSC, | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() in ("1","2","3","4","5","6")) | ||
not RoleAssignment(actorId == $ra.getActorId(), | ||
roleName == $ra.getRoleName(), | ||
roleCategory == $ra.getRoleCategory(), | ||
attributes["jurisdiction"] != null && attributes["jurisdiction"].asText() in ("SSCS"), | ||
attributes["region"] != null && attributes["region"].asText() == "7") | ||
then | ||
insert(cloneNewRoleAssignmentAndChangeRegion($ra, "7")); | ||
logMsg("Rule : sscs_multi_region_dependency_org_role__ctsc__region_7"); | ||
end; |
Oops, something went wrong.