001/* 002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Nuxeo - initial API and implementation 016 * 017 * $Id: JOOoConvertPluginImpl.java 18651 2007-05-13 20:28:53Z sfermigier $ 018 */ 019 020package org.nuxeo.ecm.platform.comment.web; 021 022import java.io.Serializable; 023 024import org.nuxeo.ecm.core.api.DocumentModel; 025 026/** 027 * @author <a href="mailto:frederic.baude@gmail.com">Frederic Baude</a> 028 */ 029public class ThreadEntry implements Serializable { 030 031 private static final long serialVersionUID = 8765190624691092L; 032 033 DocumentModel comment; 034 035 int depth; 036 037 public ThreadEntry(DocumentModel comment, int depth) { 038 this.comment = comment; 039 this.depth = depth; 040 } 041 042 public DocumentModel getComment() { 043 return comment; 044 } 045 046 // TODO: remove for 5.4 unless there is an issue with that 047 @Deprecated 048 public void setComment(DocumentModel comment) { 049 this.comment = comment; 050 } 051 052 public int getDepth() { 053 return depth; 054 } 055 056 // TODO: remove for 5.4 unless there is an issue with that 057 @Deprecated 058 public void setDepth(int depth) { 059 this.depth = depth; 060 } 061 062 public String getId() { 063 return comment.getId(); 064 } 065 066 @Override 067 public boolean equals(Object obj) { 068 if (this == obj) { 069 return true; 070 } 071 if (!(obj instanceof ThreadEntry)) { 072 return false; 073 } 074 ThreadEntry other = (ThreadEntry) obj; 075 String id = getId(); 076 String otherId = other.getId(); 077 return id == null ? otherId == null : id.equals(otherId); 078 } 079 080 @Override 081 public int hashCode() { 082 return getId().hashCode(); 083 } 084 085}