CCM NG: Added references from Workflow to the WorkflowTemplate used to create the workflow.
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4293 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
fd6de757f0
commit
cb0a19410e
|
|
@ -39,6 +39,7 @@ import javax.persistence.Inheritance;
|
|||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
|
|
@ -58,6 +59,10 @@ public class Workflow implements Serializable {
|
|||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private long workflowId;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "TEMPLATE_ID")
|
||||
private WorkflowTemplate template;
|
||||
|
||||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
|
|
@ -95,6 +100,14 @@ public class Workflow implements Serializable {
|
|||
public void setWorkflowId(final long workflowId) {
|
||||
this.workflowId = workflowId;
|
||||
}
|
||||
|
||||
public WorkflowTemplate getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
protected void setTemplate(final WorkflowTemplate template) {
|
||||
this.template = template;
|
||||
}
|
||||
|
||||
public LocalizedString getName() {
|
||||
return name;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
-- Adds a foreign key column which references the workflow template used
|
||||
-- to create a workflow
|
||||
|
||||
alter table CCM_CORE.WORKFLOWS
|
||||
add column TEMPLATE_ID int8;
|
||||
|
||||
alter table CCM_CORE.WORKFLOWS
|
||||
add constraint FKol71r1t83h0qe65gglq43far2
|
||||
foreign key (template_id)
|
||||
references CCM_CORE.WORKFLOW_TEMPLATES;
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
-- Adds a foreign key column which references the workflow template used
|
||||
-- to create a workflow
|
||||
|
||||
alter table CCM_CORE.WORKFLOWS
|
||||
add column TEMPLATE_ID bigint;
|
||||
|
||||
alter table CCM_CORE.WORKFLOWS
|
||||
add constraint FKol71r1t83h0qe65gglq43far2
|
||||
foreign key (template_id)
|
||||
references CCM_CORE.WORKFLOW_TEMPLATES;
|
||||
|
|
@ -29,6 +29,7 @@ import org.libreccm.testutils.EqualsVerifier;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -89,12 +90,19 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
|
|||
final User user2 = new TestUser();
|
||||
user2.setName("user2");
|
||||
|
||||
final WorkflowTemplate template1 = new WorkflowTemplate();
|
||||
template1.getName().addValue(Locale.ENGLISH, "Template 1");
|
||||
|
||||
final WorkflowTemplate template2 = new WorkflowTemplate();
|
||||
template1.getName().addValue(Locale.ENGLISH, "Template 2");
|
||||
|
||||
verifier
|
||||
.withPrefabValues(UserTask.class, userTask1, userTask2)
|
||||
.withPrefabValues(Role.class, role1, role2)
|
||||
.withPrefabValues(Task.class, task1, task2)
|
||||
.withPrefabValues(Group.class, group1, group2)
|
||||
.withPrefabValues(User.class, user1, user2);
|
||||
.withPrefabValues(User.class, user1, user2)
|
||||
.withPrefabValues(WorkflowTemplate.class, template1, template2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -580,6 +580,7 @@ CREATE SCHEMA ccm_core;
|
|||
|
||||
create table ccm_core.workflows (
|
||||
workflow_id bigint not null,
|
||||
template_id bigint,
|
||||
primary key (workflow_id)
|
||||
);
|
||||
|
||||
|
|
@ -1080,4 +1081,9 @@ CREATE SCHEMA ccm_core;
|
|||
foreign key (workflow_id)
|
||||
references ccm_core.workflows;
|
||||
|
||||
alter table CCM_CORE.WORKFLOWS
|
||||
add constraint FKol71r1t83h0qe65gglq43far2
|
||||
foreign key (template_id)
|
||||
references CCM_CORE.WORKFLOW_TEMPLATES;
|
||||
|
||||
create sequence hibernate_sequence start with 1 increment by 1;
|
||||
|
|
@ -1123,4 +1123,9 @@ create sequence hibernate_sequence start 1 increment 1;
|
|||
alter table CCM_CORE.WORKFLOW_USER_TASKS
|
||||
add constraint FKefpdf9ojplu7loo31hfm0wl2h
|
||||
foreign key (TASK_ID)
|
||||
references CCM_CORE.WORKFLOW_TASKS;
|
||||
references CCM_CORE.WORKFLOW_TASKS;
|
||||
|
||||
alter table CCM_CORE.WORKFLOWS
|
||||
add constraint FKol71r1t83h0qe65gglq43far2
|
||||
foreign key (template_id)
|
||||
references CCM_CORE.WORKFLOW_TEMPLATES;
|
||||
Loading…
Reference in New Issue