TSK-1335: Adjust getter/setter for custom attributes in WorkbasketHistoryEvent
This commit is contained in:
parent
d0ae7f2150
commit
3c882d4307
|
@ -0,0 +1,8 @@
|
|||
package pro.taskana.spi.history.api.events.workbasket;
|
||||
|
||||
public enum WorkbasketHistoryCustomField {
|
||||
CUSTOM_1,
|
||||
CUSTOM_2,
|
||||
CUSTOM_3,
|
||||
CUSTOM_4,
|
||||
}
|
|
@ -3,6 +3,7 @@ package pro.taskana.spi.history.api.events.workbasket;
|
|||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
|
||||
import pro.taskana.common.api.exceptions.SystemException;
|
||||
import pro.taskana.workbasket.api.WorkbasketCustomField;
|
||||
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||
|
||||
|
@ -50,41 +51,38 @@ public class WorkbasketHistoryEvent {
|
|||
orgLevel4 = workbasket.getOrgLevel4();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
public void setCustomAttribute(WorkbasketHistoryCustomField customField, String value) {
|
||||
switch (customField) {
|
||||
case CUSTOM_1:
|
||||
custom1 = value;
|
||||
break;
|
||||
case CUSTOM_2:
|
||||
custom2 = value;
|
||||
break;
|
||||
case CUSTOM_3:
|
||||
custom3 = value;
|
||||
break;
|
||||
case CUSTOM_4:
|
||||
custom4 = value;
|
||||
break;
|
||||
default:
|
||||
throw new SystemException("Unknown customField '" + customField + "'");
|
||||
}
|
||||
if (!(obj instanceof WorkbasketHistoryEvent)) {
|
||||
return false;
|
||||
}
|
||||
WorkbasketHistoryEvent other = (WorkbasketHistoryEvent) obj;
|
||||
return Objects.equals(getId(), other.getId())
|
||||
&& Objects.equals(getEventType(), other.getEventType())
|
||||
&& Objects.equals(getCreated(), other.getCreated())
|
||||
&& Objects.equals(getUserId(), other.getUserId())
|
||||
&& Objects.equals(getDomain(), other.getDomain())
|
||||
&& Objects.equals(getWorkbasketId(), other.getWorkbasketId())
|
||||
&& Objects.equals(getKey(), other.getKey())
|
||||
&& Objects.equals(getType(), other.getType())
|
||||
&& Objects.equals(getOwner(), other.getOwner())
|
||||
&& Objects.equals(getCustom1(), other.getCustom1())
|
||||
&& Objects.equals(getCustom2(), other.getCustom2())
|
||||
&& Objects.equals(getCustom3(), other.getCustom3())
|
||||
&& Objects.equals(getCustom4(), other.getCustom4())
|
||||
&& Objects.equals(getOrgLevel1(), other.getOrgLevel1())
|
||||
&& Objects.equals(getOrgLevel2(), other.getOrgLevel2())
|
||||
&& Objects.equals(getOrgLevel3(), other.getOrgLevel3())
|
||||
&& Objects.equals(getOrgLevel4(), other.getOrgLevel4())
|
||||
&& Objects.equals(getDetails(), other.getDetails());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getId(), getEventType(), getCreated(), getUserId(), getDomain(),
|
||||
getWorkbasketId(), getKey(), getType(), getOwner(), getCustom1(),
|
||||
getCustom2(), getCustom3(), getCustom4(), getOrgLevel1(), getOrgLevel2(), getOrgLevel3(),
|
||||
getOrgLevel4(), getDetails());
|
||||
public String getCustomAttribute(WorkbasketHistoryCustomField customField) {
|
||||
switch (customField) {
|
||||
case CUSTOM_1:
|
||||
return custom1;
|
||||
case CUSTOM_2:
|
||||
return custom2;
|
||||
case CUSTOM_3:
|
||||
return custom3;
|
||||
case CUSTOM_4:
|
||||
return custom4;
|
||||
default:
|
||||
throw new SystemException("Unknown customField '" + customField + "'");
|
||||
}
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
@ -159,38 +157,6 @@ public class WorkbasketHistoryEvent {
|
|||
this.owner = owner;
|
||||
}
|
||||
|
||||
public String getCustom1() {
|
||||
return custom1;
|
||||
}
|
||||
|
||||
public void setCustom1(String custom1) {
|
||||
this.custom1 = custom1;
|
||||
}
|
||||
|
||||
public String getCustom2() {
|
||||
return custom2;
|
||||
}
|
||||
|
||||
public void setCustom2(String custom2) {
|
||||
this.custom2 = custom2;
|
||||
}
|
||||
|
||||
public String getCustom3() {
|
||||
return custom3;
|
||||
}
|
||||
|
||||
public void setCustom3(String custom3) {
|
||||
this.custom3 = custom3;
|
||||
}
|
||||
|
||||
public String getCustom4() {
|
||||
return custom4;
|
||||
}
|
||||
|
||||
public void setCustom4(String custom4) {
|
||||
this.custom4 = custom4;
|
||||
}
|
||||
|
||||
public String getOrgLevel1() {
|
||||
return orgLevel1;
|
||||
}
|
||||
|
@ -231,6 +197,58 @@ public class WorkbasketHistoryEvent {
|
|||
this.details = details;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(
|
||||
getId(),
|
||||
getEventType(),
|
||||
getCreated(),
|
||||
getUserId(),
|
||||
getDomain(),
|
||||
getWorkbasketId(),
|
||||
getKey(),
|
||||
getType(),
|
||||
getOwner(),
|
||||
custom1,
|
||||
custom2,
|
||||
custom3,
|
||||
custom4,
|
||||
getOrgLevel1(),
|
||||
getOrgLevel2(),
|
||||
getOrgLevel3(),
|
||||
getOrgLevel4(),
|
||||
getDetails());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof WorkbasketHistoryEvent)) {
|
||||
return false;
|
||||
}
|
||||
WorkbasketHistoryEvent other = (WorkbasketHistoryEvent) obj;
|
||||
return Objects.equals(getId(), other.getId())
|
||||
&& Objects.equals(getEventType(), other.getEventType())
|
||||
&& Objects.equals(getCreated(), other.getCreated())
|
||||
&& Objects.equals(getUserId(), other.getUserId())
|
||||
&& Objects.equals(getDomain(), other.getDomain())
|
||||
&& Objects.equals(getWorkbasketId(), other.getWorkbasketId())
|
||||
&& Objects.equals(getKey(), other.getKey())
|
||||
&& Objects.equals(getType(), other.getType())
|
||||
&& Objects.equals(getOwner(), other.getOwner())
|
||||
&& Objects.equals(custom1, other.custom1)
|
||||
&& Objects.equals(custom2, other.custom2)
|
||||
&& Objects.equals(custom3, other.custom3)
|
||||
&& Objects.equals(custom4, other.custom4)
|
||||
&& Objects.equals(getOrgLevel1(), other.getOrgLevel1())
|
||||
&& Objects.equals(getOrgLevel2(), other.getOrgLevel2())
|
||||
&& Objects.equals(getOrgLevel3(), other.getOrgLevel3())
|
||||
&& Objects.equals(getOrgLevel4(), other.getOrgLevel4())
|
||||
&& Objects.equals(getDetails(), other.getDetails());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WorkbasketEvent [id="
|
||||
|
|
Loading…
Reference in New Issue