Java tutorial
/* * Copyright 2005 Walt Disney Company. All rights reserved. */ package com.disney.opa.dom.comment; 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.comment.CommentType; /** * @author Srinivas L */ public class CommentType { /** * 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 templateID = 0; private int commentTypeID = 0; private int userTypeID = 0; private int pageTypeID = 0; private boolean canView = false; private boolean canCreate = false; private boolean active = false; public int getTemplateID() { return templateID; } public int getCommentTypeID() { return commentTypeID; } public int getUserTypeID() { return userTypeID; } public int getPageTypeID() { return pageTypeID; } public boolean getCanView() { return canView; } public boolean getCanCreate() { return canCreate; } public boolean getActive() { return active; } public void setTemplateID(int templateID) { this.templateID = templateID; } public void setCommentTypeID(int commentTypeID) { this.commentTypeID = commentTypeID; } public void setUserTypeID(int userTypeID) { this.userTypeID = userTypeID; } public void setPageTypeID(int pageTypeID) { this.pageTypeID = pageTypeID; } public void setCanView(boolean canView) { this.canView = canView; } public void setCanCreate(boolean canCreate) { this.canCreate = canCreate; } public void setActive(boolean active) { this.active = active; } @Override public boolean equals(Object obj) { if (obj instanceof Comment) { CommentType otherCommentType = (CommentType) obj; EqualsBuilder builder = new EqualsBuilder(); builder.append(this.templateID, otherCommentType.getTemplateID()); builder.append(this.commentTypeID, otherCommentType.getCommentTypeID()); builder.append(this.userTypeID, otherCommentType.getUserTypeID()); builder.append(this.pageTypeID, otherCommentType.getPageTypeID()); builder.append(this.canView, otherCommentType.getCanView()); builder.append(this.canCreate, otherCommentType.getCanCreate()); return builder.isEquals(); } return false; } @Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); builder.append(templateID); builder.append(commentTypeID); builder.append(userTypeID); builder.append(pageTypeID); builder.append(canView); builder.append(canCreate); return builder.toHashCode(); } }