From 9303bba0e4642212fbac5b8e57307626c514d299 Mon Sep 17 00:00:00 2001 From: Martin Bergljung Date: Thu, 9 Nov 2017 15:15:03 +0000 Subject: [PATCH] [ADF-1586] ActivitiAlfrescoContentService documentation (#2625) --- docs/activiti-alfresco-content.service.md | 126 ++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 docs/activiti-alfresco-content.service.md diff --git a/docs/activiti-alfresco-content.service.md b/docs/activiti-alfresco-content.service.md new file mode 100644 index 0000000000..5838e1cdda --- /dev/null +++ b/docs/activiti-alfresco-content.service.md @@ -0,0 +1,126 @@ +# Activiti Alfresco Content Service + +Get Alfresco Repository folder content based on a Repository account configured in Alfresco Process Services (APS). +It is possible to configure multiple Alfresco Repository accounts in APS (i.e. multiple Alfresco Servers). +This service can also be used to link Alfresco content as related content in APS. +Content such as documents and other files can be attached to Process Instances +and Task Instances as related content. + + + +## Importing + +```ts +import { ActivitiAlfrescoContentService } from 'ng2-activiti-form/src/services/activiti-alfresco.service'; + +export class SomePageComponent implements OnInit { + + constructor(private contentService: ActivitiAlfrescoContentService) { + } +``` + +## Methods + +#### getAlfrescoNodes(accountId: string, folderId: string): Observable<[ExternalContent]> +Get all the nodes under passed in folder node ID (e.g. 3062d73b-fe47-4040-89d2-79efae63869c) for passed in +Alfresco Repository account ID as configured in APS: + +```ts +export class SomePageComponent implements OnInit { + + ngOnInit() { + const alfRepoAccountId = 'alfresco-2'; + const folderNodeId = '3062d73b-fe47-4040-89d2-79efae63869c'; + this.contentService.getAlfrescoNodes(alfRepoAccountId, folderNodeId).subscribe( nodes => { + console.log('Nodes: ', nodes); + }, error => { + console.log('Error: ', error); + }); + } +``` + +In the above sample code the `alfRepoAccountId` points to an Alfresco Repository configuration in APS with ID `alfresco-2`. +The `folderNodeId` needs to identify a folder node ID in the Alfresco Repository identified by the `alfRepoAccountId`. + +The response contained in `nodes` is an array with properties for each object like in this sample: + +``` +0: + folder: false + id: "2223d3c2-0709-4dd7-a79b-c45571901889;1.0" + simpleType: "pdf" + title: "JLAN_Server_Installation_Guide.pdf" +1: + folder: false + id: "900b4dc0-bfdc-4ec1-84dd-5f1f0a420066;1.0" + simpleType: "image" + title: "Screen Shot 2017-09-21 at 15.44.23.png" + +2: + folder: true + id: "f7010382-7b4e-4a78-bb94-9de092439230" + simpleType: "folder" + title: "Event More Stuff" +``` + +#### linkAlfrescoNode(accountId: string, node: ExternalContent, siteId: string): Observable +Link Alfresco content as related content in APS by passing in Alfresco node identifying the content, the Share site +that contains the content, and the Alfresco Repository account ID as configured in APS: + +```ts +export class SomePageComponent implements OnInit { + + ngOnInit() { + const alfRepoAccountId = 'alfresco-2'; + const siteId = 'sample-workspace'; + const externalContentNode = { + id: 'da196918-1324-4e97-9d26-d28f1837a0b6', + simpleType: 'content', + title: 'simple.txt', + folder: false + } + this.contentService.linkAlfrescoNode(alfRepoAccountId, externalContentNode, siteId).subscribe(link => { + console.log('Link: ', link); + }, error => { + console.log('Error: ', error); + }); + } +``` + +In the above sample code the `alfRepoAccountId` points to an Alfresco Repository configuration in APS with ID `alfresco-2`. +The `siteId` identifies an Alfresco Share site in the Alfresco Repository where the content to be linked resides. +You can get the ID for a Share site from the URL: `http://localhost:8080/share/page/site/`. +The `externalContentNode` identifies the content that should be set up as temporary related content in APS. The +`externalContentNode.id` points to an Alfresco node in the Share site specified with `siteId`. + +The response contained in `link` looks like in this sample: + +``` +link: + contentAvailable: true + created: Tue Nov 07 2017 13:18:48 GMT+0000 (GMT) {} + createdBy: {id: 1, firstName: null, lastName: "Administrator", email: "admin@app.activiti.com"} + id: 6006 + link:true + mimeType: null + name: "simple.txt" + previewStatus: "queued" + relatedContent: false + simpleType: "content" + source: "alfresco-2" + sourceId: "da196918-1324-4e97-9d26-d28f1837a0b6@sample-workspace" + thumbnailStatus: "queued" +``` + + + + \ No newline at end of file