mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2557] Updated docs with new props script (#3149)
* [ADF-2557] Updated docs for services with new props script * [ADF-2557] Updated service docs with new props script
This commit is contained in:
committed by
Eugenio Romano
parent
8769c257f8
commit
1d517d3a8a
40
docs/core/apps-process.service.md
Normal file
40
docs/core/apps-process.service.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-04-05
|
||||
---
|
||||
|
||||
# Apps Process service
|
||||
|
||||
Gets details of the Process Services apps that are deployed for the user.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- `getApplicationDetailsById(appId: number = null): Observable<AppDefinitionRepresentation>`<br/>
|
||||
Gets the details for a specific app ID number.
|
||||
- `appId: number = null` - ID of the target app
|
||||
- **Returns** `Observable<AppDefinitionRepresentation>` - Details of the app
|
||||
- `getDeployedApplications(): Observable<AppDefinitionRepresentation[]>`<br/>
|
||||
Gets a list of deployed apps for this user.
|
||||
- **Returns** `Observable<AppDefinitionRepresentation[]>` - The list of deployed apps
|
||||
- `getDeployedApplicationsByName(name: string = null): Observable<AppDefinitionRepresentation>`<br/>
|
||||
Gets a list of deployed apps for this user, where the app name is \`name\`.
|
||||
- `name: string = null` - Name of the app
|
||||
- **Returns** `Observable<AppDefinitionRepresentation>` - The list of deployed apps
|
||||
|
||||
## Details
|
||||
|
||||
This service can be used to access the Process Services apps that are available
|
||||
to the current user. You can find more information about the
|
||||
returned `AppDefinitionRepresentation` class in the [Filter model page](filter.model.md)
|
||||
and in the
|
||||
[Process Services Apps API](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/AppsApi.md#getAppDefinitions).
|
||||
The methods of this service make use of the
|
||||
[getAppDefinitions](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/AppsApi.md#getAppDefinitions)
|
||||
method, also from the Apps API.
|
||||
|
||||
## See also
|
||||
|
||||
- [Filter model](filter.model.md)
|
@@ -1,24 +1,35 @@
|
||||
---
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-04-05
|
||||
---
|
||||
|
||||
# Comment Process service
|
||||
|
||||
Adds and retrieves comments for task and process instances in Process Services.
|
||||
|
||||
## Methods
|
||||
## Class members
|
||||
|
||||
`addTaskComment(taskId: string, message: string): Observable<CommentProcessModel>`<br/>
|
||||
Adds a comment to a task.
|
||||
### Methods
|
||||
|
||||
`getTaskComments(taskId: string): Observable<CommentProcessModel[]>`<br/>
|
||||
Gets all comments that have been added to a task.
|
||||
|
||||
`addProcessInstanceComment(processInstanceId: string, message: string): Observable<CommentProcessModel>`<br/>
|
||||
Adds a comment to a process instance.
|
||||
|
||||
`getProcessInstanceComments(processInstanceId: string): Observable<CommentProcessModel[]>`<br/>
|
||||
Gets all comments that have been added to a process instance.
|
||||
- `addProcessInstanceComment(processInstanceId: string = null, message: string = null): Observable<CommentModel>`<br/>
|
||||
Adds a comment to a process instance.
|
||||
- `processInstanceId: string = null` - ID of the target process instance
|
||||
- `message: string = null` - Text for the comment
|
||||
- **Returns** `Observable<CommentModel>` - Details of the comment added
|
||||
- `addTaskComment(taskId: string = null, message: string = null): Observable<CommentModel>`<br/>
|
||||
Adds a comment to a task.
|
||||
- `taskId: string = null` - ID of the target task
|
||||
- `message: string = null` - Text for the comment
|
||||
- **Returns** `Observable<CommentModel>` - Details about the comment
|
||||
- `getProcessInstanceComments(processInstanceId: string = null): Observable<CommentModel[]>`<br/>
|
||||
Gets all comments that have been added to a process instance.
|
||||
- `processInstanceId: string = null` - ID of the target process instance
|
||||
- **Returns** `Observable<CommentModel[]>` - Details for each comment
|
||||
- `getTaskComments(taskId: string = null): Observable<CommentModel[]>`<br/>
|
||||
Gets all comments that have been added to a task.
|
||||
- `taskId: string = null` - ID of the target task
|
||||
- **Returns** `Observable<CommentModel[]>` - Details for each comment
|
||||
|
||||
## Details
|
||||
|
||||
|
@@ -1,16 +1,21 @@
|
||||
---
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-04-05
|
||||
---
|
||||
|
||||
# Deleted Nodes Api service
|
||||
|
||||
Gets a list of Content Services nodes currently in the trash.
|
||||
|
||||
## Methods
|
||||
## Class members
|
||||
|
||||
- `getDeletedNodes(options?: Object): Observable<NodePaging>`
|
||||
Gets a list of nodes in the trash.
|
||||
- `options` - (Optional) Options for JSAPI call
|
||||
### Methods
|
||||
|
||||
- `getDeletedNodes(options?: Object = null): Observable<NodePaging>`<br/>
|
||||
Gets a list of nodes in the trash.
|
||||
- `options?: Object = null` - (Optional) Options for JSAPI call
|
||||
- **Returns** `Observable<NodePaging>` - List of nodes in the trash
|
||||
|
||||
## Details
|
||||
|
||||
|
@@ -1,18 +1,23 @@
|
||||
---
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-04-05
|
||||
---
|
||||
|
||||
# Discovery Api service
|
||||
|
||||
Gets version and license information for Process Services and Content Services.
|
||||
|
||||
## Methods
|
||||
## Class members
|
||||
|
||||
- `getEcmProductInfo(): any`
|
||||
Gets product information for Content Services.
|
||||
### Methods
|
||||
|
||||
- `getBpmProductInfo(): any`
|
||||
Gets product information for Process Services.
|
||||
- `getBpmProductInfo(): any`<br/>
|
||||
Gets product information for Process Services.
|
||||
- **Returns** `any` - ProductVersionModel containing product details
|
||||
- `getEcmProductInfo(): any`<br/>
|
||||
Gets product information for Content Services.
|
||||
- **Returns** `any` - ProductVersionModel containing product details
|
||||
|
||||
## Details
|
||||
|
||||
|
@@ -1,22 +1,28 @@
|
||||
---
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-04-05
|
||||
---
|
||||
|
||||
# Ecm User service
|
||||
|
||||
Gets information about a Content Services user.
|
||||
|
||||
## Methods
|
||||
## Class members
|
||||
|
||||
- `getUserInfo(userName: string): Observable<EcmUserModel>`
|
||||
Gets information about a user identified by their username.
|
||||
- `userName` - Target username
|
||||
- `getCurrentUserInfo(): Observable<EcmUserModel>`
|
||||
Gets information about the user who is currently logged-in.
|
||||
### Methods
|
||||
|
||||
- `getUserProfileImage(avatarId: string): string`
|
||||
Returns a profile image as a URL.
|
||||
- `avatarId` - Target avatar
|
||||
- `getCurrentUserInfo(): any`<br/>
|
||||
Gets information about the user who is currently logged-in.
|
||||
- **Returns** `any` - User information as for getUserInfo
|
||||
- `getUserInfo(userName: string = null): Observable<EcmUserModel>`<br/>
|
||||
Gets information about a user identified by their username.
|
||||
- `userName: string = null` - Target username
|
||||
- **Returns** `Observable<EcmUserModel>` - User information
|
||||
- `getUserProfileImage(avatarId: string = null): string`<br/>
|
||||
Returns a profile image as a URL.
|
||||
- `avatarId: string = null` - Target avatar
|
||||
- **Returns** `string` - Image URL
|
||||
|
||||
## Details
|
||||
|
||||
|
@@ -1,46 +1,58 @@
|
||||
---
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-04-06
|
||||
---
|
||||
|
||||
# Nodes Api service
|
||||
|
||||
Accesses and manipulates ACS document nodes using their node IDs.
|
||||
|
||||
## Methods
|
||||
## Class members
|
||||
|
||||
- `getNode(nodeId: string, options: any = {}): Observable<MinimalNodeEntryEntity>`
|
||||
Gets the stored information about a node.
|
||||
- `nodeId` - ID of the target node
|
||||
- `options` - Optional parameters supported by JSAPI
|
||||
- `getNodeChildren(nodeId: string, options: any = {}): Observable<NodePaging>`
|
||||
Gets the items contained in a folder node.
|
||||
- `nodeId` - ID of the target node
|
||||
- `options` - Optional parameters supported by JSAPI
|
||||
- `createNode(parentNodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity>`
|
||||
Creates a new document node inside a folder.
|
||||
- `parentNodeId` - ID of the parent folder node
|
||||
- `nodeBody` - Data for the new node
|
||||
- `options` - Optional parameters supported by JSAPI
|
||||
- `createFolder(parentNodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity>`
|
||||
Creates a new folder node inside a parent folder.
|
||||
- `parentNodeId` - ID of the parent folder node
|
||||
- `nodeBody` - Data for the new folder
|
||||
- `options` - Optional parameters supported by JSAPI
|
||||
- `updateNode(nodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity>`
|
||||
Updates the information about a node.
|
||||
- `nodeId` - ID of the target node
|
||||
- `nodeBody` - New data for the node
|
||||
- `options` - Optional parameters supported by JSAPI
|
||||
- `deleteNode(nodeId: string, options: any = {}): Observable<void>`
|
||||
Moves a node to the trashcan.
|
||||
- `nodeId` - ID of the target node
|
||||
- `options` - Optional parameters supported by JSAPI
|
||||
- `restoreNode(nodeId: string): Observable<MinimalNodeEntryEntity>`
|
||||
Restores a node previously moved to the trashcan.
|
||||
- `nodeId` - ID of the node to restore
|
||||
- `handleError(error: any): Observable<any>`
|
||||
Reports an error.
|
||||
- `error` - Object representing the error
|
||||
### Methods
|
||||
|
||||
- `createFolder(parentNodeId: string = null, nodeBody: any = null, options: any = {}): Observable<MinimalNodeEntryEntity>`<br/>
|
||||
Creates a new folder node inside a parent folder.
|
||||
- `parentNodeId: string = null` - ID of the parent folder node
|
||||
- `nodeBody: any = null` - Data for the new folder
|
||||
- `options: any = {}` - Optional parameters supported by JSAPI
|
||||
- **Returns** `Observable<MinimalNodeEntryEntity>` - Details of the new folder
|
||||
- `createNode(parentNodeId: string = null, nodeBody: any = null, options: any = {}): Observable<MinimalNodeEntryEntity>`<br/>
|
||||
Creates a new document node inside a folder.
|
||||
- `parentNodeId: string = null` - ID of the parent folder node
|
||||
- `nodeBody: any = null` - Data for the new node
|
||||
- `options: any = {}` - Optional parameters supported by JSAPI
|
||||
- **Returns** `Observable<MinimalNodeEntryEntity>` - Details of the new node
|
||||
- `deleteNode(nodeId: string = null, options: any = {}): Observable<void>`<br/>
|
||||
Moves a node to the trashcan.
|
||||
- `nodeId: string = null` - ID of the target node
|
||||
- `options: any = {}` - Optional parameters supported by JSAPI
|
||||
- **Returns** `Observable<void>` - Empty result that notifies when the deletion is complete
|
||||
- `getNode(nodeId: string = null, options: any = {}): Observable<MinimalNodeEntryEntity>`<br/>
|
||||
Gets the stored information about a node.
|
||||
- `nodeId: string = null` - ID of the target node
|
||||
- `options: any = {}` - Optional parameters supported by JSAPI
|
||||
- **Returns** `Observable<MinimalNodeEntryEntity>` - Node information
|
||||
- `getNodeChildren(nodeId: string = null, options: any = {}): Observable<NodePaging>`<br/>
|
||||
Gets the items contained in a folder node.
|
||||
- `nodeId: string = null` - ID of the target node
|
||||
- `options: any = {}` - Optional parameters supported by JSAPI
|
||||
- **Returns** `Observable<NodePaging>` - List of child items from the folder
|
||||
- `handleError(error: any = null): Observable<any>`<br/>
|
||||
Reports an error.
|
||||
- `error: any = null` - Object representing the error
|
||||
- **Returns** `Observable<any>` - Error information
|
||||
- `restoreNode(nodeId: string = null): Observable<MinimalNodeEntryEntity>`<br/>
|
||||
Restores a node previously moved to the trashcan.
|
||||
- `nodeId: string = null` - ID of the node to restore
|
||||
- **Returns** `Observable<MinimalNodeEntryEntity>` - Details of the restored node
|
||||
- `updateNode(nodeId: string = null, nodeBody: any = null, options: any = {}): Observable<MinimalNodeEntryEntity>`<br/>
|
||||
Updates the information about a node.
|
||||
- `nodeId: string = null` - ID of the target node
|
||||
- `nodeBody: any = null` - New data for the node
|
||||
- `options: any = {}` - Optional parameters supported by JSAPI
|
||||
- **Returns** `Observable<MinimalNodeEntryEntity>` - Updated node information
|
||||
|
||||
## Details
|
||||
|
||||
|
@@ -1,19 +1,24 @@
|
||||
---
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-04-06
|
||||
---
|
||||
|
||||
# People Content service
|
||||
|
||||
Gets information about a Content Services user.
|
||||
Gets information about a Content Services user.
|
||||
|
||||
## Methods
|
||||
## Class members
|
||||
|
||||
- `getPerson(personId: string): Observable<any>`
|
||||
Gets information about a user identified by their username.
|
||||
- `personId` - ID of the target user
|
||||
- `getCurrentPerson(): Observable<any>`
|
||||
Gets information about the user who is currently logged-in.
|
||||
### Methods
|
||||
|
||||
- `getCurrentPerson(): Observable<any>`<br/>
|
||||
Gets information about the user who is currently logged in.
|
||||
- **Returns** `Observable<any>` - User information
|
||||
- `getPerson(personId: string = null): Observable<any>`<br/>
|
||||
Gets information about a user identified by their username.
|
||||
- `personId: string = null` - ID of the target user
|
||||
- **Returns** `Observable<any>` - User information
|
||||
|
||||
## Details
|
||||
|
||||
|
@@ -1,28 +1,36 @@
|
||||
---
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-04-05
|
||||
---
|
||||
|
||||
# People Process service
|
||||
|
||||
Gets information about Process Services users.
|
||||
|
||||
## Methods
|
||||
## Class members
|
||||
|
||||
- `getWorkflowUsers(taskId?: string, searchWord?: string): Observable<UserProcessModel[]>`
|
||||
Gets information about users across all tasks.
|
||||
- `taskId` - (Optional) ID of the task
|
||||
- `searchWord` - (Optional) Filter text to search for
|
||||
- `getUserImage(user: UserProcessModel): string`
|
||||
Gets the profile picture URL for the specified user.
|
||||
- `user` - The target user
|
||||
- `involveUserWithTask(taskId: string, idToInvolve: string): Observable<UserProcessModel[]>`
|
||||
Sets a user to be involved with a task.
|
||||
- `taskId` - ID of the target task
|
||||
- `idToInvolve` - ID of the user to involve
|
||||
- `removeInvolvedUser(taskId: string, idToRemove: string): Observable<UserProcessModel[]>`
|
||||
Removes a user who is currently involved with a task.
|
||||
- `taskId` - ID of the target task
|
||||
- `idToRemove` - ID of the user to remove
|
||||
### Methods
|
||||
|
||||
- `getUserImage(user: UserProcessModel = null): string`<br/>
|
||||
Gets the profile picture URL for the specified user.
|
||||
- `user: UserProcessModel = null` - The target user
|
||||
- **Returns** `string` - Profile picture URL
|
||||
- `getWorkflowUsers(taskId?: string = null, searchWord?: string = null): Observable<UserProcessModel[]>`<br/>
|
||||
Gets information about users across all tasks.
|
||||
- `taskId?: string = null` - (Optional) ID of the task
|
||||
- `searchWord?: string = null` - (Optional) Filter text to search for
|
||||
- **Returns** `Observable<UserProcessModel[]>` - Array of user information objects
|
||||
- `involveUserWithTask(taskId: string = null, idToInvolve: string = null): Observable<UserProcessModel[]>`<br/>
|
||||
Sets a user to be involved with a task.
|
||||
- `taskId: string = null` - ID of the target task
|
||||
- `idToInvolve: string = null` - ID of the user to involve
|
||||
- **Returns** `Observable<UserProcessModel[]>` - Empty response when the update completes
|
||||
- `removeInvolvedUser(taskId: string = null, idToRemove: string = null): Observable<UserProcessModel[]>`<br/>
|
||||
Removes a user who is currently involved with a task.
|
||||
- `taskId: string = null` - ID of the target task
|
||||
- `idToRemove: string = null` - ID of the user to remove
|
||||
- **Returns** `Observable<UserProcessModel[]>` - Empty response when the update completes
|
||||
|
||||
## Details
|
||||
|
||||
|
389
docs/core/process-content.service.md
Normal file
389
docs/core/process-content.service.md
Normal file
@@ -0,0 +1,389 @@
|
||||
---
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
---
|
||||
|
||||
# Process Content Service
|
||||
|
||||
Manipulates content related to a Process Instance or Task Instance in APS.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- `createProcessRelatedContent(processInstanceId: string = null, content: any = null, opts?: any = null): Observable<any>`<br/>
|
||||
Associates an uploaded file with a process instance.
|
||||
- `processInstanceId: string = null` - ID of the target process instance
|
||||
- `content: any = null` - File to associate
|
||||
- `opts?: any = null` - (Optional) Options supported by JSAPI
|
||||
- **Returns** `Observable<any>` - Details of created content
|
||||
- `createTaskRelatedContent(taskId: string = null, file: any = null, opts?: any = null): any`<br/>
|
||||
Associates an uploaded file with a task instance.
|
||||
- `taskId: string = null` - ID of the target task
|
||||
- `file: any = null` - File to associate
|
||||
- `opts?: any = null` - (Optional) Options supported by JSAPI
|
||||
- **Returns** `any` - Details of created content
|
||||
- `createTemporaryRawRelatedContent(file: any = null): Observable<RelatedContentRepresentation>`<br/>
|
||||
Create temporary related content from an uploaded file.
|
||||
- `file: any = null` - File to use for content
|
||||
- **Returns** `Observable<RelatedContentRepresentation>` - The created content data
|
||||
- `deleteRelatedContent(contentId: number = null): Observable<any>`<br/>
|
||||
Deletes related content.
|
||||
- `contentId: number = null` - Identifier of the content to delete
|
||||
- **Returns** `Observable<any>` - Null response that notifies when the deletion is complete
|
||||
- `getContentPreview(contentId: number = null): Observable<Blob>`<br/>
|
||||
Gets the preview for a related content file.
|
||||
- `contentId: number = null` - ID of the related content
|
||||
- **Returns** `Observable<Blob>` - Binary data of the content preview
|
||||
- `getContentThumbnail(contentId: number = null): Observable<Blob>`<br/>
|
||||
Gets the thumbnail for a related content file.
|
||||
- `contentId: number = null` - ID of the related content
|
||||
- **Returns** `Observable<Blob>` - Binary data of the thumbnail image
|
||||
- `getFileContent(contentId: number = null): Observable<RelatedContentRepresentation>`<br/>
|
||||
Gets the metadata for a related content item.
|
||||
- `contentId: number = null` - ID of the content item
|
||||
- **Returns** `Observable<RelatedContentRepresentation>` - Metadata for the content
|
||||
- `getFileRawContent(contentId: number = null): Observable<Blob>`<br/>
|
||||
Gets raw binary content data for a related content file.
|
||||
- `contentId: number = null` - ID of the related content
|
||||
- **Returns** `Observable<Blob>` - Binary data of the related content
|
||||
- `getFileRawContentUrl(contentId: number = null): string`<br/>
|
||||
Gets a URL for direct access to a related content file.
|
||||
- `contentId: number = null` - ID of the related content
|
||||
- **Returns** `string` - URL to access the content
|
||||
- `getProcessRelatedContent(processId: string = null): Observable<any>`<br/>
|
||||
Gets related content items for a process instance.
|
||||
- `processId: string = null` - ID of the target process
|
||||
- **Returns** `Observable<any>` - Metadata for the content
|
||||
- `getTaskRelatedContent(taskId: string = null): Observable<any>`<br/>
|
||||
Gets related content items for a task instance.
|
||||
- `taskId: string = null` - ID of the target task
|
||||
- **Returns** `Observable<any>` - Metadata for the content
|
||||
- `handleError(error: any = null): Observable<any>`<br/>
|
||||
Reports an error message.
|
||||
- `error: any = null` - Data object with optional `message` and `status` fields for the error
|
||||
- **Returns** `Observable<any>` - Callback when an error occurs
|
||||
- `toJson(res: any = null): any`<br/>
|
||||
Creates a JSON representation of data.
|
||||
- `res: any = null` - Object representing data
|
||||
- **Returns** `any` - JSON object
|
||||
- `toJsonArray(res: any = null): any`<br/>
|
||||
Creates a JSON array representation of data.
|
||||
- `res: any = null` - Object representing data
|
||||
- **Returns** `any` - JSON array object
|
||||
|
||||
## Methods
|
||||
|
||||
#### createProcessRelatedContent(processInstanceId: string, content: any, opts?: any): Observable`<any>`
|
||||
|
||||
Associate an uploaded file with a Process Instance.
|
||||
|
||||
Let's say we have an upload button as follows:
|
||||
|
||||
```html
|
||||
<div class="button-row">
|
||||
<button mat-button color="accent" mat-mini-fab (click)="fileInput.click()">
|
||||
<mat-icon>attachment</mat-icon>
|
||||
</button>
|
||||
<input hidden type="file" #fileInput (change)="onUploadFile($event)"/>
|
||||
</div>
|
||||
```
|
||||
|
||||
We can then create related content as follows:
|
||||
|
||||
```ts
|
||||
export class SomePageComponent implements OnInit {
|
||||
|
||||
@ViewChild('fileInput') fileInput;
|
||||
|
||||
...
|
||||
|
||||
onUploadFile() {
|
||||
const fileBrowser = this.fileInput.nativeElement;
|
||||
if (fileBrowser.files && fileBrowser.files[0]) {
|
||||
const file: File = fileBrowser.files[0];
|
||||
const processInstanceId = '11337';
|
||||
const opts = {
|
||||
isRelatedContent: true
|
||||
};
|
||||
this.contentService.createProcessRelatedContent(processInstanceId, file, opts).subscribe(
|
||||
(relContent: RelatedContentRepresentation) => {
|
||||
console.log('Related content: ', relContent);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In the above sample code the `file` is uploaded via an HTML input element.
|
||||
The `processInstanceId` refers to a process instance ID for a running process in APS.
|
||||
The returned `relContent` object looks like in this sample:
|
||||
|
||||
Related content:
|
||||
contentAvailable: true
|
||||
created: Wed Nov 08 2017 10:50:30 GMT+0000 (GMT) {}
|
||||
createdBy: {id: 1, firstName: null, lastName: "Administrator", email: "admin@app.activiti.com"}
|
||||
id: 6007
|
||||
link: false
|
||||
mimeType: "application/pdf"
|
||||
name: "simple.pdf"
|
||||
previewStatus: "queued"
|
||||
relatedContent: true
|
||||
simpleType: "pdf"
|
||||
thumbnailStatus: "queued"
|
||||
|
||||
The related content `id` can be used by other methods in this service to get to the content and to
|
||||
delete it. It is referred to as the `contentId`.
|
||||
|
||||
If you look at attachments for the process instance it should now display the new file.
|
||||
|
||||
#### createTaskRelatedContent(taskId: string, file: any, opts?: any)
|
||||
|
||||
Associate an uploaded file with a Task Instance. This is in effect very similar
|
||||
to the `createProcessRelatedContent` call. Just use `taskInstanceId` instead of `processInstanceId`.
|
||||
|
||||
```ts
|
||||
onUploadFile() {
|
||||
const fileBrowser = this.fileInput.nativeElement;
|
||||
if (fileBrowser.files && fileBrowser.files[0]) {
|
||||
const file: File = fileBrowser.files[0];
|
||||
const taskInstanceId = '15303';
|
||||
const opts = {
|
||||
isRelatedContent: true
|
||||
};
|
||||
this.contentService.createTaskRelatedContent(taskInstanceId, file, opts).subscribe(
|
||||
(relContent: RelatedContentRepresentation) => {
|
||||
console.log('Related content: ', relContent);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For more information see the docs for `createProcessRelatedContent`.
|
||||
|
||||
#### createTemporaryRawRelatedContent(file: any): Observable`<RelatedContentRepresentation>`
|
||||
|
||||
Create temporary related content from an uploaded file. This means that the related content
|
||||
is not yet associated with a process instance or a task instance.
|
||||
|
||||
```ts
|
||||
onUploadFile() {
|
||||
const fileBrowser = this.fileInput.nativeElement;
|
||||
if (fileBrowser.files && fileBrowser.files[0]) {
|
||||
const file: File = fileBrowser.files[0];
|
||||
this.contentService.createTemporaryRawRelatedContent(file).subscribe(
|
||||
(relContent: RelatedContentRepresentation) => {
|
||||
console.log('Related content: ', relContent);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For more information see the docs for `createProcessRelatedContent`.
|
||||
|
||||
#### deleteRelatedContent(contentId: number): Observable`<any>`
|
||||
|
||||
Delete related content via the content identifier:
|
||||
|
||||
```ts
|
||||
const contentId = 6008;
|
||||
this.contentService.deleteRelatedContent(contentId).subscribe(
|
||||
res => {
|
||||
console.log('Delete response: ', res);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The response is going to be `null` if the delete was successful.
|
||||
|
||||
See `getProcessRelatedContent` and `getTaskRelatedContent` for how to get to the `contentId`.
|
||||
|
||||
#### getFileContent(contentId: number): Observable`<RelatedContentRepresentation>`
|
||||
|
||||
Get the metadata for a related content item in the format of a `RelatedContentRepresentation` object:
|
||||
|
||||
```ts
|
||||
const contentId = 6008;
|
||||
this.contentService.getFileContent(contentId).subscribe(
|
||||
res => {
|
||||
console.log('Response Metadata: ', res);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The metadata response looks like in this example:
|
||||
|
||||
contentAvailable: true
|
||||
created: Wed Nov 08 2017 11:26:14 GMT+0000 (GMT) {}
|
||||
createdBy: {id: 1, firstName: null, lastName: "Administrator", email: "admin@app.activiti.com"}
|
||||
id: 6008
|
||||
link: false
|
||||
mimeType: "application/pdf"
|
||||
name: "simple.pdf"
|
||||
previewStatus: "created"
|
||||
relatedContent: true
|
||||
simpleType: "pdf"
|
||||
thumbnailStatus: "created"
|
||||
|
||||
See `getProcessRelatedContent` and `getTaskRelatedContent` for how to get to the `contentId`.
|
||||
|
||||
#### getFileRawContentUrl(contentId: number): string
|
||||
|
||||
Get the URL for direct access to a related content file:
|
||||
|
||||
```ts
|
||||
const contentId = 6008;
|
||||
const url = this.contentService.getFileRawContentUrl(contentId);
|
||||
console.log('URL: ', url);
|
||||
```
|
||||
|
||||
The URL response looks something like this:
|
||||
|
||||
`http://localhost:4200/bpm/activiti-app/api/enterprise/content/6008/raw`
|
||||
|
||||
This URL can be used to directly access the content file, such as from a browser.
|
||||
|
||||
See `getProcessRelatedContent` and `getTaskRelatedContent` for how to get to the `contentId`.
|
||||
|
||||
#### getFileRawContent(contentId: number): Observable`<Blob>`
|
||||
|
||||
Get the raw content bytes as a BLOB for a related content file:
|
||||
|
||||
```ts
|
||||
const contentId = 5006;
|
||||
this.contentService.getFileRawContent(contentId).subscribe(
|
||||
res => {
|
||||
console.log('Response BLOB: ', res);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The BLOB response looks something like this:
|
||||
|
||||
`Blob(205824) {size: 205824, type: "application/msword"}`
|
||||
|
||||
See `getProcessRelatedContent` and `getTaskRelatedContent` for how to get to the `contentId`.
|
||||
|
||||
#### getContentPreview(contentId: number): Observable`<Blob>`
|
||||
|
||||
Get the preview file for a related content file. A content file might be for example a
|
||||
MS Word document. This method would give you the PDF preview for this document,
|
||||
if it has been generated:
|
||||
|
||||
```ts
|
||||
const contentId = 5006;
|
||||
this.contentService.getContentPreview(contentId).subscribe(
|
||||
res => {
|
||||
console.log('Response Preview BLOB: ', res);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The preview BLOB response looks something like this:
|
||||
|
||||
`Blob(44101) {size: 44101, type: "application/pdf"}`
|
||||
|
||||
See `getProcessRelatedContent` and `getTaskRelatedContent` for how to get to the `contentId`.
|
||||
|
||||
#### getContentThumbnail(contentId: number): Observable`<Blob>`
|
||||
|
||||
Get the thumbnail file for a related content file. A content file might be for example a
|
||||
MS Word document. This method would give you the image thumbnail for this document,
|
||||
if it has been generated:
|
||||
|
||||
```ts
|
||||
const contentId = 5006;
|
||||
this.contentService.getContentThumbnail(contentId).subscribe(
|
||||
res => {
|
||||
console.log('Response thumbnail BLOB: ', res);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The response looks like in this sample:
|
||||
|
||||
`Blob(13780) {size: 13780, type: "image/png"}`
|
||||
|
||||
See `getProcessRelatedContent` and `getTaskRelatedContent` for how to get to the `contentId`.
|
||||
|
||||
#### getProcessRelatedContent(processId: string): Observable`<any>`
|
||||
|
||||
Get related content items for passed in Process Instance ID, only metadata for related content is returned:
|
||||
|
||||
```ts
|
||||
const processId = '11337';
|
||||
this.contentService.getProcessRelatedContent(processId).subscribe(
|
||||
res => {
|
||||
console.log('Response: ', res);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The response looks like in the following sample:
|
||||
|
||||
size: 2
|
||||
start:0
|
||||
total:2
|
||||
data:
|
||||
0:
|
||||
contentAvailable: true
|
||||
created: "2017-10-29T07:28:15.546+0000"
|
||||
createdBy: {id: 1, firstName: null, lastName: "Administrator", email: "admin@app.activiti.com"}
|
||||
id: 5006
|
||||
link: false
|
||||
mimeType: "application/msword"
|
||||
name: "More info for Invoice.doc"
|
||||
previewStatus: "created"
|
||||
relatedContent: true
|
||||
simpleType: "word"
|
||||
thumbnailStatus: "created"
|
||||
1:
|
||||
id: 6008,
|
||||
name: "simple.pdf",
|
||||
created: "2017-11-08T11:26:14.162+0000",
|
||||
createdBy: {…},
|
||||
relatedContent: true,
|
||||
…}
|
||||
|
||||
The `id` property corresponds to the `contentId` property used in many of the other methods of this service.
|
||||
|
||||
#### getTaskRelatedContent(taskId: string): Observable`<any>`
|
||||
|
||||
Get related content items for passed in Task Instance ID, only metadata for related content is returned:
|
||||
|
||||
```ts
|
||||
const taskId = '15303';
|
||||
this.contentService.getTaskRelatedContent(taskId).subscribe(
|
||||
res => {
|
||||
console.log('Response: ', res);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The response format is the same as for the `getProcessRelatedContent` method, see its docs.
|
||||
|
||||
## Details
|
||||
|
||||
## Importing
|
||||
|
||||
```ts
|
||||
import { RelatedContentRepresentation } from 'alfresco-js-api';
|
||||
import { ProcessContentService } from '@alfresco/adf-core';
|
||||
|
||||
export class SomePageComponent implements OnInit {
|
||||
|
||||
constructor(private contentService: ProcessContentService) {
|
||||
}
|
||||
```
|
@@ -1,57 +1,66 @@
|
||||
---
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-04-05
|
||||
---
|
||||
|
||||
# Upload Service
|
||||
|
||||
Provides access to various APIs related to file upload features.
|
||||
|
||||
## Methods
|
||||
## Class members
|
||||
|
||||
- `isUploading(): boolean`
|
||||
Checks whether the service is uploading a file.
|
||||
### Methods
|
||||
|
||||
- `getQueue(): FileModel[]`
|
||||
Returns the file Queue
|
||||
|
||||
- `addToQueue(files: FileModel[]): FileModel[]`
|
||||
Adds files to the uploading queue to be uploaded
|
||||
- `files` - One or more separate parameters or an array of files to queue
|
||||
- `uploadFilesInTheQueue(emitter: EventEmitter<any>)`
|
||||
Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
|
||||
- `emitter` - (Deprecated) Emitter to invoke on file status change
|
||||
- `cancelUpload(files: FileModel[])`
|
||||
Cancels uploading of files.
|
||||
- `files` - One or more separate parameters or an array of files
|
||||
- `clearQueue()`
|
||||
Clears the upload queue
|
||||
|
||||
- `getUploadPromise(file: FileModel): any`
|
||||
Gets an upload promise for a file.
|
||||
- `file` - The target file
|
||||
- `addToQueue(files: FileModel[] = null): FileModel[]`<br/>
|
||||
Adds files to the uploading queue to be uploaded
|
||||
- `files: FileModel[] = null` - One or more separate parameters or an array of files to queue
|
||||
- **Returns** `FileModel[]` - Array of files that were not blocked from upload by the ignore list
|
||||
- `cancelUpload(files: FileModel[] = null)`<br/>
|
||||
Cancels uploading of files.
|
||||
- `files: FileModel[] = null` - One or more separate parameters or an array of files specifying uploads to cancel
|
||||
- `clearQueue()`<br/>
|
||||
Clears the upload queue
|
||||
- `getQueue(): FileModel[]`<br/>
|
||||
Gets the file Queue
|
||||
- **Returns** `FileModel[]` - Array of files that form the queue
|
||||
- `getUploadPromise(file: FileModel = null): any`<br/>
|
||||
Gets an upload promise for a file.
|
||||
- `file: FileModel = null` - The target file
|
||||
- **Returns** `any` - Promise that is resolved if the upload is successful or error otherwise
|
||||
- `isUploading(): boolean`<br/>
|
||||
Checks whether the service is uploading a file.
|
||||
- **Returns** `boolean` - True if a file is uploading, false otherwise
|
||||
- `uploadFilesInTheQueue(emitter: EventEmitter<any> = null)`<br/>
|
||||
Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
|
||||
- `emitter: EventEmitter<any> = null` - (Deprecated) Emitter to invoke on file status change
|
||||
|
||||
## Events
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| queueChanged | FileModel\[] | Raised every time the file queue changes. |
|
||||
| fileUpload | FileUploadEvent | Raised every time a File model changes its state. |
|
||||
| fileUploadStarting | FileUploadEvent | Raised when upload starts. |
|
||||
| fileUploadCancelled | FileUploadEvent | Raised when upload gets cancelled by user. |
|
||||
| fileUploadProgress | FileUploadEvent | Raised during file upload process and contains the current progress for the particular File model. |
|
||||
| fileUploadAborted | FileUploadEvent | Raised when file upload gets aborted by the server. |
|
||||
| fileUploadError | FileUploadEvent | Raised when an error occurs to file upload. |
|
||||
| fileUploadComplete | FileUploadCompleteEvent | Raised when file upload is complete. |
|
||||
| fileUploadDelete | FileUploadDeleteEvent | Raised when uploaded file is removed from server. |
|
||||
| queueChanged | FileModel\[] | Emitted when the file queue changes. |
|
||||
| fileUpload | FileUploadEvent | Emitted when a File model changes its state. |
|
||||
| fileUploadStarting | FileUploadEvent | Emitted when an upload starts. |
|
||||
| fileUploadCancelled | FileUploadEvent | Emitted when an upload gets cancelled by the user. |
|
||||
| fileUploadProgress | FileUploadEvent | Emitted during the file upload process and contains the current progress for a particular File model. |
|
||||
| fileUploadAborted | FileUploadEvent | Emitted when a file upload gets aborted by the server. |
|
||||
| fileUploadError | FileUploadEvent | Emitted when an error occurs during a file upload. |
|
||||
| fileUploadComplete | FileUploadCompleteEvent | Emitted when a file upload is complete. |
|
||||
| fileUploadDelete | FileUploadDeleteEvent | Emitted when an uploaded file is removed from server. |
|
||||
| fileDeleted | string | This can be invoked when a file is deleted from an external source to upload the file dialog status. |
|
||||
|
||||
## Details
|
||||
|
||||
### Ignore list configuration
|
||||
|
||||
Is possible add an ignore list for files that you don't want to allow upload on your CS.
|
||||
The configuration of this service is saved in the **_app.config.json file_**.If you want more details about the configuration service follow this [link](https://github.com/Alfresco/alfresco-ng2-components/tree/master/ng2-components/ng2-alfresco-core#appconfigservice).
|
||||
In the example below you can see how filtered out the : '.git', '.DS_Store' and 'desktop.ini'. **Every element is a glob pattern string.** So, if you want to exclude all the txt files, you can add the "\*.txt". (notice the asterisk at the beginning of the pattern!)
|
||||
You can add an ignore list for files that you don't want to be uploaded on your CS.
|
||||
The configuration of this service is saved in the `app.config.json` file
|
||||
(see the [App Config service](app-config.service.md) for more information).
|
||||
|
||||
The example below shows how to filter out the : '.git', '.DS_Store' and 'desktop.ini' files.
|
||||
Each element of the ignore list is a glob pattern string, so you could exclude all the `.txt`
|
||||
files, for example, by adding a `*.txt` pattern to the list.
|
||||
|
||||
**app.config.json**
|
||||
|
||||
@@ -68,7 +77,5 @@ In the example below you can see how filtered out the : '.git', '.DS_Store' and
|
||||
}
|
||||
```
|
||||
|
||||
Note:
|
||||
|
||||
- Standard glob patterns work.
|
||||
- You can end patterns with a forward slash / to specify a directory.
|
||||
Note that all standard glob patterns work and you can end patterns with a forward
|
||||
slash `/` character to specify a directory.
|
||||
|
Reference in New Issue
Block a user