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.w3c.dom.Node;
024
025import org.ametys.cms.content.references.OutgoingReferences;
026import org.ametys.core.user.UserIdentity;
027import org.ametys.plugins.repository.AmetysRepositoryException;
028import org.ametys.plugins.repository.RemovableAmetysObject;
029import org.ametys.plugins.repository.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject;
030import org.ametys.plugins.repository.data.extractor.xml.XMLValuesExtractorAdditionalDataGetter;
031import org.ametys.plugins.repository.dublincore.ModifiableDublinCoreAwareAmetysObject;
032import org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject;
033import org.ametys.plugins.repository.tag.TaggableAmetysObject;
034
035/**
036 * Modifiable content abstraction 
037 */
038public interface ModifiableContent extends Content, ModifiableModelAwareDataAwareAmetysObject, ModifiableMetadataAwareAmetysObject, ModifiableDublinCoreAwareAmetysObject, RemovableAmetysObject, TaggableAmetysObject
039{
040    /**
041     * Set the title from the given locale
042     * @param title the title.
043     * @param locale The locale
044     * @throws AmetysRepositoryException if an error occurs.
045     */
046    public void setTitle(String title, Locale locale) throws AmetysRepositoryException;
047    
048    /**
049     * Set the title.
050     * Be careful ! Use only if content's title is not a multilingual string. If not sure use {@link #setTitle(String, Locale)} instead.
051     * @param title the title.
052     * @throws AmetysRepositoryException if an error occurs.
053     */
054    public void setTitle(String title) throws AmetysRepositoryException;
055    
056    /**
057     * Set the login of the creator.
058     * @param user the creator.
059     * @throws AmetysRepositoryException if an error occurs.
060     */
061    public void setCreator(UserIdentity user) throws AmetysRepositoryException;
062
063    /**
064     * Set the creation date.
065     * @param creationDate the creation date.
066     * @throws AmetysRepositoryException if an error occurs.
067     */
068    public void setCreationDate(Date creationDate) throws AmetysRepositoryException;
069
070    /**
071     * Set the login of the last contributor.
072     * @param user the last contributor.
073     * @throws AmetysRepositoryException if an error occurs.
074     */
075    public void setLastContributor(UserIdentity user) throws AmetysRepositoryException;
076
077    /**
078     * Set the last modification date.
079     * @param lastModified the last modification date.
080     * @throws AmetysRepositoryException if an error occurs.
081     */
082    public void setLastModified(Date lastModified) throws AmetysRepositoryException;
083    
084    /**
085     * Set the first validation date
086     * @param validationDate the validation date.
087     * @throws AmetysRepositoryException if an error occurs.
088     */
089    public void setFirstValidationDate(Date validationDate) throws AmetysRepositoryException;
090    
091    /**
092     * Set the last validation date
093     * @param validationDate the validation date.
094     * @throws AmetysRepositoryException if an error occurs.
095     */
096    public void setLastValidationDate (Date validationDate) throws AmetysRepositoryException;
097    
098    /**
099     * Set the last validation date resulting from a major modification
100     * @param validationDate the validation date.
101     * @throws AmetysRepositoryException if an error occurs.
102     */
103    public void setLastMajorValidationDate (Date validationDate) throws AmetysRepositoryException;
104    
105    /**
106     * Store the outgoing references of the content.
107     * @param references A non null map of outgoing references grouped by metadata (key are metadata path)
108     * @throws AmetysRepositoryException if an error occurs.
109     */
110    public void setOutgoingReferences(Map<String, OutgoingReferences> references) throws AmetysRepositoryException;
111    
112    /**
113     * Fills the current content with the values from the provided {@link Node}.
114     * <br>This is the anti-operation of {@link Content#toSAX}, as the Node should be a Node previously generated with SAX events from this method.
115     * @param node The node to read for retrieving values to fill
116     * @param additionalDataGetter The object that will retrieve potential additional data for the content's attributes
117     * @throws Exception if an exception occurs
118     */
119    public void fillContent(Node node, XMLValuesExtractorAdditionalDataGetter additionalDataGetter) throws Exception;
120}