TSK-1009: regenerated equals & hashcode

This commit is contained in:
Mustapha Zorgati 2020-01-07 08:23:15 +01:00
parent af0bd0156e
commit 53ffac7fd9
12 changed files with 382 additions and 970 deletions

View File

@ -1,5 +1,7 @@
package pro.taskana; package pro.taskana;
import java.util.Objects;
/** /**
* This class encapsulates key - domain pairs for identification of workbaskets. * This class encapsulates key - domain pairs for identification of workbaskets.
* *
@ -33,11 +35,7 @@ public class KeyDomain {
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; return Objects.hash(key, domain);
int result = 1;
result = prime * result + ((domain == null) ? 0 : domain.hashCode());
result = prime * result + ((key == null) ? 0 : key.hashCode());
return result;
} }
@Override @Override
@ -48,29 +46,15 @@ public class KeyDomain {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (!getClass().isAssignableFrom(obj.getClass())) { if (getClass() != obj.getClass()) {
return false; return false;
} }
KeyDomain other = (KeyDomain) obj; KeyDomain other = (KeyDomain) obj;
if (domain == null) { return Objects.equals(key, other.key) && Objects.equals(domain, other.domain);
if (other.domain != null) {
return false;
}
} else if (!domain.equals(other.domain)) {
return false;
}
if (key == null) {
if (other.key != null) {
return false;
}
} else if (!key.equals(other.key)) {
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "KeyDomain [" + "key=" + this.key + ", domain=" + this.domain + "]"; return "KeyDomain [key=" + key + ", domain=" + domain + "]";
} }
} }

View File

@ -1,5 +1,7 @@
package pro.taskana; package pro.taskana;
import java.util.Objects;
/** ObjectReference entity. */ /** ObjectReference entity. */
public class ObjectReference { public class ObjectReference {
@ -60,67 +62,27 @@ public class ObjectReference {
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; return Objects.hash(id, company, system, systemInstance, type, value);
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((company == null) ? 0 : company.hashCode());
result = prime * result + ((system == null) ? 0 : system.hashCode());
result = prime * result + ((systemInstance == null) ? 0 : systemInstance.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
} }
@Override @Override
public boolean equals(Object other) { public boolean equals(Object obj) {
if (this == other) { if (this == obj) {
return true; return true;
} }
if (other == null) { if (obj == null) {
return false; return false;
} }
if (!getClass().isAssignableFrom(other.getClass())) { if (getClass() != obj.getClass()) {
return false; return false;
} }
ObjectReference o = (ObjectReference) other; ObjectReference other = (ObjectReference) obj;
return Objects.equals(id, other.id)
if (id == null && o.id != null) { && Objects.equals(company, other.company)
return false; && Objects.equals(system, other.system)
} && Objects.equals(systemInstance, other.systemInstance)
if (id != null && !(id.equals(o.id))) { && Objects.equals(type, other.type)
return false; && Objects.equals(value, other.value);
}
if (company == null && o.company != null) {
return false;
}
if (company != null && !(company.equals(o.company))) {
return false;
}
if (system == null && o.system != null) {
return false;
}
if (system != null && !(system.equals(o.system))) {
return false;
}
if (systemInstance == null && o.systemInstance != null) {
return false;
}
if (systemInstance != null && !(systemInstance.equals(o.systemInstance))) {
return false;
}
if (type == null && o.type != null) {
return false;
}
if (type != null && !(type.equals(o.type))) {
return false;
}
if (value == null && o.value != null) {
return false;
}
if (value != null && !(value.equals(o.value))) {
return false;
}
return true;
} }
@Override @Override

View File

@ -1,6 +1,7 @@
package pro.taskana; package pro.taskana;
import java.time.Instant; import java.time.Instant;
import java.util.Objects;
/** /**
* Capture a time interval. A fixed interval has defined begin and end Instant. An open ended * Capture a time interval. A fixed interval has defined begin and end Instant. An open ended
@ -22,8 +23,8 @@ public class TimeInterval {
if (i == null) { if (i == null) {
return false; return false;
} }
boolean isAfterBegin = begin == null ? true : !i.isBefore(begin); boolean isAfterBegin = begin == null || !i.isBefore(begin);
boolean isBeforeEnd = end == null ? true : !i.isAfter(end); boolean isBeforeEnd = end == null || !i.isAfter(end);
return (isAfterBegin && isBeforeEnd); return (isAfterBegin && isBeforeEnd);
} }
@ -53,11 +54,7 @@ public class TimeInterval {
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; return Objects.hash(begin, end);
int result = 1;
result = prime * result + ((begin == null) ? 0 : begin.hashCode());
result = prime * result + ((end == null) ? 0 : end.hashCode());
return result;
} }
@Override @Override
@ -68,25 +65,11 @@ public class TimeInterval {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (!getClass().isAssignableFrom(obj.getClass())) { if (getClass() != obj.getClass()) {
return false; return false;
} }
TimeInterval other = (TimeInterval) obj; TimeInterval other = (TimeInterval) obj;
if (begin == null) { return Objects.equals(begin, other.begin) && Objects.equals(end, other.end);
if (other.begin != null) {
return false;
}
} else if (!begin.equals(other.begin)) {
return false;
}
if (end == null) {
if (other.end != null) {
return false;
}
} else if (!end.equals(other.end)) {
return false;
}
return true;
} }
@Override @Override

View File

@ -3,6 +3,7 @@ package pro.taskana.impl;
import java.time.Instant; import java.time.Instant;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import pro.taskana.Attachment; import pro.taskana.Attachment;
import pro.taskana.AttachmentSummary; import pro.taskana.AttachmentSummary;
@ -143,19 +144,16 @@ public class AttachmentImpl implements Attachment {
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; return Objects.hash(
int result = 1; id,
result = prime * result + ((channel == null) ? 0 : channel.hashCode()); taskId,
result = created,
prime * result + ((classificationSummary == null) ? 0 : classificationSummary.hashCode()); modified,
result = prime * result + ((created == null) ? 0 : created.hashCode()); classificationSummary,
result = prime * result + ((customAttributes == null) ? 0 : customAttributes.hashCode()); objectReference,
result = prime * result + ((id == null) ? 0 : id.hashCode()); channel,
result = prime * result + ((modified == null) ? 0 : modified.hashCode()); received,
result = prime * result + ((objectReference == null) ? 0 : objectReference.hashCode()); customAttributes);
result = prime * result + ((received == null) ? 0 : received.hashCode());
result = prime * result + ((taskId == null) ? 0 : taskId.hashCode());
return result;
} }
@Override @Override
@ -166,74 +164,19 @@ public class AttachmentImpl implements Attachment {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (!getClass().isAssignableFrom(obj.getClass())) { if (getClass() != obj.getClass()) {
return false; return false;
} }
AttachmentImpl other = (AttachmentImpl) obj; AttachmentImpl other = (AttachmentImpl) obj;
if (channel == null) { return Objects.equals(id, other.id)
if (other.channel != null) { && Objects.equals(taskId, other.taskId)
return false; && Objects.equals(created, other.created)
} && Objects.equals(modified, other.modified)
} else if (!channel.equals(other.channel)) { && Objects.equals(classificationSummary, other.classificationSummary)
return false; && Objects.equals(objectReference, other.objectReference)
} && Objects.equals(channel, other.channel)
if (classificationSummary == null) { && Objects.equals(received, other.received)
if (other.classificationSummary != null) { && Objects.equals(customAttributes, other.customAttributes);
return false;
}
} else if (!classificationSummary.equals(other.classificationSummary)) {
return false;
}
if (created == null) {
if (other.created != null) {
return false;
}
} else if (!created.equals(other.created)) {
return false;
}
if (customAttributes == null) {
if (other.customAttributes != null) {
return false;
}
} else if (!customAttributes.equals(other.customAttributes)) {
return false;
}
if (id == null) {
if (other.id != null) {
return false;
}
} else if (!id.equals(other.id)) {
return false;
}
if (modified == null) {
if (other.modified != null) {
return false;
}
} else if (!modified.equals(other.modified)) {
return false;
}
if (objectReference == null) {
if (other.objectReference != null) {
return false;
}
} else if (!objectReference.equals(other.objectReference)) {
return false;
}
if (received == null) {
if (other.received != null) {
return false;
}
} else if (!received.equals(other.received)) {
return false;
}
if (taskId == null) {
if (other.taskId != null) {
return false;
}
} else if (!taskId.equals(other.taskId)) {
return false;
}
return true;
} }
@Override @Override

View File

@ -1,6 +1,7 @@
package pro.taskana.impl; package pro.taskana.impl;
import java.time.Instant; import java.time.Instant;
import java.util.Objects;
import pro.taskana.AttachmentSummary; import pro.taskana.AttachmentSummary;
import pro.taskana.ClassificationSummary; import pro.taskana.ClassificationSummary;
@ -136,18 +137,8 @@ public class AttachmentSummaryImpl implements AttachmentSummary {
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; return Objects.hash(
int result = 1; id, taskId, created, modified, classificationSummary, objectReference, channel, received);
result = prime * result + ((channel == null) ? 0 : channel.hashCode());
result =
prime * result + ((classificationSummary == null) ? 0 : classificationSummary.hashCode());
result = prime * result + ((created == null) ? 0 : created.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((modified == null) ? 0 : modified.hashCode());
result = prime * result + ((objectReference == null) ? 0 : objectReference.hashCode());
result = prime * result + ((received == null) ? 0 : received.hashCode());
result = prime * result + ((taskId == null) ? 0 : taskId.hashCode());
return result;
} }
@Override @Override
@ -158,67 +149,18 @@ public class AttachmentSummaryImpl implements AttachmentSummary {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (!getClass().isAssignableFrom(obj.getClass())) { if (getClass() != obj.getClass()) {
return false; return false;
} }
AttachmentSummaryImpl other = (AttachmentSummaryImpl) obj; AttachmentSummaryImpl other = (AttachmentSummaryImpl) obj;
if (classificationSummary == null) { return Objects.equals(id, other.id)
if (other.classificationSummary != null) { && Objects.equals(taskId, other.taskId)
return false; && Objects.equals(created, other.created)
} && Objects.equals(modified, other.modified)
} else if (!classificationSummary.equals(other.classificationSummary)) { && Objects.equals(classificationSummary, other.classificationSummary)
return false; && Objects.equals(objectReference, other.objectReference)
} && Objects.equals(channel, other.channel)
if (created == null) { && Objects.equals(received, other.received);
if (other.created != null) {
return false;
}
} else if (!created.equals(other.created)) {
return false;
}
if (id == null) {
if (other.id != null) {
return false;
}
} else if (!id.equals(other.id)) {
return false;
}
if (modified == null) {
if (other.modified != null) {
return false;
}
} else if (!modified.equals(other.modified)) {
return false;
}
if (received == null) {
if (other.received != null) {
return false;
}
} else if (!received.equals(other.received)) {
return false;
}
if (taskId == null) {
if (other.taskId != null) {
return false;
}
} else if (!taskId.equals(other.taskId)) {
return false;
}
if (objectReference == null) {
if (other.objectReference != null) {
return false;
}
} else if (!objectReference.equals(other.objectReference)) {
return false;
}
if (channel == null) {
if (other.channel != null) {
return false;
}
} else if (!channel.equals(other.channel)) {
return false;
}
return true;
} }
@Override @Override

View File

@ -126,32 +126,25 @@ public class ClassificationImpl extends ClassificationSummaryImpl implements Cla
} }
@Override @Override
public boolean equals(Object o) { public boolean equals(Object obj) {
if (this == o) { if (this == obj) {
return true; return true;
} }
if (o == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!getClass().isAssignableFrom(o.getClass())) {
return false; return false;
} }
if (!super.equals(obj)) {
if (!super.equals(o)) {
return false; return false;
} }
ClassificationImpl that = (ClassificationImpl) o; ClassificationImpl other = (ClassificationImpl) obj;
return Objects.equals(isValidInDomain, other.isValidInDomain)
if (!that.canEqual(this)) { && Objects.equals(created, other.created)
return false; && Objects.equals(modified, other.modified)
} && Objects.equals(description, other.description)
&& Objects.equals(applicationEntryPoint, other.applicationEntryPoint);
return Objects.equals(isValidInDomain, that.isValidInDomain)
&& Objects.equals(created, that.created)
&& Objects.equals(modified, that.modified)
&& Objects.equals(description, that.description)
&& Objects.equals(applicationEntryPoint, that.applicationEntryPoint);
} }
@Override @Override

View File

@ -218,42 +218,35 @@ public class ClassificationSummaryImpl implements ClassificationSummary {
} }
@Override @Override
public boolean equals(Object o) { public boolean equals(Object obj) {
if (this == o) { if (this == obj) {
return true; return true;
} }
if (o == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!getClass().isAssignableFrom(o.getClass())) {
return false; return false;
} }
ClassificationSummaryImpl other = (ClassificationSummaryImpl) obj;
ClassificationSummaryImpl that = (ClassificationSummaryImpl) o; return priority == other.priority
&& Objects.equals(id, other.id)
if (!that.canEqual(this)) { && Objects.equals(key, other.key)
return false; && Objects.equals(category, other.category)
} && Objects.equals(type, other.type)
&& Objects.equals(domain, other.domain)
return priority == that.priority && Objects.equals(name, other.name)
&& Objects.equals(id, that.id) && Objects.equals(parentId, other.parentId)
&& Objects.equals(key, that.key) && Objects.equals(parentKey, other.parentKey)
&& Objects.equals(category, that.category) && Objects.equals(serviceLevel, other.serviceLevel)
&& Objects.equals(type, that.type) && Objects.equals(custom1, other.custom1)
&& Objects.equals(domain, that.domain) && Objects.equals(custom2, other.custom2)
&& Objects.equals(name, that.name) && Objects.equals(custom3, other.custom3)
&& Objects.equals(parentId, that.parentId) && Objects.equals(custom4, other.custom4)
&& Objects.equals(parentKey, that.parentKey) && Objects.equals(custom5, other.custom5)
&& Objects.equals(serviceLevel, that.serviceLevel) && Objects.equals(custom6, other.custom6)
&& Objects.equals(custom1, that.custom1) && Objects.equals(custom7, other.custom7)
&& Objects.equals(custom2, that.custom2) && Objects.equals(custom8, other.custom8);
&& Objects.equals(custom3, that.custom3)
&& Objects.equals(custom4, that.custom4)
&& Objects.equals(custom5, that.custom5)
&& Objects.equals(custom6, that.custom6)
&& Objects.equals(custom7, that.custom7)
&& Objects.equals(custom8, that.custom8);
} }
@Override @Override

View File

@ -7,6 +7,7 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import pro.taskana.Attachment; import pro.taskana.Attachment;
import pro.taskana.AttachmentSummary; import pro.taskana.AttachmentSummary;
@ -18,7 +19,6 @@ import pro.taskana.TaskState;
import pro.taskana.TaskSummary; import pro.taskana.TaskSummary;
import pro.taskana.WorkbasketSummary; import pro.taskana.WorkbasketSummary;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.SystemException;
/** Task entity. */ /** Task entity. */
public class TaskImpl implements Task { public class TaskImpl implements Task {
@ -722,57 +722,49 @@ public class TaskImpl implements Task {
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; return Objects.hash(
int result = 1; id,
Object[] myFields = { externalId,
externalId, created,
attachments, claimed,
businessProcessId, completed,
claimed, modified,
classificationSummary, planned,
completed, due,
created, name,
creator, creator,
custom1, description,
custom10, note,
custom11, priority,
custom12, state,
custom13, classificationSummary,
custom14, workbasketSummary,
custom15, businessProcessId,
custom16, parentBusinessProcessId,
custom2, owner,
custom3, primaryObjRef,
custom4, isRead,
custom5, isTransferred,
custom6, customAttributes,
custom7, callbackInfo,
custom8, callbackState,
custom9, attachments,
customAttributes, custom1,
callbackInfo, custom2,
callbackState, custom3,
description, custom4,
due, custom5,
id, custom6,
modified, custom7,
name, custom8,
note, custom9,
owner, custom10,
parentBusinessProcessId, custom11,
planned, custom12,
primaryObjRef, custom13,
state, custom14,
workbasketSummary custom15,
}; custom16);
for (Object property : myFields) {
result = prime * result + (property == null ? 0 : property.hashCode());
}
result = prime * result + (isRead ? 1231 : 1237);
result = prime * result + (isTransferred ? 1231 : 1237);
result = prime * result + priority;
return result;
} }
@Override @Override
@ -783,112 +775,52 @@ public class TaskImpl implements Task {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (!getClass().isAssignableFrom(obj.getClass())) { if (getClass() != obj.getClass()) {
return false; return false;
} }
TaskImpl other = (TaskImpl) obj; TaskImpl other = (TaskImpl) obj;
return priority == other.priority
Object[] myFields = { && isRead == other.isRead
externalId, && isTransferred == other.isTransferred
attachments, && Objects.equals(id, other.id)
businessProcessId, && Objects.equals(externalId, other.externalId)
claimed, && Objects.equals(created, other.created)
classificationSummary, && Objects.equals(claimed, other.claimed)
completed, && Objects.equals(completed, other.completed)
created, && Objects.equals(modified, other.modified)
creator, && Objects.equals(planned, other.planned)
custom1, && Objects.equals(due, other.due)
custom10, && Objects.equals(name, other.name)
custom11, && Objects.equals(creator, other.creator)
custom12, && Objects.equals(description, other.description)
custom13, && Objects.equals(note, other.note)
custom14, && state == other.state
custom15, && Objects.equals(classificationSummary, other.classificationSummary)
custom16, && Objects.equals(workbasketSummary, other.workbasketSummary)
custom2, && Objects.equals(businessProcessId, other.businessProcessId)
custom3, && Objects.equals(parentBusinessProcessId, other.parentBusinessProcessId)
custom4, && Objects.equals(owner, other.owner)
custom5, && Objects.equals(primaryObjRef, other.primaryObjRef)
custom6, && Objects.equals(customAttributes, other.customAttributes)
custom7, && Objects.equals(callbackInfo, other.callbackInfo)
custom8, && callbackState == other.callbackState
custom9, && Objects.equals(attachments, other.attachments)
customAttributes, && Objects.equals(custom1, other.custom1)
callbackInfo, && Objects.equals(custom2, other.custom2)
callbackState, && Objects.equals(custom3, other.custom3)
description, && Objects.equals(custom4, other.custom4)
due, && Objects.equals(custom5, other.custom5)
id, && Objects.equals(custom6, other.custom6)
modified, && Objects.equals(custom7, other.custom7)
name, && Objects.equals(custom8, other.custom8)
note, && Objects.equals(custom9, other.custom9)
owner, && Objects.equals(custom10, other.custom10)
parentBusinessProcessId, && Objects.equals(custom11, other.custom11)
planned, && Objects.equals(custom12, other.custom12)
primaryObjRef, && Objects.equals(custom13, other.custom13)
state, && Objects.equals(custom14, other.custom14)
workbasketSummary && Objects.equals(custom15, other.custom15)
}; && Objects.equals(custom16, other.custom16);
Object[] otherFields = {
other.externalId,
other.attachments,
other.businessProcessId,
other.claimed,
other.classificationSummary,
other.completed,
other.created,
other.creator,
other.custom1,
other.custom10,
other.custom11,
other.custom12,
other.custom13,
other.custom14,
other.custom15,
other.custom16,
other.custom2,
other.custom3,
other.custom4,
other.custom5,
other.custom6,
other.custom7,
other.custom8,
other.custom9,
other.customAttributes,
other.callbackInfo,
other.callbackState,
other.description,
other.due,
other.id,
other.modified,
other.name,
other.note,
other.owner,
other.parentBusinessProcessId,
other.planned,
other.primaryObjRef,
other.state,
other.workbasketSummary
};
if (myFields.length != otherFields.length) {
throw new SystemException("TaskSummaryImpl: length mismatch between internal arrays");
}
for (int i = 0; i < myFields.length; i++) {
if ((myFields[i] == null && otherFields[i] != null)
|| (myFields[i] != null && !myFields[i].equals(otherFields[i]))) {
return false;
}
}
if (isRead != other.isRead) {
return false;
}
if (isTransferred != other.isTransferred) {
return false;
}
return (priority == other.priority);
} }
@Override @Override

View File

@ -3,6 +3,7 @@ package pro.taskana.impl;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import pro.taskana.AttachmentSummary; import pro.taskana.AttachmentSummary;
import pro.taskana.ClassificationSummary; import pro.taskana.ClassificationSummary;
@ -11,7 +12,6 @@ import pro.taskana.TaskState;
import pro.taskana.TaskSummary; import pro.taskana.TaskSummary;
import pro.taskana.WorkbasketSummary; import pro.taskana.WorkbasketSummary;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.SystemException;
/** Entity which contains the most important informations about a Task. */ /** Entity which contains the most important informations about a Task. */
public class TaskSummaryImpl implements TaskSummary { public class TaskSummaryImpl implements TaskSummary {
@ -590,53 +590,45 @@ public class TaskSummaryImpl implements TaskSummary {
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; return Objects.hash(
int result = 1; taskId,
Object[] myFields = { externalId,
externalId, created,
attachmentSummaries, claimed,
businessProcessId, completed,
claimed, modified,
classificationSummary, planned,
completed, due,
created, name,
creator, creator,
custom1, note,
custom10, priority,
custom11, state,
custom12, classificationSummary,
custom13, workbasketSummary,
custom14, businessProcessId,
custom15, parentBusinessProcessId,
custom16, owner,
custom2, primaryObjRef,
custom3, isRead,
custom4, isTransferred,
custom5, attachmentSummaries,
custom6, custom1,
custom7, custom2,
custom8, custom3,
custom9, custom4,
due, custom5,
modified, custom6,
name, custom7,
note, custom8,
owner, custom9,
parentBusinessProcessId, custom10,
planned, custom11,
primaryObjRef, custom12,
state, custom13,
taskId, custom14,
workbasketSummary custom15,
}; custom16);
for (Object property : myFields) {
result = prime * result + (property == null ? 0 : property.hashCode());
}
result = prime * result + (isRead ? 1231 : 1237);
result = prime * result + (isTransferred ? 1231 : 1237);
result = prime * result + priority;
return result;
} }
@Override @Override
@ -647,103 +639,48 @@ public class TaskSummaryImpl implements TaskSummary {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (!getClass().isAssignableFrom(obj.getClass())) { if (getClass() != obj.getClass()) {
return false; return false;
} }
TaskSummaryImpl other = (TaskSummaryImpl) obj; TaskSummaryImpl other = (TaskSummaryImpl) obj;
Object[] myFields = { return priority == other.priority
externalId, && isRead == other.isRead
attachmentSummaries, && isTransferred == other.isTransferred
businessProcessId, && Objects.equals(taskId, other.taskId)
claimed, && Objects.equals(externalId, other.externalId)
classificationSummary, && Objects.equals(created, other.created)
completed, && Objects.equals(claimed, other.claimed)
created, && Objects.equals(completed, other.completed)
creator, && Objects.equals(modified, other.modified)
custom1, && Objects.equals(planned, other.planned)
custom10, && Objects.equals(due, other.due)
custom11, && Objects.equals(name, other.name)
custom12, && Objects.equals(creator, other.creator)
custom13, && Objects.equals(note, other.note)
custom14, && state == other.state
custom15, && Objects.equals(classificationSummary, other.classificationSummary)
custom16, && Objects.equals(workbasketSummary, other.workbasketSummary)
custom2, && Objects.equals(businessProcessId, other.businessProcessId)
custom3, && Objects.equals(parentBusinessProcessId, other.parentBusinessProcessId)
custom4, && Objects.equals(owner, other.owner)
custom5, && Objects.equals(primaryObjRef, other.primaryObjRef)
custom6, && Objects.equals(attachmentSummaries, other.attachmentSummaries)
custom7, && Objects.equals(custom1, other.custom1)
custom8, && Objects.equals(custom2, other.custom2)
custom9, && Objects.equals(custom3, other.custom3)
due, && Objects.equals(custom4, other.custom4)
modified, && Objects.equals(custom5, other.custom5)
name, && Objects.equals(custom6, other.custom6)
note, && Objects.equals(custom7, other.custom7)
owner, && Objects.equals(custom8, other.custom8)
parentBusinessProcessId, && Objects.equals(custom9, other.custom9)
planned, && Objects.equals(custom10, other.custom10)
primaryObjRef, && Objects.equals(custom11, other.custom11)
state, && Objects.equals(custom12, other.custom12)
taskId, && Objects.equals(custom13, other.custom13)
workbasketSummary && Objects.equals(custom14, other.custom14)
}; && Objects.equals(custom15, other.custom15)
&& Objects.equals(custom16, other.custom16);
Object[] otherFields = {
other.externalId,
other.attachmentSummaries,
other.businessProcessId,
other.claimed,
other.classificationSummary,
other.completed,
other.created,
other.creator,
other.custom1,
other.custom10,
other.custom11,
other.custom12,
other.custom13,
other.custom14,
other.custom15,
other.custom16,
other.custom2,
other.custom3,
other.custom4,
other.custom5,
other.custom6,
other.custom7,
other.custom8,
other.custom9,
other.due,
other.modified,
other.name,
other.note,
other.owner,
other.parentBusinessProcessId,
other.planned,
other.primaryObjRef,
other.state,
other.taskId,
other.workbasketSummary
};
if (myFields.length != otherFields.length) {
throw new SystemException("TaskSummaryImpl: length mismatch between internal arrays");
}
for (int i = 0; i < myFields.length; i++) {
if ((myFields[i] == null && otherFields[i] != null)
|| (myFields[i] != null && !myFields[i].equals(otherFields[i]))) {
return false;
}
}
if (isRead != other.isRead) {
return false;
}
if (isTransferred != other.isTransferred) {
return false;
}
return (priority == other.priority);
} }
@Override @Override

View File

@ -1,5 +1,7 @@
package pro.taskana.impl; package pro.taskana.impl;
import java.util.Objects;
import pro.taskana.WorkbasketAccessItem; import pro.taskana.WorkbasketAccessItem;
import pro.taskana.configuration.TaskanaEngineConfiguration; import pro.taskana.configuration.TaskanaEngineConfiguration;
@ -415,31 +417,29 @@ public class WorkbasketAccessItemImpl implements WorkbasketAccessItem {
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; return Objects.hash(
int result = 1; id,
result = prime * result + ((accessId == null) ? 0 : accessId.hashCode()); workbasketId,
result = prime * result + ((id == null) ? 0 : id.hashCode()); workbasketKey,
result = prime * result + (permAppend ? 1231 : 1237); accessId,
result = prime * result + (permCustom1 ? 1231 : 1237); accessName,
result = prime * result + (permCustom10 ? 1231 : 1237); permRead,
result = prime * result + (permCustom11 ? 1231 : 1237); permOpen,
result = prime * result + (permCustom12 ? 1231 : 1237); permAppend,
result = prime * result + (permCustom2 ? 1231 : 1237); permTransfer,
result = prime * result + (permCustom3 ? 1231 : 1237); permDistribute,
result = prime * result + (permCustom4 ? 1231 : 1237); permCustom1,
result = prime * result + (permCustom5 ? 1231 : 1237); permCustom2,
result = prime * result + (permCustom6 ? 1231 : 1237); permCustom3,
result = prime * result + (permCustom7 ? 1231 : 1237); permCustom4,
result = prime * result + (permCustom8 ? 1231 : 1237); permCustom5,
result = prime * result + (permCustom9 ? 1231 : 1237); permCustom6,
result = prime * result + (permDistribute ? 1231 : 1237); permCustom7,
result = prime * result + (permOpen ? 1231 : 1237); permCustom8,
result = prime * result + (permRead ? 1231 : 1237); permCustom9,
result = prime * result + (permTransfer ? 1231 : 1237); permCustom10,
result = prime * result + ((workbasketId == null) ? 0 : workbasketId.hashCode()); permCustom11,
result = prime * result + ((workbasketKey == null) ? 0 : workbasketKey.hashCode()); permCustom12);
result = prime * result + ((accessName == null) ? 0 : accessName.hashCode());
return result;
} }
@Override @Override
@ -450,97 +450,32 @@ public class WorkbasketAccessItemImpl implements WorkbasketAccessItem {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (!getClass().isAssignableFrom(obj.getClass())) { if (getClass() != obj.getClass()) {
return false; return false;
} }
WorkbasketAccessItemImpl other = (WorkbasketAccessItemImpl) obj; WorkbasketAccessItemImpl other = (WorkbasketAccessItemImpl) obj;
if (accessId == null) { return permRead == other.permRead
if (other.accessId != null) { && permOpen == other.permOpen
return false; && permAppend == other.permAppend
} && permTransfer == other.permTransfer
} else if (!accessId.equals(other.accessId)) { && permDistribute == other.permDistribute
return false; && permCustom1 == other.permCustom1
} && permCustom2 == other.permCustom2
if (id == null) { && permCustom3 == other.permCustom3
if (other.id != null) { && permCustom4 == other.permCustom4
return false; && permCustom5 == other.permCustom5
} && permCustom6 == other.permCustom6
} else if (!id.equals(other.id)) { && permCustom7 == other.permCustom7
return false; && permCustom8 == other.permCustom8
} && permCustom9 == other.permCustom9
if (permAppend != other.permAppend) { && permCustom10 == other.permCustom10
return false; && permCustom11 == other.permCustom11
} && permCustom12 == other.permCustom12
if (permCustom1 != other.permCustom1) { && Objects.equals(id, other.id)
return false; && Objects.equals(workbasketId, other.workbasketId)
} && Objects.equals(workbasketKey, other.workbasketKey)
if (permCustom10 != other.permCustom10) { && Objects.equals(accessId, other.accessId)
return false; && Objects.equals(accessName, other.accessName);
}
if (permCustom11 != other.permCustom11) {
return false;
}
if (permCustom12 != other.permCustom12) {
return false;
}
if (permCustom2 != other.permCustom2) {
return false;
}
if (permCustom3 != other.permCustom3) {
return false;
}
if (permCustom4 != other.permCustom4) {
return false;
}
if (permCustom5 != other.permCustom5) {
return false;
}
if (permCustom6 != other.permCustom6) {
return false;
}
if (permCustom7 != other.permCustom7) {
return false;
}
if (permCustom8 != other.permCustom8) {
return false;
}
if (permCustom9 != other.permCustom9) {
return false;
}
if (permDistribute != other.permDistribute) {
return false;
}
if (permOpen != other.permOpen) {
return false;
}
if (permRead != other.permRead) {
return false;
}
if (permTransfer != other.permTransfer) {
return false;
}
if (workbasketId == null) {
if (other.workbasketId != null) {
return false;
}
} else if (!workbasketId.equals(other.workbasketId)) {
return false;
}
if (workbasketKey == null) {
if (other.workbasketKey != null) {
return false;
}
} else if (!workbasketKey.equals(other.workbasketKey)) {
return false;
}
if (accessName == null) {
if (other.accessName != null) {
return false;
}
} else if (!accessName.equals(other.accessName)) {
return false;
}
return true;
} }
@Override @Override

