TSK-1168: made interfaces of entities clonable

This commit is contained in:
Christopher Heiting 2020-03-23 14:12:42 +01:00 committed by Mustapha Zorgati
parent b79c4891e3
commit 9013eaa573
21 changed files with 363 additions and 111 deletions

View File

@ -177,4 +177,11 @@ public interface Classification extends ClassificationSummary {
* @return the ClassificationSummary object for the current classification * @return the ClassificationSummary object for the current classification
*/ */
ClassificationSummary asSummary(); ClassificationSummary asSummary();
/**
* Duplicates this Classification
*
* @return a copy of this Classification
*/
Classification clone();
} }

View File

@ -4,7 +4,7 @@ package pro.taskana.classification.api.models;
* Interface for ClassificationSummaries. This is a specific short model-object which only requieres * Interface for ClassificationSummaries. This is a specific short model-object which only requieres
* the most important informations. Specific ones can be load afterwards via ID. * the most important informations. Specific ones can be load afterwards via ID.
*/ */
public interface ClassificationSummary { public interface ClassificationSummary extends Cloneable {
/** /**
* Gets the id of the classification. * Gets the id of the classification.
@ -63,8 +63,8 @@ public interface ClassificationSummary {
String getParentKey(); String getParentKey();
/** /**
* Gets the service level of the classification. It is a String in ISO-8601 duration * Gets the service level of the classification. It is a String in ISO-8601 duration format. See
* format. See the parse() method of {@code Duration} for details. * the parse() method of {@code Duration} for details.
* *
* @return the service level * @return the service level
*/ */
@ -139,4 +139,11 @@ public interface ClassificationSummary {
* @return custom8 * @return custom8
*/ */
String getCustom8(); String getCustom8();
/**
* Duplicates this ClassificationSummary
*
* @return a copy of this ClassificationSummary
*/
ClassificationSummary clone();
} }

View File

@ -16,30 +16,12 @@ public class ClassificationImpl extends ClassificationSummaryImpl implements Cla
public ClassificationImpl() {} public ClassificationImpl() {}
public ClassificationImpl(ClassificationImpl classification) { private ClassificationImpl(ClassificationImpl copyFrom) {
this.id = classification.getId(); super(copyFrom);
this.key = classification.getKey(); isValidInDomain = copyFrom.isValidInDomain;
this.parentId = classification.getParentId(); created = copyFrom.created;
this.parentKey = classification.getParentKey(); modified = copyFrom.modified;
this.category = classification.getCategory(); description = copyFrom.description;
this.type = classification.getType();
this.domain = classification.getDomain();
this.isValidInDomain = classification.getIsValidInDomain();
this.created = classification.getCreated();
this.modified = classification.getModified();
this.name = classification.getName();
this.description = classification.getDescription();
this.priority = classification.getPriority();
this.serviceLevel = classification.getServiceLevel();
this.applicationEntryPoint = classification.getApplicationEntryPoint();
this.custom1 = classification.getCustom1();
this.custom2 = classification.getCustom2();
this.custom3 = classification.getCustom3();
this.custom4 = classification.getCustom4();
this.custom5 = classification.getCustom5();
this.custom6 = classification.getCustom6();
this.custom7 = classification.getCustom7();
this.custom8 = classification.getCustom8();
} }
@Override @Override
@ -119,10 +101,14 @@ public class ClassificationImpl extends ClassificationSummaryImpl implements Cla
return (other instanceof ClassificationImpl); return (other instanceof ClassificationImpl);
} }
@Override
public ClassificationImpl clone() {
return new ClassificationImpl(this);
}
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash( return Objects.hash(super.hashCode(), isValidInDomain, created, modified, description);
super.hashCode(), isValidInDomain, created, modified, description);
} }
@Override @Override

View File

