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 */ 016package org.ametys.cms.repository; 017 018import java.util.Collection; 019import java.util.Date; 020import java.util.Map; 021 022import org.ametys.cms.content.references.OutgoingReferences; 023import org.ametys.core.user.UserIdentity; 024import org.ametys.plugins.explorer.resources.ResourceCollection; 025import org.ametys.plugins.repository.AmetysRepositoryException; 026import org.ametys.plugins.repository.ModifiableACLAmetysObject; 027import org.ametys.plugins.repository.dublincore.DublinCoreAwareAmetysObject; 028import org.ametys.plugins.repository.metadata.MetadataAwareAmetysObject; 029import org.ametys.plugins.repository.metadata.UnknownMetadataException; 030 031/** 032 * Content abstraction defined by the following properties: 033 * <dl> 034 * <dt>type 035 * <dd>the content type (can only be set on creation) 036 * <dt>language 037 * <dd>the language (can only be set on creation) 038 * <dt>title 039 * <dd>the title 040 * <dt>creator 041 * <dd>the login of the creator 042 * <dt>creationDate 043 * <dd>the date when the content was created 044 * <dt>lastContributor 045 * <dd>the login of the last contributor 046 * <dt>lastModified 047 * <dd>the date when the last modification takes place 048 * </dl> 049 */ 050public interface Content extends MetadataAwareAmetysObject, DublinCoreAwareAmetysObject, TagAwareAmetysObject, ModifiableACLAmetysObject 051{ 052 /** 053 * Retrieves the types of this content. 054 * @return the types of this content. 055 * @throws AmetysRepositoryException if an error occurs. 056 */ 057 public String[] getTypes() throws AmetysRepositoryException; 058 059 /** 060 * Retrieves the mixin types of this content. 061 * @return the mixin types of this content. 062 * @throws AmetysRepositoryException if an error occurs. 063 */ 064 public String[] getMixinTypes() throws AmetysRepositoryException; 065 066 /** 067 * Retrieves the language of this content.<br> 068 * This method may only be called on a new Content, ie. before its first save. 069 * @return the language of this content. 070 * @throws AmetysRepositoryException if an error occurs. 071 */ 072 public String getLanguage() throws AmetysRepositoryException; 073 074 /** 075 * Retrieves the title. 076 * @return the title. 077 * @throws UnknownMetadataException if this property does not exist. 078 * @throws AmetysRepositoryException if an error occurs. 079 */ 080 public String getTitle() throws UnknownMetadataException, AmetysRepositoryException; 081 082 /** 083 * Retrieves the login of the creator. 084 * @return the login of the creator. 085 * @throws UnknownMetadataException if this property does not exist. 086 * @throws AmetysRepositoryException if an error occurs. 087 */ 088 public UserIdentity getCreator() throws UnknownMetadataException, AmetysRepositoryException; 089 090 /** 091 * Retrieves the creation date. 092 * @return the creation date. 093 * @throws UnknownMetadataException if this property does not exist. 094 * @throws AmetysRepositoryException if an error occurs. 095 */ 096 public Date getCreationDate() throws UnknownMetadataException, AmetysRepositoryException; 097 098 /** 099 * Retrieves the login of the last contributor. 100 * @return the login of the last contributor. 101 * @throws UnknownMetadataException if this property does not exist. 102 * @throws AmetysRepositoryException if an error occurs. 103 */ 104 public UserIdentity getLastContributor() throws UnknownMetadataException, AmetysRepositoryException; 105 106 /** 107 * Retrieves the last modification date. 108 * @return the last modification date. 109 * @throws UnknownMetadataException if this property does not exist. 110 * @throws AmetysRepositoryException if an error occurs. 111 */ 112 public Date getLastModified() throws UnknownMetadataException, AmetysRepositoryException; 113 114 /** 115 * Retrieves the last validation date 116 * @return the last validation date 117 * @throws UnknownMetadataException if this property does not exist. 118 * @throws AmetysRepositoryException if an error occurs. 119 */ 120 public Date getLastValidationDate() throws UnknownMetadataException, AmetysRepositoryException; 121 122 /** 123 * Retrieves the last validation date resulting from a major modification. At least this is the first validation date 124 * @return the last validation date resulting from a major modification 125 * @throws UnknownMetadataException if this property does not exist. 126 * @throws AmetysRepositoryException if an error occurs. 127 */ 128 public Date getLastMajorValidationDate () throws UnknownMetadataException, AmetysRepositoryException; 129 130 /** 131 * Returns all Contents referencing this Content (as a metadata). 132 * @return all Contents referencing this Content. 133 * @throws AmetysRepositoryException if an error occurs. 134 */ 135 public Collection<Content> getReferencingContents() throws AmetysRepositoryException; 136 137 /** 138 * Get the stored outgoing references of the content. This references can be used for different purposes, such as testing link consistency for example. 139 * @return A non null map of outgoing references grouped by metadata (key are metadata path) 140 * @throws AmetysRepositoryException if an error occurs. 141 */ 142 public Map<String, OutgoingReferences> getOutgoingReferences() throws AmetysRepositoryException; 143 144 /** 145 * Retrieves the attachments root node 146 * @return The attachments root node, or null if the content is working on 147 * an (unmodifiable) old version and the attachments root is missing. 148 * @throws AmetysRepositoryException if an error occurs. 149 */ 150 public ResourceCollection getRootAttachments() throws AmetysRepositoryException; 151}