View File

@ -1,6 +1,7 @@
package pro.taskana.impl; package pro.taskana.impl;
import java.time.Instant; import java.time.Instant;
import java.util.Objects;
import pro.taskana.Workbasket; import pro.taskana.Workbasket;
import pro.taskana.WorkbasketSummary; import pro.taskana.WorkbasketSummary;
@ -229,27 +230,25 @@ public class WorkbasketImpl implements Workbasket {
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; return Objects.hash(
int result = 1; id,
result = prime * result + ((created == null) ? 0 : created.hashCode()); key,
result = prime * result + ((custom1 == null) ? 0 : custom1.hashCode()); created,
result = prime * result + ((custom2 == null) ? 0 : custom2.hashCode()); modified,
result = prime * result + ((custom3 == null) ? 0 : custom3.hashCode()); name,
result = prime * result + ((custom4 == null) ? 0 : custom4.hashCode()); description,
result = prime * result + ((description == null) ? 0 : description.hashCode()); owner,
result = prime * result + ((domain == null) ? 0 : domain.hashCode()); domain,
result = prime * result + ((id == null) ? 0 : id.hashCode()); type,
result = prime * result + ((key == null) ? 0 : key.hashCode()); custom1,
result = prime * result + (markedForDeletion ? 1231 : 1237); custom2,
result = prime * result + ((modified == null) ? 0 : modified.hashCode()); custom3,
result = prime * result + ((name == null) ? 0 : name.hashCode()); custom4,
result = prime * result + ((orgLevel1 == null) ? 0 : orgLevel1.hashCode()); orgLevel1,
result = prime * result + ((orgLevel2 == null) ? 0 : orgLevel2.hashCode()); orgLevel2,
result = prime * result + ((orgLevel3 == null) ? 0 : orgLevel3.hashCode()); orgLevel3,
result = prime * result + ((orgLevel4 == null) ? 0 : orgLevel4.hashCode()); orgLevel4,
result = prime * result + ((owner == null) ? 0 : owner.hashCode()); markedForDeletion);
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
} }
@Override @Override
@ -260,130 +259,28 @@ public class WorkbasketImpl implements Workbasket {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!getClass().isAssignableFrom(obj.getClass())) {
return false; return false;
} }
WorkbasketImpl other = (WorkbasketImpl) obj; WorkbasketImpl other = (WorkbasketImpl) obj;
if (created == null) { return markedForDeletion == other.markedForDeletion
if (other.created != null) { && Objects.equals(id, other.id)
return false; && Objects.equals(key, other.key)
} && Objects.equals(created, other.created)
} else if (!created.equals(other.created)) { && Objects.equals(modified, other.modified)
return false; && Objects.equals(name, other.name)
} && Objects.equals(description, other.description)
if (custom1 == null) { && Objects.equals(owner, other.owner)
if (other.custom1 != null) { && Objects.equals(domain, other.domain)
return false; && type == other.type
} && Objects.equals(custom1, other.custom1)
} else if (!custom1.equals(other.custom1)) { && Objects.equals(custom2, other.custom2)
return false; && Objects.equals(custom3, other.custom3)
} && Objects.equals(custom4, other.custom4)
if (custom2 == null) { && Objects.equals(orgLevel1, other.orgLevel1)
if (other.custom2 != null) { && Objects.equals(orgLevel2, other.orgLevel2)
return false; && Objects.equals(orgLevel3, other.orgLevel3)
} && Objects.equals(orgLevel4, other.orgLevel4);
} else if (!custom2.equals(other.custom2)) {
return false;
}
if (custom3 == null) {
if (other.custom3 != null) {
return false;
}
} else if (!custom3.equals(other.custom3)) {
return false;
}
if (custom4 == null) {
if (other.custom4 != null) {
return false;
}
} else if (!custom4.equals(other.custom4)) {
return false;
}
if (description == null) {
if (other.description != null) {
return false;
}
} else if (!description.equals(other.description)) {
return false;
}
if (domain == null) {
if (other.domain != null) {
return false;
}
} else if (!domain.equals(other.domain)) {
return false;
}
if (id == null) {
if (other.id != null) {
return false;
}
} else if (!id.equals(other.id)) {
return false;
}
if (key == null) {
if (other.key != null) {
return false;
}
} else if (!key.equals(other.key)) {
return false;
}
if (markedForDeletion != other.markedForDeletion) {
return false;
}
if (modified == null) {
if (other.modified != null) {
return false;
}
} else if (!modified.equals(other.modified)) {
return false;
}
if (name == null) {
if (other.name != null) {
return false;
}
} else if (!name.equals(other.name)) {
return false;
}
if (orgLevel1 == null) {
if (other.orgLevel1 != null) {
return false;
}
} else if (!orgLevel1.equals(other.orgLevel1)) {
return false;
}
if (orgLevel2 == null) {
if (other.orgLevel2 != null) {
return false;
}
} else if (!orgLevel2.equals(other.orgLevel2)) {
return false;
}
if (orgLevel3 == null) {
if (other.orgLevel3 != null) {
return false;
}
} else if (!orgLevel3.equals(other.orgLevel3)) {
return false;
}
if (orgLevel4 == null) {
if (other.orgLevel4 != null) {
return false;
}
} else if (!orgLevel4.equals(other.orgLevel4)) {
return false;
}
if (owner == null) {
if (other.owner != null) {
return false;
}
} else if (!owner.equals(other.owner)) {
return false;
}
if (type != other.type) {
return false;
}
return true;
} }
@Override @Override

