1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.chemistry.opencmis.inmemory.storedobj.api;
20
21 import java.util.List;
22
23 /**
24 * Path is the capability of an object to get accessed by a path in addition to
25 * the identifier. Paths are hierarchical, each object with a path has a parent
26 * where the parent is always a folder. Paths do not exist on its own but are
27 * part of other objects (documents and folders). Most of the functionality is
28 * defined in interfaces that are subclasses.
29 *
30 * @author Jens
31 */
32 public interface Filing {
33
34 /**
35 * character indicating how folders are separated within a path string. This
36 * char must not be a valid character of an object name.
37 */
38 String PATH_SEPARATOR = "/";
39
40 /**
41 * return a list of parents the principal has access to. for single parent object this list must contain
42 * only one element. returns an empty list if this is an unfiled document.
43 *
44 * @param user
45 * user id
46 * @return list of parent folders
47 */
48 List<Folder> getParents(String user);
49
50 /**
51 * usually true except for the root folder, optimized call that just tests
52 * existence to provide information for AtomPub links (much cheaper than
53 * calling getParents() and test for empty result.
54 *
55 * @return
56 * true if object has a parent, false if it is a root object
57 */
58 boolean hasParent();
59
60 /**
61 * Move an object to a different folder. Source and target object are
62 * persisted in this call as part of a transactional step.
63 *
64 * @param newParent
65 * new parent folder for the object
66 */
67 void move(Folder oldParent, Folder newParent);
68
69 }