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() |
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() |
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.
|
Project |
getProject()
Returns the belonging project of this storeelement.
|
String |
getReferenceName() |
Set<ReferenceEntry> |
getReferences()
Returns current outgoing references of this store element.
|
Store |
getStore() |
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. during 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() |
boolean |
isFolder() |
boolean |
isImportSupported() |
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() |
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() |
void |
refresh()
Refreshs this storeelement against the actual server version
|
void |
removeAllWorkflowPermissions() |
void |
removeChild(StoreElement child)
Removes the given child from this element.
|
void |
removePermission(Group group) |
void |
removePermission(User user) |
void |
removePermission(User[] users) |
void |
removeWorkflowPermission(Workflow workflow) |
void |
replaceChild(StoreElement oldChild,
StoreElement newChild) |
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 store element and all childs.
|
void |
setLock(boolean lock,
boolean recursive)
Lock or unlock this store element, if
recursive == true all children are also locked or unlocked. |
void |
setPermission(Group group,
Permission permission) |
void |
setPermission(User[] users,
Permission permission) |
void |
setPermission(User user,
Permission permission) |
void |
setWorkflowPermission(WorkflowPermission permission) |
void |
setWorkflowPermissions(WorkflowPermission[] permissions) |
void |
setWriteLock(boolean lock)
A write lock is a flag to prevent changes e.g. during a workflow is active for this element.
|
String |
toXml() |
String |
toXml(boolean includeChilds) |
String |
toXml(boolean includeChildren,
boolean prettyPrinting) |
void |
update(ZipFile exportFile,
ImportHandler importHandler)
Deprecated.
since 4.2.406 - no replacement, always throws UnsupportedOperationException
|
getColor, getTask, hasTask, removeTask, setColor, setTask
compareTo
Listable<StoreElement> getChildren()
<T extends StoreElement> Listable<T> getChildren(@NotNull Class<T> type)
type
- The type to find instances of.<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.<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.Usage example with a StoreElementFilter. |
@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)
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)
void replaceChild(StoreElement oldChild, StoreElement newChild)
int getChildCount()
int getChildIndex(StoreElement child)
@Nullable StoreElement getParent()
StoreElement
which is null
for deleted
elements or store-roots
.@Nullable StoreElement getNextSibling()
null
if there is none@Nullable StoreElement getFirstChild()
null
if there are no childsboolean isFolder()
boolean isPermissionSupported()
true
if this element supports permissions, false
otherwiseboolean hasPermissions()
true
if this element has defined permissions, false
otherwisePermission getPermission()
current user
even if permission checking is turned off.Permission getPermission(User user)
Permission getPermission(Group group)
void setPermission(User user, Permission permission)
void setPermission(User[] users, Permission permission)
void setPermission(Group group, Permission permission)
void removePermission(User user)
void removePermission(User[] users)
void removePermission(Group group)
de.espirit.firstspirit.store.access.PermissionMap getTreePermission()
@NotNull List<Principal> getDefinedPrincipalPermissions()
Principal's
for which
permissions are defined at this storeelement.Principal's
@NotNull List<Principal> getInheritedPrincipalPermissions()
Principal's
for which
permissions are defined at this storelement including the inherited permissions on parent path.Principal's
long getLastChanged()
boolean isWorkflowSupported()
WorkflowPermission[] getWorkflowPermissions()
WorkflowPermission getWorkflowPermission(Workflow workflow)
WorkflowPermission getCreateWorkflowPermission(Workflow workflow)
void setWorkflowPermission(WorkflowPermission permission)
void setWorkflowPermissions(WorkflowPermission[] permissions)
void removeWorkflowPermission(Workflow workflow)
void removeAllWorkflowPermissions()
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.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.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.void setWriteLock(boolean lock)
lock
- true
to signal changes on this element should be preventedgetWriteLock()
boolean getWriteLock()
true
if the element is locked to prevent changessetWriteLock(boolean)
boolean isLockSupported()
true
if this node supports lockssetLock(boolean)
,
isLocked()
,
isLockedOnServer(boolean)
void setLock(boolean lock) throws LockException, ElementDeletedException
setLock(lock, true)
.LockException
ElementDeletedException
void setLock(boolean lock, boolean recursive) throws LockException, ElementDeletedException
recursive == true
all children are also locked or unlocked.LockException
ElementDeletedException
boolean isLocked()
true
if this node is lockedUnsupportedOperationException
- if isLockSupported()
is false
setLock(boolean)
,
isLockSupported()
,
isLockedOnServer(boolean)
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
otherwisevoid save()
save(null, true)
.
Use isLockSupported()
to check if save operation is supported.
save(String)
void save(String comment)
Use isLockSupported()
to check if save operation is supported.
comment
- comment for the revision
which is created during savevoid save(String comment, boolean saveChilds)
saveChilds == true
to save recursive all childrencomment
- commentsaveChilds
- true
to save recursive all children, otherwise use false
void delete() throws LockException
delete
in interface Workflowable
LockException
- if the direct parent is locked in a different sessionvoid refresh()
String toXml()
String toXml(boolean includeChilds)
includeChilds
- if true
the xml of id childs is includedString 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 indentationboolean isImportSupported()
boolean isExportSupported()
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
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.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.@Deprecated void update(ZipFile exportFile, ImportHandler importHandler) throws IOException
UnsupportedOperationException
- deprecated, no implementation. Always throws this exception.IOException
String getElementType()
Project getProject()
@NotNull ReferenceEntry[] getIncomingReferences()
StoreElement
.StoreElement
.hasIncomingReferences()
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.@NotNull ReferenceEntry[] getOutgoingReferences()
StoreElement
.StoreElement
.@Nullable String getReferenceName()
null
if this element
supports no referencingSet<ReferenceEntry> getReferences()
boolean isDeleted()
Copyright © 2014 e-Spirit AG. All Rights Reserved. Build 5.0_BETA.500