@ -29,6 +29,28 @@ public class ClassificationSummaryImpl implements ClassificationSummary {
public ClassificationSummaryImpl() {} public ClassificationSummaryImpl() {}
protected ClassificationSummaryImpl(ClassificationSummaryImpl copyFrom) {
id = copyFrom.id;
applicationEntryPoint = copyFrom.applicationEntryPoint;
category = copyFrom.category;
domain = copyFrom.domain;
key = copyFrom.key;
name = copyFrom.name;
parentId = copyFrom.parentId;
parentKey = copyFrom.parentKey;
priority = copyFrom.priority;
serviceLevel = copyFrom.serviceLevel;
type = copyFrom.type;
custom1 = copyFrom.custom1;
custom2 = copyFrom.custom2;
custom3 = copyFrom.custom3;
custom4 = copyFrom.custom4;
custom5 = copyFrom.custom5;
custom6 = copyFrom.custom6;
custom7 = copyFrom.custom7;
custom8 = copyFrom.custom8;
}
@Override @Override
public String getId() { public String getId() {
return id; return id;
@ -97,16 +119,28 @@ public class ClassificationSummaryImpl implements ClassificationSummary {
return parentKey; return parentKey;
} }
public void setParentKey(String parentKey) {
this.parentKey = parentKey;
}
@Override @Override
public String getServiceLevel() { public String getServiceLevel() {
return serviceLevel; return serviceLevel;
} }
public void setServiceLevel(String serviceLevel) {
this.serviceLevel = serviceLevel;
}
@Override @Override
public String getApplicationEntryPoint() { public String getApplicationEntryPoint() {
return this.applicationEntryPoint; return this.applicationEntryPoint;
} }
public void setApplicationEntryPoint(String applicationEntryPoint) {
this.applicationEntryPoint = applicationEntryPoint;
}
@Override @Override
public int getPriority() { public int getPriority() {
return priority; return priority;
@ -188,22 +222,15 @@ public class ClassificationSummaryImpl implements ClassificationSummary {
this.custom8 = custom8; this.custom8 = custom8;
} }
public void setApplicationEntryPoint(String applicationEntryPoint) {
this.applicationEntryPoint = applicationEntryPoint;
}
public void setServiceLevel(String serviceLevel) {
this.serviceLevel = serviceLevel;
}
public void setParentKey(String parentKey) {
this.parentKey = parentKey;
}
protected boolean canEqual(Object other) { protected boolean canEqual(Object other) {
return (other instanceof ClassificationSummaryImpl); return (other instanceof ClassificationSummaryImpl);
} }
@Override
public ClassificationSummaryImpl clone() {
return new ClassificationSummaryImpl(this);
}
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash( return Objects.hash(

View File

@ -57,4 +57,11 @@ public interface Attachment extends AttachmentSummary {
* @return the AttachmentSummary object for the current attachment * @return the AttachmentSummary object for the current attachment
*/ */
AttachmentSummary asSummary(); AttachmentSummary asSummary();
/**
* Duplicates this Attachment
*
* @return a copy of this Attachment
*/
Attachment clone();
} }

View File

@ -8,7 +8,7 @@ import pro.taskana.classification.api.models.ClassificationSummary;
* Interface for AttachmentSummaries. This is a specific short model-object which only contains the * Interface for AttachmentSummaries. This is a specific short model-object which only contains the
* most important information. * most important information.
*/ */
public interface AttachmentSummary { public interface AttachmentSummary extends Cloneable {
/** /**
* Gets the id of the attachment. * Gets the id of the attachment.
@ -65,4 +65,11 @@ public interface AttachmentSummary {
* @return received Instant * @return received Instant
*/ */
Instant getReceived(); Instant getReceived();
/**
* Duplicates this AttachmentSummary
*
* @return a copy of this AttachmentSummary
*/
AttachmentSummary clone();
} }

View File

@ -7,7 +7,7 @@ import org.slf4j.LoggerFactory;
import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.InvalidArgumentException;
/** ObjectReference entity. */ /** ObjectReference entity. */
public class ObjectReference { public class ObjectReference implements Cloneable {
private static final Logger LOGGER = LoggerFactory.getLogger(ObjectReference.class); private static final Logger LOGGER = LoggerFactory.getLogger(ObjectReference.class);
private String id; private String id;
private String company; private String company;
@ -16,6 +16,44 @@ public class ObjectReference {
private String type; private String type;
private String value; private String value;
public ObjectReference() {}
private ObjectReference(ObjectReference copyFrom) {
id = copyFrom.id;
company = copyFrom.company;
system = copyFrom.system;
systemInstance = copyFrom.systemInstance;
type = copyFrom.type;
value = copyFrom.value;
}
public static void validate(ObjectReference objectReference, String objRefType, String objName)
throws InvalidArgumentException {
LOGGER.debug("entry to validateObjectReference()");
// check that all values in the ObjectReference are set correctly
if (objectReference == null) {
throw new InvalidArgumentException(
String.format("ObectReferenc %s of %s must not be null.", objRefType, objName));
} else if (objectReference.getCompany() == null || objectReference.getCompany().length() == 0) {
throw new InvalidArgumentException(
String.format("Company of %s of %s must not be empty", objRefType, objName));
} else if (objectReference.getSystem() == null || objectReference.getSystem().length() == 0) {
throw new InvalidArgumentException(
String.format("System of %s of %s must not be empty", objRefType, objName));
} else if (objectReference.getSystemInstance() == null
|| objectReference.getSystemInstance().length() == 0) {
throw new InvalidArgumentException(
String.format("SystemInstance of %s of %s must not be empty", objRefType, objName));
} else if (objectReference.getType() == null || objectReference.getType().length() == 0) {
throw new InvalidArgumentException(
String.format("Type of %s of %s must not be empty", objRefType, objName));
} else if (objectReference.getValue() == null || objectReference.getValue().length() == 0) {
throw new InvalidArgumentException(
String.format("Value of %s of %s must not be empty", objRefType, objName));
}
LOGGER.debug("exit from validateObjectReference()");
}
public String getId() { public String getId() {
return id; return id;
} }
@ -64,31 +102,9 @@ public class ObjectReference {
this.value = value; this.value = value;
} }
public static void validate(ObjectReference objectReference, String objRefType, String objName) @Override
throws InvalidArgumentException { protected ObjectReference clone() {
LOGGER.debug("entry to validateObjectReference()"); return new ObjectReference(this);
// check that all values in the ObjectReference are set correctly
if (objectReference == null) {
throw new InvalidArgumentException(
String.format("ObectReferenc %s of %s must not be null.", objRefType, objName));
} else if (objectReference.getCompany() == null || objectReference.getCompany().length() == 0) {
throw new InvalidArgumentException(
String.format("Company of %s of %s must not be empty", objRefType, objName));
} else if (objectReference.getSystem() == null || objectReference.getSystem().length() == 0) {
throw new InvalidArgumentException(
String.format("System of %s of %s must not be empty", objRefType, objName));
} else if (objectReference.getSystemInstance() == null
|| objectReference.getSystemInstance().length() == 0) {
throw new InvalidArgumentException(
String.format("SystemInstance of %s of %s must not be empty", objRefType, objName));
} else if (objectReference.getType() == null || objectReference.getType().length() == 0) {
throw new InvalidArgumentException(
String.format("Type of %s of %s must not be empty", objRefType, objName));
} else if (objectReference.getValue() == null || objectReference.getValue().length() == 0) {
throw new InvalidArgumentException(
String.format("Value of %s of %s must not be empty", objRefType, objName));
}
LOGGER.debug("exit from validateObjectReference()");
} }
@Override @Override

View File

@ -187,4 +187,11 @@ public interface Task extends TaskSummary {
* @return classificationCategory * @return classificationCategory
*/ */
String getClassificationCategory(); String getClassificationCategory();
/**
* Duplicates this Task
*
* @return a copy of this Task
*/
Task clone();
} }

View File

@ -3,7 +3,7 @@ package pro.taskana.task.api.models;
import java.time.Instant; import java.time.Instant;
/** TaskComment-Interface to specify TaskComment Attributes. */ /** TaskComment-Interface to specify TaskComment Attributes. */
public interface TaskComment { public interface TaskComment extends Cloneable {
/** /**
* Gets the id of the task comment. * Gets the id of the task comment.
@ -33,11 +33,8 @@ public interface TaskComment {
*/ */
String getTextField(); String getTextField();
/** /** Sets the text field of the task comment. */
* Sets the text field of the task comment.
*
* @param textField the text field * @param textField the text field
*/
void setTextField(String textField); void setTextField(String textField);
/** /**
@ -54,6 +51,10 @@ public interface TaskComment {
*/ */
Instant getModified(); Instant getModified();
/**
* Duplicates this TaskComment
*
* @return a copy of this TaskComment
*/
TaskComment clone();
} }

View File

@ -12,7 +12,7 @@ import pro.taskana.workbasket.api.models.WorkbasketSummary;
* Interface for TaskSummary. This is a specific short model-object which only contains the most * Interface for TaskSummary. This is a specific short model-object which only contains the most
* important information. * important information.
*/ */
public interface TaskSummary { public interface TaskSummary extends Cloneable {
/** /**
* Gets the id of the task. * Gets the id of the task.
@ -192,4 +192,11 @@ public interface TaskSummary {
* @throws InvalidArgumentException if num has not a value of "1", "2" ... "16" * @throws InvalidArgumentException if num has not a value of "1", "2" ... "16"
*/ */
String getCustomAttribute(String num) throws InvalidArgumentException; String getCustomAttribute(String num) throws InvalidArgumentException;
/**
* Duplicates this TaskSummary
*
* @return a copy of this TaskSummary
*/
TaskSummary clone();
} }

View File

@ -18,6 +18,11 @@ public class AttachmentImpl extends AttachmentSummaryImpl implements Attachment
public AttachmentImpl() {} public AttachmentImpl() {}
private AttachmentImpl(AttachmentImpl copyFrom) {
super(copyFrom);
customAttributes = new HashMap<>(copyFrom.customAttributes);
}
@Override @Override
public Map<String, String> getCustomAttributes() { public Map<String, String> getCustomAttributes() {
if (customAttributes == null) { if (customAttributes == null) {
@ -49,6 +54,11 @@ public class AttachmentImpl extends AttachmentSummaryImpl implements Attachment
return (!(other instanceof AttachmentImpl)); return (!(other instanceof AttachmentImpl));
} }
@Override
public AttachmentImpl clone() {
return new AttachmentImpl(this);
}
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(super.hashCode(), customAttributes); return Objects.hash(super.hashCode(), customAttributes);

View File

@ -22,6 +22,17 @@ public class AttachmentSummaryImpl implements AttachmentSummary {
AttachmentSummaryImpl() {} AttachmentSummaryImpl() {}
protected AttachmentSummaryImpl(AttachmentSummaryImpl copyFrom) {
id = copyFrom.id;
taskId = copyFrom.taskId;
created = copyFrom.created;
modified = copyFrom.modified;
classificationSummary = copyFrom.classificationSummary;
objectReference = copyFrom.objectReference;
channel = copyFrom.channel;
received = copyFrom.received;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see pro.taskana.impl.AttachmentSummary#getId() * @see pro.taskana.impl.AttachmentSummary#getId()
@ -96,6 +107,10 @@ public class AttachmentSummaryImpl implements AttachmentSummary {
return channel; return channel;
} }
public void setChannel(String channel) {
this.channel = channel;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see pro.taskana.impl.AttachmentSummary#getClassification() * @see pro.taskana.impl.AttachmentSummary#getClassification()
@ -122,10 +137,6 @@ public class AttachmentSummaryImpl implements AttachmentSummary {
this.received = received; this.received = received;
} }
public void setChannel(String channel) {
this.channel = channel;
}
// auxiliary method to enable MyBatis access to classificationSummary // auxiliary method to enable MyBatis access to classificationSummary
@SuppressWarnings("unused") @SuppressWarnings("unused")
public ClassificationSummaryImpl getClassificationSummaryImpl() { public ClassificationSummaryImpl getClassificationSummaryImpl() {
@ -142,6 +153,11 @@ public class AttachmentSummaryImpl implements AttachmentSummary {
return (!(other instanceof AttachmentSummaryImpl)); return (!(other instanceof AttachmentSummaryImpl));
} }
@Override
public AttachmentSummaryImpl clone() {
return new AttachmentSummaryImpl(this);
}
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash( return Objects.hash(

View File

@ -14,6 +14,17 @@ public class TaskCommentImpl implements TaskComment {
private Instant created; private Instant created;
private Instant modified; private Instant modified;
public TaskCommentImpl() {}
private TaskCommentImpl(TaskCommentImpl copyFrom) {
id = copyFrom.id;
taskId = copyFrom.taskId;
textField = copyFrom.textField;
creator = copyFrom.creator;
created = copyFrom.created;
modified = copyFrom.modified;
}
@Override @Override
public String getId() { public String getId() {
return id; return id;
@ -45,6 +56,10 @@ public class TaskCommentImpl implements TaskComment {
return textField; return textField;
} }
public void setTextField(String textField) {
this.textField = textField;
}
@Override @Override
public Instant getCreated() { public Instant getCreated() {
return created; return created;
@ -63,23 +78,18 @@ public class TaskCommentImpl implements TaskComment {
this.modified = modified; this.modified = modified;
} }
public void setTextField(String textField) {
this.textField = textField;
}
protected boolean canEqual(Object other) { protected boolean canEqual(Object other) {
return (other instanceof TaskCommentImpl); return (other instanceof TaskCommentImpl);
} }
@Override
public TaskCommentImpl clone() {
return new TaskCommentImpl(this);
}
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash( return Objects.hash(id, taskId, textField, creator, created, modified);
id,
taskId,
textField,
creator,
created,
modified);
} }
@Override @Override

View File

@ -29,6 +29,14 @@ public class TaskImpl extends TaskSummaryImpl implements Task {
public TaskImpl() {} public TaskImpl() {}
private TaskImpl(TaskImpl copyFrom) {
super(copyFrom);
customAttributes = new HashMap<>(copyFrom.customAttributes);
callbackInfo = new HashMap<>(copyFrom.callbackInfo);
callbackState = copyFrom.callbackState;
attachments = new ArrayList<>(copyFrom.attachments);
}
public CallbackState getCallbackState() { public CallbackState getCallbackState() {
return callbackState; return callbackState;
} }
@ -170,6 +178,14 @@ public class TaskImpl extends TaskSummaryImpl implements Task {
return attachments; return attachments;
} }
public void setAttachments(List<Attachment> attachments) {
if (attachments != null) {
this.attachments = attachments;
} else if (this.attachments == null) {
this.attachments = new ArrayList<>();
}
}
@Override @Override
public TaskSummary asSummary() { public TaskSummary asSummary() {
TaskSummaryImpl taskSummary = new TaskSummaryImpl(); TaskSummaryImpl taskSummary = new TaskSummaryImpl();
@ -246,14 +262,6 @@ public class TaskImpl extends TaskSummaryImpl implements Task {
((ClassificationSummaryImpl) this.classificationSummary).setCategory(classificationCategory); ((ClassificationSummaryImpl) this.classificationSummary).setCategory(classificationCategory);
} }
public void setAttachments(List<Attachment> attachments) {
if (attachments != null) {
this.attachments = attachments;
} else if (this.attachments == null) {
this.attachments = new ArrayList<>();
}
}
public String getClassificationId() { public String getClassificationId() {
return classificationSummary == null ? null : classificationSummary.getId(); return classificationSummary == null ? null : classificationSummary.getId();
} }
@ -262,6 +270,11 @@ public class TaskImpl extends TaskSummaryImpl implements Task {
return (other instanceof TaskImpl); return (other instanceof TaskImpl);
} }
@Override
public TaskImpl clone() {
return new TaskImpl(this);
}
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash( return Objects.hash(

View File

@ -64,6 +64,48 @@ public class TaskSummaryImpl implements TaskSummary {
public TaskSummaryImpl() {} public TaskSummaryImpl() {}
protected TaskSummaryImpl(TaskSummaryImpl copyFrom) {
id = copyFrom.id;
externalId = copyFrom.externalId;
created = copyFrom.created;
claimed = copyFrom.claimed;
completed = copyFrom.completed;
modified = copyFrom.modified;
planned = copyFrom.planned;
due = copyFrom.due;
name = copyFrom.name;
creator = copyFrom.creator;
note = copyFrom.note;
description = copyFrom.description;
priority = copyFrom.priority;
state = copyFrom.state;
classificationSummary = copyFrom.classificationSummary;
workbasketSummary = copyFrom.workbasketSummary;
businessProcessId = copyFrom.businessProcessId;
parentBusinessProcessId = copyFrom.parentBusinessProcessId;
owner = copyFrom.owner;
primaryObjRef = copyFrom.primaryObjRef;
isRead = copyFrom.isRead;
isTransferred = copyFrom.isTransferred;
attachmentSummaries = new ArrayList<>(copyFrom.attachmentSummaries);
custom1 = copyFrom.custom1;
custom2 = copyFrom.custom2;
custom3 = copyFrom.custom3;
custom4 = copyFrom.custom4;
custom5 = copyFrom.custom5;
custom6 = copyFrom.custom6;
custom7 = copyFrom.custom7;
custom8 = copyFrom.custom8;
custom9 = copyFrom.custom9;
custom10 = copyFrom.custom10;
custom11 = copyFrom.custom11;
custom12 = copyFrom.custom12;
custom13 = copyFrom.custom13;
custom14 = copyFrom.custom14;
custom15 = copyFrom.custom15;
custom16 = copyFrom.custom16;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see pro.taskana.TaskSummary#getTaskId() * @see pro.taskana.TaskSummary#getTaskId()
@ -99,6 +141,10 @@ public class TaskSummaryImpl implements TaskSummary {
return creator; return creator;
} }
public void setCreator(String creator) {
this.creator = creator;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see pro.taskana.TaskSummary#getCreated() * @see pro.taskana.TaskSummary#getCreated()
@ -276,6 +322,10 @@ public class TaskSummaryImpl implements TaskSummary {
return attachmentSummaries; return attachmentSummaries;
} }
public void setAttachmentSummaries(List<AttachmentSummary> attachmentSummaries) {
this.attachmentSummaries = attachmentSummaries;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see pro.taskana.TaskSummary#getDomain() * @see pro.taskana.TaskSummary#getDomain()
@ -422,14 +472,6 @@ public class TaskSummaryImpl implements TaskSummary {
} }
} }
public void setAttachmentSummaries(List<AttachmentSummary> attachmentSummaries) {
this.attachmentSummaries = attachmentSummaries;
}
public void setCreator(String creator) {
this.creator = creator;
}
// utility method to allow mybatis access to workbasketSummary // utility method to allow mybatis access to workbasketSummary
public WorkbasketSummaryImpl getWorkbasketSummaryImpl() { public WorkbasketSummaryImpl getWorkbasketSummaryImpl() {
return (WorkbasketSummaryImpl) workbasketSummary; return (WorkbasketSummaryImpl) workbasketSummary;
@ -605,6 +647,11 @@ public class TaskSummaryImpl implements TaskSummary {
return (other instanceof TaskSummaryImpl); return (other instanceof TaskSummaryImpl);
} }
@Override
public TaskSummaryImpl clone() {
return new TaskSummaryImpl(this);
}
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash( return Objects.hash(

View File

@ -126,4 +126,11 @@ public interface Workbasket extends WorkbasketSummary {
* @return the WorkbasketSummary object for the current work basket * @return the WorkbasketSummary object for the current work basket
*/ */
WorkbasketSummary asSummary(); WorkbasketSummary asSummary();
/**
* Duplicates this Workbasket
*
* @return a copy of this Workbasket
*/
Workbasket clone();
} }

View File

@ -6,7 +6,7 @@ package pro.taskana.workbasket.api.models;
* *
* @author bbr * @author bbr
*/ */
public interface WorkbasketAccessItem { public interface WorkbasketAccessItem extends Cloneable {
/** /**
* Returns the current id of the WorkbasketAccessItem. * Returns the current id of the WorkbasketAccessItem.
@ -315,4 +315,11 @@ public interface WorkbasketAccessItem {
* @param permCustom12 specifies whether custom12 permission is granted * @param permCustom12 specifies whether custom12 permission is granted
*/ */
void setPermCustom12(boolean permCustom12); void setPermCustom12(boolean permCustom12);
/**
* Duplicates this WorkbasketAccessItem
*
* @return a copy of this WorkbasketAccessItem
*/
WorkbasketAccessItem clone();
} }

View File

@ -6,7 +6,7 @@ import pro.taskana.workbasket.api.WorkbasketType;
* Interface for WorkbasketSummary. This is a specific short model-object which only contains the * Interface for WorkbasketSummary. This is a specific short model-object which only contains the
* most important information. * most important information.
*/ */
public interface WorkbasketSummary { public interface WorkbasketSummary extends Cloneable {
/** /**
* Gets the id of the workbasket. * Gets the id of the workbasket.
@ -119,4 +119,11 @@ public interface WorkbasketSummary {
* @return the workbasket's markedForDeletion property * @return the workbasket's markedForDeletion property
*/ */
boolean isMarkedForDeletion(); boolean isMarkedForDeletion();
/**
* Duplicates this WorkbasketSummary
*
* @return a copy of this WorkbasketSummary
*/
WorkbasketSummary clone();
} }

View File

@ -30,8 +30,31 @@ public class WorkbasketAccessItemImpl implements WorkbasketAccessItem {
private boolean permCustom11; private boolean permCustom11;
private boolean permCustom12; private boolean permCustom12;
public WorkbasketAccessItemImpl() { public WorkbasketAccessItemImpl() {}
super();
private WorkbasketAccessItemImpl(WorkbasketAccessItemImpl copyFrom) {
id = copyFrom.id;
workbasketId = copyFrom.workbasketId;
workbasketKey = copyFrom.workbasketKey;
accessId = copyFrom.accessId;
accessName = copyFrom.accessName;
permRead = copyFrom.permRead;
permOpen = copyFrom.permOpen;
permAppend = copyFrom.permAppend;
permTransfer = copyFrom.permTransfer;
permDistribute = copyFrom.permDistribute;
permCustom1 = copyFrom.permCustom1;
permCustom2 = copyFrom.permCustom2;
permCustom3 = copyFrom.permCustom3;
permCustom4 = copyFrom.permCustom4;
permCustom5 = copyFrom.permCustom5;
permCustom6 = copyFrom.permCustom6;
permCustom7 = copyFrom.permCustom7;
permCustom8 = copyFrom.permCustom8;
permCustom9 = copyFrom.permCustom9;
permCustom10 = copyFrom.permCustom10;
permCustom11 = copyFrom.permCustom11;
permCustom12 = copyFrom.permCustom12;
} }
/* /*
@ -406,6 +429,11 @@ public class WorkbasketAccessItemImpl implements WorkbasketAccessItem {
this.permCustom12 = permCustom12; this.permCustom12 = permCustom12;
} }
@Override
public WorkbasketAccessItemImpl clone() {
return new WorkbasketAccessItemImpl(this);
}
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash( return Objects.hash(

View File

@ -14,6 +14,12 @@ public class WorkbasketImpl extends WorkbasketSummaryImpl implements Workbasket
public WorkbasketImpl() {} public WorkbasketImpl() {}
private WorkbasketImpl(WorkbasketImpl copyFrom) {
super(copyFrom);
created = copyFrom.created;
modified = copyFrom.modified;
}
@Override @Override
public Instant getCreated() { public Instant getCreated() {
return created; return created;
@ -99,6 +105,11 @@ public class WorkbasketImpl extends WorkbasketSummaryImpl implements Workbasket
return Objects.equals(created, other.created) && Objects.equals(modified, other.modified); return Objects.equals(created, other.created) && Objects.equals(modified, other.modified);
} }
@Override
public WorkbasketImpl clone() {
return new WorkbasketImpl(this);
}
@Override @Override
public String toString() { public String toString() {
return "WorkbasketImpl [id=" return "WorkbasketImpl [id="

View File

@ -27,6 +27,25 @@ public class WorkbasketSummaryImpl implements WorkbasketSummary {
public WorkbasketSummaryImpl() {} public WorkbasketSummaryImpl() {}
protected WorkbasketSummaryImpl(WorkbasketSummaryImpl copyFrom) {
id = copyFrom.id;
key = copyFrom.key;
name = copyFrom.name;
description = copyFrom.description;
owner = copyFrom.owner;
domain = copyFrom.domain;
type = copyFrom.type;
custom1 = copyFrom.custom1;
custom2 = copyFrom.custom2;
custom3 = copyFrom.custom3;
custom4 = copyFrom.custom4;
orgLevel1 = copyFrom.orgLevel1;
orgLevel2 = copyFrom.orgLevel2;
orgLevel3 = copyFrom.orgLevel3;
orgLevel4 = copyFrom.orgLevel4;
markedForDeletion = copyFrom.markedForDeletion;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see pro.taskana.impl.WorkbasketSummary#getId() * @see pro.taskana.impl.WorkbasketSummary#getId()
@ -286,6 +305,11 @@ public class WorkbasketSummaryImpl implements WorkbasketSummary {
&& Objects.equals(orgLevel4, other.orgLevel4); && Objects.equals(orgLevel4, other.orgLevel4);
} }
@Override
public WorkbasketSummaryImpl clone() {
return new WorkbasketSummaryImpl(this);
}
@Override @Override
public String toString() { public String toString() {
return "WorkbasketSummaryImpl [id=" return "WorkbasketSummaryImpl [id="