diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/LDUEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/LDUEntity.java deleted file mode 100644 index 847673ae..00000000 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/LDUEntity.java +++ /dev/null @@ -1,33 +0,0 @@ -package uk.co.bconline.ndelius.model.entity; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; -import java.io.Serializable; - -@Getter -@Entity -@NoArgsConstructor -@AllArgsConstructor -@Table(name = "LOCAL_DELIVERY_UNIT") -public class LDUEntity implements Serializable -{ - @Id - @Column(name = "LOCAL_DELIVERY_UNIT_ID") - @GeneratedValue(generator = "LOCAL_DELIVERY_UNIT_ID_SEQ") - @SequenceGenerator(name = "LOCAL_DELIVERY_UNIT_ID_SEQ", sequenceName = "LOCAL_DELIVERY_UNIT_ID_SEQ", allocationSize = 1) - private Long id; - - @Column(name = "CODE") - private String code; - - @Column(name = "DESCRIPTION") - private String description; -} diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql index da766086..0b3edc4e 100644 --- a/src/main/resources/data.sql +++ b/src/main/resources/data.sql @@ -21,12 +21,15 @@ INSERT INTO PROBATION_AREA(PROBATION_AREA_ID, CODE, DESCRIPTION, ORGANISATION_ID INSERT INTO PROBATION_AREA(PROBATION_AREA_ID, CODE, DESCRIPTION, ORGANISATION_ID, ESTABLISHMENT, SELECTABLE) VALUES (PROBATION_AREA_ID_SEQ.NEXTVAL, 'NWI', 'Norwich (HMP & YOI)', ORGANISATION_ID_SEQ.CURRVAL, 'Y', 'Y'); INSERT INTO PROBATION_AREA(PROBATION_AREA_ID, CODE, DESCRIPTION, ORGANISATION_ID, ESTABLISHMENT, SELECTABLE) VALUES (PROBATION_AREA_ID_SEQ.NEXTVAL, 'PVI', 'Pentonville (HMP)', ORGANISATION_ID_SEQ.CURRVAL, 'Y', 'Y'); --- LDU/PDU +-- Probation Delivery Units INSERT INTO BOROUGH (BOROUGH_ID, CODE, DESCRIPTION, PROBATION_AREA_ID) VALUES (BOROUGH_ID_SEQ.NEXTVAL, 'B1', 'Borough A', (SELECT PROBATION_AREA_ID FROM PROBATION_AREA WHERE CODE='N01')); INSERT INTO BOROUGH (BOROUGH_ID, CODE, DESCRIPTION, PROBATION_AREA_ID) VALUES (BOROUGH_ID_SEQ.NEXTVAL, 'B2', 'Borough B', (SELECT PROBATION_AREA_ID FROM PROBATION_AREA WHERE CODE='N02')); -INSERT INTO LOCAL_DELIVERY_UNIT (LOCAL_DELIVERY_UNIT_ID, CODE, DESCRIPTION) VALUES (LOCAL_DELIVERY_UNIT_ID_SEQ.NEXTVAL, 'LDU1', 'Local Delivery Unit A'); -INSERT INTO LOCAL_DELIVERY_UNIT (LOCAL_DELIVERY_UNIT_ID, CODE, DESCRIPTION) VALUES (LOCAL_DELIVERY_UNIT_ID_SEQ.NEXTVAL, 'LDU2', 'Local Delivery Unit B'); +-- Local Admin Units +INSERT INTO DISTRICT (DISTRICT_ID, CODE, DESCRIPTION, SELECTABLE, BOROUGH_ID) +VALUES (DISTRICT_ID_SEQ.NEXTVAL, 'LAU1', 'Local Admin Unit A', 'Y', (SELECT BOROUGH_ID FROM BOROUGH WHERE CODE = 'B1')); +INSERT INTO DISTRICT (DISTRICT_ID, CODE, DESCRIPTION, SELECTABLE, BOROUGH_ID) +VALUES (DISTRICT_ID_SEQ.NEXTVAL, 'LAU2', 'Local Admin Unit B', 'Y', (SELECT BOROUGH_ID FROM BOROUGH WHERE CODE = 'B2')); -- Sub-contracted Providers INSERT INTO SC_PROVIDER(SC_PROVIDER_ID, CODE, DESCRIPTION, ACTIVE_FLAG, PROVIDER_ID) VALUES (SC_PROVIDER_ID_SEQ.NEXTVAL, 'N01SC1', 'NPS London SC 1', 1, (SELECT PROBATION_AREA_ID FROM PROBATION_AREA WHERE CODE='N01')); @@ -480,6 +483,7 @@ INSERT INTO USER_NOTE (USER_NOTE_ID, ROW_VERSION, USER_ID, LAST_UPDATED_USER_ID, VALUES (USER_NOTE_ID_SEQ.NEXTVAL, 0, (SELECT USER_ID FROM USER_ WHERE DISTINGUISHED_NAME = 'Joe.Bloggs'), (SELECT USER_ID FROM USER_ WHERE DISTINGUISHED_NAME = 'Mavis.Mehler'), CURRENT_TIMESTAMP-9.9, 'Added user management roles, to allow access to UMT.'); INSERT INTO USER_NOTE (USER_NOTE_ID, ROW_VERSION, USER_ID, LAST_UPDATED_USER_ID, LAST_UPDATED_DATETIME, NOTES) VALUES (USER_NOTE_ID_SEQ.NEXTVAL, 0, (SELECT USER_ID FROM USER_ WHERE DISTINGUISHED_NAME = 'Joe.Bloggs'), (SELECT USER_ID FROM USER_ WHERE DISTINGUISHED_NAME = '[Data Maintenance]'), CURRENT_TIMESTAMP-9.9, 'Added user management roles, to allow access to UMT.'); + -- Datasets INSERT INTO PROBATION_AREA_USER (PROBATION_AREA_ID, USER_ID) VALUES ((SELECT PROBATION_AREA_ID FROM PROBATION_AREA WHERE CODE = 'N01'), (SELECT USER_ID FROM USER_ WHERE DISTINGUISHED_NAME = 'test.user')); INSERT INTO PROBATION_AREA_USER (PROBATION_AREA_ID, USER_ID) VALUES ((SELECT PROBATION_AREA_ID FROM PROBATION_AREA WHERE CODE = 'N02'), (SELECT USER_ID FROM USER_ WHERE DISTINGUISHED_NAME = 'test.user')); @@ -490,9 +494,15 @@ INSERT INTO PROBATION_AREA_USER (PROBATION_AREA_ID, USER_ID) VALUES ((SELECT PRO -- Teams INSERT INTO TEAM (TEAM_ID, CODE, DESCRIPTION, PROBATION_AREA_ID, END_DATE) VALUES (TEAM_ID_SEQ.NEXTVAL, 'N01TST', 'Test team (Ended)', (SELECT PROBATION_AREA_ID FROM PROBATION_AREA WHERE CODE = 'N01'), CURRENT_TIMESTAMP); -INSERT INTO TEAM (TEAM_ID, CODE, DESCRIPTION, PROBATION_AREA_ID, DISTRICT_ID) VALUES (TEAM_ID_SEQ.NEXTVAL, 'N01TST', 'Test team', (SELECT PROBATION_AREA_ID FROM PROBATION_AREA WHERE CODE = 'N01'), (SELECT BOROUGH_ID FROM BOROUGH WHERE CODE = 'B2')); -INSERT INTO TEAM (TEAM_ID, CODE, DESCRIPTION, PROBATION_AREA_ID, DISTRICT_ID, LOCAL_DELIVERY_UNIT_ID) VALUES (TEAM_ID_SEQ.NEXTVAL, 'N02TST', 'Other team', (SELECT PROBATION_AREA_ID FROM PROBATION_AREA WHERE CODE = 'N02'), (SELECT BOROUGH_ID FROM BOROUGH WHERE CODE = 'B1'), (SELECT LOCAL_DELIVERY_UNIT_ID FROM LOCAL_DELIVERY_UNIT WHERE CODE = 'LDU1')); -INSERT INTO TEAM (TEAM_ID, CODE, DESCRIPTION, PROBATION_AREA_ID, LOCAL_DELIVERY_UNIT_ID) VALUES (TEAM_ID_SEQ.NEXTVAL, 'N03TST', 'Another', (SELECT PROBATION_AREA_ID FROM PROBATION_AREA WHERE CODE = 'N03'), (SELECT LOCAL_DELIVERY_UNIT_ID FROM LOCAL_DELIVERY_UNIT WHERE CODE = 'LDU1')); +INSERT INTO TEAM (TEAM_ID, CODE, DESCRIPTION, PROBATION_AREA_ID, DISTRICT_ID) +VALUES (TEAM_ID_SEQ.NEXTVAL, 'N01TST', 'Test team', (SELECT PROBATION_AREA_ID FROM PROBATION_AREA WHERE CODE = 'N01'), + (SELECT DISTRICT_ID FROM DISTRICT WHERE CODE = 'LAU2')); +INSERT INTO TEAM (TEAM_ID, CODE, DESCRIPTION, PROBATION_AREA_ID, DISTRICT_ID) +VALUES (TEAM_ID_SEQ.NEXTVAL, 'N02TST', 'Other team', (SELECT PROBATION_AREA_ID FROM PROBATION_AREA WHERE CODE = 'N02'), + (SELECT DISTRICT_ID FROM DISTRICT WHERE CODE = 'LAU1')); +INSERT INTO TEAM (TEAM_ID, CODE, DESCRIPTION, PROBATION_AREA_ID, DISTRICT_ID) +VALUES (TEAM_ID_SEQ.NEXTVAL, 'N03TST', 'Another', (SELECT PROBATION_AREA_ID FROM PROBATION_AREA WHERE CODE = 'N03'), + (SELECT DISTRICT_ID FROM DISTRICT WHERE CODE = 'LAU1')); INSERT INTO STAFF_TEAM (STAFF_ID, TEAM_ID) VALUES ((SELECT STAFF_ID FROM STAFF WHERE OFFICER_CODE = 'N01A001'), (SELECT TEAM_ID FROM TEAM WHERE CODE = 'N01TST' AND END_DATE IS NULL)); INSERT INTO STAFF_TEAM (STAFF_ID, TEAM_ID) VALUES ((SELECT STAFF_ID FROM STAFF WHERE OFFICER_CODE = 'N01A002'), (SELECT TEAM_ID FROM TEAM WHERE CODE = 'N01TST' AND END_DATE IS NULL)); INSERT INTO STAFF_TEAM (STAFF_ID, TEAM_ID) VALUES ((SELECT STAFF_ID FROM STAFF WHERE OFFICER_CODE = 'N01A003'), (SELECT TEAM_ID FROM TEAM WHERE CODE = 'N01TST' AND END_DATE IS NULL));