diff --git a/jbpm-installer/db/upgrade-scripts/oracle/bpms-6.0-to-6.1.sql b/jbpm-installer/db/upgrade-scripts/oracle/bpms-6.0-to-6.1.sql index 8aebfb6bfb..33e8d0ed9e 100644 --- a/jbpm-installer/db/upgrade-scripts/oracle/bpms-6.0-to-6.1.sql +++ b/jbpm-installer/db/upgrade-scripts/oracle/bpms-6.0-to-6.1.sql @@ -56,8 +56,8 @@ update Task t set name = (select shortText from I18NText where Task_Names_Id = t update Task t set subject = (select shortText from I18NText where Task_Subjects_Id = t.id); update Task t set description = (select shortText from I18NText where Task_Descriptions_Id = t.id); -INSERT INTO AuditTaskImpl (activationTime, actualOwner, createdBy, createdOn, deploymentId, description, dueDate, name, parentId, priority, processId, processInstanceId, processSessionId, status, taskId) -SELECT activationTime, actualOwner_id, createdBy_id, createdOn, deploymentId, description, expirationTime, name, parentId, priority,processId, processInstanceId, processSessionId, status, id +INSERT INTO AuditTaskImpl (id, activationTime, actualOwner, createdBy, createdOn, deploymentId, description, dueDate, name, parentId, priority, processId, processInstanceId, processSessionId, status, taskId) +SELECT AUDIT_ID_SEQ.nextval, activationTime, actualOwner_id, createdBy_id, createdOn, deploymentId, description, expirationTime, name, parentId, priority,processId, processInstanceId, processSessionId, status, id FROM Task; alter table TaskEvent add workItemId number(19,0); diff --git a/jbpm-installer/db/upgrade-scripts/oracle/jbpm-6.1-to-6.2.sql b/jbpm-installer/db/upgrade-scripts/oracle/jbpm-6.1-to-6.2.sql index 0a58befb42..b6156cddf8 100644 --- a/jbpm-installer/db/upgrade-scripts/oracle/jbpm-6.1-to-6.2.sql +++ b/jbpm-installer/db/upgrade-scripts/oracle/jbpm-6.1-to-6.2.sql @@ -1,41 +1,41 @@ -alter table SessionInfo modify ( id number(19,0) ); -alter table AuditTaskImpl modify ( processSessionId number(19,0) ); -alter table AuditTaskImpl modify ( activationTime timestamp ); -alter table AuditTaskImpl modify ( createdOn timestamp ); -alter table AuditTaskImpl modify ( dueDate timestamp ); -alter table ContextMappingInfo modify ( KSESSION_ID number(19,0) ); -alter table Task modify ( processSessionId number(19,0) ); - -create table DeploymentStore ( - id number(19,0) not null, - attributes varchar2(255 char), - DEPLOYMENT_ID varchar2(255 char), - deploymentUnit clob, - state number(10,0), - updateDate timestamp, - primary key (id) -); -alter table DeploymentStore add constraint UK_DeploymentStore_1 unique (DEPLOYMENT_ID); -create sequence DEPLOY_STORE_ID_SEQ; - -alter table ProcessInstanceLog add processInstanceDescription varchar2(255 char); -alter table RequestInfo add owner varchar2(255 char); -alter table Task add ( - description varchar2(255 char), - name varchar2(255 char), - subject varchar2(255 char) - ); - --- update all tasks with its name, subject and description -update Task t set name = (select shortText from I18NText where Task_Names_Id = t.id); -update Task t set subject = (select shortText from I18NText where Task_Subjects_Id = t.id); -update Task t set description = (select shortText from I18NText where Task_Descriptions_Id = t.id); - -INSERT INTO AuditTaskImpl (activationTime, actualOwner, createdBy, createdOn, deploymentId, description, dueDate, name, parentId, priority, processId, processInstanceId, processSessionId, status, taskId) -SELECT activationTime, actualOwner_id, createdBy_id, createdOn, deploymentId, description, expirationTime, name, parentId, priority,processId, processInstanceId, processSessionId, status, id -FROM Task; - -alter table TaskEvent add workItemId number(19,0); -alter table TaskEvent add processInstanceId number(19,0); -update TaskEvent t set workItemId = (select workItemId from Task where id = t.taskId); +alter table SessionInfo modify ( id number(19,0) ); +alter table AuditTaskImpl modify ( processSessionId number(19,0) ); +alter table AuditTaskImpl modify ( activationTime timestamp ); +alter table AuditTaskImpl modify ( createdOn timestamp ); +alter table AuditTaskImpl modify ( dueDate timestamp ); +alter table ContextMappingInfo modify ( KSESSION_ID number(19,0) ); +alter table Task modify ( processSessionId number(19,0) ); + +create table DeploymentStore ( + id number(19,0) not null, + attributes varchar2(255 char), + DEPLOYMENT_ID varchar2(255 char), + deploymentUnit clob, + state number(10,0), + updateDate timestamp, + primary key (id) +); +alter table DeploymentStore add constraint UK_DeploymentStore_1 unique (DEPLOYMENT_ID); +create sequence DEPLOY_STORE_ID_SEQ; + +alter table ProcessInstanceLog add processInstanceDescription varchar2(255 char); +alter table RequestInfo add owner varchar2(255 char); +alter table Task add ( + description varchar2(255 char), + name varchar2(255 char), + subject varchar2(255 char) + ); + +-- update all tasks with its name, subject and description +update Task t set name = (select shortText from I18NText where Task_Names_Id = t.id); +update Task t set subject = (select shortText from I18NText where Task_Subjects_Id = t.id); +update Task t set description = (select shortText from I18NText where Task_Descriptions_Id = t.id); + +INSERT INTO AuditTaskImpl (id, activationTime, actualOwner, createdBy, createdOn, deploymentId, description, dueDate, name, parentId, priority, processId, processInstanceId, processSessionId, status, taskId) +SELECT AUDIT_ID_SEQ.nextval, activationTime, actualOwner_id, createdBy_id, createdOn, deploymentId, description, expirationTime, name, parentId, priority,processId, processInstanceId, processSessionId, status, id +FROM Task; + +alter table TaskEvent add workItemId number(19,0); +alter table TaskEvent add processInstanceId number(19,0); +update TaskEvent t set workItemId = (select workItemId from Task where id = t.taskId); update TaskEvent t set processInstanceId = (select processInstanceId from Task where id = t.taskId); \ No newline at end of file diff --git a/jbpm-installer/db/upgrade-scripts/postgresql/bpms-6.0-to-6.1.sql b/jbpm-installer/db/upgrade-scripts/postgresql/bpms-6.0-to-6.1.sql index 727c964d9f..1fff476584 100644 --- a/jbpm-installer/db/upgrade-scripts/postgresql/bpms-6.0-to-6.1.sql +++ b/jbpm-installer/db/upgrade-scripts/postgresql/bpms-6.0-to-6.1.sql @@ -55,8 +55,8 @@ UPDATE Task t SET name = (SELECT shortText FROM I18NText WHERE Task_Names_Id = t UPDATE Task t SET subject = (SELECT shortText FROM I18NText WHERE Task_Subjects_Id = t.id); UPDATE Task t SET description = (SELECT shortText FROM I18NText WHERE Task_Descriptions_Id = t.id); -INSERT INTO AuditTaskImpl (activationTime, actualOwner, createdBy, createdOn, deploymentId, description, dueDate, name, parentId, priority, processId, processInstanceId, processSessionId, status, taskId) -SELECT activationTime, actualOwner_id, createdBy_id, createdOn, deploymentId, description, expirationTime, name, parentId, priority,processId, processInstanceId, processSessionId, status, id +INSERT INTO AuditTaskImpl (id, activationTime, actualOwner, createdBy, createdOn, deploymentId, description, dueDate, name, parentId, priority, processId, processInstanceId, processSessionId, status, taskId) +SELECT nextval('AUDIT_ID_SEQ'), activationTime, actualOwner_id, createdBy_id, createdOn, deploymentId, description, expirationTime, name, parentId, priority,processId, processInstanceId, processSessionId, status, id FROM Task; ALTER TABLE TaskEvent ADD COLUMN workItemId bigint; diff --git a/jbpm-installer/db/upgrade-scripts/postgresql/jbpm-6.1-to-6.2.sql b/jbpm-installer/db/upgrade-scripts/postgresql/jbpm-6.1-to-6.2.sql index 65311be3aa..fd8eaabe40 100644 --- a/jbpm-installer/db/upgrade-scripts/postgresql/jbpm-6.1-to-6.2.sql +++ b/jbpm-installer/db/upgrade-scripts/postgresql/jbpm-6.1-to-6.2.sql @@ -30,8 +30,8 @@ UPDATE Task t SET name = (SELECT shortText FROM I18NText WHERE Task_Names_Id = t UPDATE Task t SET subject = (SELECT shortText FROM I18NText WHERE Task_Subjects_Id = t.id); UPDATE Task t SET description = (SELECT shortText FROM I18NText WHERE Task_Descriptions_Id = t.id); -INSERT INTO AuditTaskImpl (activationTime, actualOwner, createdBy, createdOn, deploymentId, description, dueDate, name, parentId, priority, processId, processInstanceId, processSessionId, status, taskId) -SELECT activationTime, actualOwner_id, createdBy_id, createdOn, deploymentId, description, expirationTime, name, parentId, priority,processId, processInstanceId, processSessionId, status, id +INSERT INTO AuditTaskImpl (id, activationTime, actualOwner, createdBy, createdOn, deploymentId, description, dueDate, name, parentId, priority, processId, processInstanceId, processSessionId, status, taskId) +SELECT nextval('AUDIT_ID_SEQ'), activationTime, actualOwner_id, createdBy_id, createdOn, deploymentId, description, expirationTime, name, parentId, priority,processId, processInstanceId, processSessionId, status, id FROM Task; ALTER TABLE TaskEvent ADD COLUMN workItemId bigint; diff --git a/jbpm-installer/src/test/filtered-resources/META-INF/persistence.xml b/jbpm-installer/src/test/filtered-resources/META-INF/persistence.xml index 751bb9e01b..4a858258d4 100644 --- a/jbpm-installer/src/test/filtered-resources/META-INF/persistence.xml +++ b/jbpm-installer/src/test/filtered-resources/META-INF/persistence.xml @@ -11,6 +11,22 @@ org.jbpm.persistence.scripts.oldentities.ProcessInstanceInfo org.jbpm.persistence.scripts.oldentities.SessionInfo + org.jbpm.persistence.scripts.oldentities.TaskImpl + org.jbpm.services.task.impl.model.AttachmentImpl + org.jbpm.services.task.impl.model.BooleanExpressionImpl + org.jbpm.services.task.impl.model.CommentImpl + org.jbpm.services.task.impl.model.ContentImpl + org.jbpm.services.task.impl.model.DeadlineImpl + org.jbpm.services.task.impl.model.EmailNotificationHeaderImpl + org.jbpm.services.task.impl.model.EmailNotificationImpl + org.jbpm.services.task.impl.model.EscalationImpl + org.jbpm.services.task.impl.model.GroupImpl + org.jbpm.services.task.impl.model.I18NTextImpl + org.jbpm.services.task.impl.model.NotificationImpl + org.jbpm.services.task.impl.model.OrganizationalEntityImpl + org.jbpm.services.task.impl.model.ReassignmentImpl + org.jbpm.services.task.impl.model.TaskDefImpl + org.jbpm.services.task.impl.model.UserImpl true diff --git a/jbpm-installer/src/test/java/org/jbpm/persistence/scripts/TestPersistenceContext.java b/jbpm-installer/src/test/java/org/jbpm/persistence/scripts/TestPersistenceContext.java index c4c2de4c02..3d1e3502d5 100644 --- a/jbpm-installer/src/test/java/org/jbpm/persistence/scripts/TestPersistenceContext.java +++ b/jbpm-installer/src/test/java/org/jbpm/persistence/scripts/TestPersistenceContext.java @@ -8,6 +8,7 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -17,12 +18,12 @@ import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; -import bitronix.tm.resource.jdbc.PoolingDataSource; import org.drools.core.impl.KnowledgeBaseImpl; import org.drools.persistence.jta.JtaTransactionManager; import org.jbpm.persistence.map.impl.ProcessCreatorForHelp; import org.jbpm.persistence.scripts.oldentities.ProcessInstanceInfo; import org.jbpm.persistence.scripts.oldentities.SessionInfo; +import org.jbpm.persistence.scripts.oldentities.TaskImpl; import org.jbpm.persistence.scripts.util.SQLCommandUtil; import org.jbpm.persistence.scripts.util.SQLScriptUtil; import org.jbpm.persistence.scripts.util.TestsUtil; @@ -30,10 +31,19 @@ import org.kie.api.KieBase; import org.kie.api.runtime.Environment; import org.kie.api.runtime.EnvironmentName; +import org.kie.api.task.model.I18NText; +import org.kie.api.task.model.OrganizationalEntity; import org.kie.internal.KnowledgeBase; import org.kie.internal.KnowledgeBaseFactory; import org.kie.internal.persistence.jpa.JPAKnowledgeService; import org.kie.internal.runtime.StatefulKnowledgeSession; +import org.kie.internal.task.api.TaskModelProvider; +import org.kie.internal.task.api.model.InternalI18NText; +import org.kie.internal.task.api.model.InternalOrganizationalEntity; +import org.kie.internal.task.api.model.InternalPeopleAssignments; +import org.kie.internal.task.api.model.InternalTaskData; + +import bitronix.tm.resource.jdbc.PoolingDataSource; /** * Central context that hides persistence from tests, so there is no need to work with persistence in the tests @@ -132,6 +142,47 @@ public void startAndPersistSomeProcess(final String processId) { session = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, environment); session.startProcess(processId); } + + public void createSomeTask() { + testIsInitialized(); + TaskImpl task = new TaskImpl(); + InternalI18NText name = (InternalI18NText) TaskModelProvider.getFactory().newI18NText(); + name.setText("Some Task"); + List names = new ArrayList(); + names.add(name); + task.setNames(names); + InternalTaskData taskData = (InternalTaskData) TaskModelProvider.getFactory().newTaskData(); + taskData.setWorkItemId(12); + taskData.setProcessInstanceId(1); + taskData.setProcessId("someprocess"); + taskData.setDeploymentId("org.jbpm.test:someprocess:1.0"); + taskData.setProcessSessionId(1); + task.setTaskData(taskData); + InternalPeopleAssignments peopleAssignments = + (InternalPeopleAssignments) TaskModelProvider.getFactory().newPeopleAssignments(); + peopleAssignments.setPotentialOwners(new ArrayList()); + peopleAssignments.setBusinessAdministrators(new ArrayList()); + peopleAssignments.setExcludedOwners(new ArrayList()); + peopleAssignments.setRecipients(new ArrayList()); + peopleAssignments.setTaskStakeholders(new ArrayList()); + InternalOrganizationalEntity jdoe = + (InternalOrganizationalEntity) TaskModelProvider.getFactory().newUser(); + jdoe.setId("jdoe"); + peopleAssignments.getPotentialOwners().add(jdoe); + peopleAssignments.getBusinessAdministrators().add(jdoe); + task.setPeopleAssignments(peopleAssignments); + final boolean txOwner = transactionManager.begin(); + try { + EntityManager em = entityManagerFactory.createEntityManager(); + em.persist(jdoe); + em.persist(task); + transactionManager.commit(txOwner); + } catch (Exception ex) { + ex.printStackTrace(); + transactionManager.rollback(txOwner); + throw new RuntimeException(ex.getMessage(), ex); + } + } /** * Loads persisted session from database. diff --git a/jbpm-installer/src/test/java/org/jbpm/persistence/scripts/UpgradeScriptsTest.java b/jbpm-installer/src/test/java/org/jbpm/persistence/scripts/UpgradeScriptsTest.java index d1a5090d50..7c0efe1745 100644 --- a/jbpm-installer/src/test/java/org/jbpm/persistence/scripts/UpgradeScriptsTest.java +++ b/jbpm-installer/src/test/java/org/jbpm/persistence/scripts/UpgradeScriptsTest.java @@ -78,6 +78,7 @@ public void testPersistedProcess(String type) throws IOException, ParseException // Prepare 6.0. schema scriptRunnerContext.executeScripts(new File(getClass().getResource("/ddl60").getFile())); scriptRunnerContext.persistOldProcessAndSession(TEST_SESSION_ID, TEST_PROCESS_ID, TEST_PROCESS_INSTANCE_ID); + scriptRunnerContext.createSomeTask(); // Execute upgrade scripts. scriptRunnerContext.executeScripts(new File(getClass().getResource("/upgrade-scripts").getFile()), type); } finally { diff --git a/jbpm-installer/src/test/java/org/jbpm/persistence/scripts/oldentities/TaskImpl.java b/jbpm-installer/src/test/java/org/jbpm/persistence/scripts/oldentities/TaskImpl.java new file mode 100644 index 0000000000..6e22d362d1 --- /dev/null +++ b/jbpm-installer/src/test/java/org/jbpm/persistence/scripts/oldentities/TaskImpl.java @@ -0,0 +1,369 @@ +package org.jbpm.persistence.scripts.oldentities; + +/** + * Copyright 2010 JBoss Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.util.Collections; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Embedded; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Version; + +import org.jbpm.services.task.impl.model.DeadlinesImpl; +import org.jbpm.services.task.impl.model.DelegationImpl; +import org.jbpm.services.task.impl.model.I18NTextImpl; +import org.jbpm.services.task.impl.model.PeopleAssignmentsImpl; +import org.jbpm.services.task.impl.model.TaskDataImpl; +import org.jbpm.services.task.utils.CollectionUtils; +import org.kie.api.task.model.I18NText; +import org.kie.api.task.model.PeopleAssignments; +import org.kie.api.task.model.TaskData; +import org.kie.internal.task.api.model.Deadlines; +import org.kie.internal.task.api.model.Delegation; +import org.kie.internal.task.api.model.SubTasksStrategy; + +@Entity +@Table(name="Task") +@SequenceGenerator(name="taskIdSeq", sequenceName="TASK_ID_SEQ", allocationSize=1) +public class TaskImpl { + /** + * WSHT uses a name for the unique identifier, for now we use a generated ID which is also the key, which can be + * mapped to the name or a unique name field added later. + */ + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator="taskIdSeq") + @Column(name = "id") + private Long id = 0L; + + @Version + @Column(name = "OPTLOCK") + private int version; + + /** + * While WSHT says this is an expression, it always resolves to an integer, so resolve before setting + * default value is 0. + */ + private int priority; + + @OneToMany(cascade = CascadeType.ALL, targetEntity=I18NTextImpl.class) + @JoinColumn(name = "Task_Names_Id", nullable = true) + private List names = Collections.emptyList(); + + @OneToMany(cascade = CascadeType.ALL, targetEntity=I18NTextImpl.class) + @JoinColumn(name = "Task_Subjects_Id", nullable = true) + private List subjects = Collections.emptyList(); + + @OneToMany(cascade = CascadeType.ALL, targetEntity=I18NTextImpl.class) + @JoinColumn(name = "Task_Descriptions_Id", nullable = true) + private List descriptions = Collections.emptyList(); + + + @Embedded + private PeopleAssignmentsImpl peopleAssignments; + + @Embedded + private DelegationImpl delegation; + + @Embedded + private TaskDataImpl taskData; + + @Embedded + private DeadlinesImpl deadlines; + + @Enumerated(EnumType.STRING) + // Default Behaviour + private SubTasksStrategy subTaskStrategy = SubTasksStrategy.NoAction; + + private String taskType; + + private String formName; + + @Basic + private Short archived = 0; + + + public TaskImpl() { + } + + public void writeExternal(ObjectOutput out) throws IOException { + out.writeLong( id ); + out.writeInt( priority ); + out.writeShort( archived ); + out.writeUTF(taskType); + out.writeUTF(formName); + CollectionUtils.writeI18NTextList( names, out ); + CollectionUtils.writeI18NTextList( subjects, out ); + CollectionUtils.writeI18NTextList( descriptions, out ); + + if (subTaskStrategy != null) { + out.writeBoolean(true); + out.writeUTF(subTaskStrategy.toString()); + } else { + out.writeBoolean(false); + } + + if ( peopleAssignments != null ) { + out.writeBoolean( true ); + peopleAssignments.writeExternal( out ); + } else { + out.writeBoolean( false ); + } + + if ( delegation != null ) { + out.writeBoolean( true ); + delegation.writeExternal( out ); + } else { + out.writeBoolean( false ); + } + + if ( taskData != null ) { + out.writeBoolean( true ); + taskData.writeExternal( out ); + } else { + out.writeBoolean( false ); + } + + if ( deadlines != null ) { + out.writeBoolean( true ); + deadlines.writeExternal( out ); + } else { + out.writeBoolean( false ); + } + + } + + public void readExternal(ObjectInput in) throws IOException, + ClassNotFoundException { + id = in.readLong(); + priority = in.readInt(); + archived = in.readShort(); + taskType = in.readUTF(); + formName = in.readUTF(); + names = CollectionUtils.readI18NTextList( in ); + subjects = CollectionUtils.readI18NTextList( in ); + descriptions = CollectionUtils.readI18NTextList( in ); + + if (in.readBoolean()) { + subTaskStrategy = SubTasksStrategy.valueOf(in.readUTF()); + } + + if ( in.readBoolean() ) { + peopleAssignments = new PeopleAssignmentsImpl(); + peopleAssignments.readExternal( in ); + } + + if ( in.readBoolean() ) { + delegation = new DelegationImpl(); + delegation.readExternal( in ); + } + + if ( in.readBoolean() ) { + taskData = new TaskDataImpl(); + taskData.readExternal( in ); + } + + if ( in.readBoolean() ) { + deadlines = new DeadlinesImpl(); + deadlines.readExternal( in ); + } + + } + + public Long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public Boolean isArchived() { + if (archived == null) { + return null; + } + return (archived == 1) ? Boolean.TRUE : Boolean.FALSE; + } + + public void setArchived(Boolean archived) { + if (archived == null) { + this.archived = null; + } else { + this.archived = (archived == true) ? new Short("1") : new Short("0"); + } + } + + public int getVersion() { + return this.version; + } + + public int getPriority() { + return priority; + } + + public void setPriority(int priority) { + this.priority = priority; + } + + public List getNames() { + return names; + } + + public void setNames(List names) { + this.names = names; + } + + public List getSubjects() { + return subjects; + } + + public void setSubjects(List subjects) { + this.subjects = subjects; + } + + public List getDescriptions() { + return descriptions; + } + + public void setDescriptions(List descriptions) { + this.descriptions = descriptions; + } + + public PeopleAssignments getPeopleAssignments() { + return peopleAssignments; + } + + public void setPeopleAssignments(PeopleAssignments peopleAssignments) { + this.peopleAssignments = (PeopleAssignmentsImpl) peopleAssignments; + } + + public Delegation getDelegation() { + return delegation; + } + + public void setDelegation(Delegation delegation) { + this.delegation = (DelegationImpl) delegation; + } + + public TaskData getTaskData() { + return taskData; + } + + public void setTaskData(TaskData taskData) { + this.taskData = (TaskDataImpl) taskData; + } + + public Deadlines getDeadlines() { + return deadlines; + } + + public void setDeadlines(Deadlines deadlines) { + this.deadlines = (DeadlinesImpl) deadlines; + } + + public String getTaskType() { + return taskType; + } + + public void setTaskType(String taskType) { + this.taskType = taskType; + } + + public String getFormName() { + return formName; + } + + public void setFormName(String formName) { + this.formName = formName; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + version; + result = prime * result + priority; + result = prime * result + archived.hashCode(); + result = prime * result + ((taskType == null) ? 0 : taskType.hashCode()); + result = prime * result + CollectionUtils.hashCode( descriptions ); + result = prime * result + CollectionUtils.hashCode( names ); + result = prime * result + CollectionUtils.hashCode( subjects ); + result = prime * result + ((peopleAssignments == null) ? 0 : peopleAssignments.hashCode()); + result = prime * result + ((delegation == null) ? 0 : delegation.hashCode()); + result = prime * result + ((taskData == null) ? 0 : taskData.hashCode()); + result = prime * result + ((deadlines == null) ? 0 : deadlines.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if ( this == obj ) return true; + if ( obj == null ) return false; + if ( !(obj instanceof TaskImpl) ) return false; + TaskImpl other = (TaskImpl) obj; + if ( this.version != other.version ) { + return false; + } + if ( this.archived != other.archived ) { + return false; + } + if (taskType == null) { + if (other.taskType != null) return false; + } else if (!taskType.equals(other.taskType)) return false; + if ( deadlines == null ) { + if ( other.deadlines != null ) { + + } + } else if ( !deadlines.equals( other.deadlines ) ) return false; + if ( delegation == null ) { + if ( other.delegation != null ) return false; + } else if ( !delegation.equals( other.delegation ) ) return false; + if ( peopleAssignments == null ) { + if ( other.peopleAssignments != null ) return false; + } else if ( !peopleAssignments.equals( other.peopleAssignments ) ) return false; + + if ( priority != other.priority ) return false; + if ( taskData == null ) { + if ( other.taskData != null ) return false; + } else if ( !taskData.equals( other.taskData ) ) return false; + return ( CollectionUtils.equals( descriptions, other.descriptions ) && CollectionUtils.equals( names, other.names ) + && CollectionUtils.equals( subjects, other.subjects )); + } + + public SubTasksStrategy getSubTaskStrategy() { + return subTaskStrategy; + } + + public void setSubTaskStrategy(SubTasksStrategy subTaskStrategy) { + this.subTaskStrategy = subTaskStrategy; + } + +} \ No newline at end of file