Skip to content

Commit

Permalink
HOCS-6741: build changes to remove completed column from db and pojos (
Browse files Browse the repository at this point in the history
  • Loading branch information
vinothon84 authored Sep 20, 2023
1 parent 32d52db commit c0016a8
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ public class AbstractCaseData implements Serializable {
@Column(name = "date_received")
private LocalDate dateReceived;

@Setter
@Getter
@Column(name = "completed")
private boolean completed;

@Setter
@Getter
@Column(name = "date_completed")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ public CaseData(Long id,
LocalDate caseDeadline,
LocalDate caseDeadlineWarning,
LocalDate dateReceived,
boolean completed,
LocalDateTime dateCompleted,
Set<ActiveStage> activeStages,
Set<CaseNote> caseNotes) {
super(id, uuid, created, type, reference, null, deleted, data, primaryTopicUUID, primaryTopic,
primaryCorrespondentUUID, primaryCorrespondent, caseDeadline, caseDeadlineWarning, dateReceived,
completed, dateCompleted,activeStages, caseNotes);
dateCompleted,activeStages, caseNotes);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DROP VIEW IF EXISTS active_case;

CREATE VIEW active_case
(id, uuid, created, type, reference, data, primary_topic_uuid, primary_correspondent_uuid, case_deadline,
date_received, deleted, completed, date_completed, case_deadline_warning, secondary_case_uuid, secondary_case_reference,
date_received, deleted, date_completed, case_deadline_warning, secondary_case_uuid, secondary_case_reference,
secondary_stage_uuid, primary_case_uuid, primary_case_reference, primary_stage_uuid, migrated_reference)
AS
SELECT case_data.id,
Expand All @@ -18,7 +18,6 @@ SELECT case_data.id,
case_data.case_deadline,
case_data.date_received,
case_data.deleted,
case_data.completed,
case_data.date_completed,
case_data.case_deadline_warning,
secondary_case.uuid AS secondary_case_uuid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void create_shouldCreateNewActionForCase() {
new Correspondent(PREVIOUS_CASE_UUID, PREV_CORRESPONDENT_TYPE, PREV_FULLNAME, PREV_ORGANISATION,
new Address(PREV_ADDR_1, PREV_ADDR_2, PREV_ADDR_3, PREV_ADDR_4, PREV_ADDR_5), PREV_TELEPHONE,
PREV_EMAIL, PREV_REFERENCE, PREV_EXTERNAL_KEY), originalCaseDeadline, originalDeadlineWarning,
LocalDate.now().minusDays(10), false, null, Set.of(new ActiveStage(), new ActiveStage()),
LocalDate.now().minusDays(10), null, Set.of(new ActiveStage(), new ActiveStage()),
Set.of(new CaseNote(UUID.randomUUID(), "type", "text", "author")));

CaseTypeActionDto mockCaseTypeActionDto = new CaseTypeActionDto(actionTypeUuid, null, caseType, null,
Expand Down Expand Up @@ -234,7 +234,7 @@ public void update_shouldThrowWhenActionEntityToUpdateNotExist() {
new Correspondent(PREVIOUS_CASE_UUID, PREV_CORRESPONDENT_TYPE, PREV_FULLNAME, PREV_ORGANISATION,
new Address(PREV_ADDR_1, PREV_ADDR_2, PREV_ADDR_3, PREV_ADDR_4, PREV_ADDR_5), PREV_TELEPHONE,
PREV_EMAIL, PREV_REFERENCE, PREV_EXTERNAL_KEY), originalCaseDeadline, originalDeadlineWarning,
LocalDate.now().minusDays(10), false, null, Set.of(new ActiveStage(), new ActiveStage()),
LocalDate.now().minusDays(10), null, Set.of(new ActiveStage(), new ActiveStage()),
Set.of(new CaseNote(UUID.randomUUID(), "type", "text", "author")));

when(mockCaseDataRepository.findActiveByUuid(caseUUID)).thenReturn(caseData);
Expand Down Expand Up @@ -266,7 +266,7 @@ public void update_shouldUpdateExistingActionForCase() {
new Correspondent(PREVIOUS_CASE_UUID, PREV_CORRESPONDENT_TYPE, PREV_FULLNAME, PREV_ORGANISATION,
new Address(PREV_ADDR_1, PREV_ADDR_2, PREV_ADDR_3, PREV_ADDR_4, PREV_ADDR_5), PREV_TELEPHONE,
PREV_EMAIL, PREV_REFERENCE, PREV_EXTERNAL_KEY), originalCaseDeadline, originalDeadlineWarning,
LocalDate.now().minusDays(10), false, null, Set.of(new ActiveStage(), new ActiveStage()),
LocalDate.now().minusDays(10), null, Set.of(new ActiveStage(), new ActiveStage()),
Set.of(new CaseNote(UUID.randomUUID(), "type", "text", "author")));

CaseTypeActionDto mockCaseTypeActionDto = new CaseTypeActionDto(actionTypeUuid, null, caseType, null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void create_shouldSaveExtension() {
new Correspondent(PREVIOUS_CASE_UUID, PREV_CORRESPONDENT_TYPE, PREV_FULLNAME, PREV_ORGANISATION,
new Address(PREV_ADDR_1, PREV_ADDR_2, PREV_ADDR_3, PREV_ADDR_4, PREV_ADDR_5), PREV_TELEPHONE,
PREV_EMAIL, PREV_REFERENCE, PREV_EXTERNAL_KEY), originalCaseDeadline, originalDeadlineWarning,
mockedNow.minusDays(10), false, null, Set.of(new ActiveStage(), new ActiveStage()),
mockedNow.minusDays(10), null, Set.of(new ActiveStage(), new ActiveStage()),
Set.of(new CaseNote(UUID.randomUUID(), "type", "text", "author")));

CaseTypeActionDto mockCaseTypeActionDto = new CaseTypeActionDto(actionTypeUuid, null, caseType, null, null,
Expand Down Expand Up @@ -254,7 +254,7 @@ public void create_shouldAlwaysThrowBadRequestIfSecondWhenMaxConcurrentEventsExc
new Correspondent(PREVIOUS_CASE_UUID, PREV_CORRESPONDENT_TYPE, PREV_FULLNAME, PREV_ORGANISATION,
new Address(PREV_ADDR_1, PREV_ADDR_2, PREV_ADDR_3, PREV_ADDR_4, PREV_ADDR_5), PREV_TELEPHONE,
PREV_EMAIL, PREV_REFERENCE, PREV_EXTERNAL_KEY), originalCaseDeadline, originalDeadlineWarning,
mockedNow.minusDays(10), false, null, Set.of(new ActiveStage(), new ActiveStage()),
mockedNow.minusDays(10), null, Set.of(new ActiveStage(), new ActiveStage()),
Set.of(new CaseNote(UUID.randomUUID(), "type", "text", "author")));

CaseTypeActionDto mockCaseTypeActionDto = new CaseTypeActionDto(actionTypeUuid, null, caseType, null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void create_shouldCreateNewActionForCase() {
new Correspondent(PREVIOUS_CASE_UUID, PREV_CORRESPONDENT_TYPE, PREV_FULLNAME, PREV_ORGANISATION,
new Address(PREV_ADDR_1, PREV_ADDR_2, PREV_ADDR_3, PREV_ADDR_4, PREV_ADDR_5), PREV_TELEPHONE,
PREV_EMAIL, PREV_REFERENCE, PREV_EXTERNAL_KEY), originalCaseDeadline, originalDeadlineWarning,
LocalDate.now().minusDays(10), false, null, Set.of(new ActiveStage(), new ActiveStage()),
LocalDate.now().minusDays(10), null, Set.of(new ActiveStage(), new ActiveStage()),
Set.of(new CaseNote(UUID.randomUUID(), "type", "text", "author")));

CaseTypeActionDto mockCaseTypeActionDto = new CaseTypeActionDto(actionTypeUuid, null, "TEST_EXTERNAL_INTEREST",
Expand Down Expand Up @@ -181,7 +181,7 @@ public void update_shouldUpdateExistingActionForCase() {
new Correspondent(PREVIOUS_CASE_UUID, PREV_CORRESPONDENT_TYPE, PREV_FULLNAME, PREV_ORGANISATION,
new Address(PREV_ADDR_1, PREV_ADDR_2, PREV_ADDR_3, PREV_ADDR_4, PREV_ADDR_5), PREV_TELEPHONE,
PREV_EMAIL, PREV_REFERENCE, PREV_EXTERNAL_KEY), originalCaseDeadline, originalDeadlineWarning,
LocalDate.now().minusDays(10), false, null, Set.of(new ActiveStage(), new ActiveStage()),
LocalDate.now().minusDays(10), null, Set.of(new ActiveStage(), new ActiveStage()),
Set.of(new CaseNote(UUID.randomUUID(), "type", "text", "author")));

CaseTypeActionDto mockCaseTypeActionDto = new CaseTypeActionDto(actionTypeUuid, null, caseType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void setUp() {
EXISTING_CASE = new CaseData(1L, CASE_UUID, LocalDateTime.of(2021, Month.APRIL, 1, 0, 0), CASE_TYPE,
CASE_REFERENCE, false, DATA_CLOB, TOPIC_NAME_UUID, new Topic(CASE_UUID, TOPIC_NAME, TOPIC_NAME_UUID),
primaryCorrespondent.getUuid(), primaryCorrespondent, ORIGINAL_CASE_DEADLINE,
ORIGINAL_CASE_DEADLINE_WARNING, ORIGINAL_CASE_DEADLINE.minusDays(CASE_TYPE_SLA), false, null, activeStages,
ORIGINAL_CASE_DEADLINE_WARNING, ORIGINAL_CASE_DEADLINE.minusDays(CASE_TYPE_SLA), null, activeStages,
Set.of(new CaseNote(CASE_UUID, "type", "text", "author")));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void setup() {
private void setupCaseData(String type) {
CaseData caseData = new CaseData(1L, UUID.randomUUID(), LocalDateTime.now(), type, null, false,
Map.of("TestField", "TestValue"), UUID.randomUUID(), null, UUID.randomUUID(), null, LocalDate.now(),
LocalDate.now(), LocalDate.now(), false, null, Set.of(), Set.of());
LocalDate.now(), LocalDate.now(), null, Set.of(), Set.of());

when(caseDataService.getCaseData(any())).thenReturn(caseData);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ public void testShouldReturnOkWhenMapCaseDataValuesCalled() {
}

private CaseData buildStubCaseData(UUID uuid) {
return new CaseData(null, uuid, null, null, null, false, null, null, null, null, null, null, null, null, false, null, null, null);
return new CaseData(null, uuid, null, null, null, false, null, null, null, null, null, null, null, null, null, null, null);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public void shouldCreateCaseUsingPreviousUUID() throws ApplicationExceptions.Ent
new Correspondent(PREVIOUS_CASE_UUID, PREV_CORRESPONDENT_TYPE, PREV_FULLNAME, PREV_ORGANISATION,
new Address(PREV_ADDR_1, PREV_ADDR_2, PREV_ADDR_3, PREV_ADDR_4, PREV_ADDR_5), PREV_TELEPHONE,
PREV_EMAIL, PREV_REFERENCE, PREV_EXTERNAL_KEY), LocalDate.now(), LocalDate.now(),
LocalDate.now().minusDays(10), false, null, Set.of(new ActiveStage(), new ActiveStage()),
LocalDate.now().minusDays(10), null, Set.of(new ActiveStage(), new ActiveStage()),
Set.of(new CaseNote(UUID.randomUUID(), "type", "text", "author")));

when(caseDataRepository.findActiveByUuid(PREVIOUS_CASE_UUID)).thenReturn(previousCaseData);
Expand Down Expand Up @@ -343,7 +343,7 @@ public void shouldMigrateCase() throws ApplicationExceptions.EntityCreationExcep
new Correspondent(PREVIOUS_CASE_UUID, PREV_CORRESPONDENT_TYPE, PREV_FULLNAME, PREV_ORGANISATION,
new Address(PREV_ADDR_1, PREV_ADDR_2, PREV_ADDR_3, PREV_ADDR_4, PREV_ADDR_5), PREV_TELEPHONE,
PREV_EMAIL, PREV_REFERENCE, PREV_EXTERNAL_KEY), LocalDate.now(), LocalDate.now(), originalReceivedDate,
false, null, Set.of(new ActiveStage(), new ActiveStage()),
null, Set.of(new ActiveStage(), new ActiveStage()),
Set.of(new CaseNote(UUID.randomUUID(), "type", "text", "author")));

when(caseDataRepository.findActiveByUuid(PREVIOUS_CASE_UUID)).thenReturn(previousCaseData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class AbstractCaseCopyStrategyTest {
}

private static final CaseData FROM_CASE = new CaseData(1L, null, null, null, null, false, FROM_CLOB, null, null,
null, null, null, null, null, false, null,null, null);
null, null, null, null, null, null,null, null);

private CaseData toCase;

Expand All @@ -34,7 +34,7 @@ public class AbstractCaseCopyStrategyTest {
public void setUp() {
abstractStrategy = new AbstractCaseCopyStrategy() {};
toCase = new CaseData(2L, null, null, null, null, false, EXISTING_CLOB, null, null, null, null, null, null,
null, false, null, null, null);
null, null, null, null);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class CopyBFToCOMPTest {
COUNTRY).build(), TELEPHONE, EMAIL, REFERENCE, EXTERNAL_KEY);

private static final CaseData FROM_CASE = new CaseData(1L, FROM_CASE_UUID, null, null, "BF/12345678/01", false,
FROM_CLOB, null, null, PRIMARY_CORRESPONDENT.getUuid(), PRIMARY_CORRESPONDENT, null, null, null,false, null, null,
FROM_CLOB, null, null, PRIMARY_CORRESPONDENT.getUuid(), PRIMARY_CORRESPONDENT, null, null, null, null, null,
null);

@Mock
Expand All @@ -83,7 +83,7 @@ public class CopyBFToCOMPTest {
@Before
public void setUp() {
toCase = new CaseData(2L, TO_CASE_UUID, null, null, null, false, new HashMap<>(Map.of()), null, null, null,
null, null, null, null, false, null, null, null);
null, null, null, null, null, null, null);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class CopyBFToSMCTest {
COUNTRY).build(), TELEPHONE, EMAIL, REFERENCE, EXTERNAL_KEY);

private static final CaseData FROM_CASE = new CaseData(1L, FROM_CASE_UUID, null, null, "BF/12345678/01", false,
FROM_CLOB, null, null, PRIMARY_CORRESPONDENT.getUuid(), PRIMARY_CORRESPONDENT, null, null, null, false, null,
FROM_CLOB, null, null, PRIMARY_CORRESPONDENT.getUuid(), PRIMARY_CORRESPONDENT, null, null, null, null,
null, null);

@Mock
Expand All @@ -85,7 +85,7 @@ public class CopyBFToSMCTest {
@Before
public void setUp() {
toCase = new CaseData(2L, TO_CASE_UUID, null, null, "SMC/12345678/01", false, new HashMap<>(), null, null, null,
null, null, null, null, false, null, null, null);
null, null, null, null, null, null, null);

bfToSmc = new CopyBFToSMC(caseDataService, correspondentService, caseDocumentService);
}
Expand Down Expand Up @@ -116,7 +116,7 @@ public void testShouldNotInsertNullValueInCaseDataIfOriginCaseIsAbsent() {
Map<String, String> fromClob = new HashMap<>(Map.of("CaseSummary", "TestValue"));

CaseData oldCase = new CaseData(1L, FROM_CASE_UUID, null, null, "BF/12345678/01", false, fromClob, null, null,
PRIMARY_CORRESPONDENT.getUuid(), PRIMARY_CORRESPONDENT, null, null, null, false, null, null, null);
PRIMARY_CORRESPONDENT.getUuid(), PRIMARY_CORRESPONDENT, null, null, null, null, null, null);

// when
bfToSmc.copyCase(oldCase, toCase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class CopyBfToBf2Test {
COUNTRY).build(), TELEPHONE, EMAIL, REFERENCE, EXTERNAL_KEY);

private static final CaseData FROM_CASE = new CaseData(1L, FROM_CASE_UUID, null, null, "BF/12345678/01", false,
FROM_CLOB, null, null, PRIMARY_CORRESPONDENT.getUuid(), PRIMARY_CORRESPONDENT, null, null, null, false, null,
FROM_CLOB, null, null, PRIMARY_CORRESPONDENT.getUuid(), PRIMARY_CORRESPONDENT, null, null, null, null,
null, null);

@Mock
Expand All @@ -73,7 +73,7 @@ public class CopyBfToBf2Test {
@Before
public void setUp() {
toCase = new CaseData(2L, TO_CASE_UUID, null, null, null, false, new HashMap<>(Map.of()), null, null, UUID.randomUUID(),
null, null, null, null, false, null, null, null);
null, null, null, null, null, null, null);

FROM_CLOB.put("OwningCSU", "csu");
FROM_CLOB.put("ComplainantHORef", "12345678");
Expand Down Expand Up @@ -124,7 +124,7 @@ public void shouldCopyCaseDetailsWithNoCorrespondent() {
var bfToBf2 = new CopyBfToBf2(caseDataService, correspondentService);

toCase = new CaseData(2L, TO_CASE_UUID, null, null, null, false, new HashMap<>(Map.of()), null, null, null,
null, null, null, null, false, null, null, null);
null, null, null, null, null, null, null);

// when
bfToBf2.copyCase(FROM_CASE, toCase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class CopyCompToComp2Test {
COUNTRY).build(), TELEPHONE, EMAIL, REFERENCE, EXTERNAL_KEY);

private static final CaseData FROM_CASE = new CaseData(1L, FROM_CASE_UUID, null, null, null, false, FROM_CLOB, null,
null, PRIMARY_CORRESPONDENT.getUuid(), PRIMARY_CORRESPONDENT, null, null, null, false, null, null, null);
null, PRIMARY_CORRESPONDENT.getUuid(), PRIMARY_CORRESPONDENT, null, null, null, null, null, null);

@Mock
private CaseDataService caseDataService;
Expand All @@ -79,7 +79,7 @@ public class CopyCompToComp2Test {
@Before
public void setUp() {
toCase = new CaseData(2L, TO_CASE_UUID, null, null, null, false, new HashMap<>(Map.of()), null, null, UUID.randomUUID(),
null, null, null, null, false, null, null, null);
null, null, null, null, null, null, null);
}

@Test
Expand Down Expand Up @@ -108,7 +108,7 @@ public void shouldCopyCaseDetailsWithNoCorrespondent() {
var compToComp2 = new CopyCompToComp2(caseDataService, correspondentService);

toCase = new CaseData(2L, TO_CASE_UUID, null, null, null, false, new HashMap<>(Map.of()), null, null, null,
null, null, null, null, false, null, null, null);
null, null, null, null, null, null, null);

// when
compToComp2.copyCase(FROM_CASE, toCase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class CopyPOGRToPOGR2Test {
COUNTRY).build(), TELEPHONE, EMAIL, REFERENCE, EXTERNAL_KEY);

private static final CaseData FROM_CASE = new CaseData(1L, FROM_CASE_UUID, null, null, null, false, FROM_CLOB, null,
null, PRIMARY_CORRESPONDENT.getUuid(), PRIMARY_CORRESPONDENT, null, null, null, false, null, null, null);
null, PRIMARY_CORRESPONDENT.getUuid(), PRIMARY_CORRESPONDENT, null, null, null, null, null, null);

@Mock
private CaseDataService caseDataService;
Expand All @@ -79,7 +79,7 @@ public class CopyPOGRToPOGR2Test {
@Before
public void setUp() {
toCase = new CaseData(2L, TO_CASE_UUID, null, null, null, false, new HashMap<>(Map.of()), null, null,
UUID.randomUUID(), null, null, null, null, false, null, null, null);
UUID.randomUUID(), null, null, null, null, null, null, null);
}

@Test
Expand Down Expand Up @@ -107,7 +107,7 @@ public void shouldCopyCaseDetailsWithNoCorrespondent() {
var pogrToPogr2 = new CopyPOGRtoPOGR2(caseDataService, correspondentService);

toCase = new CaseData(2L, TO_CASE_UUID, null, null, null, false, new HashMap<>(Map.of()), null, null, null,
null, null, null, null, false, null, null, null);
null, null, null, null, null, null, null);

// when
pogrToPogr2.copyCase(FROM_CASE, toCase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void setUp() throws Exception {
EXISTING_CASE = new CaseData(1L, CASE_UUID, LocalDateTime.of(2020, Month.APRIL, 1, 0, 0), CASE_TYPE,
CASE_REFERENCE, false, DATA_CLOB, TOPIC_NAME_UUID, new Topic(CASE_UUID, TOPIC_NAME, TOPIC_NAME_UUID),
primaryCorrespondent.getUuid(), primaryCorrespondent, ORIGINAL_CASE_DEADLINE,
ORIGINAL_CASE_DEADLINE_WARNING, ORIGINAL_CASE_DEADLINE.minusDays(CASE_TYPE_SLA), false, null, activeStages,
ORIGINAL_CASE_DEADLINE_WARNING, ORIGINAL_CASE_DEADLINE.minusDays(CASE_TYPE_SLA), null, activeStages,
Set.of(new CaseNote(CASE_UUID, "type", "text", "author")));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void setUp() {

private CaseData getCaseData(boolean completed) {
return new CaseData(1L, caseUUID, LocalDateTime.now(), "COMP", null, false, data, null, null, null,
null, LocalDate.now(), LocalDate.now(), LocalDate.now().minusDays(10), completed, completed ? originalCompletedDate.atStartOfDay() : null, null, null
null, LocalDate.now(), LocalDate.now(), LocalDate.now().minusDays(10), completed ? originalCompletedDate.atStartOfDay() : null, null, null
);
}

Expand Down

0 comments on commit c0016a8

Please sign in to comment.