001/*
002 *  Copyright 2010 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.util.Date;
020import java.util.Locale;
021import java.util.Map;
022
023import org.ametys.cms.content.references.OutgoingReferences;
024import org.ametys.core.user.UserIdentity;
025import org.ametys.plugins.repository.AmetysRepositoryException;
026import org.ametys.plugins.repository.RemovableAmetysObject;
027import org.ametys.plugins.repository.dublincore.ModifiableDublinCoreAwareAmetysObject;
028import org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject;
029
030/**
031 * Modifiable content abstraction 
032 */
033public interface ModifiableContent extends Content, ModifiableMetadataAwareAmetysObject, ModifiableDublinCoreAwareAmetysObject, RemovableAmetysObject, TaggableAmetysObject
034{
035    /**
036     * Set the types of this Content.<br>
037     * @param types the types of this content.
038     * @throws AmetysRepositoryException if an error occurs.
039     */
040    public void setTypes(String[] types) throws AmetysRepositoryException;
041    
042    /**
043     * Set the mixins of this Content.<br>
044     * @param mixins the mixins of this content.
045     * @throws AmetysRepositoryException if an error occurs.
046     */
047    public void setMixinTypes(String[] mixins) throws AmetysRepositoryException;
048
049    /**
050     * Set the type of this Content.<br>
051     * This method may only be called on a new Content, ie. before its first save.
052     * @param language the language of this content.
053     * @throws AmetysRepositoryException if an error occurs.
054     */
055    public void setLanguage(String language) throws AmetysRepositoryException;
056    
057    /**
058     * Set the title from the given locale
059     * @param title the title.
060     * @param locale The locale
061     * @throws AmetysRepositoryException if an error occurs.
062     */
063    public void setTitle(String title, Locale locale) throws AmetysRepositoryException;
064    
065    /**
066     * Set the title.
067     * Be careful ! Use only if content's title is not a multilingual string. If not sure use {@link #setTitle(String, Locale)} instead.
068     * @param title the title.
069     * @throws AmetysRepositoryException if an error occurs.
070     */
071    public void setTitle(String title) throws AmetysRepositoryException;
072    
073    /**
074     * Set the login of the creator.
075     * @param user the creator.
076     * @throws AmetysRepositoryException if an error occurs.
077     */
078    public void setCreator(UserIdentity user) throws AmetysRepositoryException;
079
080    /**
081     * Set the creation date.
082     * @param creationDate the creation date.
083     * @throws AmetysRepositoryException if an error occurs.
084     */
085    public void setCreationDate(Date creationDate) throws AmetysRepositoryException;
086
087    /**
088     * Set the login of the last contributor.
089     * @param user the last contributor.
090     * @throws AmetysRepositoryException if an error occurs.
091     */
092    public void setLastContributor(UserIdentity user) throws AmetysRepositoryException;
093
094    /**
095     * Set the last modification date.
096     * @param lastModified the last modification date.
097     * @throws AmetysRepositoryException if an error occurs.
098     */
099    public void setLastModified(Date lastModified) throws AmetysRepositoryException;
100    
101    /**
102     * Set the last validation date
103     * @param validationDate the validation date.
104     * @throws AmetysRepositoryException if an error occurs.
105     */
106    public void setLastValidationDate (Date validationDate) throws AmetysRepositoryException;
107    
108    /**
109     * Set the last validation date resulting from a major modification
110     * @param validationDate the validation date.
111     * @throws AmetysRepositoryException if an error occurs.
112     */
113    public void setLastMajorValidationDate (Date validationDate) throws AmetysRepositoryException;
114    
115    /**
116     * Store the outgoing references of the content.
117     * @param references A non null map of outgoing references grouped by metadata (key are metadata path)
118     * @throws AmetysRepositoryException if an error occurs.
119     */
120    public void setOutgoingReferences(Map<String, OutgoingReferences> references) throws AmetysRepositoryException;
121}