TSK-1065 Refactor WorkbasketImpl
This commit is contained in:
parent
5815e38fa7
commit
819b4ca699
|
@ -3,64 +3,8 @@ package pro.taskana.workbasket.api;
|
|||
import java.time.Instant;
|
||||
|
||||
/** Workbasket entity interface. */
|
||||
// @JsonDeserialize(as = WorkbasketImpl.class)
|
||||
public interface Workbasket {
|
||||
|
||||
/**
|
||||
* Returns the unique id of a workbasket.
|
||||
*
|
||||
* @return workbasketId
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* Returns the date when the workbasket was created.
|
||||
*
|
||||
* @return created as Instant
|
||||
*/
|
||||
Instant getCreated();
|
||||
|
||||
/**
|
||||
* Returns the key of the workbasket.
|
||||
*
|
||||
* @return the key of the workbasket
|
||||
*/
|
||||
String getKey();
|
||||
|
||||
/**
|
||||
* Returns the domain of the workbasket.
|
||||
*
|
||||
* @return domain of the workbasket
|
||||
*/
|
||||
String getDomain();
|
||||
|
||||
/**
|
||||
* Returns the type of the workbasket.
|
||||
*
|
||||
* @return the type of the workbasket
|
||||
*/
|
||||
WorkbasketType getType();
|
||||
|
||||
/**
|
||||
* Sets the type of the workbasket.
|
||||
*
|
||||
* @param type the type of the workbasket
|
||||
*/
|
||||
void setType(WorkbasketType type);
|
||||
|
||||
/**
|
||||
* Returns the date when the workbasket was modified the last time.
|
||||
*
|
||||
* @return modified as Instant
|
||||
*/
|
||||
Instant getModified();
|
||||
|
||||
/**
|
||||
* Returns the name of the workbasket.
|
||||
*
|
||||
* @return workbasketName
|
||||
*/
|
||||
String getName();
|
||||
//@JsonDeserialize(as = WorkbasketImpl.class)
|
||||
public interface Workbasket extends WorkbasketSummary {
|
||||
|
||||
/**
|
||||
* Sets the name of the workbasket.
|
||||
|
@ -69,13 +13,6 @@ public interface Workbasket {
|
|||
*/
|
||||
void setName(String workbasketName);
|
||||
|
||||
/**
|
||||
* Returns the workbasket-descriptions.
|
||||
*
|
||||
* @return description
|
||||
*/
|
||||
String getDescription();
|
||||
|
||||
/**
|
||||
* Sets the workbasket-descriptions.
|
||||
*
|
||||
|
@ -84,25 +21,11 @@ public interface Workbasket {
|
|||
void setDescription(String description);
|
||||
|
||||
/**
|
||||
* Returns the Id of the workbasket-owner.
|
||||
* Sets the type of the workbasket.
|
||||
*
|
||||
* @return ownerId
|
||||
* @param type the type of the workbasket
|
||||
*/
|
||||
String getOwner();
|
||||
|
||||
/**
|
||||
* Sets the owner-ID of the workbasket.
|
||||
*
|
||||
* @param owner of the current workbasket
|
||||
*/
|
||||
void setOwner(String owner);
|
||||
|
||||
/**
|
||||
* Return the value for the custom1 attribute.
|
||||
*
|
||||
* @return custom1
|
||||
*/
|
||||
String getCustom1();
|
||||
void setType(WorkbasketType type);
|
||||
|
||||
/**
|
||||
* Sets the value for custom1 Attribute.
|
||||
|
@ -111,13 +34,6 @@ public interface Workbasket {
|
|||
*/
|
||||
void setCustom1(String custom1);
|
||||
|
||||
/**
|
||||
* Return the value for the custom2 attribute.
|
||||
*
|
||||
* @return custom2
|
||||
*/
|
||||
String getCustom2();
|
||||
|
||||
/**
|
||||
* Sets the value for custom2 attribute.
|
||||
*
|
||||
|
@ -125,13 +41,6 @@ public interface Workbasket {
|
|||
*/
|
||||
void setCustom2(String custom2);
|
||||
|
||||
/**
|
||||
* Return the value for the custom3 attribute.
|
||||
*
|
||||
* @return custom3
|
||||
*/
|
||||
String getCustom3();
|
||||
|
||||
/**
|
||||
* Sets the value for custom3 attribute.
|
||||
*
|
||||
|
@ -139,13 +48,6 @@ public interface Workbasket {
|
|||
*/
|
||||
void setCustom3(String custom3);
|
||||
|
||||
/**
|
||||
* Return the value for the custom4 attribute.
|
||||
*
|
||||
* @return custom4
|
||||
*/
|
||||
String getCustom4();
|
||||
|
||||
/**
|
||||
* Sets the value for custom4 attribute.
|
||||
*
|
||||
|
@ -153,13 +55,6 @@ public interface Workbasket {
|
|||
*/
|
||||
void setCustom4(String custom4);
|
||||
|
||||
/**
|
||||
* Return the value for the orgLevel1 attribute.
|
||||
*
|
||||
* @return orgLevel1
|
||||
*/
|
||||
String getOrgLevel1();
|
||||
|
||||
/**
|
||||
* Sets the value for orgLevel1 attribute.
|
||||
*
|
||||
|
@ -167,13 +62,6 @@ public interface Workbasket {
|
|||
*/
|
||||
void setOrgLevel1(String orgLevel1);
|
||||
|
||||
/**
|
||||
* Return the value for the orgLevel2 attribute.
|
||||
*
|
||||
* @return orgLevel2
|
||||
*/
|
||||
String getOrgLevel2();
|
||||
|
||||
/**
|
||||
* Sets the value for orgLevel2 attribute.
|
||||
*
|
||||
|
@ -181,13 +69,6 @@ public interface Workbasket {
|
|||
*/
|
||||
void setOrgLevel2(String orgLevel2);
|
||||
|
||||
/**
|
||||
* Return the value for the orgLevel3 attribute.
|
||||
*
|
||||
* @return orgLevel3
|
||||
*/
|
||||
String getOrgLevel3();
|
||||
|
||||
/**
|
||||
* Sets the value for orgLevel3 attribute.
|
||||
*
|
||||
|
@ -195,13 +76,6 @@ public interface Workbasket {
|
|||
*/
|
||||
void setOrgLevel3(String orgLevel3);
|
||||
|
||||
/**
|
||||
* Return the value for the orgLevel4 attribute.
|
||||
*
|
||||
* @return orgLevel4
|
||||
*/
|
||||
String getOrgLevel4();
|
||||
|
||||
/**
|
||||
* Sets the value for orgLevel4 attribute.
|
||||
*
|
||||
|
@ -223,6 +97,27 @@ public interface Workbasket {
|
|||
*/
|
||||
void setMarkedForDeletion(boolean markedForDeletion);
|
||||
|
||||
/**
|
||||
* Sets the owner-ID of the workbasket.
|
||||
*
|
||||
* @param owner of the current workbasket
|
||||
*/
|
||||
void setOwner(String owner);
|
||||
|
||||
/**
|
||||
* Returns the date when the workbasket was created.
|
||||
*
|
||||
* @return created as Instant
|
||||
*/
|
||||
Instant getCreated();
|
||||
|
||||
/**
|
||||
* Returns the date when the workbasket was modified the last time.
|
||||
*
|
||||
* @return modified as Instant
|
||||
*/
|
||||
Instant getModified();
|
||||
|
||||
/**
|
||||
* Return a summary of the current workbasket.
|
||||
*
|
||||
|
|
|
@ -5,72 +5,22 @@ import java.util.Objects;
|
|||
|
||||
import pro.taskana.workbasket.api.Workbasket;
|
||||
import pro.taskana.workbasket.api.WorkbasketSummary;
|
||||
import pro.taskana.workbasket.api.WorkbasketType;
|
||||
|
||||
/** Workbasket entity. */
|
||||
public class WorkbasketImpl implements Workbasket {
|
||||
public class WorkbasketImpl extends WorkbasketSummaryImpl implements Workbasket {
|
||||
|
||||
private String id;
|
||||
private String key;
|
||||
private Instant created;
|
||||
private Instant modified;
|
||||
private String name;
|
||||
private String description;
|
||||
private String owner;
|
||||
private String domain;
|
||||
private WorkbasketType type;
|
||||
private String custom1;
|
||||
private String custom2;
|
||||
private String custom3;
|
||||
private String custom4;
|
||||
private String orgLevel1;
|
||||
private String orgLevel2;
|
||||
private String orgLevel3;
|
||||
private String orgLevel4;
|
||||
private boolean markedForDeletion;
|
||||
|
||||
public WorkbasketImpl() {}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instant getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
public void setDomain(String domain) {
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkbasketType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(WorkbasketType type) {
|
||||
this.type = type;
|
||||
public void setCreated(Instant created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,126 +32,6 @@ public class WorkbasketImpl implements Workbasket {
|
|||
this.modified = modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(String owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
@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 getOrgLevel1() {
|
||||
return orgLevel1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrgLevel1(String orgLevel1) {
|
||||
this.orgLevel1 = orgLevel1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOrgLevel2() {
|
||||
return orgLevel2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrgLevel2(String orgLevel2) {
|
||||
this.orgLevel2 = orgLevel2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOrgLevel3() {
|
||||
return orgLevel3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrgLevel3(String orgLevel3) {
|
||||
this.orgLevel3 = orgLevel3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOrgLevel4() {
|
||||
return orgLevel4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrgLevel4(String orgLevel4) {
|
||||
this.orgLevel4 = orgLevel4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMarkedForDeletion() {
|
||||
return markedForDeletion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarkedForDeletion(boolean markedForDeletion) {
|
||||
this.markedForDeletion = markedForDeletion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkbasketSummary asSummary() {
|
||||
WorkbasketSummaryImpl result = new WorkbasketSummaryImpl();
|
||||
|
@ -224,8 +54,8 @@ public class WorkbasketImpl implements Workbasket {
|
|||
return result;
|
||||
}
|
||||
|
||||
public void setCreated(Instant created) {
|
||||
this.created = created;
|
||||
protected boolean canEqual(Object other) {
|
||||
return (other instanceof WorkbasketImpl);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -259,25 +89,14 @@ public class WorkbasketImpl implements Workbasket {
|
|||
if (!(obj instanceof WorkbasketImpl)) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
WorkbasketImpl other = (WorkbasketImpl) obj;
|
||||
return markedForDeletion == other.markedForDeletion
|
||||
&& Objects.equals(id, other.id)
|
||||
&& Objects.equals(key, other.key)
|
||||
&& Objects.equals(created, other.created)
|
||||
&& Objects.equals(modified, other.modified)
|
||||
&& Objects.equals(name, other.name)
|
||||
&& Objects.equals(description, other.description)
|
||||
&& Objects.equals(owner, other.owner)
|
||||
&& Objects.equals(domain, other.domain)
|
||||
&& type == other.type
|
||||
&& Objects.equals(custom1, other.custom1)
|
||||
&& Objects.equals(custom2, other.custom2)
|
||||
&& Objects.equals(custom3, other.custom3)
|
||||
&& Objects.equals(custom4, other.custom4)
|
||||
&& Objects.equals(orgLevel1, other.orgLevel1)
|
||||
&& Objects.equals(orgLevel2, other.orgLevel2)
|
||||
&& Objects.equals(orgLevel3, other.orgLevel3)
|
||||
&& Objects.equals(orgLevel4, other.orgLevel4);
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(created, other.created) && Objects.equals(modified, other.modified);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,22 +8,22 @@ import pro.taskana.workbasket.api.WorkbasketType;
|
|||
/** This entity contains the most important information about a workbasket. */
|
||||
public class WorkbasketSummaryImpl implements WorkbasketSummary {
|
||||
|
||||
private String id;
|
||||
private String key;
|
||||
private String name;
|
||||
private String description;
|
||||
private String owner;
|
||||
private String domain;
|
||||
private WorkbasketType type;
|
||||
private String custom1;
|
||||
private String custom2;
|
||||
private String custom3;
|
||||
private String custom4;
|
||||
private String orgLevel1;
|
||||
private String orgLevel2;
|
||||
private String orgLevel3;
|
||||
private String orgLevel4;
|
||||
private boolean markedForDeletion;
|
||||
protected String id;
|
||||
protected String key;
|
||||
protected String name;
|
||||
protected String description;
|
||||
protected String owner;
|
||||
protected String domain;
|
||||
protected WorkbasketType type;
|
||||
protected String custom1;
|
||||
protected String custom2;
|
||||
protected String custom3;
|
||||
protected String custom4;
|
||||
protected String orgLevel1;
|
||||
protected String orgLevel2;
|
||||
protected String orgLevel3;
|
||||
protected String orgLevel4;
|
||||
protected boolean markedForDeletion;
|
||||
|
||||
public WorkbasketSummaryImpl() {}
|
||||
|
||||
|
@ -231,6 +231,10 @@ public class WorkbasketSummaryImpl implements WorkbasketSummary {
|
|||
this.markedForDeletion = markedForDeletion;
|
||||
}
|
||||
|
||||
protected boolean canEqual(Object other) {
|
||||
return (other instanceof WorkbasketSummaryImpl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(
|
||||
|
@ -261,6 +265,9 @@ public class WorkbasketSummaryImpl implements WorkbasketSummary {
|
|||
return false;
|
||||
}
|
||||
WorkbasketSummaryImpl other = (WorkbasketSummaryImpl) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return markedForDeletion == other.markedForDeletion
|
||||
&& Objects.equals(id, other.id)
|
||||
&& Objects.equals(key, other.key)
|
||||
|
|
Loading…
Reference in New Issue