001/*
002 * (C) Copyright 2012 Nuxeo SA (http://nuxeo.com/) and others.
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 * Contributors:
017 *     Antoine Taillefer <ataillefer@nuxeo.com>
018 */
019package org.nuxeo.drive.adapter;
020
021import java.util.Calendar;
022
023import org.nuxeo.drive.adapter.impl.AbstractDocumentBackedFileSystemItem;
024import org.nuxeo.drive.adapter.impl.AbstractFileSystemItem;
025import org.nuxeo.ecm.core.api.Lock;
026
027/**
028 * Representation of a file system item, typically a file or a folder.
029 *
030 * @author Antoine Taillefer
031 * @see AbstractFileSystemItem
032 * @see AbstractDocumentBackedFileSystemItem
033 * @see FileItem
034 * @see FolderItem
035 */
036public interface FileSystemItem extends Comparable<FileSystemItem> {
037
038    /**
039     * Gets a unique id generated server-side.
040     */
041    String getId();
042
043    /**
044     * Gets the parent {@link FileSystemItem} id.
045     */
046    String getParentId();
047
048    /**
049     * A concatenation of ancestor ids with '/' as prefix and separator.
050     */
051    String getPath();
052
053    /**
054     * Gets the name displayed in the file system.
055     */
056    String getName();
057
058    boolean isFolder();
059
060    String getCreator();
061
062    String getLastContributor();
063
064    Calendar getCreationDate();
065
066    Calendar getLastModificationDate();
067
068    boolean getCanRename();
069
070    void rename(String name);
071
072    boolean getCanDelete();
073
074    void delete();
075
076    Lock getLockInfo();
077
078    boolean canMove(FolderItem dest);
079
080    FileSystemItem move(FolderItem dest);
081
082}