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.plugins.repository.metadata;
018
019import java.util.Collection;
020
021import org.ametys.plugins.repository.AmetysRepositoryException;
022import org.ametys.plugins.repository.RepositoryIntegrityViolationException;
023
024/**
025 * Folder that is not read only
026 * @deprecated org.ametys.cms.data.RichText new class doesn't use folder anymore
027 */
028@Deprecated
029public interface ModifiableFolder extends Folder
030{
031    public Collection<ModifiableFolder> getFolders() throws AmetysRepositoryException;
032    
033    public ModifiableFolder getFolder(String folderName) throws UnknownMetadataException, AmetysRepositoryException;
034    
035    public Collection<ModifiableFile> getFiles() throws AmetysRepositoryException;
036    
037    public ModifiableFile getFile(String fileName) throws UnknownMetadataException, AmetysRepositoryException;
038
039    /**
040     * Add a folder with the specified name in this folder.
041     * @param folderName the folder name.
042     * @return the created folder.
043     * @throws RepositoryIntegrityViolationException if a file
044     *         or a folder already exists with the given name.
045     * @throws AmetysRepositoryException if an error occurs.
046     */
047    public ModifiableFolder addFolder(String folderName) throws RepositoryIntegrityViolationException, AmetysRepositoryException;
048    
049    /**
050     * Add a file with the specified name in this folder.
051     * @param fileName the file name.
052     * @return the created file.
053     * @throws RepositoryIntegrityViolationException if a file
054     *         or a folder already exists with the given name.
055     * @throws AmetysRepositoryException if an error occurs.
056     */
057    public ModifiableFile addFile(String fileName) throws RepositoryIntegrityViolationException, AmetysRepositoryException;
058    
059    /**
060     * Removes the sub-element represented by the specified name.
061     * @param name the name of the folder or file to be removed.
062     * @throws UnknownMetadataException if no folder nor file does exists.
063     * @throws AmetysRepositoryException if an error occurs.
064     */
065    public void remove(String name) throws UnknownMetadataException, AmetysRepositoryException;
066    
067    /**
068     * Removes all files and folders in this folder.
069     * @throws AmetysRepositoryException if an error occurs.
070     */
071    public void removeAll() throws AmetysRepositoryException;
072}