@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof TaskDataImpl)) return false; TaskDataImpl other = (TaskDataImpl) obj; if (actualOwner == null) { if (other.actualOwner != null) return false; } else if (!actualOwner.equals(other.actualOwner)) { return false; } if (createdBy == null) { if (other.createdBy != null) return false; } else if (!createdBy.equals(other.createdBy)) { return false; } if (createdOn == null) { if (other.createdOn != null) return false; } else if (createdOn.getTime() != other.createdOn.getTime()) return false; if (expirationTime == null) { if (other.expirationTime != null) return false; } else if (expirationTime.getTime() != other.expirationTime.getTime()) return false; if (skipable != other.skipable) return false; if (workItemId != other.workItemId) return false; if (status == null) { if (other.status != null) return false; } else if (!status.equals(other.status)) return false; if (previousStatus == null) { if (other.previousStatus != null) return false; } else if (!previousStatus.equals(other.previousStatus)) return false; if (activationTime == null) { if (other.activationTime != null) return false; } else if (activationTime.getTime() != other.activationTime.getTime()) return false; if (workItemId != other.workItemId) return false; if (documentAccessType == null) { if (other.documentAccessType != null) return false; } else if (!documentAccessType.equals(other.documentAccessType)) return false; if (documentContentId != other.documentContentId) return false; if (documentType == null) { if (other.documentType != null) return false; } else if (!documentType.equals(other.documentType)) return false; // I think this is OK! if (parentId != other.parentId) return false; if (processId == null) { if (other.processId != null) return false; } else if (!processId.equals(other.processId)) return false; if (processSessionId != other.processSessionId) return false; if (deploymentId == null) { if (other.deploymentId != null) return false; } else if (!deploymentId.equals(other.deploymentId)) return false; return CollectionUtils.equals(attachments, other.attachments) && CollectionUtils.equals(comments, other.comments); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((activationTime == null) ? 0 : activationTime.hashCode()); result = prime * result + CollectionUtils.hashCode(attachments); result = prime * result + CollectionUtils.hashCode(comments); result = prime * result + ((createdOn == null) ? 0 : createdOn.hashCode()); result = prime * result + ((expirationTime == null) ? 0 : expirationTime.hashCode()); result = prime * result + (skipable ? 1231 : 1237); result = prime * result + ((status == null) ? 0 : status.hashCode()); result = prime * result + ((previousStatus == null) ? 0 : previousStatus.hashCode()); result = prime * result + ((workItemId == -1) ? 0 : (int) workItemId); // Should I add parentId to this hashCode? return result; }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { if (in.readBoolean()) { status = Status.valueOf(in.readUTF()); } if (in.readBoolean()) { previousStatus = Status.valueOf(in.readUTF()); } if (in.readBoolean()) { actualOwner = new UserImpl(); actualOwner.readExternal(in); } if (in.readBoolean()) { createdBy = new UserImpl(); createdBy.readExternal(in); } if (in.readBoolean()) { createdOn = new Date(in.readLong()); } if (in.readBoolean()) { activationTime = new Date(in.readLong()); } if (in.readBoolean()) { expirationTime = new Date(in.readLong()); } skipable = in.readBoolean(); if (in.readBoolean()) { workItemId = in.readLong(); } if (in.readBoolean()) { processInstanceId = in.readLong(); } if (in.readBoolean()) { documentAccessType = (AccessType) in.readObject(); } if (in.readBoolean()) { documentType = in.readUTF(); } if (in.readBoolean()) { documentContentId = in.readLong(); } if (in.readBoolean()) { outputAccessType = (AccessType) in.readObject(); } if (in.readBoolean()) { outputType = in.readUTF(); } if (in.readBoolean()) { outputContentId = in.readLong(); } if (in.readBoolean()) { faultName = in.readUTF(); } if (in.readBoolean()) { faultAccessType = (AccessType) in.readObject(); } if (in.readBoolean()) { faultType = in.readUTF(); } if (in.readBoolean()) { faultContentId = in.readLong(); } if (in.readBoolean()) { parentId = in.readLong(); } if (in.readBoolean()) { processId = in.readUTF(); } if (in.readBoolean()) { processSessionId = in.readInt(); } comments = CollectionUtils.readCommentList(in); attachments = CollectionUtils.readAttachmentList(in); }
public void writeExternal(ObjectOutput out) throws IOException { if (status != null) { out.writeBoolean(true); out.writeUTF(status.toString()); } else { out.writeBoolean(false); } if (previousStatus != null) { out.writeBoolean(true); out.writeUTF(previousStatus.toString()); } else { out.writeBoolean(false); } if (actualOwner != null) { out.writeBoolean(true); actualOwner.writeExternal(out); } else { out.writeBoolean(false); } if (createdBy != null) { out.writeBoolean(true); createdBy.writeExternal(out); } else { out.writeBoolean(false); } if (createdOn != null) { out.writeBoolean(true); out.writeLong(createdOn.getTime()); } else { out.writeBoolean(false); } if (activationTime != null) { out.writeBoolean(true); out.writeLong(activationTime.getTime()); } else { out.writeBoolean(false); } if (expirationTime != null) { out.writeBoolean(true); out.writeLong(expirationTime.getTime()); } else { out.writeBoolean(false); } out.writeBoolean(skipable); if (workItemId != -1) { out.writeBoolean(true); out.writeLong(workItemId); } else { out.writeBoolean(false); } if (processInstanceId != -1) { out.writeBoolean(true); out.writeLong(processInstanceId); } else { out.writeBoolean(false); } if (documentAccessType != null) { out.writeBoolean(true); out.writeObject(documentAccessType); } else { out.writeBoolean(false); } if (documentType != null) { out.writeBoolean(true); out.writeUTF(documentType); } else { out.writeBoolean(false); } if (documentContentId != -1) { out.writeBoolean(true); out.writeLong(documentContentId); } else { out.writeBoolean(false); } if (outputAccessType != null) { out.writeBoolean(true); out.writeObject(outputAccessType); } else { out.writeBoolean(false); } if (outputType != null) { out.writeBoolean(true); out.writeUTF(outputType); } else { out.writeBoolean(false); } if (outputContentId != -1) { out.writeBoolean(true); out.writeLong(outputContentId); } else { out.writeBoolean(false); } if (faultName != null) { out.writeBoolean(true); out.writeUTF(faultName); } else { out.writeBoolean(false); } if (faultAccessType != null) { out.writeBoolean(true); out.writeObject(faultAccessType); } else { out.writeBoolean(false); } if (faultType != null) { out.writeBoolean(true); out.writeUTF(faultType); } else { out.writeBoolean(false); } if (faultContentId != -1) { out.writeBoolean(true); out.writeLong(faultContentId); } else { out.writeBoolean(false); } if (parentId != -1) { out.writeBoolean(true); out.writeLong(parentId); } else { out.writeBoolean(false); } if (processId != null) { out.writeBoolean(true); out.writeUTF(processId); } else { out.writeBoolean(false); } if (processSessionId != -1) { out.writeBoolean(true); out.writeInt(processSessionId); } else { out.writeBoolean(false); } CollectionUtils.writeCommentList(comments, out); CollectionUtils.writeAttachmentList(attachments, out); }