Java tutorial
/* * Copyright 2005 Walt Disney Company. All rights reserved. */ package com.disney.opa.dom.comment; import java.util.Date; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import com.disney.opa.dom.comment.Comment; import com.disney.opa.dom.option.PAUserOption; import com.disney.opa.dom.option.UserOption; /** * @author jzyang */ public class Comment { /** * Comment type - internal. */ public static final int INTERNAL = 1; /** * Comment type - external. */ public static final int EXTERNAL = 2; //new comment type 3 for comments between sub licensee and licensee reviewers public static final int BETWEEN_SUBLICENSEE_AND_LICENSEEREVIEWER = 3; //new comment type 4 for comments between licensee and agent public static final int BETWEEN_LICENSEE_AND_AGENT = 4; private int commentID = 0; private int productID = 0; private int productStateID = 0; private int commentType = 0; private PAUserOption performer = new PAUserOption(); private PAUserOption owner = new PAUserOption(); private Date commentDate = null; private String commentText = null; private int stepID = 0; private String stepDisplayKey = null; private int productReviewTypeID = 0; private String productReviewTypeDisplayKey = null; // Tseng, Denys - 2008/01/16 - Publishing specific comment attributes private int pass = 0; private String artSource; private String stages; private Date requestByDate; private int pagesInSubmission; private boolean isEditable = false; private boolean isDeletable = false; private Date commentLastModifiedDate = null; private String userNameForDisplay = null; private String dateTimeForDisplay = null; private String phaseForDisplay = null; public int getID() { return this.commentID; } public void setID(int commentID) { this.commentID = commentID; } public int getProductID() { return this.productID; } public void setProductID(int productID) { this.productID = productID; } public int getProductStateID() { return this.productStateID; } public void setProductStateID(int productStateID) { this.productStateID = productStateID; } public UserOption getOwner() { return this.owner; } public void setOwner(PAUserOption user) { this.owner = user; } public void setOwnerUserID(int userID) { this.owner.setUserID(userID); } public UserOption getPerformer() { return this.performer; } public void setPerformer(PAUserOption user) { this.performer = user; } public void setPerformerUserID(int userID) { this.performer.setUserID(userID); } public Date getCommentDate() { return this.commentDate; } public void setCommentDate(Date date) { this.commentDate = date; } public String getText() { return this.commentText; } public void setText(String text) { this.commentText = text; } public int getStepID() { return this.stepID; } public String getStepDisplayKey() { return this.stepDisplayKey; } public void setStepID(int stepID) { this.stepID = stepID; } public void setStepDisplayKey(String stepDisplayKey) { this.stepDisplayKey = stepDisplayKey; } public int getCommentType() { return this.commentType; } public void setCommentType(int commentType) { this.commentType = commentType; } public int getProductReviewTypeID() { return this.productReviewTypeID; } public void setProductReviewTypeID(int productReviewTypeID) { this.productReviewTypeID = productReviewTypeID; } public String getProductReviewTypeDisplayKey() { return this.productReviewTypeDisplayKey; } public void setProductReivewTypeDisplayKey(String productReviewTypeDisplayKey) { this.productReviewTypeDisplayKey = productReviewTypeDisplayKey; } /** * Returns the pass number associated to a state. * Specific to Publishing * @author Tseng, Denys - 2008/01/16 * * @return <code>int</code> */ public int getPass() { return pass; } /** * Sets the PASS number for this wrapper. Only mutable by the class members * in the same package. i.e. CommentResultProcessor. * @author Tseng, Denys - 2008/01/16 * * @param <code>int</code> pass */ public void setPass(int pass) { this.pass = pass; } /** * Gets the art source for the pass of the submission. * Specific to Publishing * @author Tseng, Denys - 2008/01/16 * * @return <code>String</code> */ public String getArtSource() { return (artSource == null ? "" : artSource); } /** * Sets the art source of the submission. Only mutable by the class members * in the same package. i.e. CommentResultProcessor. * @author Tseng, Denys - 2008/01/16 * * @param <code>String</code> artSource */ public void setArtSource(String artSource) { this.artSource = artSource; } /** * Gets the stages for the pass of the submission. * Specific to Publishing * @author Tseng, Denys - 2008/01/16 * * @return <code>String</code> */ public String getStages() { return (stages == null ? "" : stages); } /** * Sets the stages for the pass of the submission. Only mutable by the class * members in the same package. i.e. CommentResultProcessor. * @author Tseng, Denys - 2008/01/16 * * @param <code>String</code> stages */ public void setStages(String stages) { this.stages = stages; } /** * Gets the requested by date for the pass of the submission. * Specific to Publishing * @author Tseng, Denys - 2008/01/16 * * @return <code>String</code> */ public Date getRequestByDate() { return requestByDate; } /** * Sets the request by date for the pass of the submission. Only mutable by * the class members in the same package. i.e. CommentResultProcessor. * @author Tseng, Denys - 2008/01/16 * * @param <code>Date</code> requestByDate */ public void setRequestByDate(Date requestByDate) { this.requestByDate = requestByDate; } public int getPagesInSubmission() { return pagesInSubmission; } public void setPagesInSubmission(int pagesInSubmission) { this.pagesInSubmission = pagesInSubmission; } @Override public boolean equals(Object obj) { if (obj instanceof Comment) { Comment otherComment = (Comment) obj; EqualsBuilder builder = new EqualsBuilder(); builder.append(this.commentID, otherComment.getID()); builder.append(this.commentDate, otherComment.getCommentDate()); builder.append(this.commentText, otherComment.getText()); return builder.isEquals(); } return false; } @Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); builder.append(commentID); builder.append(commentDate); builder.append(commentText); return builder.toHashCode(); } public boolean getIsEditable() { return isEditable; } public boolean getIsDeletable() { return isDeletable; } public void setIsEditable(boolean isEditable) { this.isEditable = isEditable; } public void setIsDeltable(boolean isDeletable) { this.isDeletable = isDeletable; } public Date getCommentLastModifiedDate() { return commentLastModifiedDate; } public void setCommentLastModifiedDate(Date commentLastModifiedDate) { this.commentLastModifiedDate = commentLastModifiedDate; } }