View File

@ -1,5 +1,7 @@
package pro.taskana.impl; package pro.taskana.impl;
import java.util.Objects;
import pro.taskana.WorkbasketSummary; import pro.taskana.WorkbasketSummary;
import pro.taskana.WorkbasketType; import pro.taskana.WorkbasketType;
@ -231,25 +233,23 @@ public class WorkbasketSummaryImpl implements WorkbasketSummary {
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; return Objects.hash(
int result = 1; id,
result = prime * result + ((custom1 == null) ? 0 : custom1.hashCode()); key,
result = prime * result + ((custom2 == null) ? 0 : custom2.hashCode()); name,
result = prime * result + ((custom3 == null) ? 0 : custom3.hashCode()); description,
result = prime * result + ((custom4 == null) ? 0 : custom4.hashCode()); owner,
result = prime * result + ((description == null) ? 0 : description.hashCode()); domain,
result = prime * result + ((domain == null) ? 0 : domain.hashCode()); type,
result = prime * result + ((id == null) ? 0 : id.hashCode()); custom1,
result = prime * result + ((key == null) ? 0 : key.hashCode()); custom2,
result = prime * result + (markedForDeletion ? 1231 : 1237); custom3,
result = prime * result + ((name == null) ? 0 : name.hashCode()); custom4,
result = prime * result + ((orgLevel1 == null) ? 0 : orgLevel1.hashCode()); orgLevel1,
result = prime * result + ((orgLevel2 == null) ? 0 : orgLevel2.hashCode()); orgLevel2,
result = prime * result + ((orgLevel3 == null) ? 0 : orgLevel3.hashCode()); orgLevel3,
result = prime * result + ((orgLevel4 == null) ? 0 : orgLevel4.hashCode()); orgLevel4,
result = prime * result + ((owner == null) ? 0 : owner.hashCode()); markedForDeletion);
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
} }
@Override @Override
@ -260,115 +260,26 @@ public class WorkbasketSummaryImpl implements WorkbasketSummary {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (!getClass().isAssignableFrom(obj.getClass())) { if (getClass() != obj.getClass()) {
return false; return false;
} }
WorkbasketSummaryImpl other = (WorkbasketSummaryImpl) obj; WorkbasketSummaryImpl other = (WorkbasketSummaryImpl) obj;
if (custom1 == null) { return markedForDeletion == other.markedForDeletion
if (other.custom1 != null) { && Objects.equals(id, other.id)
return false; && Objects.equals(key, other.key)
} && Objects.equals(name, other.name)
} else if (!custom1.equals(other.custom1)) { && Objects.equals(description, other.description)
return false; && Objects.equals(owner, other.owner)
} && Objects.equals(domain, other.domain)
if (custom2 == null) { && type == other.type
if (other.custom2 != null) { && Objects.equals(custom1, other.custom1)
return false; && Objects.equals(custom2, other.custom2)
} && Objects.equals(custom3, other.custom3)
} else if (!custom2.equals(other.custom2)) { && Objects.equals(custom4, other.custom4)
return false; && Objects.equals(orgLevel1, other.orgLevel1)
} && Objects.equals(orgLevel2, other.orgLevel2)
if (custom3 == null) { && Objects.equals(orgLevel3, other.orgLevel3)
if (other.custom3 != null) { && Objects.equals(orgLevel4, other.orgLevel4);
return false;
}
} else if (!custom3.equals(other.custom3)) {
return false;
}
if (custom4 == null) {
if (other.custom4 != null) {
return false;
}
} else if (!custom4.equals(other.custom4)) {
return false;
}
if (description == null) {
if (other.description != null) {
return false;
}
} else if (!description.equals(other.description)) {
return false;
}
if (domain == null) {
if (other.domain != null) {
return false;
}
} else if (!domain.equals(other.domain)) {
return false;
}
if (id == null) {
if (other.id != null) {
return false;
}
} else if (!id.equals(other.id)) {
return false;
}
if (key == null) {
if (other.key != null) {
return false;
}
} else if (!key.equals(other.key)) {
return false;
}
if (markedForDeletion != other.markedForDeletion) {
return false;
}
if (name == null) {
if (other.name != null) {
return false;
}
} else if (!name.equals(other.name)) {
return false;
}
if (orgLevel1 == null) {
if (other.orgLevel1 != null) {
return false;
}
} else if (!orgLevel1.equals(other.orgLevel1)) {
return false;
}
if (orgLevel2 == null) {
if (other.orgLevel2 != null) {
return false;
}
} else if (!orgLevel2.equals(other.orgLevel2)) {
return false;
}
if (orgLevel3 == null) {
if (other.orgLevel3 != null) {
return false;
}
} else if (!orgLevel3.equals(other.orgLevel3)) {
return false;
}
if (orgLevel4 == null) {
if (other.orgLevel4 != null) {
return false;
}
} else if (!orgLevel4.equals(other.orgLevel4)) {
return false;
}
if (owner == null) {
if (other.owner != null) {
return false;
}
} else if (!owner.equals(other.owner)) {
return false;
}
if (type != other.type) {
return false;
}
return true;
} }
@Override @Override