Package de.espirit.firstspirit.access
Class AccessUtil
java.lang.Object
de.espirit.firstspirit.access.AccessUtil
Utitly class providing methods for Access-API operations like
server release,
server delete- Since:
- 2.3.17
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcleanUpName(String name) Remove illegal chars from a name.static <T extends StoreElement>
TcopyStoreElement(T element, StoreElement parent) Creates a copy of the given element below the parent.static <T extends StoreElement>
TcopyStoreElement(T element, StoreElement parent, boolean checkRules) Creates a copy of the given element below the parent.static ServerActionHandle<? extends DeleteProgress,Boolean> delete(IDProvider element, boolean ignoreIncomingReferences) Deprecated.static ServerActionHandle<? extends DeleteProgress,Boolean> delete(Collection<IDProvider> elements, boolean ignoreIncomingReferences) Deprecated.useDeleteOperationinstead ; since 5.2.1804static intexecuteProcess(Writer out, Writer err, String... command) Execute a programm in a native process.static LanguagegetLanguageForKey(Project project, String languageKey) Gets a single project language by its unique abbreviation.static @NotNull LanguagegetLanguageForKeyNotNull(Project project, String languageKey) Gets a single project language by its unique abbreviation.static ServerActionHandle<? extends ReleaseProgress,Boolean> release(IDProvider toRelease, boolean checkOnly) Deprecated.useReleaseOperationinstead ; since 5.2.180606static ServerActionHandle<? extends ReleaseProgress,Boolean> release(IDProvider releaseStartNode, boolean checkOnly, boolean ensureAccessibility, boolean recursive, IDProvider.DependentReleaseType dependentType) Deprecated.useReleaseOperationinstead ; since 5.2.180606static ServerActionHandle<? extends ReleaseProgress,Boolean> release(IDProvider releaseStartNode, boolean checkOnly, boolean ensureAccessibility, boolean recursive, IDProvider.DependentReleaseType dependentType, String comment) Deprecated.useReleaseOperationinstead ; since 5.2.180606static ServerActionHandle<? extends ReleaseProgress,Boolean> release(IDProvider toRelease, boolean checkOnly, String comment) Deprecated.useReleaseOperationinstead ; since 5.2.180606static ServerActionHandle<? extends RestoreProgress,Boolean> restore(@NotNull IDProvider newParent, @NotNull ElementInfo elementInfo, boolean restoreParentIfNecessary, boolean ignoreMissingReferencedObjects, boolean checkOnlyMode) Starts a restore action on the server, which restores the deleted element specified by the givenelementInfostatic ServerActionHandle<? extends RevertProgress,Boolean> revert(IDProvider element, Revision revision, boolean recursive, EnumSet<IDProvider.RevertType> ignoreRevertTypes, boolean ignoreMissingReferencedObjects, boolean checkOnlyMode) Reverts an element of typeIDProviderto a specific revision.
-
Constructor Details
-
AccessUtil
public AccessUtil()
-
-
Method Details
-
copyStoreElement
public static <T extends StoreElement> T copyStoreElement(T element, StoreElement parent) throws IOException Creates a copy of the given element below the parent.- Parameters:
element- The element to copyparent- The parent of the new element- Returns:
- The new StoreElement
- Throws:
IOException- thrown during temp-file operations.- Since:
- 4.0.17
-
copyStoreElement
public static <T extends StoreElement> T copyStoreElement(T element, StoreElement parent, boolean checkRules) throws IOException Creates a copy of the given element below the parent.- Parameters:
element- The element to copyparent- The parent of the new elementcheckRules- Whether the rules should be checked when saving or not- Returns:
- The new StoreElement
- Throws:
IOException- thrown during temp-file operations.- Since:
- 5.2.210902
-
cleanUpName
Remove illegal chars from a name.- Parameters:
name- The name- Returns:
- name without illegal chars
- Since:
- 3.0.112
-
release
@Deprecated public static ServerActionHandle<? extends ReleaseProgress,Boolean> release(IDProvider toRelease, boolean checkOnly) Deprecated.useReleaseOperationinstead ; since 5.2.180606Performs the default release on the server for the given IDProvider and following type specific options:- Parameters:
toRelease- the startnode of releasecheckOnly- iftruerelease would not be processed- Returns:
- the handle to the belonging server action which is started on the server
- Throws:
IllegalArgumentException- if given releaseStartNodedoesn't support release- Since:
- 4.0.13
-
release
@Deprecated public static ServerActionHandle<? extends ReleaseProgress,Boolean> release(IDProvider toRelease, boolean checkOnly, String comment) Deprecated.useReleaseOperationinstead ; since 5.2.180606Performs the default release on the server for the given IDProvider and following type specific options:- Parameters:
toRelease- the startnode of releasecheckOnly- iftruerelease would not be processedcomment- the release comment, may be null- Returns:
- the handle to the belonging server action which is started on the server
- Throws:
IllegalArgumentException- if given releaseStartNodedoesn't support release- Since:
- 4.0.120
-
release
@Deprecated public static ServerActionHandle<? extends ReleaseProgress,Boolean> release(IDProvider releaseStartNode, boolean checkOnly, boolean ensureAccessibility, boolean recursive, IDProvider.DependentReleaseType dependentType) Deprecated.useReleaseOperationinstead ; since 5.2.180606Starts the server release action for the given element with the given release options.- Parameters:
releaseStartNode- the startnode of the releasecheckOnly- iftruerelease would not be processedensureAccessibility- iftrueeach element on the parent path of the given releaseStartNode will be released which has never been releasedrecursive- iftruethe subtree of given releaseStartNode will be released recursivedependentType- the dependent type specifying the behaviour for referenced elements of the given releaseStartNode (seeIDProvider.DependentReleaseTypefor details) ifnullthenIDProvider.DependentReleaseType.NO_DEPENDENT_RELEASEis used- Returns:
- the handle to the belonging server action which is started on the server
- Throws:
IllegalArgumentException- if given releaseStartNodedoesn't support release- Since:
- 4.0.13
- See Also:
-
release
@Deprecated public static ServerActionHandle<? extends ReleaseProgress,Boolean> release(IDProvider releaseStartNode, boolean checkOnly, boolean ensureAccessibility, boolean recursive, IDProvider.DependentReleaseType dependentType, String comment) Deprecated.useReleaseOperationinstead ; since 5.2.180606Starts the server release action for the given element with the given release options.- Parameters:
releaseStartNode- the startnode of the releasecheckOnly- iftruerelease would not be processedensureAccessibility- iftrueeach element on the parent path of the given releaseStartNode will be released which has never been releaseddependentType- the dependent type specifying the behaviour for referenced elements of the given releaseStartNode (seeIDProvider.DependentReleaseTypefor details) ifnullthenIDProvider.DependentReleaseType.NO_DEPENDENT_RELEASEis usedcomment- the release comment, may be null- Returns:
- the handle to the belonging server action which is started on the server
- Throws:
IllegalArgumentException- if given releaseStartNodedoesn't support release- Since:
- 4.0.120
- See Also:
-
restore
public static ServerActionHandle<? extends RestoreProgress,Boolean> restore(@NotNull @NotNull IDProvider newParent, @NotNull @NotNull ElementInfo elementInfo, boolean restoreParentIfNecessary, boolean ignoreMissingReferencedObjects, boolean checkOnlyMode) throws WorkflowLockException Starts a restore action on the server, which restores the deleted element specified by the givenelementInfo- Parameters:
newParent- the parent node, the restored node should be added as childcheckOnlyMode- usefalseto test the restore of the element,progressof returned handle will contain infos about the restore test- Returns:
- a server action handle to the server restore action
- Throws:
WorkflowLockException- Since:
- 4.0.57
- See Also:
-
revert
public static ServerActionHandle<? extends RevertProgress,Boolean> revert(IDProvider element, Revision revision, boolean recursive, EnumSet<IDProvider.RevertType> ignoreRevertTypes, boolean ignoreMissingReferencedObjects, boolean checkOnlyMode) throws WorkflowLockException Reverts an element of typeIDProviderto a specific revision.- Parameters:
element- Element to be reverted.revision-Revisionobject that specifies the revision that the element should be reverted to.recursive- Iftrue, elements will be reverted recursive. Iffalse, only the given element will be reverted.ignoreRevertTypes- Set ofIDProvider.RevertTypethat specifies attributes and elements that should not be reverted. If this set does not containIDProvider.RevertType.CHILD_LIST, i.e. children should be reverted as well, recursive will be set totrue.ignoreMissingReferencedObjects- Iftruethe element will be reverted even if a referenced element can not be found. Iffalse, a missing referenced element will cause the revert operation to fail.checkOnlyMode- Iftrue, the element will not actually be reverted. Instead only all preconditions will be checked and violations will be reported. Iffalseand all preconditions are met, the element will actually be reverted.- Returns:
- the handle to the belonging server action which is started on the server.
- Throws:
WorkflowLockException- if the given elementis lockedby a workflow- Since:
- 4.0.120
-
delete
@Deprecated public static ServerActionHandle<? extends DeleteProgress,Boolean> delete(IDProvider element, boolean ignoreIncomingReferences) Deprecated.useDeleteOperationinstead ; since 5.2.1804Deletes the subtree specified by the given element on the server. The strategy is to delete as much as possible. Elements which couldn't be deleted because of missing permissions, lock failed, incoming references, etc. will be skipped.- Parameters:
element- the element to deleteignoreIncomingReferences- usetrueto delete elements ignoring incoming references, iffalseelements which are referenced will be skipped- Returns:
- The action handle.
- Throws:
IllegalArgumentException- if given element is aDataset- Since:
- 4.0.120
-
delete
@Deprecated public static ServerActionHandle<? extends DeleteProgress,Boolean> delete(Collection<IDProvider> elements, boolean ignoreIncomingReferences) Deprecated.useDeleteOperationinstead ; since 5.2.1804Deletes all elements on the server. The strategy is to delete as much as possible. Elements which couldn't be deleted because of missing permissions, lock failed, incoming references, etc. will be skipped.- Parameters:
elements- the elements to deleteignoreIncomingReferences- usetrueto delete elements ignoring incoming references, iffalseelements which are referenced will be skipped- Returns:
- The action handle.
- Throws:
IllegalArgumentException- if one of the given elements is aDataset- Since:
- 5.0.34
-
getLanguageForKey
Gets a single project language by its unique abbreviation. Returnsnullif no language with the given abbreviation can be found.- Parameters:
project- Languages of this project will be searched for the sought language.languageKey- Unique abbreviation of the sought language.- Returns:
- Project language that corresponds to the given abbreviation or null, if no such language can be found.
- Since:
- 4.0.17
-
getLanguageForKeyNotNull
@NotNull public static @NotNull Language getLanguageForKeyNotNull(Project project, String languageKey) Gets a single project language by its unique abbreviation. Throws anIllegalArgumentExceptionif no language with the given abbreviation can be found.- Parameters:
project- Languages of this project will be searched for the sought language.languageKey- Unique abbreviation of the sought language.- Returns:
- Project language that corresponds to the given abbreviation.
- Throws:
IllegalArgumentException- if no language with the given abbreviation can be found.- Since:
- 4.0.41
-
executeProcess
Execute a programm in a native process.- Parameters:
out- the output writer the process will append its output to. Writer will be closed after execution.err- the error writer the process will append its error output to. Writer will be closed after execution.command- the program and its arguments- Returns:
- the exit code of the process
- Throws:
IOException- if process creation fails- Since:
- 4.0.19
-
DeleteOperationinstead ; since 5.2.1804