Accesses and manipulates ACS document nodes using their node IDs.
string, nodeBody: any, options: any = {}): Observable<MinimalNode>string - ID of the parent folder nodeany - Data for the new folderany - Optional parameters supported by JS-APIObservable<MinimalNode> - Details of the new folderstring, nodeBody: any, options: any = {}): Observable<MinimalNode>string - ID of the parent folder nodeany - Data for the new nodeany - Optional parameters supported by JS-APIObservable<MinimalNode> - Details of the new nodestring, nodeType: string, properties: any, path: string): Observable<NodeEntry>-root- folderstring - Node namestring - Node typeany - Node body propertiesstring - Path to the nodeObservable<NodeEntry> - The created nodestring, nameSpace: any, data: any, path: string, name?: string): Observable<NodeEntry>string - Node typeany - Namespace for propertiesany - Property data to store in the node under namespacestring - Path to the nodestring - (Optional) Node nameObservable<NodeEntry> - The created nodestring, options: any = {}): Observable<any>string - ID of the target nodeany - Optional parameters supported by JS-APIObservable<any> - Empty result that notifies when the deletion is completestring, options: any = {}): Observable<MinimalNode>string - ID of the target nodeany - Optional parameters supported by JS-APIObservable<MinimalNode> - Node informationstring, options: any = {}): Observable<NodePaging>string - ID of the target nodeany - Optional parameters supported by JS-APIObservable<NodePaging> - List of child items from the folderstring): Observable<any>string - ID of the target nodeObservable<any> - Content datastring): Observable<NodeMetadata>string - ID of the target nodeObservable<NodeMetadata> - Node metadatastring): Observable<MinimalNode>string - ID of the node to restoreObservable<MinimalNode> - Details of the restored nodestring, nodeBody: any, options: any = {}): Observable<MinimalNode>string - ID of the target nodeany - New data for the nodeany - Optional parameters supported by JS-APIObservable<MinimalNode> - Updated node informationEach node (ie, document or folder) in an ACS repository is identified by its own unique node ID value. The ID is a long string of hex values separated by dashes, eg:
53ef6110-ed9c-4739-a520-e7b4336229c0
The string is convenient for storage, for passing as an Angular route parameter and other purposes but doesn't enable you to do very much with the node itself. The Nodes Api Service has methods for getting information about nodes and managing them within the repository (creating, deleting, etc).
Other lower level interfaces to the ACS nodes API are also available - see the Alfresco Api service, the Alfresco JS API docs and the REST API Explorer for more information.
The getNode method gives access to the MinimalNode object that represents the
details of a node:
interface MinimalNode extends Node { id: string; parentId: string; name: string; nodeType: string; isFolder: boolean; isFile: boolean; modifiedAt: Date; modifiedByUser: UserInfo; createdAt: Date; createdByUser: UserInfo; content: ContentInfo; path: PathInfoEntity; properties: NodeProperties; }
This provides useful information about the node, such as its name, creation and
modification dates, etc. Also, the id and parentId properties contain the node
ID strings for the current node and its enclosing folder.
Sometimes, a MinimalNode is provided directly, for example, the folderNode property
of a Document List component or the data context of a
Document List row. In these cases,
you might pass the id or parentId as a route parameter
to a page describing the node in full detail. The component receiving the node ID can
use the Nodes Api service to "decode" the ID string into a MinimalNode:
import { ActivatedRoute, Router } from '@angular/router';
import { Component, OnInit } from '@angular/core';
import { NodesApiService } from '@alfresco/adf-core';
import { MinimalNode } from '@alfresco/js-api';
...
class RepositoryDetailsPageComponent implements OnInit {
nodeId: string;
nodeName: string;
isFile: boolean;
...
constructor(private router: Router,
private activatedRoute: ActivatedRoute,
private nodeService: NodesApiService) {
}
ngOnInit() {
this.nodeId = this.activatedRoute.snapshot.params['node-id'];
this.nodeService.getNode(this.nodeId).subscribe((entry: MinimalNode) => {
const node: MinimalNode = entry;
this.nodeName = node.name;
this.isFile = node.isFile;
...
});
}
You can supply a number of extra options using the options parameter. See the
getNode
page in the Alfresco JS API docs for more information.
The getNodeChildren method returns the contents of a folder
as a list of items. The
getNodeChildren
page in the Alfresco JS API gives more information about the structure of the
options parameter.
You can use the createNode and createFolder methods to add new nodes
within a parent folder node, and the updateNode method to update an
existing node. See the
addNode
and
updateNode
entries in the Alfresco JS API for further information about the available options and
the format of the new node data.
The Content Services repository maintains a "trashcan" where items are temporarily held after they have been deleted. This means you can restore a deleted item if you remove it from the trashcan before it gets deleted permanently.
By default, the deleteNode method moves an item into the trash, where it can
be retrieved using restoreNode. However, you can set an option for deleteNode
to delete the node immediately if you have the right permissions. See the
deleteNode
and
restoreNode
pages in the Alfresco JS API for further details and options. Note that you can also use the
Deleted Nodes Api service get a list of all items currently in the trashcan.
© 2023 Alfresco Software, Inc. All Rights Reserved.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.