[ACS-5601] Add getProcessesAndTasksOnContent to process content service (#8940)

* [ACS-5601] Add getProcessesAndTasksOnContent to process content service

* [ACS-5601] Add docs for new method

* [ACS-5601] Fix import
This commit is contained in:
MichalKinas 2023-09-28 11:05:19 +02:00 committed by GitHub
parent 094acf77ce
commit a0c79e6c64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 1 deletions

View File

@ -62,6 +62,12 @@ Manipulates content related to a Process Instance or Task Instance in APS.
- _taskId:_ `string` - ID of the target task - _taskId:_ `string` - ID of the target task
- _opts:_ `any` - (Optional) Options supported by JS-API - _opts:_ `any` - (Optional) Options supported by JS-API
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Metadata for the content - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Metadata for the content
- **getProcessesAndTasksOnContent**(sourceId: `string`, source: `string`, size?: `number`, page?: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)<[`ResultListDataRepresentationRelatedProcessTask`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/ResultListDataRepresentation%C2%ABRelatedContentRepresentation%C2%BB.md)><br/>
Lists processes and tasks on workflow started with provided document
- _sourceId:_ `string` - id of the document that workflow or task has been started with
- _source:_ `string` - source of the document that workflow or task has been started with
- _size:_ `number` - size of the entries to get
- _page:_ `number` - page number
- **handleError**(error: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/> - **handleError**(error: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Reports an error message. Reports an error message.
- _error:_ `any` - Data object with optional `message` and `status` fields for the error - _error:_ `any` - Data object with optional `message` and `status` fields for the error
@ -377,6 +383,21 @@ this.contentService.getTaskRelatedContent(taskId).subscribe(
The response format is the same as for the `getProcessRelatedContent` method, see its docs. The response format is the same as for the `getProcessRelatedContent` method, see its docs.
#### getProcessesAndTasksOnContent(sourceId: string, source: string, size?: number, page?: number): Observable`<ResultListDataRepresentationRelatedProcessTask>`
Lists processes and tasks on workflow started with provided document.
```ts
const sourceId = 'sourceId';
const source = 'source';
this.contentService.getProcessesAndTasksOnContent(sourceId, source).subscribe(
res => {
console.log('Response: ', res);
}, error => {
console.log('Error: ', error);
});
```
## Details ## Details
## Importing ## Importing

View File

@ -17,7 +17,7 @@
import { AlfrescoApiService, LogService } from '@alfresco/adf-core'; import { AlfrescoApiService, LogService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ActivitiContentApi, RelatedContentRepresentation } from '@alfresco/js-api'; import { ActivitiContentApi, RelatedContentRepresentation, ResultListDataRepresentationRelatedProcessTask } from '@alfresco/js-api';
import { Observable, from, throwError } from 'rxjs'; import { Observable, from, throwError } from 'rxjs';
import { catchError } from 'rxjs/operators'; import { catchError } from 'rxjs/operators';
@ -183,6 +183,19 @@ export class ProcessContentService {
.pipe(catchError((err) => this.handleError(err))); .pipe(catchError((err) => this.handleError(err)));
} }
/**
* Lists processes and tasks on workflow started with provided document
*
* @param sourceId - id of the document that workflow or task has been started with
* @param source - source of the document that workflow or task has been started with
* @param size - size of the entries to get
* @param page - page number
* @return Promise<ResultListDataRepresentationRelatedProcessTask>
*/
getProcessesAndTasksOnContent(sourceId: string, source: string, size?: number, page?: number): Observable<ResultListDataRepresentationRelatedProcessTask> {
return from(this.contentApi.getProcessesAndTasksOnContent(sourceId, source, size, page)).pipe(catchError((err) => this.handleError(err)));
}
/** /**
* Creates a JSON representation of data. * Creates a JSON representation of data.
* *