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