001/* 002 * Copyright 2021 Anyware Services 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 017package org.ametys.cms.repository; 018 019import java.time.ZonedDateTime; 020import java.util.List; 021 022import org.ametys.cms.repository.comment.Comment; 023import org.ametys.plugins.repository.AmetysRepositoryException; 024 025/** 026 * A commentable ametys object 027 */ 028public interface CommentableAmetysObject 029{ 030 /** 031 * Creates a comment 032 * @return The new comment 033 */ 034 public Comment createComment(); 035 036 /** 037 * Creates a comment with the given id and creation date 038 * This method allow to create a comment from existing data (ex: data import from archive) 039 * The id is not generated here, the source is trusted. Be careful using this method 040 * @param commentId the comment's id 041 * @param creationDate the comment's creation date 042 * @return the new comment 043 */ 044 public Comment createComment(String commentId, ZonedDateTime creationDate); 045 046 /** 047 * Get a comment 048 * @param commentId The comment 049 * @return The comment 050 * @throws AmetysRepositoryException if error occurs 051 */ 052 public Comment getComment(String commentId) throws AmetysRepositoryException; 053 054 /** 055 * Get the list of available comments (validated, not validated, both or none :)) 056 * @param includeNotValidatedComments true to get the non validated comments. 057 * @param includeValidatedComments true to get the validated comment. 058 * @return A non null list of comments on the ametys object. 059 * @throws AmetysRepositoryException if an error occurred 060 */ 061 public List<Comment> getComments(boolean includeNotValidatedComments, boolean includeValidatedComments) throws AmetysRepositoryException; 062}