diff --git a/INSTALL.md b/INSTALL.md index c6e65c28b..590124911 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -335,13 +335,16 @@ repository, update its location in your local properties: If you have a previous build deployed already, you can replace the deployment in the UI or add the `--force` switch after `deploy`. -1. Create database schema and initial data. Use the `seed.sql` data to create tables -and `legacy_seed.sql` to create tables for entities that have not yet -been migrated to Hibernate5: +1. Create database schema and initial data. Use `seed.sql` to create tables and + data for the application, `jbpm.sql` to create tables and data for the + embedded jBPM engine, and `legacy_seed.sql` to create tables for entities + that have not yet been migrated to Hibernate5: ```ShellSession - $ psql -h localhost -U psm psm < {/path/to/psm}/psm-app/db/seed.sql - $ psql -h localhost -U psm psm < {/path/to/psm}/psm-app/db/legacy_seed.sql + $ cat {/path/to/psm}/psm-app/db/legacy_seed.sql \ + {/path/to/psm}/psm-app/db/jbpm.sql \ + {/path/to/psm}/psm-app/db/seed.sql \ + | psql -h localhost -U psm psm ``` 1. To check that the app is running, navigate to diff --git a/psm-app/build.gradle b/psm-app/build.gradle index d7efebc3b..c5582b090 100644 --- a/psm-app/build.gradle +++ b/psm-app/build.gradle @@ -11,6 +11,21 @@ buildscript { } } +def jbpm_version = '5.4.0.Final' + +ext.libs = [ + jbpm_human_task_core: dependencies.create("org.jbpm:jbpm-human-task-core:${jbpm_version}") { + exclude group: 'javax.transaction' + exclude group: 'org.apache.cxf' + exclude group: 'org.hibernate.javax.persistence' + }, + jbpm_persistence_jpa: dependencies.create("org.jbpm:jbpm-persistence-jpa:${jbpm_version}") { + exclude group: 'javax.transaction' + exclude group: 'org.hibernate' + exclude group: 'org.hibernate.javax.persistence' + }, +] + allprojects { repositories { mavenCentral() @@ -21,6 +36,7 @@ project(':services') { apply plugin: 'java' dependencies { + compile libs.jbpm_human_task_core compile fileTree(dir: '../cms-portal-services/lib', include: '*.jar', exclude: 'cms-core.jar') compile project(path: ':cms-business-model', configuration: 'archives') compile fileTree(dir: '../../../wildfly-10.1.0.Final/modules/system/layers/base/javax') @@ -44,10 +60,12 @@ project(':cms-business-process') { dependencies { compile project(path: ':services', configuration: 'archives') compile project(path: ':cms-business-model', configuration: 'archives') + compile libs.jbpm_human_task_core compile fileTree(dir: '../cms-portal-services/lib', include: '*.jar', exclude: 'cms-core.jar') compile fileTree(dir: '../../../wildfly-10.1.0.Final/modules/system/layers/base/javax') compile fileTree(dir: '../../../wildfly-10.1.0.Final/modules/system/layers/base/org/hibernate') compile fileTree(dir: '../../../wildfly-10.1.0.Final/modules/system/layers/base/org/codehaus/jackson') + runtime libs.jbpm_persistence_jpa } sourceSets { @@ -114,6 +132,8 @@ project(':cms-portal-services') { deploy project(path: ':cms-web', configuration: 'archives') deploy project(':cms-business-process') earlib fileTree(dir: 'lib') + earlib libs.jbpm_human_task_core + earlib libs.jbpm_persistence_jpa earlib project(path: ':cms-business-model', configuration: 'archives') earlib project(path: ':services', configuration: 'archives') } diff --git a/psm-app/cms-business-process/src/main/java/gov/medicaid/services/impl/LocalHumanTaskHandler.java b/psm-app/cms-business-process/src/main/java/gov/medicaid/services/impl/LocalHumanTaskHandler.java index e3455f80f..a57f2ca34 100644 --- a/psm-app/cms-business-process/src/main/java/gov/medicaid/services/impl/LocalHumanTaskHandler.java +++ b/psm-app/cms-business-process/src/main/java/gov/medicaid/services/impl/LocalHumanTaskHandler.java @@ -4,19 +4,6 @@ package gov.medicaid.services.impl; import gov.medicaid.process.enrollment.GenericHandler; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - import org.drools.runtime.KnowledgeRuntime; import org.drools.runtime.StatefulKnowledgeSession; import org.drools.runtime.process.WorkItem; @@ -34,15 +21,27 @@ import org.jbpm.task.Task; import org.jbpm.task.TaskData; import org.jbpm.task.User; -import org.jbpm.task.event.TaskCompletedEvent; -import org.jbpm.task.event.TaskEvent; import org.jbpm.task.event.TaskEventKey; -import org.jbpm.task.event.TaskFailedEvent; -import org.jbpm.task.event.TaskSkippedEvent; +import org.jbpm.task.event.entity.TaskCompletedEvent; +import org.jbpm.task.event.entity.TaskEvent; +import org.jbpm.task.event.entity.TaskFailedEvent; +import org.jbpm.task.event.entity.TaskSkippedEvent; import org.jbpm.task.service.ContentData; import org.jbpm.task.service.local.LocalTaskService; import org.jbpm.task.service.responsehandlers.AbstractBaseResponseHandler; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + /** * This is a port of org.jbpm.process.workitem.wsht.CommandBasedWSHumanTaskHandler to use local connections. * @@ -152,7 +151,8 @@ public void executeWorkItem(WorkItem workItem, WorkItemManager manager) { task.setTaskData(taskData); ContentData content = saveContent(workItem); - task.setDeadlines(HumanTaskHandlerHelper.setDeadlines(workItem, businessAdministrators)); + task.setDeadlines(HumanTaskHandlerHelper.setDeadlines( + workItem, businessAdministrators, null)); service.addTask(task, content); } diff --git a/psm-app/cms-business-process/src/main/resources/META-INF/persistence.xml b/psm-app/cms-business-process/src/main/resources/META-INF/persistence.xml index 1caefd3d7..7caaefff0 100644 --- a/psm-app/cms-business-process/src/main/resources/META-INF/persistence.xml +++ b/psm-app/cms-business-process/src/main/resources/META-INF/persistence.xml @@ -11,6 +11,7 @@ jdbc/MitaDS jdbc/TaskServiceDS + META-INF/ProcessInstanceInfoMapping-JPA2.xml META-INF/JBPMorm-JPA2.xml META-INF/ormTasks.xml @@ -33,7 +34,6 @@ org.jbpm.task.EmailNotificationHeader org.jbpm.task.PeopleAssignments org.jbpm.task.Reassignment - org.jbpm.task.Status org.jbpm.task.Task org.jbpm.task.TaskData org.jbpm.task.SubTasksStrategy diff --git a/psm-app/cms-portal-services/lib/antlr-2.7.6.jar b/psm-app/cms-portal-services/lib/antlr-2.7.6.jar deleted file mode 100644 index 3702b645f..000000000 Binary files a/psm-app/cms-portal-services/lib/antlr-2.7.6.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/antlr-3.3.jar b/psm-app/cms-portal-services/lib/antlr-3.3.jar deleted file mode 100644 index 42aed1209..000000000 Binary files a/psm-app/cms-portal-services/lib/antlr-3.3.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/antlr-runtime-3.1.3.jar b/psm-app/cms-portal-services/lib/antlr-runtime-3.1.3.jar deleted file mode 100644 index b0a9ea69f..000000000 Binary files a/psm-app/cms-portal-services/lib/antlr-runtime-3.1.3.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/antlr-runtime-3.3.jar b/psm-app/cms-portal-services/lib/antlr-runtime-3.3.jar deleted file mode 100644 index c516cb329..000000000 Binary files a/psm-app/cms-portal-services/lib/antlr-runtime-3.3.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/btm-2.1.2.jar b/psm-app/cms-portal-services/lib/btm-2.1.2.jar deleted file mode 100644 index 78c93fb66..000000000 Binary files a/psm-app/cms-portal-services/lib/btm-2.1.2.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/commons-collections-3.2.1.jar b/psm-app/cms-portal-services/lib/commons-collections-3.2.1.jar deleted file mode 100644 index c35fa1fee..000000000 Binary files a/psm-app/cms-portal-services/lib/commons-collections-3.2.1.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/dom4j-1.6.1.jar b/psm-app/cms-portal-services/lib/dom4j-1.6.1.jar deleted file mode 100644 index c8c4dbb92..000000000 Binary files a/psm-app/cms-portal-services/lib/dom4j-1.6.1.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/drools-compiler-5.4.0.Final.jar b/psm-app/cms-portal-services/lib/drools-compiler-5.4.0.Final.jar deleted file mode 100644 index 75a17559b..000000000 Binary files a/psm-app/cms-portal-services/lib/drools-compiler-5.4.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/drools-core-5.4.0.Final.jar b/psm-app/cms-portal-services/lib/drools-core-5.4.0.Final.jar deleted file mode 100644 index 765ef9a5e..000000000 Binary files a/psm-app/cms-portal-services/lib/drools-core-5.4.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/drools-persistence-jpa-5.4.0.Final.jar b/psm-app/cms-portal-services/lib/drools-persistence-jpa-5.4.0.Final.jar deleted file mode 100644 index 724f67687..000000000 Binary files a/psm-app/cms-portal-services/lib/drools-persistence-jpa-5.4.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/drools-spring-5.3.0.Final.jar b/psm-app/cms-portal-services/lib/drools-spring-5.3.0.Final.jar deleted file mode 100644 index 7307c964f..000000000 Binary files a/psm-app/cms-portal-services/lib/drools-spring-5.3.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/javassist-3.12.1.GA.jar b/psm-app/cms-portal-services/lib/javassist-3.12.1.GA.jar deleted file mode 100644 index aba1783b7..000000000 Binary files a/psm-app/cms-portal-services/lib/javassist-3.12.1.GA.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/jbpm-bam-5.3.0.Final.jar b/psm-app/cms-portal-services/lib/jbpm-bam-5.3.0.Final.jar deleted file mode 100644 index 82bc0c1de..000000000 Binary files a/psm-app/cms-portal-services/lib/jbpm-bam-5.3.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/jbpm-bpmn2-5.3.0.Final.jar b/psm-app/cms-portal-services/lib/jbpm-bpmn2-5.3.0.Final.jar deleted file mode 100644 index 2b26bc5f5..000000000 Binary files a/psm-app/cms-portal-services/lib/jbpm-bpmn2-5.3.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/jbpm-flow-5.3.0.Final.jar b/psm-app/cms-portal-services/lib/jbpm-flow-5.3.0.Final.jar deleted file mode 100644 index 50bc4f4ba..000000000 Binary files a/psm-app/cms-portal-services/lib/jbpm-flow-5.3.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/jbpm-flow-builder-5.3.0.Final.jar b/psm-app/cms-portal-services/lib/jbpm-flow-builder-5.3.0.Final.jar deleted file mode 100644 index 96cbe5ebb..000000000 Binary files a/psm-app/cms-portal-services/lib/jbpm-flow-builder-5.3.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/jbpm-human-task-core-5.3.0.Final-sources.jar b/psm-app/cms-portal-services/lib/jbpm-human-task-core-5.3.0.Final-sources.jar deleted file mode 100644 index 4ae6753ba..000000000 Binary files a/psm-app/cms-portal-services/lib/jbpm-human-task-core-5.3.0.Final-sources.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/jbpm-human-task-core-5.3.0.Final.jar b/psm-app/cms-portal-services/lib/jbpm-human-task-core-5.3.0.Final.jar deleted file mode 100644 index 84320a452..000000000 Binary files a/psm-app/cms-portal-services/lib/jbpm-human-task-core-5.3.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/jbpm-human-task-hornetq-5.3.0.Final.jar b/psm-app/cms-portal-services/lib/jbpm-human-task-hornetq-5.3.0.Final.jar deleted file mode 100644 index 4af66a239..000000000 Binary files a/psm-app/cms-portal-services/lib/jbpm-human-task-hornetq-5.3.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/jbpm-human-task-jms-5.3.0.Final.jar b/psm-app/cms-portal-services/lib/jbpm-human-task-jms-5.3.0.Final.jar deleted file mode 100644 index 971165386..000000000 Binary files a/psm-app/cms-portal-services/lib/jbpm-human-task-jms-5.3.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/jbpm-human-task-mina-5.3.0.Final.jar b/psm-app/cms-portal-services/lib/jbpm-human-task-mina-5.3.0.Final.jar deleted file mode 100644 index f314a491e..000000000 Binary files a/psm-app/cms-portal-services/lib/jbpm-human-task-mina-5.3.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/jbpm-persistence-jpa-5.3.0.Final.jar b/psm-app/cms-portal-services/lib/jbpm-persistence-jpa-5.3.0.Final.jar deleted file mode 100644 index 7a35fd9a6..000000000 Binary files a/psm-app/cms-portal-services/lib/jbpm-persistence-jpa-5.3.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/jbpm-workitems-5.3.0.Final.jar b/psm-app/cms-portal-services/lib/jbpm-workitems-5.3.0.Final.jar deleted file mode 100644 index 817b05270..000000000 Binary files a/psm-app/cms-portal-services/lib/jbpm-workitems-5.3.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/knowledge-api-5.4.0.Final.jar b/psm-app/cms-portal-services/lib/knowledge-api-5.4.0.Final.jar deleted file mode 100644 index b7ae61135..000000000 Binary files a/psm-app/cms-portal-services/lib/knowledge-api-5.4.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/knowledge-internal-api-5.4.0.Final.jar b/psm-app/cms-portal-services/lib/knowledge-internal-api-5.4.0.Final.jar deleted file mode 100644 index 602b4b83f..000000000 Binary files a/psm-app/cms-portal-services/lib/knowledge-internal-api-5.4.0.Final.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/mina-core-2.0.1.jar b/psm-app/cms-portal-services/lib/mina-core-2.0.1.jar deleted file mode 100644 index 8fe47bf17..000000000 Binary files a/psm-app/cms-portal-services/lib/mina-core-2.0.1.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/mvel2-2.1.0.drools16.jar b/psm-app/cms-portal-services/lib/mvel2-2.1.0.drools16.jar deleted file mode 100644 index fd5dced0d..000000000 Binary files a/psm-app/cms-portal-services/lib/mvel2-2.1.0.drools16.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/mvel2-2.1.0.drools2.jar b/psm-app/cms-portal-services/lib/mvel2-2.1.0.drools2.jar deleted file mode 100644 index 0dabf63a3..000000000 Binary files a/psm-app/cms-portal-services/lib/mvel2-2.1.0.drools2.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/protobuf-java-2.4.1.jar b/psm-app/cms-portal-services/lib/protobuf-java-2.4.1.jar deleted file mode 100644 index c8ca83317..000000000 Binary files a/psm-app/cms-portal-services/lib/protobuf-java-2.4.1.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/slf4j-api-1.6.4.jar b/psm-app/cms-portal-services/lib/slf4j-api-1.6.4.jar deleted file mode 100644 index 76ef3050f..000000000 Binary files a/psm-app/cms-portal-services/lib/slf4j-api-1.6.4.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/slf4j-log4j12-1.6.4.jar b/psm-app/cms-portal-services/lib/slf4j-log4j12-1.6.4.jar deleted file mode 100644 index 1517fbd14..000000000 Binary files a/psm-app/cms-portal-services/lib/slf4j-log4j12-1.6.4.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/trove.jar b/psm-app/cms-portal-services/lib/trove.jar deleted file mode 100644 index 119916b1f..000000000 Binary files a/psm-app/cms-portal-services/lib/trove.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/xmlpull.jar b/psm-app/cms-portal-services/lib/xmlpull.jar deleted file mode 100644 index cbc149d0d..000000000 Binary files a/psm-app/cms-portal-services/lib/xmlpull.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/xpp3_min-1.1.4c.jar b/psm-app/cms-portal-services/lib/xpp3_min-1.1.4c.jar deleted file mode 100644 index 813a9a830..000000000 Binary files a/psm-app/cms-portal-services/lib/xpp3_min-1.1.4c.jar and /dev/null differ diff --git a/psm-app/cms-portal-services/lib/xstream.jar b/psm-app/cms-portal-services/lib/xstream.jar deleted file mode 100644 index 8374fa27d..000000000 Binary files a/psm-app/cms-portal-services/lib/xstream.jar and /dev/null differ diff --git a/psm-app/db/README.md b/psm-app/db/README.md index 69457c6d4..cf9001b7f 100644 --- a/psm-app/db/README.md +++ b/psm-app/db/README.md @@ -6,6 +6,10 @@ initial test data. This file sets up the database, inserts static data, and create some default users to get you going +## jbpm.sql +Create the tables and static data needed by the embedded [jBPM +engine](http://www.jbpm.org/). + ## Legacy_seed.sql We are in the process of migrating all of the entities from Hibernate 4 to Hibernate 5, however during the migration we need some of the unmigrated tables configured to perform diff --git a/psm-app/db/jbpm.sql b/psm-app/db/jbpm.sql new file mode 100644 index 000000000..e55ffa9fc --- /dev/null +++ b/psm-app/db/jbpm.sql @@ -0,0 +1,382 @@ +DROP SEQUENCE IF EXISTS + attachment_id_seq, + booleanexpr_id_seq, + comment_id_seq, + content_id_seq, + deadline_id_seq, + emailnotifhead_id_seq, + escalation_id_seq, + i18ntext_id_seq, + notification_id_seq, + reassignment_id_seq, + sessioninfo_id_seq, + workiteminfo_id_seq +CASCADE; + +DROP TABLE IF EXISTS + attachment, + booleanexpression, + content, + deadline, + delegation_delegates, + email_header, + escalation, + eventtypes, + i18ntext, + notification, + notification_bas, + notification_email_header, + notification_recipients, + organizationalentity, + peopleassignments_bas, + peopleassignments_exclowners, + peopleassignments_potowners, + peopleassignments_recipients, + peopleassignments_stakeholders, + processinstanceinfo, + reassignment, + reassignment_potentialowners, + sessioninfo, + subtasksstrategy, + task, + task_comment, + workiteminfo +CASCADE; + +CREATE TABLE organizationalentity ( + id TEXT PRIMARY KEY, + dtype TEXT NOT NULL +); +INSERT INTO organizationalentity (id, dtype) VALUES + ('Administrator', 'User'), + ('Service Administrator', 'Group'), + ('Service Agent', 'Group'), + ('System Administrator', 'Group'); + +CREATE TABLE task ( + id BIGINT PRIMARY KEY, + archived SMALLINT, + allowedtodelegate TEXT, + priority INTEGER NOT NULL, + activationtime TIMESTAMP WITH TIME ZONE, + completedon TIMESTAMP WITH TIME ZONE, + createdon TIMESTAMP WITH TIME ZONE, + documentaccesstype INTEGER, + documentcontentid BIGINT NOT NULL, + documenttype TEXT, + expirationtime TIMESTAMP WITH TIME ZONE, + faultaccesstype INTEGER, + faultcontentid BIGINT NOT NULL, + faultname TEXT, + faulttype TEXT, + outputaccesstype INTEGER, + outputcontentid BIGINT NOT NULL, + outputtype TEXT, + parentid BIGINT NOT NULL, + previousstatus INTEGER, + processid TEXT, + processinstanceid BIGINT NOT NULL, + processsessionid INTEGER NOT NULL, + skipable BOOLEAN NOT NULL, + status TEXT, + workitemid BIGINT NOT NULL, + optlock INTEGER, + taskinitiator_id TEXT + REFERENCES organizationalentity(id), + actualowner_id TEXT + REFERENCES organizationalentity(id), + createdby_id TEXT + REFERENCES organizationalentity(id) +); + +CREATE SEQUENCE attachment_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; +CREATE TABLE attachment ( + id BIGINT PRIMARY KEY, + accesstype INTEGER, + attachedat TIMESTAMP WITH TIME ZONE, + attachmentcontentid BIGINT NOT NULL, + contenttype TEXT, + name TEXT, + attachment_size INTEGER, + attachedby_id TEXT + REFERENCES organizationalentity(id), + taskdata_attachments_id BIGINT + REFERENCES task(id) +); + +CREATE SEQUENCE content_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; +CREATE TABLE content ( + id BIGINT PRIMARY KEY, + content OID +); + +CREATE SEQUENCE deadline_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; +CREATE TABLE deadline ( + id BIGINT PRIMARY KEY, + deadline_date TIMESTAMP WITH TIME ZONE, + escalated SMALLINT, + deadlines_startdeadline_id BIGINT + REFERENCES task(id), + deadlines_enddeadline_id BIGINT + REFERENCES task(id) +); + +CREATE TABLE delegation_delegates ( + task_id BIGINT NOT NULL + REFERENCES task(id), + entity_id TEXT NOT NULL + REFERENCES organizationalentity(id), + PRIMARY KEY (task_id, entity_id) +); + +CREATE SEQUENCE emailnotifhead_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; +CREATE TABLE email_header ( + id BIGINT PRIMARY KEY, + body TEXT, + fromaddress TEXT, + language TEXT, + replytoaddress TEXT, + subject TEXT +); + +CREATE SEQUENCE escalation_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; +CREATE TABLE escalation ( + id BIGINT PRIMARY KEY, + name TEXT, + deadline_escalation_id BIGINT + REFERENCES deadline(id) +); + +CREATE SEQUENCE booleanexpr_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; +CREATE TABLE booleanexpression ( + id BIGINT PRIMARY KEY, + expression TEXT, + type TEXT, + escalation_constraints_id BIGINT + REFERENCES escalation(id) +); + +CREATE SEQUENCE notification_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; +CREATE TABLE notification ( + id BIGINT PRIMARY KEY, + dtype TEXT NOT NULL, + priority INTEGER NOT NULL, + escalation_notifications_id BIGINT + REFERENCES escalation(id) +); + +CREATE SEQUENCE reassignment_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; +CREATE TABLE reassignment ( + id BIGINT PRIMARY KEY, + escalation_reassignments_id BIGINT + REFERENCES escalation(id) +); + +CREATE SEQUENCE i18ntext_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; +CREATE TABLE i18ntext ( + id BIGINT PRIMARY KEY, + language TEXT, + shorttext TEXT, + text TEXT, + task_subjects_id BIGINT + REFERENCES task(id), + task_names_id BIGINT + REFERENCES task(id), + task_descriptions_id BIGINT + REFERENCES task(id), + reassignment_documentation_id BIGINT + REFERENCES reassignment(id), + notification_subjects_id BIGINT + REFERENCES notification(id), + notification_names_id BIGINT + REFERENCES notification(id), + notification_documentation_id BIGINT + REFERENCES notification(id), + notification_descriptions_id BIGINT + REFERENCES notification(id), + deadline_documentation_id BIGINT + REFERENCES deadline(id) +); + +CREATE TABLE notification_bas ( + task_id bigint NOT NULL + REFERENCES notification(id), + entity_id TEXT NOT NULL + REFERENCES organizationalentity(id), + PRIMARY KEY (task_id, entity_id) +); + +CREATE TABLE notification_email_header ( + emailnotification_id bigint NOT NULL + REFERENCES notification(id), + emailheaders_id BIGINT UNIQUE NOT NULL + REFERENCES email_header(id), + mapkey TEXT NOT NULL, + PRIMARY KEY (emailnotification_id, mapkey) +); + +CREATE TABLE notification_recipients ( + task_id BIGINT NOT NULL + REFERENCES notification(id), + entity_id TEXT NOT NULL + REFERENCES organizationalentity(id), + PRIMARY KEY (task_id, entity_id) +); + +CREATE TABLE peopleassignments_bas ( + task_id BIGINT NOT NULL + REFERENCES task(id), + entity_id TEXT NOT NULL + REFERENCES organizationalentity(id), + PRIMARY KEY (task_id, entity_id) +); + +CREATE TABLE peopleassignments_exclowners ( + task_id BIGINT NOT NULL + REFERENCES task(id), + entity_id TEXT NOT NULL + REFERENCES organizationalentity(id), + PRIMARY KEY (task_id, entity_id) +); + +CREATE TABLE peopleassignments_potowners ( + task_id BIGINT NOT NULL + REFERENCES task(id), + entity_id TEXT NOT NULL + REFERENCES organizationalentity(id), + PRIMARY KEY (task_id, entity_id) +); + +CREATE TABLE peopleassignments_recipients ( + task_id BIGINT NOT NULL + REFERENCES task(id), + entity_id TEXT NOT NULL + REFERENCES organizationalentity(id), + PRIMARY KEY (task_id, entity_id) +); + +CREATE TABLE peopleassignments_stakeholders ( + task_id BIGINT NOT NULL + REFERENCES task(id), + entity_id TEXT NOT NULL + REFERENCES organizationalentity(id), + PRIMARY KEY (task_id, entity_id) +); + +CREATE TABLE processinstanceinfo ( + instanceid BIGINT PRIMARY KEY, + id BIGINT, + lastmodificationdate TIMESTAMP WITH TIME ZONE, + lastreaddate TIMESTAMP WITH TIME ZONE, + processid TEXT, + processinstancebytearray OID, + startdate TIMESTAMP WITH TIME ZONE, + state INTEGER NOT NULL, + optlock INTEGER +); + +CREATE TABLE eventtypes ( + instanceid BIGINT NOT NULL + REFERENCES processinstanceinfo(instanceid), + eventtypes TEXT +); + +CREATE TABLE reassignment_potentialowners ( + task_id bigint NOT NULL + REFERENCES reassignment(id), + entity_id TEXT NOT NULL + REFERENCES organizationalentity(id) +); + +CREATE SEQUENCE sessioninfo_id_seq + START WITH 1 + INCREMENT BY 50 + NO MINVALUE + NO MAXVALUE + CACHE 1; +CREATE TABLE sessioninfo ( + id INTEGER PRIMARY KEY, + lastmodificationdate TIMESTAMP WITH TIME ZONE, + rulesbytearray OID, + startdate TIMESTAMP WITH TIME ZONE, + optlock INTEGER +); + +CREATE TABLE subtasksstrategy ( + id bigint PRIMARY KEY, + dtype TEXT NOT NULL, + name TEXT, + task_id bigint + REFERENCES task(id) +); + +CREATE TABLE task_comment ( + id BIGINT PRIMARY KEY, + addedat TIMESTAMP WITH TIME ZONE, + text TEXT, + addedby_id TEXT + REFERENCES organizationalentity(id), + taskdata_comments_id BIGINT + REFERENCES task(id) +); + +CREATE SEQUENCE workiteminfo_id_seq + START WITH 1 + INCREMENT BY 50 + NO MINVALUE + NO MAXVALUE + CACHE 1; +CREATE TABLE workiteminfo ( + workitemid BIGINT PRIMARY KEY, + creationdate TIMESTAMP WITH TIME ZONE, + name TEXT, + processinstanceid BIGINT NOT NULL, + state BIGINT NOT NULL, + optlock INTEGER, + workitembytearray OID +); diff --git a/psm-app/db/legacy_seed.sql b/psm-app/db/legacy_seed.sql index 8321f97ce..113b2b0ea 100644 --- a/psm-app/db/legacy_seed.sql +++ b/psm-app/db/legacy_seed.sql @@ -1,44 +1,8 @@ -DROP SEQUENCE IF EXISTS - attachment_id_seq, - booleanexpr_id_seq, - comment_id_seq, - content_id_seq, - deadline_id_seq, - emailnotifhead_id_seq, - escalation_id_seq, - i18ntext_id_seq, - notification_id_seq, - reassignment_id_seq, - sessioninfo_id_seq, - workiteminfo_id_seq -CASCADE ; - - -DROP TABLE IF EXISTS - attachment, - booleanexpression, - content, - deadline, - delegation_delegates, - email_header, - escalation, +DROP TABLE IF EXISTS event, - eventtypes, external_account_link, external_profile_link, - i18ntext, legacy_mapping, - notification, - notification_bas, - notification_email_header, - notification_recipients, - organizationalentity, - peopleassignments_bas, - peopleassignments_exclowners, - peopleassignments_potowners, - peopleassignments_recipients, - peopleassignments_stakeholders, - processinstanceinfo, profile_assured_ext_svcs, profile_assured_svc_xref, profile_notes, @@ -47,115 +11,9 @@ DROP TABLE IF EXISTS provider_cos_xref, provider_setting, provider_svcs, - reassignment, - reassignment_potentialowners, - required_fld, - sessioninfo, - subtasksstrategy, - task, - task_comment, - workiteminfo + required_fld CASCADE ; - -create sequence attachment_id_seq; -create sequence booleanexpr_id_seq; -create sequence comment_id_seq; -create sequence content_id_seq; -create sequence deadline_id_seq; -create sequence emailnotifhead_id_seq; -create sequence escalation_id_seq; -create sequence i18ntext_id_seq; -create sequence notification_id_seq; -create sequence reassignment_id_seq; -create sequence sessioninfo_id_seq; -create sequence workiteminfo_id_seq; - -create table attachment -( - id bigint not null - constraint attachment_pkey - primary key, - accesstype integer, - attachedat timestamp, - attachmentcontentid bigint not null, - contenttype varchar(255), - name varchar(255), - attachment_size integer, - attachedby_id varchar(255), - taskdata_attachments_id bigint -) -; - -create table booleanexpression -( - id bigint not null - constraint booleanexpression_pkey - primary key, - expression text, - type varchar(255), - escalation_constraints_id bigint -) -; - -create table content -( - id bigint not null - constraint content_pkey - primary key, - content oid -) -; - -create table deadline -( - id bigint not null - constraint deadline_pkey - primary key, - deadline_date timestamp, - escalated smallint, - deadlines_startdeadline_id bigint, - deadlines_enddeadline_id bigint -) -; - -create table delegation_delegates -( - task_id bigint not null, - entity_id varchar(255) not null -) -; - -create table email_header -( - id bigint not null - constraint email_header_pkey - primary key, - body text, - fromaddress varchar(255), - language varchar(255), - replytoaddress varchar(255), - subject varchar(255) -) -; - -create table escalation -( - id bigint not null - constraint escalation_pkey - primary key, - name varchar(255), - deadline_escalation_id bigint - constraint fk37v8ova8ti6jiblda7n6j298e - references deadline -) -; - -alter table booleanexpression - add constraint fkqth56a8k6d8pv6ngsu2vjp4kj - foreign key (escalation_constraints_id) references escalation -; - create table event ( event_id bigint not null @@ -169,13 +27,6 @@ create table event ) ; -create table eventtypes -( - instanceid bigint not null, - eventtypes varchar(255) -) -; - create table external_account_link ( external_account_link_id bigint not null @@ -198,27 +49,6 @@ create table external_profile_link ) ; -create table i18ntext -( - id bigint not null - constraint i18ntext_pkey - primary key, - language varchar(255), - text text, - task_subjects_id bigint, - task_names_id bigint, - task_descriptions_id bigint, - reassignment_documentation_id bigint, - notification_subjects_id bigint, - notification_names_id bigint, - notification_documentation_id bigint, - notification_descriptions_id bigint, - deadline_documentation_id bigint - constraint fk8wn7sw34q6bifsi1pvl2b1yyb - references deadline -) -; - create table legacy_mapping ( legacy_mapping_id bigint not null @@ -231,168 +61,6 @@ create table legacy_mapping ) ; -create table notification -( - dtype varchar(31) not null, - id bigint not null - constraint notification_pkey - primary key, - priority integer not null, - escalation_notifications_id bigint - constraint fkoxq5uqfg4ylwyijsg2ubyflna - references escalation -) -; - -alter table i18ntext - add constraint fkthf8ix3t3opf9hya1s04hwsx8 - foreign key (notification_subjects_id) references notification -; - -alter table i18ntext - add constraint fkg2jsybeuc8pbj8ek8xwxutuyo - foreign key (notification_names_id) references notification -; - -alter table i18ntext - add constraint fkp0m7uhipskrljktvfeubdgfid - foreign key (notification_documentation_id) references notification -; - -alter table i18ntext - add constraint fk6k8hmfvhko069970eghiy2ifp - foreign key (notification_descriptions_id) references notification -; - -create table notification_bas -( - task_id bigint not null - constraint fkb123fgeomc741s9yc014421yy - references notification, - entity_id varchar(255) not null -) -; - -create table notification_email_header -( - emailnotification_id bigint not null - constraint fk1nrqk2dtn3c9ytwxy70t0i73b - references notification, - emailheaders_id bigint not null - constraint uk_ptaka5kost68h7l3wflv7w6y8 - unique - constraint fkd74pdu41avy2f7a8qyp7wn2n - references email_header, - mapkey varchar(255) not null, - constraint notification_email_header_pkey - primary key (emailnotification_id, mapkey) -) -; - -create table notification_recipients -( - task_id bigint not null - constraint fkn7v944d0hw37bh0auv4gr3hsf - references notification, - entity_id varchar(255) not null -) -; - -create table organizationalentity -( - dtype varchar(31) not null, - id varchar(255) not null - constraint organizationalentity_pkey - primary key -) -; - -alter table attachment - add constraint fkd5xpm81gxg8n40167lbu5rbfb - foreign key (attachedby_id) references organizationalentity -; - -alter table delegation_delegates - add constraint fkewkdyi0wrgy9byp6abyglpcxq - foreign key (entity_id) references organizationalentity -; - -alter table notification_bas - add constraint fk378pb1cvjv54w4ljqpw99s3wr - foreign key (entity_id) references organizationalentity -; - -alter table notification_recipients - add constraint fkot769nimyq1jvw0m61pgsq5g3 - foreign key (entity_id) references organizationalentity -; - -create table peopleassignments_bas -( - task_id bigint not null, - entity_id varchar(255) not null - constraint fka90cdfgc4km384n1ataqigq67 - references organizationalentity -) -; - -create table peopleassignments_exclowners -( - task_id bigint not null, - entity_id varchar(255) not null - constraint fk5ituvd6t8uvp63hsx6282xo6h - references organizationalentity -) -; - -create table peopleassignments_potowners -( - task_id bigint not null, - entity_id varchar(255) not null - constraint fksa3rrrjsm1qw98ajbbu2s7cjr - references organizationalentity -) -; - -create table peopleassignments_recipients -( - task_id bigint not null, - entity_id varchar(255) not null - constraint fkrd0h9ud1bhs9waf2mdmiv6j2r - references organizationalentity -) -; - -create table peopleassignments_stakeholders -( - task_id bigint not null, - entity_id varchar(255) not null - constraint fk9uy76cu650rg1nnkrtjwj1e9t - references organizationalentity -) -; - -create table processinstanceinfo -( - instanceid bigint not null - constraint processinstanceinfo_pkey - primary key, - id bigint, - lastmodificationdate date, - lastreaddate date, - processid varchar(255), - processinstancebytearray oid, - startdate date, - state integer not null, - optlock integer -) -; - -alter table eventtypes - add constraint fkj0o3uve2nqo5yrjwrkc9jfttq - foreign key (instanceid) references processinstanceinfo -; - create table profile_assured_ext_svcs ( profile_assured_svc_id bigint not null, @@ -495,33 +163,6 @@ create table provider_svcs ) ; -create table reassignment -( - id bigint not null - constraint reassignment_pkey - primary key, - escalation_reassignments_id bigint - constraint fkessy30safh44b30f1cfoujv2k - references escalation -) -; - -alter table i18ntext - add constraint fkqxgws3fnukyqlaet11tivqg5u - foreign key (reassignment_documentation_id) references reassignment -; - -create table reassignment_potentialowners -( - task_id bigint not null - constraint fkftegfexshix752bh2jfxf6bnh - references reassignment, - entity_id varchar(255) not null - constraint fksqrmpvehlc4qe9i0km22nmkjl - references organizationalentity -) -; - create table required_fld ( code varchar(2) not null @@ -533,169 +174,3 @@ create table required_fld references required_fld ) ; - -create table sessioninfo -( - id integer not null - constraint sessioninfo_pkey - primary key, - lastmodificationdate timestamp, - rulesbytearray oid, - startdate timestamp, - optlock integer -) -; - -create table subtasksstrategy -( - dtype varchar(100) not null, - id bigint not null - constraint subtasksstrategy_pkey - primary key, - name varchar(255), - task_id bigint -) -; - -create table task -( - id bigint not null - constraint task_pkey - primary key, - archived smallint, - allowedtodelegate varchar(255), - priority integer not null, - activationtime timestamp, - createdon timestamp, - documentaccesstype integer, - documentcontentid bigint not null, - documenttype varchar(255), - expirationtime timestamp, - faultaccesstype integer, - faultcontentid bigint not null, - faultname varchar(255), - faulttype varchar(255), - outputaccesstype integer, - outputcontentid bigint not null, - outputtype varchar(255), - parentid bigint not null, - previousstatus integer, - processid varchar(255), - processinstanceid bigint not null, - processsessionid integer not null, - skipable boolean not null, - status varchar(255), - workitemid bigint not null, - optlock integer, - taskinitiator_id varchar(255) - constraint fk48d1bfgwf0jqow1yk8ku4xcpi - references organizationalentity, - actualowner_id varchar(255) - constraint fkpmkxvqq63aed2y2boruu53a0s - references organizationalentity, - createdby_id varchar(255) - constraint fkexuboqnbla7jfyyesyo61ucmb - references organizationalentity -) -; - -alter table attachment - add constraint fkjj9psk52ifamilliyo16epwpc - foreign key (taskdata_attachments_id) references task -; - -alter table deadline - add constraint fk361ggw230po88svgfasg36i2w - foreign key (deadlines_startdeadline_id) references task -; - -alter table deadline - add constraint fkpeiadnoy228t35213t63c3imm - foreign key (deadlines_enddeadline_id) references task -; - -alter table delegation_delegates - add constraint fk85x3trafk3wfbrv719cafr591 - foreign key (task_id) references task -; - -alter table i18ntext - add constraint fkcd6eb4q62d9ab8p0di8pb99ch - foreign key (task_subjects_id) references task -; - -alter table i18ntext - add constraint fkiogka67sji8fk4cp7a369895i - foreign key (task_names_id) references task -; - -alter table i18ntext - add constraint fkrisdlmalotmk64mdeqpo4s5m0 - foreign key (task_descriptions_id) references task -; - -alter table peopleassignments_bas - add constraint fkt4xs0glwhbsa0xwg69r6xduv9 - foreign key (task_id) references task -; - -alter table peopleassignments_exclowners - add constraint fkqxbjm1b3dl7w8w2f2y6sk0fv8 - foreign key (task_id) references task -; - -alter table peopleassignments_potowners - add constraint fkh8oqmk4iuh2pmpgby6g8r3jd1 - foreign key (task_id) references task -; - -alter table peopleassignments_recipients - add constraint fk9gnbv6bplxkxoedj35vg8n7ir - foreign key (task_id) references task -; - -alter table peopleassignments_stakeholders - add constraint fkaeyk4nwslvx0jywjomjq7083i - foreign key (task_id) references task -; - -alter table subtasksstrategy - add constraint fk4e4k7ew5y1u0uvnjdj4wxp4il - foreign key (task_id) references task -; - -create table task_comment -( - id bigint not null - constraint task_comment_pkey - primary key, - addedat timestamp, - text text, - addedby_id varchar(255) - constraint fkqb4mkarf209y9546w7n75lb7a - references organizationalentity, - taskdata_comments_id bigint - constraint fkm2mwc1ukcpdsiqwgkoroy6ise - references task -) -; - -create table workiteminfo -( - workitemid bigint not null - constraint workiteminfo_pkey - primary key, - creationdate timestamp, - name varchar(255), - processinstanceid bigint not null, - state bigint not null, - optlock integer, - workitembytearray oid -) -; - - -insert into OrganizationalEntity (DTYPE, id) values ('Group', 'Service Agent'), -('Group', 'Service Administrator'), -('Group', 'System Administrator'), -('User', 'Administrator');