Skip to content

Commit

Permalink
COT-917: Add removed judge and bookable for identified fee-paid judge (
Browse files Browse the repository at this point in the history
…#2155)

* Revert "COT-912 ST_CIC remove booked judge role assignment (#2145)"

This reverts commit 0264ddb.

* Removed requirement for ticket code

* Update DroolStcicJudicialRoleMappingTest.java

Removed variables from test as no longer being used

* Update DroolStcicJudicialRoleMappingTest.java

Removed additional variables as no longer required
  • Loading branch information
ben-james-hmcts authored Nov 8, 2024
1 parent b2fe588 commit 0db17de
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/functionalTest/resources/features/F-012/S-128.td.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"attributes": {
"substantive": "N",
"contractType": "Fee-Paid",
"bookable": "true",
"primaryLocation": "[[ANYTHING_PRESENT]]",
"jurisdiction": "ST_CIC",
"workTypes": "decision_making_work"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,46 @@ then
logMsg("Rule : st_cic_judge_org_role");
end;

/*
* 2.1: ST_CIC "judge" Org role mapping.
* this judge has 'y' under the '... and has a booking? ...' column
* when fee paid judges use the booking service, they are temporarily given judge org role
*/

rule "st_cic_judge_org_role_for_fee_paid_judge"
when
$f: FeatureFlag(status && flagName == FeatureFlagEnum.ST_CIC_WA_1_0.getValue())
$joh: JudicialOfficeHolder(office in ("ST_CIC Tribunal Judge-Fee Paid",
"ST_CIC Judge of the First-tier Tribunal (sitting in retirement)-Fee Paid",
"ST_CIC Chairman-Fee Paid",
"ST_CIC Recorder-Fee Paid",
"ST_CIC Deputy Upper Tribunal Judge-Fee Paid"))
$bk: JudicialBooking(userId == $joh.userId)
then
Map<String,JsonNode> attribute = new HashMap<>();
attribute.put("jurisdiction", JacksonUtils.convertObjectIntoJsonNode("ST_CIC"));
attribute.put("primaryLocation", JacksonUtils.convertObjectIntoJsonNode($bk.getLocationId() != null ?
$bk.getLocationId():$joh.getPrimaryLocation()));
attribute.put("contractType", JacksonUtils.convertObjectIntoJsonNode("Fee-Paid"));
attribute.put("workTypes", JacksonUtils.convertObjectIntoJsonNode("decision_making_work"));
insert(
RoleAssignment.builder()
.actorIdType(ActorIdType.IDAM)
.actorId($joh.getUserId())
.roleCategory(RoleCategory.JUDICIAL)
.roleType(RoleType.ORGANISATION)
.roleName("judge")
.grantType(GrantType.STANDARD)
.classification(Classification.PUBLIC)
.readOnly(false)
.beginTime($bk.getBeginTime())
.endTime($bk.getEndTime())
.attributes(attribute)
.authorisations($joh.getTicketCodes())
.build());
logMsg("Rule : st_cic_judge_org_role_for_fee_paid_judge");
end;

/*
* 3: ST_CIC "case-allocator" Org role mapping.
*/
Expand Down Expand Up @@ -296,6 +336,7 @@ then
attribute.put("primaryLocation", JacksonUtils.convertObjectIntoJsonNode($joh.getPrimaryLocation()));
attribute.put("contractType", JacksonUtils.convertObjectIntoJsonNode("Fee-Paid"));
attribute.put("workTypes", JacksonUtils.convertObjectIntoJsonNode("decision_making_work"));
attribute.put("bookable", JacksonUtils.convertObjectIntoJsonNode("true"));
insert(
RoleAssignment.builder()
.actorIdType(ActorIdType.IDAM)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ static void assertCommonRoleAssignmentAttributes(RoleAssignment r) {
assertEquals(TestDataBuilder.id_2, r.getActorId());
assertEquals(RoleType.ORGANISATION, r.getRoleType());
assertEquals(RoleCategory.JUDICIAL, r.getRoleCategory());
assertNull(r.getAttributes().get("bookable"));
if (r.getRoleName().equals("fee-paid-judge")) {
assertTrue(r.getAttributes().get("bookable").asBoolean());
} else {
assertNull(r.getAttributes().get("bookable"));
}

String primaryLocation = null;
if (r.getAttributes().get("primaryLocation") != null) {
Expand Down Expand Up @@ -137,18 +141,29 @@ void shouldReturnSalariedRoles(String setOffice, String expectedRoles) {
+ "fee-paid-tribunal-member,hmcts-judiciary'",
"ST_CIC Tribunal Member Financially Qualified-Fee Paid,'fee-paid-financial,hmcts-judiciary'"
})
void verifyFeePaidRoles(String setOffice, String expectedRoles) throws IOException {
shouldReturnFeePaidRoles(setOffice, expectedRoles, false, "");
shouldReturnFeePaidRoles(setOffice, expectedRoles, true, "328");
shouldReturnFeePaidRoles(setOffice, expectedRoles, true, "");
void verifyFeePaidRolesWithoutBooking(String setOffice, String expectedRoles) throws IOException {
shouldReturnFeePaidRoles(setOffice, expectedRoles, false);
}

@ParameterizedTest
@CsvSource({
"ST_CIC Tribunal Judge-Fee Paid,'fee-paid-judge,hmcts-judiciary,judge'",
"ST_CIC Judge of the First-tier Tribunal (sitting in retirement)-Fee Paid,'fee-paid-judge,"
+ "hmcts-judiciary,judge'",
"ST_CIC Chairman-Fee Paid,'fee-paid-judge,hmcts-judiciary,judge'",
"ST_CIC Recorder-Fee Paid,'fee-paid-judge,hmcts-judiciary,judge'",
"ST_CIC Deputy Upper Tribunal Judge-Fee Paid,'fee-paid-judge,hmcts-judiciary,judge'"
})
void verifyFeePaidRolesWithBooking(String setOffice, String expectedRoles) throws IOException {
shouldReturnFeePaidRoles(setOffice, expectedRoles, true);
}

void shouldReturnFeePaidRoles(String setOffice, String expectedRoles,
boolean withBooking, String ticketCode) throws IOException {
boolean withBooking) throws IOException {

judicialOfficeHolders.forEach(joh -> {
joh.setOffice(setOffice);
joh.setTicketCodes(List.of(ticketCode));
joh.setTicketCodes(List.of("328"));
});

if (withBooking) {
Expand Down

0 comments on commit 0db17de

Please sign in to comment.