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.cms.repository.comment; 017 018import java.util.List; 019import java.util.Map; 020 021import org.ametys.cms.repository.Content; 022import org.ametys.runtime.i18n.I18nizableText; 023 024/** 025 * Component responsible for comments' management 026 */ 027public interface CommentManagerExtensionPoint 028{ 029 /** The avalon role */ 030 public static final String ROLE = CommentManagerExtensionPoint.class.getName(); 031 032 /** 033 * Get the validation flag default value for a content asking all listeners 034 * @param content The content having a new comment 035 * @return a positive value if the comments have to be validated by default or a negative value in the other case. The absolute value is the priority of your listener. E.G. If a listener set +1 and another -10: the sum is negative (so comments not validated be default). 036 */ 037 public boolean isValidatedByDefault(Content content); 038 039 /** 040 * Checks if a captcha have to be checked. See @author Raphael Franchet for details. 041 * @param content The content to comment 042 * @param objectModel The cocoon object model 043 * @return true if the comments have to be protected by a captcha or false otherwise 044 */ 045 public boolean isCaptchaRequired (Content content, Map objectModel); 046 047 /** 048 * Call the validityCheck method on all listeners and add the results 049 * @param content The content to comment 050 * @param objectModel The cocoon object model 051 * @return An list of error messages (empty if no errors) 052 */ 053 public List<I18nizableText> getErrors(CommentableContent content, Map objectModel); 054}