diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationImpl.java index 7af1647c0..ddff3fc44 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationImpl.java @@ -1,6 +1,7 @@ package pro.taskana.impl; import java.time.Instant; +import java.util.Objects; import pro.taskana.Classification; import pro.taskana.ClassificationSummary; @@ -8,31 +9,13 @@ import pro.taskana.ClassificationSummary; /** * Classification entity. */ -public class ClassificationImpl implements Classification { +public class ClassificationImpl extends ClassificationSummaryImpl implements Classification { - private String id; - private String key; - private String parentId; - private String parentKey; - private String category; - private String type; - private String domain; private Boolean isValidInDomain; private Instant created; private Instant modified; - private String name; private String description; - private int priority; - private String serviceLevel; // PddDThhHmmM private String applicationEntryPoint; - private String custom1; - private String custom2; - private String custom3; - private String custom4; - private String custom5; - private String custom6; - private String custom7; - private String custom8; ClassificationImpl() { } @@ -63,72 +46,6 @@ public class ClassificationImpl implements Classification { this.custom8 = classification.getCustom8(); } - @Override - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @Override - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - @Override - public String getParentId() { - return parentId; - } - - @Override - public void setParentId(String parentId) { - this.parentId = parentId; - } - - @Override - public String getParentKey() { - return parentKey; - } - - @Override - public void setParentKey(String parentKey) { - this.parentKey = parentKey; - } - - @Override - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - @Override - public String getCategory() { - return category; - } - - @Override - public void setCategory(String category) { - this.category = category; - } - - @Override - public String getDomain() { - return this.domain; - } - - public void setDomain(String domain) { - this.domain = domain; - } - @Override public Boolean getIsValidInDomain() { return isValidInDomain; @@ -157,16 +74,6 @@ public class ClassificationImpl implements Classification { this.modified = modified; } - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - @Override public String getDescription() { return description; @@ -177,26 +84,6 @@ public class ClassificationImpl implements Classification { this.description = description; } - @Override - public int getPriority() { - return priority; - } - - @Override - public void setPriority(int priority) { - this.priority = priority; - } - - @Override - public String getServiceLevel() { - return serviceLevel; - } - - @Override - public void setServiceLevel(String serviceLevel) { - this.serviceLevel = serviceLevel; - } - @Override public String getApplicationEntryPoint() { return applicationEntryPoint; @@ -207,86 +94,6 @@ public class ClassificationImpl implements Classification { this.applicationEntryPoint = applicationEntryPoint; } - @Override - public String getCustom1() { - return custom1; - } - - @Override - public void setCustom1(String custom1) { - this.custom1 = custom1; - } - - @Override - public String getCustom2() { - return custom2; - } - - @Override - public void setCustom2(String custom2) { - this.custom2 = custom2; - } - - @Override - public String getCustom3() { - return custom3; - } - - @Override - public void setCustom3(String custom3) { - this.custom3 = custom3; - } - - @Override - public String getCustom4() { - return custom4; - } - - @Override - public void setCustom4(String custom4) { - this.custom4 = custom4; - } - - @Override - public String getCustom5() { - return custom5; - } - - @Override - public void setCustom5(String custom5) { - this.custom5 = custom5; - } - - @Override - public String getCustom6() { - return custom6; - } - - @Override - public void setCustom6(String custom6) { - this.custom6 = custom6; - } - - @Override - public String getCustom7() { - return custom7; - } - - @Override - public void setCustom7(String custom7) { - this.custom7 = custom7; - } - - @Override - public String getCustom8() { - return custom8; - } - - @Override - public void setCustom8(String custom8) { - this.custom8 = custom8; - } - @Override public ClassificationSummary asSummary() { ClassificationSummaryImpl summary = new ClassificationSummaryImpl(); @@ -323,205 +130,26 @@ public class ClassificationImpl implements Classification { } @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((applicationEntryPoint == null) ? 0 : applicationEntryPoint.hashCode()); - result = prime * result + ((category == null) ? 0 : category.hashCode()); - result = prime * result + ((created == null) ? 0 : created.hashCode()); - result = prime * result + ((custom1 == null) ? 0 : custom1.hashCode()); - result = prime * result + ((custom2 == null) ? 0 : custom2.hashCode()); - result = prime * result + ((custom3 == null) ? 0 : custom3.hashCode()); - result = prime * result + ((custom4 == null) ? 0 : custom4.hashCode()); - result = prime * result + ((custom5 == null) ? 0 : custom5.hashCode()); - result = prime * result + ((custom6 == null) ? 0 : custom6.hashCode()); - result = prime * result + ((custom7 == null) ? 0 : custom7.hashCode()); - result = prime * result + ((custom8 == null) ? 0 : custom8.hashCode()); - result = prime * result + ((description == null) ? 0 : description.hashCode()); - result = prime * result + ((domain == null) ? 0 : domain.hashCode()); - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((isValidInDomain == null) ? 0 : isValidInDomain.hashCode()); - result = prime * result + ((key == null) ? 0 : key.hashCode()); - result = prime * result + ((modified == null) ? 0 : modified.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((parentId == null) ? 0 : parentId.hashCode()); - result = prime * result + ((parentKey == null) ? 0 : parentKey.hashCode()); - result = prime * result + priority; - result = prime * result + ((serviceLevel == null) ? 0 : serviceLevel.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - return result; + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + ClassificationImpl that = (ClassificationImpl) o; + 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 - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - ClassificationImpl other = (ClassificationImpl) obj; - if (applicationEntryPoint == null) { - if (other.applicationEntryPoint != null) { - return false; - } - } else if (!applicationEntryPoint.equals(other.applicationEntryPoint)) { - return false; - } - if (category == null) { - if (other.category != null) { - return false; - } - } else if (!category.equals(other.category)) { - return false; - } - if (created == null) { - if (other.created != null) { - return false; - } - } else if (!created.equals(other.created)) { - return false; - } - if (custom1 == null) { - if (other.custom1 != null) { - return false; - } - } else if (!custom1.equals(other.custom1)) { - return false; - } - if (custom2 == null) { - if (other.custom2 != null) { - return false; - } - } 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 (custom5 == null) { - if (other.custom5 != null) { - return false; - } - } else if (!custom5.equals(other.custom5)) { - return false; - } - if (custom6 == null) { - if (other.custom6 != null) { - return false; - } - } else if (!custom6.equals(other.custom6)) { - return false; - } - if (custom7 == null) { - if (other.custom7 != null) { - return false; - } - } else if (!custom7.equals(other.custom7)) { - return false; - } - if (custom8 == null) { - if (other.custom8 != null) { - return false; - } - } else if (!custom8.equals(other.custom8)) { - 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 (isValidInDomain == null) { - if (other.isValidInDomain != null) { - return false; - } - } else if (!isValidInDomain.equals(other.isValidInDomain)) { - return false; - } - if (key == null) { - if (other.key != null) { - return false; - } - } else if (!key.equals(other.key)) { - 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 (parentId == null) { - if (other.parentId != null) { - return false; - } - } else if (!parentId.equals(other.parentId)) { - return false; - } - if (parentKey == null) { - if (other.parentKey != null) { - return false; - } - } else if (!parentKey.equals(other.parentKey)) { - return false; - } - if (priority != other.priority) { - return false; - } - if (serviceLevel == null) { - if (other.serviceLevel != null) { - return false; - } - } else if (!serviceLevel.equals(other.serviceLevel)) { - return false; - } - if (type == null) { - if (other.type != null) { - return false; - } - } else if (!type.equals(other.type)) { - return false; - } - return true; + public int hashCode() { + return Objects.hash(super.hashCode(), isValidInDomain, created, modified, description, applicationEntryPoint); } - } diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationSummaryImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationSummaryImpl.java index 5331935e7..a6c6a784b 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationSummaryImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationSummaryImpl.java @@ -1,5 +1,7 @@ package pro.taskana.impl; +import java.util.Objects; + import pro.taskana.ClassificationSummary; /** @@ -7,24 +9,27 @@ import pro.taskana.ClassificationSummary; */ public class ClassificationSummaryImpl implements ClassificationSummary { - private String id; - private String key; - private String category; - private String type; - private String domain; - private String name; - private String parentId; - private String parentKey; - private int priority; - private String serviceLevel; // PddDThhHmmM - private String custom1; - private String custom2; - private String custom3; - private String custom4; - private String custom5; - private String custom6; - private String custom7; - private String custom8; + protected String id; + protected String key; + protected String category; + protected String type; + protected String domain; + protected String name; + protected String parentId; + protected String parentKey; + protected int priority; + protected String serviceLevel; // PddDThhHmmM + protected String custom1; + protected String custom2; + protected String custom3; + protected String custom4; + protected String custom5; + protected String custom6; + protected String custom7; + protected String custom8; + + ClassificationSummaryImpl() { + } @Override public int getPriority() { @@ -44,9 +49,6 @@ public class ClassificationSummaryImpl implements ClassificationSummary { this.serviceLevel = serviceLevel; } - ClassificationSummaryImpl() { - } - @Override public String getId() { return id; @@ -200,153 +202,38 @@ public class ClassificationSummaryImpl implements ClassificationSummary { } @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((category == null) ? 0 : category.hashCode()); - result = prime * result + ((domain == null) ? 0 : domain.hashCode()); - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((key == null) ? 0 : key.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((parentId == null) ? 0 : parentId.hashCode()); - result = prime * result + ((parentKey == null) ? 0 : parentKey.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((custom1 == null) ? 0 : custom1.hashCode()); - result = prime * result + ((custom2 == null) ? 0 : custom2.hashCode()); - result = prime * result + ((custom3 == null) ? 0 : custom3.hashCode()); - result = prime * result + ((custom4 == null) ? 0 : custom4.hashCode()); - result = prime * result + ((custom5 == null) ? 0 : custom5.hashCode()); - result = prime * result + ((custom6 == null) ? 0 : custom6.hashCode()); - result = prime * result + ((custom7 == null) ? 0 : custom7.hashCode()); - result = prime * result + ((custom8 == null) ? 0 : custom8.hashCode()); - return result; + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassificationSummaryImpl that = (ClassificationSummaryImpl) o; + return priority == that.priority + && Objects.equals(id, that.id) + && Objects.equals(key, that.key) + && Objects.equals(category, that.category) + && Objects.equals(type, that.type) + && Objects.equals(domain, that.domain) + && Objects.equals(name, that.name) + && Objects.equals(parentId, that.parentId) + && Objects.equals(parentKey, that.parentKey) + && Objects.equals(serviceLevel, that.serviceLevel) + && Objects.equals(custom1, that.custom1) + && Objects.equals(custom2, that.custom2) + && 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 - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof ClassificationSummaryImpl)) { - return false; - } - ClassificationSummaryImpl other = (ClassificationSummaryImpl) obj; - if (category == null) { - if (other.category != null) { - return false; - } - } else if (!category.equals(other.category)) { - 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 (name == null) { - if (other.name != null) { - return false; - } - } else if (!name.equals(other.name)) { - return false; - } - if (parentId == null) { - if (other.parentId != null) { - return false; - } - } else if (!parentId.equals(other.parentId)) { - return false; - } - if (parentKey == null) { - if (other.parentKey != null) { - return false; - } - } else if (!parentKey.equals(other.parentKey)) { - return false; - } - if (type == null) { - if (other.type != null) { - return false; - } - } else if (!type.equals(other.type)) { - return false; - } - if (custom1 == null) { - if (other.custom1 != null) { - return false; - } - } else if (!custom1.equals(other.custom1)) { - return false; - } - if (custom2 == null) { - if (other.custom2 != null) { - return false; - } - } 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 (custom5 == null) { - if (other.custom5 != null) { - return false; - } - } else if (!custom5.equals(other.custom5)) { - return false; - } - if (custom6 == null) { - if (other.custom6 != null) { - return false; - } - } else if (!custom6.equals(other.custom6)) { - return false; - } - if (custom7 == null) { - if (other.custom7 != null) { - return false; - } - } else if (!custom7.equals(other.custom7)) { - return false; - } - if (custom8 == null) { - if (other.custom8 != null) { - return false; - } - } else if (!custom8.equals(other.custom8)) { - return false; - } - return true; + public int hashCode() { + return Objects.hash(id, key, category, type, domain, name, parentId, parentKey, priority, serviceLevel, custom1, + custom2, custom3, custom4, custom5, custom6, custom7, custom8); } @Override