public interface StoreElement extends Workflowable, Comparable<StoreElement>
Modifier and Type | Method and Description |
---|---|
void |
appendChild(StoreElement child)
Deprecated.
since 4.2.204 - use
IDProvider#moveChild(child) |
void |
appendChildBefore(StoreElement child,
StoreElement nextsibling)
Deprecated.
since 4.2.204 - use
IDProvider#moveChild(child, nextsibling) |
void |
delete()
Deletes this storeelement.
|
void |
exportStoreElement(OutputStream out,
ExportHandler exportHandler)
Exports this storeelement as zip file to the given outputstream.
|
int |
getChildCount() |
int |
getChildIndex(StoreElement child) |
Listable<StoreElement> |
getChildren()
Get the element's direct children.
|
<T extends StoreElement> |
getChildren(Class<T> type)
Get the element's direct children that are instances of the given type.
|
<T extends StoreElement> |
getChildren(Class<T> type,
boolean recurse)
Get the element's children that are instances of the given type.
|
<T extends StoreElement> |
getChildren(Filter.TypedFilter<T> filter,
boolean recurse)
Get the element's children passing the given typed filter.
|
WorkflowPermission |
getCreateWorkflowPermission(Workflow workflow)
Return workflow permission object for the given workflow.
|
List<Principal> |
getDefinedPrincipalPermissions()
Returns a list of
Principal's for which
permissions are defined at this storeelement. |
User |
getEditor() |
String |
getElementType() |
StoreElement |
getFirstChild()
Provides the first child node.
|
ReferenceEntry[] |
getIncomingReferences()
Returns all incoming references of this
StoreElement . |
List<Principal> |
getInheritedPrincipalPermissions()
Returns a list of
Principal's for which
permissions are defined at this storelement including the inherited permissions on parent path. |
long |
getLastChanged() |
String |
getName() |
StoreElement |
getNextSibling()
Provides the next sibling store element.
|
ReferenceEntry[] |
getOutgoingReferences()
Returns all outgoing references of this
StoreElement . |
StoreElement |
getParent()
|
Permission |
getPermission()
Returns the permission object for the
current user
even if permission checking is turned off. |
Permission |
getPermission(Group group)
Returns the correct permission object even if permission checking is turned off.
|
Permission |
getPermission(User user)
Returns the correct permission object even if permission checking is turned off.
|
StoreElement |
getPreviousSibling()
Provides the previous store element.
|
Project |
getProject()
Returns the belonging project of this storeelement.
|
String |
getReferenceName()
Provided the element's reference name.
|
Set<ReferenceEntry> |
getReferences()
Returns current outgoing references of this store element.
|
Store |
getStore()
Provides the store related to the element.
|
de.espirit.firstspirit.store.access.PermissionMap |
getTreePermission()
Return permissions combined from defined and inherited permissions for current user.
|
WorkflowPermission |
getWorkflowPermission(Workflow workflow)
Return workflow permission object for the given workflow.
|
WorkflowPermission[] |
getWorkflowPermissions()
Return all existing workflow permissions.
|
boolean |
getWriteLock()
A write lock is a flag to prevent changes e.g. while a workflow is active for this element.
|
boolean |
hasIncomingReferences()
Returns
true if this StoreElement has incoming references. |
boolean |
hasPermissions()
Indicates whether for this element permissions are defined or not.
|
StoreElement |
importStoreElement(ZipFile exportFile,
ImportHandler importHandler)
Imports the first root node from the given zip exportfile.
|
Listable<StoreElement> |
importStoreElements(ZipFile exportFile,
ImportHandler importHandler)
Imports all root nodes from the given zip exportfile.
|
boolean |
inheritWorkflowPermission()
Returns a
boolean state, whether the workflow permissions should be inherited for this StoreElement or not. |
boolean |
isDeleted()
Returns the state of deletion. true if element is deleted and false if its not
|
boolean |
isExportSupported()
Checks if the element supports export.
|
boolean |
isFolder()
Checks if the element is a folder.
|
boolean |
isImportSupported()
Checks if the element supports import.
|
boolean |
isLocked()
Checks if this node is locked by this session.
|
boolean |
isLockedOnServer(boolean allSessions)
Checks if this storeelement is locked on the server.
|
boolean |
isLockSupported()
Check this before using any lock method.
|
boolean |
isPermissionSupported()
Indicates whether this element supports permissions or not.
|
boolean |
isWorkflowAllowed(Workflow workflow,
User user)
Returns
true if
workflow is not null and is explicitly allowed to be started on this element by given user or
workflow is null and any workflow is allowed to be started on this element by given user . |
boolean |
isWorkflowSupported()
Checks if a workflow might be executed at the element.
|
void |
refresh()
Refreshes this element if there is a newer version on the server.
|
void |
removeAllWorkflowPermissions() |
void |
removeChild(StoreElement child)
Removes the given child from this element.
|
void |
removePermission(Group group)
Removes the permission object for a given group.
|
void |
removePermission(User user)
Removes the permission object for the given user.
|
void |
removePermission(User[] users)
Removes the permission object for several given users.
|
void |
removeWorkflowPermission(Workflow workflow) |
void |
replaceChild(StoreElement oldChild,
StoreElement newChild)
Replaces an element's child by another child.
|
void |
save()
Saves the node and all childs, shortcut for
save(null, true) . |
void |
save(String comment)
Saves the node and all childs.
|
void |
save(String comment,
boolean saveChilds)
Saves this node.
|
void |
setInheritWorkflowPermission(boolean inherit)
Sets a
boolean flag to enable or disable the inheritance of workflow permissions for this StoreElement . |
void |
setLock(boolean lock)
Lock or unlock this element and all children.
|
void |
setLock(boolean lock,
boolean recursive)
Lock or unlock this element, if
recursive == true all children are also (un)locked. |
void |
setPermission(Group group,
Permission permission)
Set the defined permission for the given group.
|
void |
setPermission(User[] users,
Permission permission)
Set the defined permission for several users.
|
void |
setPermission(User user,
Permission permission)
Set the defined permission for the given user.
|
void |
setWorkflowPermission(WorkflowPermission permission) |
void |
setWorkflowPermissions(WorkflowPermission[] permissions) |
void |
setWriteLock(boolean lock)
A write lock is a flag to prevent changes e.g. while a workflow is active for this element.
|
String |
toXml()
Creates the xml representation of the node with all children but without indentation and line breaks.
|
String |
toXml(boolean includeChilds)
Creates the xml representation with or without all children depending on the given parameter.
|
String |
toXml(boolean includeChildren,
boolean prettyPrinting)
Creates the xml representation with or without children, line breaks and indentation depending on the given parameters.
|
getColor, getTask, hasTask, removeTask, setColor, setTask
compareTo
@ApiDoc(comment="Get the element\'s direct children.", since="4.0") Listable<StoreElement> getChildren()
@ApiDoc(comment="Get the element\'s direct children that are instances of the given type.", since="4.0") <T extends StoreElement> Listable<T> getChildren(@NotNull Class<T> type)
type
- The type to find instances of.@ApiDoc(comment="Get the element\'s children that are instances of the given type.", since="4.0") <T extends StoreElement> Listable<T> getChildren(@NotNull Class<T> type, boolean recurse)
type
- The type to find instances of.recurse
- If true
, recursively collects children.@ApiDoc(comment="Get the element\'s children passing the given typed filter.", since="4.0") <T extends StoreElement> Listable<T> getChildren(@NotNull Filter.TypedFilter<T> filter, boolean recurse)
filter
- The filter to be used.recurse
- If true
, recursively collects children.@Deprecated void appendChild(StoreElement child)
IDProvider#moveChild(child)
IllegalArgumentException
- if child
is not a child node fo this node.appendChildBefore(StoreElement, StoreElement)
@Deprecated void appendChildBefore(@NotNull StoreElement child, @Nullable StoreElement nextsibling)
IDProvider#moveChild(child, nextsibling)
nextsibling
element.
If you want to append a child from a different parent, use
moveChild(child)
or
moveChild(child, nextSiblingIndex)
Attention:
It's necessary to lock and save all parts of the operation (parent and child)
You need permission can change
and
can append leaf
(if given child is a leaf node) or
can append folder
(if given child is a folder)
Example 1 (position ordering - same parent):
parent.setLock(true, false); // non recursive lock move.setLock(true, false); // non recursive lock -> avoid concurrent change try { parent.removeChild(moveNode); parent.appendChildBefore(moveNode, nextSibling); // append 'moveNode' before 'nextSibling' parent.save("position changed", false); // non recursive save // it's not necessary to save 'moveNode' because parent hasn't changed } finally { move.setLock(false, false); // non recursive unlock parent.setLock(false, false); // non recursive unlock }
child
- the child to append to the children list of this elementnextsibling
- the child will be appended before the nextsibling nodeIllegalArgumentException
- if child
is not a child node fo this node.removeChild(StoreElement)
,
IDProvider.moveChild(IDProvider)
,
IDProvider.moveChild(IDProvider, int)
@ApiDoc(comment="Removes the given child from this element.", since="3.0.7") void removeChild(StoreElement child)
If you want to move a child to a different parent, is recommended to use
moveChild(child)
or moveChild(child, nextSiblingIndex)
Attention:
It's necessary to lock and save all parts of the operation (parent and child)
You need permission can change
and
can delete
(if given child is a leaf node) or
can delete folder
(if given child is a folder)
Example 1 (position ordering - same parent):
parent.setLock(true, false); // non recursive lock move.setLock(true, false); // non recursive lock -> avoid concurrent change try { parent.removeChild(moveNode); parent.appendChildBefore(moveNode, nextSibling); // append 'moveNode' before 'nextSibling' parent.save("position changed", false); // non recursive save // it's not necessary to save 'moveNode' because parent hasn't changed } finally { move.setLock(false, false); // non recursive unlock parent.setLock(false, false); // non recursive unlock }
Example 2 (move to another folder -> it's recommended to use move(child)
instead):
parent.setLock(true, false); // non recursive lock move.setLock(true, false); // non recursive lock newParent.setLock(true, false); // non recursive lock try { parent.removeChild(moveNode); newParent.appendChild(moveNode); // move 'moveNode' to 'newparent' parent.save("removed", false); // non recursive save newParent.save("moveNode added", false); // non recursive save moveNode.save("parent changed", false); // non recursive save } finally { parent.setLock(false, false); // non recursive unlock move.setLock(false, false); // non recursive unlock newParent.setLock(false, false); // non recursive unlock }
child
- the child to removeappendChild(StoreElement)
,
appendChildBefore(StoreElement, StoreElement)
,
IDProvider.moveChild(IDProvider)
,
IDProvider.moveChild(IDProvider, int)
@ApiDoc(comment="Replaces an element\'s child by another child.", since="3.0.7") void replaceChild(StoreElement oldChild, StoreElement newChild)
oldChild
- The element's child which should be replaced.newChild
- The new child which replaces the element's old child.@ApiDoc(comment="", since="3.0.115") int getChildIndex(StoreElement child)
@ApiDoc(comment="Return parent StoreElement which is null for deleted elements or store-roots.", since="2.3") @Nullable StoreElement getParent()
StoreElement
which is null
for deleted
elements or store-roots
.@ApiDoc(comment="Provides the next sibling store element.", since="4.0.17") @Nullable StoreElement getNextSibling()
null
will be returned.null
if there is none@ApiDoc(comment="Provides the previous sibling store element.", since="5.2.200804") @Nullable StoreElement getPreviousSibling()
null
will be returned.null
if there is none@ApiDoc(comment="Provides the first child node.", since="4.0.17") @Nullable StoreElement getFirstChild()
null
will be returned.null
if there are no childs@ApiDoc(comment="Provides the store related to the element.", since="2.3") @NotNull Store getStore()
null
.@ApiDoc(comment="Checks if the element is a folder.", since="3.0") boolean isFolder()
true
if the element is a folder, else false
@ApiDoc(comment="Indicates whether this element supports permissions or not.", since="2.3") boolean isPermissionSupported()
true
if this element supports permissions, false
otherwise@ApiDoc(comment="Indicates whether for this element permissions are defined or not.", since="4.0.17") boolean hasPermissions()
true
if this element has defined permissions, false
otherwise@ApiDoc(comment="Returns the permission object for the current user even if permission checking is turned off.", since="2.3") Permission getPermission()
current user
even if permission checking is turned off.@ApiDoc(comment="Returns the correct permission object even if permission checking is turned off.", since="2.3") Permission getPermission(User user)
@ApiDoc(comment="Returns the correct permission object even if permission checking is turned off.", since="2.3") Permission getPermission(Group group)
@ApiDoc(comment="Set the defined permission for the given user.", since="2.3") void setPermission(User user, Permission permission)
user
- The user which receives the permission.permission
- The permission the user should receive.@ApiDoc(comment="Set the defined permission for several users.", since="2.3") void setPermission(User[] users, Permission permission)
users
- The users which receives the permission.permission
- The permission that should be granted for the users.@ApiDoc(comment="Set the defined permission for the given group.", since="2.3") void setPermission(Group group, Permission permission)
group
- The group which should receives the permission.permission
- The permission that should be granted for the group.@ApiDoc(comment="Removes the permission object for the given user.", since="2.3") void removePermission(User user)
user
- The user for which the permission object should be removed.@ApiDoc(comment="Removes the permission object for several given users.", since="2.3") void removePermission(User[] users)
users
- Several user for that the permission object should be removed.@ApiDoc(comment="Removes the permission object for a given group.", since="2.3") void removePermission(Group group)
group
- The group for which the permission object should be removed.@ApiDoc(comment="Return permissions combined from defined and inherited permissions for current user.", since="3.0.59") de.espirit.firstspirit.store.access.PermissionMap getTreePermission()
@ApiDoc(comment="Returns a list of Principal\'s for which permissions are defined at this storeelement.", since="3.1.187") @NotNull List<Principal> getDefinedPrincipalPermissions()
Principal's
for which
permissions are defined at this storeelement.Principal's
@ApiDoc(comment="Returns a list of Principal\'s for which permissions are defined at this storelement including the inherited permissions on parent path.", since="3.1.187") @NotNull List<Principal> getInheritedPrincipalPermissions()
Principal's
for which
permissions are defined at this storelement including the inherited permissions on parent path.Principal's
@ApiDoc(comment="Checks if a workflow might be executed at the element.", since="3.0.1") boolean isWorkflowSupported()
true
if the element supports workflows, else false
@ApiDoc(comment="Return all existing workflow permissions.", since="3.0.1") WorkflowPermission[] getWorkflowPermissions()
@ApiDoc(comment="Return workflow permission object for the given workflow.", since="3.0.1") @Nullable WorkflowPermission getWorkflowPermission(@Nullable Workflow workflow)
@ApiDoc(comment="Return workflow permission object for the given workflow.", since="4.0.120") @NotNull WorkflowPermission getCreateWorkflowPermission(@Nullable Workflow workflow)
@ApiDoc(comment="", since="3.0.1") void setWorkflowPermission(WorkflowPermission permission)
@ApiDoc(comment="", since="3.0.1") void setWorkflowPermissions(WorkflowPermission[] permissions)
@ApiDoc(comment="", since="3.0.1") void removeWorkflowPermission(Workflow workflow)
@ApiDoc(comment="", since="3.0.1") void removeAllWorkflowPermissions()
@ApiDoc(comment="Returns true if workflow is not null and is explicitly allowed to be started on this element by given user or workflow is null and any workflow is allowed to be started on this element by given user, false otherwise.", since="3.0.1") boolean isWorkflowAllowed(@Nullable Workflow workflow, User user)
true
if
workflow
is not null
and is explicitly allowed to be started on this element by given user
orworkflow
is null
and any workflow is allowed to be started on this element by given user
.false
otherwise.@ApiDoc(comment="Returns a boolean state, whether the workflow permissions should be inherited for this StoreElement or not.", since="3.0.1") boolean inheritWorkflowPermission()
boolean
state, whether the workflow permissions should be inherited for this StoreElement
or not.true
the WorkflowPermissions of parent StoreElement
used, false
otherwise.Store
has no parent and return always false
true
for workflow permission inheritance, false
otherwise.@ApiDoc(comment="Sets a boolean flag to enable or disable the inheritance of workflow permissions for this StoreElement.", since="3.0.1") void setInheritWorkflowPermission(boolean inherit)
boolean
flag to enable or disable the inheritance of workflow permissions for this StoreElement
.true
the WorkflowPermissions of parent StoreElement
used, false
otherwise.Store
has no parent and inheritWorkflowPermission()
return always false
inherit
- true
for workflow permission inheritance, false
otherwise.@ApiDoc(comment="A write lock is a flag to prevent changes e.g. while a workflow is active for this element.", since="3.0.4") void setWriteLock(boolean lock)
lock
- true
to signal changes on this element should be preventedgetWriteLock()
@ApiDoc(comment="A write lock is a flag to prevent changes e.g. while a workflow is active for this element.", since="3.0.4") boolean getWriteLock()
true
if the element is locked to prevent changessetWriteLock(boolean)
@ApiDoc(comment="Check this before using any lock method.", since="2.3") boolean isLockSupported()
true
if this node supports lockingsetLock(boolean)
,
setLock(boolean, boolean)
,
isLocked()
,
isLockedOnServer(boolean)
@ApiDoc(comment="Lock or unlock this element and all children.", since="2.3") void setLock(boolean lock) throws LockException, ElementDeletedException
setLock(lock, true)
.LockException
ElementDeletedException
setLock(boolean, boolean)
@ApiDoc(comment="Lock or unlock this element, if recursive == true all children are also (un)locked.", since="4.0.17") void setLock(boolean lock, boolean recursive) throws LockException, ElementDeletedException
recursive == true
all children are also (un)locked.LockException
ElementDeletedException
@ApiDoc(comment="Checks if this node is locked by this session.", since="3.1.158") boolean isLocked()
true
if this node is lockedUnsupportedOperationException
- if isLockSupported()
is false
setLock(boolean)
,
isLockSupported()
,
isLockedOnServer(boolean)
@ApiDoc(comment="Checks if this storeelement is locked on the server.", since="3.1.158") boolean isLockedOnServer(boolean allSessions)
allSessions
- true
all sessions are checked, false
only current session is checkedtrue
wether this object is locked on the server, false
otherwise@ApiDoc(comment="Saves the node and all childs, shortcut for save(null, true).", since="2.3") void save()
save(null, true)
.
Use isLockSupported()
to check if save operation is supported.
save(String)
@ApiDoc(comment="Saves the node and all childs.", since="4.0") void save(String comment)
Use isLockSupported()
to check if save operation is supported.
comment
- comment for the revision
which is created during save@ApiDoc(comment="Saves this node.", since="4.0") void save(String comment, boolean saveChilds)
saveChilds == true
to save recursive all childrencomment
- commentsaveChilds
- true
to save recursive all children, otherwise use false
@ApiDoc(comment="Deletes this storeelement.", since="2.3") void delete() throws LockException
delete
in interface Workflowable
LockException
- if the direct parent is locked in a different session@ApiDoc(comment="Refreshes this element if there is a newer version on the server.", since="2.3") void refresh()
@ApiDoc(comment="Creates the xml representation of the node with all children but without indentation and line breaks.", since="2.3") String toXml()
@ApiDoc(comment="Creates the xml representation with or without all children depending on the given parameter.", since="4.0") String toXml(boolean includeChilds)
includeChilds
- if true
the xml of id childs is included@ApiDoc(comment="Creates the xml representation with or without children, line breaks and indentation depending on the given parameters.", since="4.0") String toXml(boolean includeChildren, boolean prettyPrinting)
includeChildren
- if true
the xml of id children is includedprettyPrinting
- if true
to get the xml strings with line breaks and indentation@ApiDoc(comment="Checks if the element supports import.", since="3.0.1") boolean isImportSupported()
true
if import is supported, else false
@ApiDoc(comment="Checks if the element supports export.", since="3.0.1") boolean isExportSupported()
true
if the element supports export, else false
@ApiDoc(comment="Exports this storeelement as zip file to the given outputstream.", since="3.0.7") void exportStoreElement(OutputStream out, @Nullable ExportHandler exportHandler) throws IOException
exportHandler
- the export events will be reported to this handler (may be null)out
- the output stream the zip export file will be written toIOException
@ApiDoc(comment="Imports the first root node from the given zip exportfile.", since="3.0.7") StoreElement importStoreElement(ZipFile exportFile, @Nullable ImportHandler importHandler) throws IOException, ElementDeletedException, WorkflowLockException
lock
, save
and unlock
the
imported element.exportFile
- Zip export file to import from.importHandler
- Import handler, may be null
.IOException
- If an io error occurs when handling given zip file.ElementDeletedException
- If this element is already deleted.WorkflowLockException
- If this element is locked in a workflow.@ApiDoc(comment="Imports all root nodes from the given zip exportfile.", since="4.0.47") Listable<StoreElement> importStoreElements(ZipFile exportFile, @Nullable ImportHandler importHandler) throws IOException, ElementDeletedException, WorkflowLockException
lock
, save
and unlock
them.exportFile
- Zip export file to import from.importHandler
- Import handler, may be null
.IOException
- If an io error occurs when handling given zip file.ElementDeletedException
- If this element is already deleted.WorkflowLockException
- If this element is locked in a workflow.@ApiDoc(comment="Returns the belonging project of this storeelement.", since="4.0") Project getProject()
@ApiDoc(comment="Returns all incoming references of this StoreElement.", since="3.1.172") @NotNull ReferenceEntry[] getIncomingReferences()
StoreElement
.StoreElement
.hasIncomingReferences()
@ApiDoc(comment="Returns true if this StoreElement has incoming references.", since="4.0") boolean hasIncomingReferences()
true
if this StoreElement
has incoming references. This method is
more efficient and less time consuming than getIncomingReferences()
.length > 0
.true
if this StoreElement
has incoming references.@ApiDoc(comment="Returns all outgoing references of this StoreElement.", since="3.1.172") @NotNull ReferenceEntry[] getOutgoingReferences()
StoreElement
.StoreElement
.@ApiDoc(comment="Provided the element\'s reference name.", since="4.0.17") @Nullable String getReferenceName()
null
will be provided.null
if this element
supports no referencing@ApiDoc(comment="Returns current outgoing references of this store element.", since="4.0.17") Set<ReferenceEntry> getReferences()
Copyright © 2021 e-Spirit AG. All Rights Reserved. Build 5.2.210210