Package org.alfresco.rm.rest.api.impl
Class FilePlanComponentsApiUtils
java.lang.Object
org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils
Utility class that handles common api endpoint tasks
- Since:
- 2.6
- Author:
- Ana Bozianu
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateRMNode
(NodeRef parentNodeRef, RMNode nodeInfo, Parameters parameters) Create an RM nodegetAllowableOperations
(NodeRef nodeRef, QName typeQName) Helper method that generates allowable operation for the provided nodegetContent
(NodeRef nodeRef, Parameters parameters, boolean recordActivity) Helper method to obtain file plan type or null if the rm site does not exist.getListChildrenFilterProps
(Parameters parameters, Set<String> listFolderChildrenEqualsQueryProperties) Returns a List of filter properties specified by request parameters.getSortProperties
(Parameters parameters) TODOlookupAndValidateNodeType
(String nodeId, QName expectedNodeType) lookup node and validate typelookupAndValidateNodeType
(String nodeId, QName expectedNodeType, String relativePath) lookup node by id and relative path and validate typelookupAndValidateNodeType
(String nodeId, QName expectedNodeType, String relativePath, boolean readOnlyRelativePath) lookup node by id and relative path and validate typelookupAndValidateRelativePath
(NodeRef parentNodeRef, String relativePath, boolean readOnlyRelativePath, QName nodesType) Helper method that creates a relative path if it doesn't already exist and if relative path is not read only.lookupAndValidateRelativePath
(NodeRef parentNodeRef, String relativePath, QName nodesType) Helper method that creates a relative path if it doesn't already exist The relative path will be build with nodes of the type specified in nodesType If the relative path already exists the method validates if the last element is of type nodesType The method does not validate the type of parentNodeReflookupByAllowedPlaceholders
(String nodeId, List<String> allowedPlaceholders) Lookup node by placeholder from allowed placeholder listlookupByPlaceholder
(String nodeId) Lookup node by placeholdermapToNodeProperties
(Map<String, Object> properties) Helper method that converts a map of String properties into a map of QName propertiesvoid
postActivity
(FileInfo fileInfo, NodeRef parentNodeRef, String activityType) Posts activities for given fileInfovoid
setActivityPoster
(ActivityPoster poster) void
setAuthenticationUtil
(AuthenticationUtil authenticationUtil) void
setCapabilityService
(CapabilityService capabilityService) void
setContentService
(ContentService contentService) void
setDictionaryService
(DictionaryService dictionaryService) void
setFileFolderService
(FileFolderService fileFolderService) void
setFilePlanService
(FilePlanService filePlanService) void
setMimetypeService
(MimetypeService mimetypeService) void
void
setNodeService
(NodeService nodeService) void
setPermissionService
(PermissionService permissionService) void
setRecordService
(RecordService recordService) void
void
updateNode
(NodeRef nodeRef, RMNode updateInfo, Parameters parameters) Utility method that updates a node's name and propertiesvoid
updateTransferContainer
(NodeRef nodeRef, TransferContainer transferContainerInfo, Parameters parameters) Utility method that updates a transfer container's name and propertiesuploadRecord
(NodeRef parentNodeRef, UploadInfo uploadInfo, Parameters parameters) Upload a recordvalidateAndLookUpContainerNode
(String nodeId, List<String> allowedPlaceholders) look up node by id and validate node type is suitable containervalidateRecord
(String recordId) Validates a recordvoid
writeContent
(NodeRef nodeRef, String fileName, InputStream stream, boolean guessEncoding) Write content to file
-
Field Details
-
FILE_PLAN_ALIAS
- See Also:
-
TRANSFERS_ALIAS
- See Also:
-
UNFILED_ALIAS
- See Also:
-
HOLDS_ALIAS
- See Also:
-
RM_SITE_ID
- See Also:
-
CONTAINERS_FOR_CLASSIFIABLE_CHILDREN_ALIAS
-
TYPES_CAN_CREATE
-
-
Constructor Details
-
FilePlanComponentsApiUtils
public FilePlanComponentsApiUtils()
-
-
Method Details
-
setNodes
-
setFileFolderService
-
setFilePlanService
-
setNodeService
-
setContentService
-
setMimetypeService
-
setDictionaryService
-
setCapabilityService
-
setPermissionService
-
setRecordService
-
setAuthenticationUtil
-
setActivityPoster
-
setSites
-
lookupAndValidateNodeType
public NodeRef lookupAndValidateNodeType(String nodeId, QName expectedNodeType) throws EntityNotFoundException lookup node and validate type- Parameters:
nodeId
-expectedNodeType
-- Returns:
- Throws:
EntityNotFoundException
-
lookupAndValidateNodeType
public NodeRef lookupAndValidateNodeType(String nodeId, QName expectedNodeType, String relativePath) throws EntityNotFoundException lookup node by id and relative path and validate type- Parameters:
nodeId
-expectedNodeType
-relativePath
-- Returns:
- Throws:
EntityNotFoundException
-
lookupAndValidateNodeType
public NodeRef lookupAndValidateNodeType(String nodeId, QName expectedNodeType, String relativePath, boolean readOnlyRelativePath) throws EntityNotFoundException lookup node by id and relative path and validate type- Parameters:
nodeId
-expectedNodeType
-relativePath
-- Returns:
- Throws:
EntityNotFoundException
-
validateAndLookUpContainerNode
look up node by id and validate node type is suitable container- Parameters:
nodeId
-- Returns:
-
lookupByAllowedPlaceholders
Lookup node by placeholder from allowed placeholder list- Parameters:
nodeId
-allowedPlaceholders
-- Returns:
- NodeRef for corresponding id
-
lookupByPlaceholder
Lookup node by placeholder- Parameters:
nodeId
-- Returns:
- NodeRef for corresponding id
-
getSortProperties
TODO- Parameters:
parameters
-- Returns:
-
writeContent
public void writeContent(NodeRef nodeRef, String fileName, InputStream stream, boolean guessEncoding) Write content to file- Parameters:
nodeRef
- the node to write the content tofileName
- the name of the file (used for guessing the file's mimetype)stream
- the input stream to writeguessEncoding
- whether to guess stream encoding
-
lookupAndValidateRelativePath
public NodeRef lookupAndValidateRelativePath(NodeRef parentNodeRef, String relativePath, QName nodesType) Helper method that creates a relative path if it doesn't already exist The relative path will be build with nodes of the type specified in nodesType If the relative path already exists the method validates if the last element is of type nodesType The method does not validate the type of parentNodeRef- Parameters:
parentNodeRef
- the first node of the pathrelativePath
- a string representing the relative path in the format "Folder1/Folder2/Folder3"nodesType
- the type of all the containers in the path- Returns:
- the last element of the relative path
-
lookupAndValidateRelativePath
public NodeRef lookupAndValidateRelativePath(NodeRef parentNodeRef, String relativePath, boolean readOnlyRelativePath, QName nodesType) Helper method that creates a relative path if it doesn't already exist and if relative path is not read only. If relative path is read only an exception will be thrown if the provided relative path does not exist. The relative path will be build with nodes of the type specified in nodesType If the relative path already exists the method validates if the last element is of type nodesType The method does not validate the type of parentNodeRef- Parameters:
parentNodeRef
- the first node of the pathrelativePath
- a string representing the relative path in the format "Folder1/Folder2/Folder3"readOnlyRelativePath
- the flag that indicates if the relativePath should be created if doesn't exist or notnodesType
- the type of all the containers in the path- Returns:
- the last element of the relative path
-
mapToNodeProperties
Helper method that converts a map of String properties into a map of QName properties- Parameters:
properties
-- Returns:
- a map of properties
-
createRMNode
Create an RM node- Parameters:
parentNodeRef
- the parent of the nodenodeInfo
- the node infos to createparameters
- the object to get the parameters passed into the request- Returns:
- the new node
-
uploadRecord
Upload a record- Parameters:
parentNodeRef
- the parent of the recorduploadInfo
- the infos of the uploaded recordparameters
- the object to get the parameters passed into the request- Returns:
- the new record
-
getListChildrenFilterProps
public List<FilterProp> getListChildrenFilterProps(Parameters parameters, Set<String> listFolderChildrenEqualsQueryProperties) Returns a List of filter properties specified by request parameters.- Parameters:
parameters
- TheParameters
object to get the parameters passed into the request including: - filter, sort & paging params (where, orderBy, skipCount, maxItems)- Returns:
- The list of
FilterProp
. Can be null.
-
updateNode
Utility method that updates a node's name and properties- Parameters:
nodeRef
- the node to updateupdateInfo
- information to update the record withparameters
- request parameters
-
validateRecord
Validates a record- Parameters:
recordId
- the id of the record to validate- Returns:
- Throws:
InvalidArgumentException
-
getContent
-
updateTransferContainer
public void updateTransferContainer(NodeRef nodeRef, TransferContainer transferContainerInfo, Parameters parameters) Utility method that updates a transfer container's name and properties- Parameters:
nodeRef
- the node to updatetransferContainerInfo
- information to update the transfer container withparameters
- request parameters
-
getAllowableOperations
Helper method that generates allowable operation for the provided node- Parameters:
nodeRef
- the node to get the allowable operations fortypeQName
- the type of the provided nodeRef- Returns:
- a sublist of [
Nodes.OP_DELETE
,Nodes.OP_CREATE
,Nodes.OP_UPDATE
] representing the allowable operations for the provided node
-
getFilePlanType
Helper method to obtain file plan type or null if the rm site does not exist.- Returns:
- file plan type or null
-
postActivity
Posts activities for given fileInfo- Parameters:
fileInfo
-parentNodeRef
-activityType
-
-