]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.api.acr/src/org/argeo/api/acr/spi/ProvidedContent.java
1 package org
.argeo
.api
.acr
.spi
;
3 import java
.util
.Optional
;
5 import org
.argeo
.api
.acr
.Content
;
7 /** A {@link Content} implementation. */
8 public interface ProvidedContent
extends Content
{
9 /** The related {@link ProvidedSession}. */
10 ProvidedSession
getSession();
12 /** The {@link ContentProvider} this {@link Content} belongs to. */
13 ContentProvider
getProvider();
15 /** Depth relative to the root of the repository. */
19 * Whether this is the root node of the related repository. Default checks
20 * whether <code>{@link #getDepth()} == 0</code>, but it can be optimised by
23 default boolean isRoot() {
24 return getDepth() == 0;
28 * An opaque ID which is guaranteed to uniquely identify this content within the
29 * session return by {@link #getSession()}. Typically used for UI.
31 String
getSessionLocalId();
34 * The {@link Content} within the same {@link ContentProvider} which can be used
35 * to mount another {@link ContentProvider}.
37 default ProvidedContent
getMountPoint(String relativePath
) {
38 throw new UnsupportedOperationException("This content doe not support mount");
42 default Optional
<Content
> getContent(String path
) {
44 if (path
.startsWith(ROOT_PATH
)) {// absolute
47 absolutePath
= getPath() + PATH_SEPARATOR
+ path
;
49 return getSession().exists(absolutePath
) ? Optional
.of(getSession().get(absolutePath
)) : Optional
.empty();
55 /** Whether the session has the right to access the parent. */
56 default boolean isParentAccessible() {
60 /** Whether the related session can open this content for edit. */
61 default boolean canEdit() {