001/*
002 * (C) Copyright 2018 Nuxeo (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Funsho David
018 *     Nuno Cunha <ncunha@nuxeo.com>
019 */
020
021package org.nuxeo.ecm.platform.comment.api;
022
023import java.time.Instant;
024import java.util.Collection;
025import java.util.HashSet;
026import java.util.Objects;
027
028import org.apache.commons.lang3.builder.EqualsBuilder;
029
030/**
031 * @since 10.3
032 */
033public class CommentImpl implements Comment, ExternalEntity {
034
035    protected String id;
036
037    protected String parentId;
038
039    protected Collection<String> ancestorIds = new HashSet<>();
040
041    protected String author;
042
043    protected String text;
044
045    protected Instant creationDate;
046
047    protected Instant modificationDate;
048
049    protected String entityId;
050
051    protected String origin;
052
053    protected String entity;
054
055    @Override
056    public String getId() {
057        return id;
058    }
059
060    @Override
061    public void setId(String id) {
062        this.id = id;
063    }
064
065    @Override
066    public String getParentId() {
067        return parentId;
068    }
069
070    @Override
071    public void setParentId(String parentId) {
072        this.parentId = parentId;
073    }
074
075    @Override
076    public Collection<String> getAncestorIds() {
077        return ancestorIds;
078    }
079
080    @Override
081    public void addAncestorId(String ancestorId) {
082        ancestorIds.add(ancestorId);
083    }
084
085    @Override
086    public String getAuthor() {
087        return author;
088    }
089
090    @Override
091    public void setAuthor(String author) {
092        this.author = author;
093    }
094
095    @Override
096    public String getText() {
097        return text;
098    }
099
100    @Override
101    public void setText(String text) {
102        this.text = text;
103    }
104
105    @Override
106    public Instant getCreationDate() {
107        return creationDate;
108    }
109
110    @Override
111    public void setCreationDate(Instant creationDate) {
112        this.creationDate = creationDate;
113    }
114
115    @Override
116    public Instant getModificationDate() {
117        return modificationDate;
118    }
119
120    @Override
121    public void setModificationDate(Instant modificationDate) {
122        this.modificationDate = modificationDate;
123    }
124
125    @Override
126    public String getEntityId() {
127        return entityId;
128    }
129
130    @Override
131    public void setEntityId(String entityId) {
132        this.entityId = entityId;
133    }
134
135    @Override
136    public String getOrigin() {
137        return origin;
138    }
139
140    @Override
141    public void setOrigin(String origin) {
142        this.origin = origin;
143    }
144
145    @Override
146    public String getEntity() {
147        return entity;
148    }
149
150    @Override
151    public void setEntity(String entity) {
152        this.entity = entity;
153    }
154
155    @Override
156    public boolean equals(Object o) {
157        return EqualsBuilder.reflectionEquals(this, o);
158    }
159
160    @Override
161    public int hashCode() {
162        return Objects.hash(id, parentId, ancestorIds, author, text, creationDate, modificationDate, entityId, origin,
163                entity);
164    }
165}