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