Package eu.xenit.alfred.api.node
Interface INodeService
public interface INodeService
Service for operations on nodes.
-
Method Summary
Modifier and TypeMethodDescriptioncancelCheckout(NodeRef nodeRef) Cancels a checkout of a working copy.Checks in the given working copy.Checks out the given node placing a working copy in the destination specified.Copies a source node to a given destination parent node.voidcreateAssociation(NodeRef source, NodeRef target, QName assocType) Creates an association between source and target of a given type.createContent(InputStream inputStream, String mimeType, String encoding) Creates a content without linking it to a specific node yet.createContentWithMimetypeGuess(InputStream inputStream, String fileName, String encoding) Creates a content without linking it to a specific node yet.createNode(NodeRef parent, String name, QName type) Create a node with a given parent, name and type.createNode(NodeRef parent, String fileName, String contentType, MetadataChanges metadata, InputStream content) Convenience method to create a node giving the type, the list of properties, and requesting metadata extraction from its content.createNode(NodeRef parent, Map<QName, String[]> properties, QName[] aspectsToAdd, QName[] aspectsToRemove, QName type, ContentData contentData) Creation of a node giving the list of properties as well as the type.createNode(NodeRef parent, Map<QName, String[]> properties, QName type, ContentData contentData) Creation of a node giving the list of properties as well as the type.booleandeleteNode(NodeRef nodeRef) Delete a node by moving it to the trashcan.booleandeleteNode(NodeRef nodeRef, boolean permanently) Delete a node.booleanvoidextractMetadata(NodeRef node) Extracts metadata on a nodegetAncestors(NodeRef ref, NodeRef rootRef) Returns all primary ancestors of the given node.getAssociations(NodeRef ref) Returns all target, parent and child associations of the given node.getContent(NodeRef node) Returns content as inputStream + other related informations (mimeType, size, ...)getMetadata(NodeRef noderef) getRootNode(StoreRef storeRef) Get the root node of the given store.Fetches all associations for which the given node is the target.Fetches all associations for which the given node is the source.getWorkingCopySource(NodeRef nodeRef) Moves a source node to a given destination parent node.voidremoveAssociation(NodeRef source, NodeRef target, QName assocType) Removes an association between source and target of a given type.voidsetContent(NodeRef node, ContentData contentData) Set the content of a node.voidsetContent(NodeRef node, InputStream inputStream, String originalFilename) Sets content of a specific node.setMetadata(NodeRef noderef, MetadataChanges metadata)
-
Method Details
-
getMetadata
- Parameters:
noderef- The noderef for which the metadata is requested.- Returns:
- The metadata of the given noderef. In case the node has no transaction id, the transaction id is set to -1. This can be the case for nodes that are stored as an old version.
-
setMetadata
- Parameters:
noderef- The noderef for which the metadata is set.metadata- The new metadata for the given noderef.- Returns:
- Returns the new metadata in a NodeMetadata object (contains node ref, properties, ...).
-
getRootNode
Get the root node of the given store.- Parameters:
storeRef- the Store of which the root node is requested.- Returns:
- the noderef of the root node.
-
getChildAssociations
- Parameters:
ref- The node for which the child associations are requested.- Returns:
- The child associations of the given node.
-
getParentAssociations
- Parameters:
ref- The node for which the parent associations are requested.- Returns:
- The parent associations of the given node.
-
getTargetAssociations
Fetches all associations for which the given node is the source.- Parameters:
ref- The node for which the associations are requested.- Returns:
- The peer associations of the given node for which it is the source
-
getSourceAssociations
Fetches all associations for which the given node is the target.- Parameters:
ref- The node for which the associations are requested.- Returns:
- The peer associations of the given node for which it is the target
-
getAssociations
Returns all target, parent and child associations of the given node.- Parameters:
ref- The node for which the associations are requested.- Returns:
- all target, parent and child associations of the given node.
-
getAncestors
Returns all primary ancestors of the given node.- Parameters:
ref- The node for which the ancestors are requested.rootRef- The node up to which point the ancestors have to be retrieved. This is optional and uses Company Home as root by default.- Returns:
- a list of the node references of the primary parents.
-
createAssociation
Creates an association between source and target of a given type.- Parameters:
source- The source of the association to create.target- The target of the association to create.assocType- The type of association to create.
-
removeAssociation
Removes an association between source and target of a given type.- Parameters:
source- The source of the association to remove.target- The target of the association to remove.assocType- The type of association to remove.
-
copyNode
Copies a source node to a given destination parent node. Children are copied if deepCopy is true.- Parameters:
source- The node to copy.destination- The parent which will contain the copied node.deepCopy- If true child nodes are also copied.- Returns:
- The noderef of the new node.
-
moveNode
Moves a source node to a given destination parent node.- Parameters:
source- The node to move.destination- The parent which will contain the moved node.- Returns:
- The new noderef of the moved node.
-
createNode
Create a node with a given parent, name and type.- Parameters:
parent- The parent node of the new node.name- The name of the new node.type- The type of the new node.- Returns:
- The noderef of the newly created node.
-
createNode
NodeRef createNode(NodeRef parent, Map<QName, String[]> properties, QName type, ContentData contentData) Creation of a node giving the list of properties as well as the type. To be used when using a custom type has required properties.- Parameters:
parent- The parent node of the new node.properties- list of properties to add to node.type- The type of the node.contentData- can contain returned result of function createContent (or null).- Returns:
- The noderef of the new node.
-
createNode
NodeRef createNode(NodeRef parent, Map<QName, String[]> properties, QName[] aspectsToAdd, QName[] aspectsToRemove, QName type, ContentData contentData) Creation of a node giving the list of properties as well as the type. To be used when using a custom type has required properties.- Parameters:
parent- The parent node of the new node.properties- list of properties to add to node.aspectsToAdd- list of aspects to add to node.aspectsToRemove- list of aspects to remove from node.type- The type of the node.contentData- can contain returned result of function createContent (or null).- Returns:
- The noderef of the new node.
-
createNode
NodeRef createNode(NodeRef parent, String fileName, String contentType, MetadataChanges metadata, InputStream content) Convenience method to create a node giving the type, the list of properties, and requesting metadata extraction from its content. Since Alfresco 7, metadata extraction is done asynchronously. The metadata should be added to the node upon success.- Parameters:
parent- The parent node of the new node.fileName- Name for the target document.contentType- String representation of the target alfresco contenttype.metadata- Properties (and optionally, aspects) to set on the new node in MetadataChanges format.content- Inputstream for the content for this new node.- Returns:
- The noderef of the new node.
-
deleteNode
Delete a node.- Parameters:
nodeRef- The noderef of the node to delete.permanently- If true the node is deleted permanently. If false the node is just moved to the trashcan.- Returns:
- whether the deletion was successful.
-
deleteNode
Delete a node by moving it to the trashcan.- Parameters:
nodeRef- The noderef of the node to delete.- Returns:
- whether the deletion was successful.
-
exists
- Parameters:
nodeRef- The noderef of a node that could exist.- Returns:
- Whether a noderef exists.
-
checkout
Checks out the given node placing a working copy in the destination specified.- Parameters:
original- The node to checkoutdestination- The destination in which the working copy is placed.- Returns:
- null in case the checkout fails.
-
checkin
Checks in the given working copy.- Parameters:
nodeRef- the node that will be checked.comment- Give a comment while checking in.majorVersion- If true this version will have an increased major version number relative to the previous commit. Otherwise an increased minor version number.- Returns:
- the noderef to the original node, updated with the checked in state.
-
cancelCheckout
Cancels a checkout of a working copy. Returns the noderef of the original node.- Parameters:
nodeRef- The working copy of which the checkout will be canceled.- Returns:
- The noderef of the original node.
-
getWorkingCopySource
- Parameters:
nodeRef- The noderef of the working copy.- Returns:
- The Noderef of the source of the working copy (The original node).
-
setContent
Sets content of a specific node. Also changes mimetype by guessing it using content and original file name.- Parameters:
node- noderef of the node where the content of the inputStream will placed.inputStream- The input stream that contains the content. In case the input stream is null the content will be set to empty. The inputstream will be read (in combination with originalFilename) to make a best effort guess about which mimetype the content should have. To enforce a specific mimetype, usesetContent(NodeRef, ContentData)with a ContentData object that has the mimetype explicitly set. A ContentData object can be obtained from the methodcreateContentoriginalFilename- The filename of the content. This is only used to guess the mimetype of the node.
-
setContent
Set the content of a node.- Parameters:
node- The node of which the content is set.contentData- The content to set.
-
createContent
Creates a content without linking it to a specific node yet.- Parameters:
inputStream- Can be null: in that case, the content property of the file is removed.mimeType- ex: "application/pdf"encoding- ex: "UTF-8", ....- Returns:
- the URL of the content (can be set to the content property of a node).
-
createContentWithMimetypeGuess
ContentData createContentWithMimetypeGuess(InputStream inputStream, String fileName, String encoding) Creates a content without linking it to a specific node yet.- Parameters:
inputStream- Can be null: in that case, the content property of the file is removed.fileName- Needed for guessing the mimetype. (Does necessary not need to contain the extension as mimeTypeGuessing will also work on content of the inputStream)encoding- Encoding of the inputStream. ex: "UTF-8", ....- Returns:
- the URL of the content (can be set to the content property of a node).
-
getContent
Returns content as inputStream + other related informations (mimeType, size, ...)- Parameters:
node- the noderef from which the content will be gathered.- Returns:
- ContentInputStream.inputStream has to be closed!
-
extractMetadata
Extracts metadata on a node- Parameters:
node- the noderef from which metadata will be extracted.
-