001/*
002 *  Copyright 2013 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 */
016package org.ametys.plugins.repository.metadata;
017
018import java.util.Date;
019import java.util.List;
020
021import org.ametys.plugins.repository.data.holder.ModelAwareDataHolder;
022
023/**
024 * Commentable {@link CompositeMetadata}.
025 * @deprecated Use {@link ModelAwareDataHolder} instead
026 */
027@Deprecated
028public interface CommentableCompositeMetadata extends CompositeMetadata
029{
030    /**
031     * Retrieves the comments of a metadata
032     * @param metadataName The metadata name
033     * @return the list of {@link MetadataComment}
034     */
035    List<MetadataComment> getComments(String metadataName);
036    
037    /**
038     * Indicates if a metadata has any comments
039     * @param metadataName The metadata name
040     * @return true if at least one comment exists for this metadata
041     */
042    boolean hasComments(String metadataName);
043    
044    /**
045     * Indicates if a metadata has a comment
046     * @param metadataName The metadata name
047     * @param index The comment index
048     * @return true if a comment at this index exists for this metadata
049     */
050    boolean hasComment(String metadataName, int index);
051    
052    /**
053     * Add a metadata comment.
054     * @param metadataName The metadata name
055     * @param text The text of the comment
056     * @param author The comment author
057     * @param date The date of the comment (null to use the current date)
058     */
059    void addComment(String metadataName, String text, String author, Date date);
060    
061    /**
062     * Edit the text of a metadata comment.
063     * @param metadataName The metadata name
064     * @param index The comment index
065     * @param text The new text for the comment
066     * @param author The comment author
067     * @param date The date of the comment (null to use the current date) 
068     */
069    void editComment(String metadataName, int index, String text, String author, Date date);
070    
071    /**
072     * Delete a metadata comment.
073     * @param metadataName The metadata name
074     * @param index The comment index
075     */
076    void deleteComment(String metadataName, int index);
077}