[ADF-2463] Moved doc files to subfolders (#3081)

This commit is contained in:
Andy Stark
2018-03-15 15:41:09 +00:00
committed by Eugenio Romano
parent c27273cb7d
commit e33cb06371
49 changed files with 131 additions and 131 deletions

View File

@@ -0,0 +1,36 @@
---
Added: v2.0.0
Status: Active
---
# Apps Process service
Gets details of the Process Services apps that are deployed for the user.
## Methods
`getDeployedApplications(): Observable<AppDefinitionRepresentation[]>`<br/>
Gets a list of deployed apps for this user.
`getDeployedApplicationsByName(name: string): Observable<AppDefinitionRepresentation>`<br/>
Gets a list of deployed apps for this user, where the app name is `name`.
`getApplicationDetailsById(appId: number): Observable<AppDefinitionRepresentation>`<br/>
Get the details for a specific app ID number.
## 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.
<!-- Don't edit the See also section. Edit seeAlsoGraph.json and run config/generateSeeAlso.js -->
<!-- seealso start -->
## See also
- [Filter model](filter.model.md)
<!-- seealso end -->

View File

@@ -0,0 +1,73 @@
---
Added: v2.0.0
Status: Active
---
# Filter model
Contains classes related to filters in Process Services.
## Details
You can find more information about the usage of these classes in the
[APS Rest API docs](https://github.com/Alfresco/alfresco-js-api/tree/master/src/alfresco-activiti-rest-api)
and in various ADF docs (see the [See Also](#see-also) section for links).
```ts
class AppDefinitionRepresentationModel {
defaultAppId: string;
deploymentId: string;
name: string;
description: string;
theme: string;
icon: string;
id: number;
modelId: number;
tenantId: number;
}
class FilterParamsModel {
id: string;
name: string;
index: number;
}
class FilterRepresentationModel implements UserTaskFilterRepresentation {
id: number;
appId: number;
name: string;
recent: boolean;
icon: string;
filter: FilterParamRepresentationModel;
index: number;
}
class FilterParamRepresentationModel {
processDefinitionId: string;
processDefinitionKey: string;
name: string;
state: string;
sort: string;
assignment: string;
dueAfter: Date;
dueBefore: Date;
}
class TaskQueryRequestRepresentationModel implements TaskQueryRequestRepresentation {
appDefinitionId: string;
processInstanceId: string;
processDefinitionId: string;
text: string;
assignment: string;
state: string;
start: string;
sort: string;
page: number;
size: number;
}
```
## See also
- [Process filters component](process-filters.component.md)
- [Task filters component](task-filters.component.md)
- [Apps process service](apps-process.service.md)

View File

@@ -0,0 +1,88 @@
---
Added: v2.0.0
Status: Active
---
# Log Service
Provide a log functionality for your ADF application.
## Basic Usage
**app.component.ts**
```ts
import { LogService } from '@alfresco/adf-core';
@Component({...})
export class AppComponent {
constructor(logService: LogService) {
}
myMethod(){
this.logService.error('My error');
this.logService.trace('My trace')
this.logService.debug('My debug')
this.logService.info('My info')
this.logService.warn('My warn')
}
}
```
### Log levels
The log service provide 6 level of logs:
Name | Level
-|-
TRACE |5
DEBUG |4
INFO |3
WARN |2
ERROR |1
SILENT |0
You can configure the log level setting the ***logLevel*** properties in the **app.config.json**. By default the level is TRACE.
If you want set for example the log to warning:
**app.config.json**
```json
{
"logLevel": "WARN"
}
```
### Log message bus
The logservice provide also an Observable ***onMessage*** where you can subscribe and recive all the logs:
The messagge object recived form the bus is composed:
```ts
{
text: "Message log text"
type: "ERROR|DEBUG|INFO|LOG|TRACE|WARN|ASSERT"
}
```
## Usage
```ts
import { LogService } from '@alfresco/adf-core';
@Component({...})
export class AppComponent {
constructor(logService: LogService, myIntegrationService: MyIntegrationService)) {
logService.onMessage.subscribe((message) => {
myIntegrationService.send(message.text,message.type);
});
}
}
```

View File

@@ -65,7 +65,7 @@ In the component template use the people list component:
```
Note that the people list component is based on the
[Datatable component](../datatable.component.md).
[Datatable component](../core/datatable.component.md).
### Properties

View File

@@ -74,4 +74,4 @@ page for an example of how to do set this up.
## See also
- [Filter model](../filter.model.md)
- [Filter model](filter.model.md)

View File

@@ -133,5 +133,5 @@ adf-process-instance-list also supports pagination and the same can be used as s
## See also
- [Data column component](../core/data-column.component.md)
- [DataTableAdapter](../datatable-adapter.interface.md)
- [Pagination component](../pagination.component.md)
- [DataTableAdapter](../core/datatable-adapter.interface.md)
- [Pagination component](../core/pagination.component.md)

View File

@@ -0,0 +1,33 @@
---
Added: v2.0.0
Status: Active
---
# Select app Component
Show all available apps and return the selected app.
![select-apps-dialog](../docassets/images/select-apps-dialog.png)
## Basic Usage
```ts
import { SelectAppsDialogComponent } from '@alfresco/adf-process-services';
constructor(private dialog: MatDialog) {
}
startSelectDialog(){
const dialogRef = this.dialog.open(SelectAppsDialogComponent, {
width: '630px',
panelClass: 'adf-version-manager-dialog'
});
dialogRef.afterClosed().subscribe(selectedProcess => {
this.processId = selectedProcess.id;
});
}
```
## See Also
- [Start process component](start-process.component.md)

View File

@@ -0,0 +1,134 @@
---
Added: v2.0.0
Status: Active
Last reviewed: 2018-03-13
---
# Start Process component
Starts a process.
![adf-start-process ](../docassets/images/startProcess.png)
## Basic Usage
```html
<adf-start-process
[appId]="YOUR_APP_ID">
</adf-start-process>
```
### Properties
| Name | Type | Description |
| ---- | ---- | ----------- |
| appId | `number` | (optional): Limit the list of processes which can be started to those contained in the specified app |
| name | `string` | (optional) name to assign to the current process |
| processDefinitionName | `string` | (optional) definition name of the process to start |
| variables | `ProcessInstanceVariable[]` | Variables in input to the process [RestVariable](https://github.com/Alfresco/alfresco-js-api/tree/master/src/alfresco-activiti-rest-api/docs/RestVariable.md) |
| values | `FormValues` | Parameter to pass form field values in the start form if is associated |
| showSelectProcessDropdown | `boolean` | hide or show the process selection drodown, true by default |
### Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| start | `EventEmitter<ProcessInstance>` | Emitted when the process starts |
| cancel | `EventEmitter<ProcessInstance>` | Emitted when the process is canceled |
| error | `EventEmitter<ProcessInstance>` | Emitted when the start process operation fails |
## Details
### Starting a process with a default name and pre-selected process definition name
```html
<adf-start-process
[appId]="YOUR_APP_ID"
[name]="PROCESS_NAME"
[processDefinitionName]="PROCESS_DEFINITION_NAME">
</adf-start-process>
```
You can use the `processDefinitionName` property to select which process will be selected by
default on the dropdown (when there is more than one process to choose from). Use the `name`
property to set the name shown on the dropdown item.
### Starting a process not included in an app
```html
<adf-start-process
[processDefinitionName]="PROCESS_DEFINITION_NAME">
</adf-start-process>
```
Use `processDefinitionName` to set the dropdown item as in the example above.
### Custom data example
The following example shows how to pass in form field values to initialize the
start form for the process:
```ts
const formValues: FormValues = {
'test_1': 'value_1',
'test_2': 'value_2',
'test_3': 'value_1',
'test_4': 'dropdown_id',
'test_5': 'dropdown_label',
'dropdown': {'id': 'dropdown_id', 'name': 'dropdown_label'}
};
```
```html
<adf-start-process
[values]="formValues"
[appId]="YOUR_APP_ID" >
</adf-start-process>
```
### Attaching a File to the start form of the process
You can see a repository in the Alfresco Repositories list once it is created in APS.
If the repository is set up with an ID value of anything other than 1 then you will need
to declare it in `app.config.json`. For example, if the repository's ID is 1002 and its
name is _alfresco_ then you would set the `alfrescoRepositoryName` property in`app.config.json`
to _alfresco-1002_ as follows:
```json
{
name: 'Alfresco ADF Application'
},
ecmHost: 'http://{hostname}{:port}/ecm',
bpmHost: 'http://{hostname}{:port}/bpm',
logLevel: 'silent',
alfrescoRepositoryName : 'alfresco-1002'
```
You then need to pass the node as the input `values` object with the other properties:
```ts
let node: MinimalNodeEntryEntity = this.nodesApiService.getNode(NODE_ID);
const formValues: FormValues = {
'file' : node
'field_one': 'example text'
};
```
Note that in the object above, the key `file` is the name of the attach file field in the start form of the process. The value of the `file` property must be a
[MinimalNodeEntryEntity](../content-services/document-library.model.md):
```html
<adf-start-process
[values]="formValues"
[appId]="YOUR_APP_ID" >
</adf-start-process>
```
The result will be the start form prefilled with the file data:
![Start process load file](../docassets/images/start_process.png)
## See also
- [Select Apps Dialog component](select-apps-dialog.component.md)

View File

@@ -0,0 +1,31 @@
---
Added: v2.0.0
Status: Active
---
# Start Task Component
Creates/Starts new task for the specified app
![adf-start-task](../docassets/images/adf-start-task.png)
## Basic Usage
```html
<adf-start-task
[appId]="YOUR_APP_ID">
</adf-start-task>
```
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| appId | `number` | | (required) The id of the app. |
### Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| success | `EventEmitter<any>` | Emitted when the task is successfully created. |
| cancel | `EventEmitter<void>` | Emitted when the cancel button is clicked by the user. |
| error | `EventEmitter<any>` | Emitted when an error occurs. |

View File

@@ -0,0 +1,89 @@
---
Added: v2.0.0
Status: Active
Last reviewed: 2018-03-13
---
# Task Attachment List Component
Displays attached documents on a specified task.
![task-attachment-list-sample](../docassets/images/task-attachment-list.png)
## Basic Usage
```html
<adf-task-attachment-list
[taskId]="YOUR_TASK_ID"
(attachmentClick)="YOUR_HANDLER">
</adf-task-attachment-list>
```
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| taskId | `string` | | (**required**) The ID of the task to display. |
| disabled | `boolean` | `false` | Disable/Enable read only mode for attachement list. |
### Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| attachmentClick | `EventEmitter<{}>` | Emitted when the attachment is double-clicked or a view option is selected from the context menu by the user from within the component. Returns a Blob representing the clicked object. |
| success | `EventEmitter<{}>` | Emitted when the attachment list has fetched all the attachments. Returns a list of attachments. |
| error | `EventEmitter<any>` | Emitted when an error occurs while fetching the attachments. |
## Details
If the List is empty, a default "no content" template is displayed.
![default-no-content-template-sample](../docassets/images/default-no-content-template.png)
### How to Add Drag and Drop Functionality
You can wrap the component with an [Upload Drag Area component](../content-services/upload-drag-area.component.md)
to enable the user to upload attachments for empty lists. When you do this, you can also pass
a custom _no content template_ as shown below. The component invites the user to drag files to
upload whenever the list is empty.
```html
<adf-upload-drag-area
[parentId]="YOUR_TASK_ID"
[showNotificationBar]="BOOLEAN">
<adf-task-attachment-list
[taskId]="YOUR_TASK_ID"
(attachmentClick)="YOUR_HANDLER">
<adf-empty-list>
<div adf-empty-list-header>{{This List is empty}}</div>
<div adf-empty-list-body>{{Drag and drop to upload}}</div>
<div adf-empty-list-footer>
<img [src]="Your custom image URL"></div>
</adf-empty-list>
</adf-task-attachment-list>
</adf-upload-drag-area>
```
```ts
import { UploadService } from '@alfresco/adf-core';
import { TaskUploadService } from '@alfresco/adf-process-services';
```
Make sure you override the `UploadService` with the `TaskUploadService`
```ts
@Component({
selector: 'my-custom-task-attachment',
providers: [
{ provide: UploadService, useClass: TaskUploadService }
]
})
export class MyCustomTaskAttachmentComponent {
constructor() {}
}
```
[Upload Drag Area Component](../content-services/upload-drag-area.component.md)
If the List is empty, the custom no-content template we passed is displayed.
![custom-no-content-drag-drop-template-sample](../docassets/images/custom-no-content-drag-drop-template.png)

View File

@@ -0,0 +1,37 @@
---
Added: v2.0.0
Status: Active
---
# Task Audit Directive
Fetches the Task Audit information in the pdf or json format.
![adf-task-audit-directive](../docassets/images/adf-task-audit-directive.png)
## Basic Usage
```html
<button
adf-task-audit
[task-id]="taskId"
[download]="download"
mat-icon-button (clicked)="onAuditClick($event)" (error)="onAuditError($event)" >
<mat-icon>assignment_ind</mat-icon>
</button>
```
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| taskId | `string` | | (**required**) The id of the task. |
| fileName | `string` | `'Audit'` | Name of the downloaded file (for PDF downloads). |
| format | `string` | `'pdf'` | Format of the audit information. Can be "pdf" or "json". |
| download | `boolean` | `true` | Enables downloading of the audit when the decorated element is clicked. |
### Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| clicked | `EventEmitter<any>` | Emitted when the decorated element is clicked. |
| error | `EventEmitter<any>` | Emitted when an error occurs. |

View File

@@ -0,0 +1,73 @@
---
Added: v2.0.0
Status: Active
Last reviewed: 2018-03-13
---
# Task Details component
Shows the details of the task ID passed in as input.
## Basic Usage
```html
<adf-task-details
[taskId]="taskId">
</adf-task-details>
```
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| debugMode | `boolean` | `false` | Toggles debug mode. |
| taskId | `string` | | (**required**) The id of the task whose details we are asking for. |
| showNextTask | `boolean` | `true` | Automatically renders the next task when the current one is completed. |
| showHeader | `boolean` | `true` | Toggles task details Header component. |
| showHeaderContent | `boolean` | `true` | Toggles collapsed/expanded state of the Header component. |
| showInvolvePeople | `boolean` | `true` | Toggles `Involve People` feature for the Header component. |
| showComments | `boolean` | `true` | Toggles `Comments` feature for the Header component. |
| showChecklist | `boolean` | `true` | Toggles `Checklist` feature for the Header component. |
| showFormTitle | `boolean` | `true` | Toggles rendering of the form title. |
| showFormCompleteButton | `boolean` | `true` | Toggles rendering of the `Complete` outcome button. |
| showFormSaveButton | `boolean` | `true` | Toggles rendering of the `Save` outcome button. |
| readOnlyForm | `boolean` | `false` | Toggles read-only state of the form. All form widgets render as read-only if enabled. |
| showFormRefreshButton | `boolean` | `true` | Toggles rendering of the `Refresh` button. |
| fieldValidators | `any[]` | `[]` | Field validators for use with the form. |
### Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| formSaved | `EventEmitter<any>` | Emitted when the form is submitted with the `Save` or custom outcomes. |
| formCompleted | `EventEmitter<any>` | Emitted when the form is submitted with the `Complete` outcome. |
| formContentClicked | `EventEmitter<any>` | Emitted when the form field content is clicked. |
| formLoaded | `EventEmitter<any>` | Emitted when the form is loaded or reloaded. |
| taskCreated | `EventEmitter<TaskDetailsModel>` | Emitted when a checklist task is created. |
| taskDeleted | `EventEmitter<string>` | Emitted when a checklist task is deleted. |
| error | `EventEmitter<any>` | Emitted when an error occurs. |
| executeOutcome | `EventEmitter<any>` | Emitted when any outcome is executed. Default behaviour can be prevented via `event.preventDefault()`. |
| assignTask | `EventEmitter<void>` | Emitted when a task is assigned. |
| claimedTask | `EventEmitter<string>` | Emitted when a task is claimed. |
| unClaimedTask | `EventEmitter<string>` | Emitted when a task is unclaimed. |
## Details
### Custom 'empty Task Details' template
By default the Task Details component shows a simple "No Tasks" message when there are
no details. You can change this by adding the a custom HTML template as in the following
example:
```html
<adf-task-details [taskId]="taskId">
<no-task-details-template>
<ng-template>
<h1>Sorry, no tasks here</h1>
<img src="example.jpg">
</ng-template>
</no-task-details-template>
</adf-task-details>
```
Note that you can use any HTML content in the template, including other Angular components.

View File

@@ -0,0 +1,23 @@
---
Added: v2.0.0
Status: Active
---
# Task Details model
Information about a task.
## Details
```json
{
"id": "string",
"assignee": "User",
"dueDate": "data",
"endDate": "string",
"description": "string"
}
```
## See Also
- [Task header component](task-header.component.md)

View File

@@ -0,0 +1,329 @@
---
Added: v2.0.0
Status: Active
---
# Task Filter Service
Manage Task Filters, which are pre-configured Task Instance queries.
## Importing
```ts
import { TaskFilterService, FilterRepresentationModel } from '@alfresco/adf-process-services';
export class SomePageComponent implements OnInit {
constructor(private taskFilterService: TaskFilterService) {
}
```
## Methods
#### createDefaultFilters(appId: number): Observable`<FilterRepresentationModel[]>`
Create and return the default task filters for a Process App:
```ts
const processAppId = 2;
this.taskFilterService.createDefaultFilters(processAppId).subscribe( (filters: FilterRepresentationModel[]) => {
console.log('Task filters: ', filters);
}, error => {
console.log('Error: ', error);
});
```
The response is an array of `FilterRepresentationModel` objects:
```
filters:
0: {
appId: 2
filter : {
assignment: "involved"
dueAfter: null
dueBefore: null
name: null
processDefinitionId: null
processDefinitionKey: null
sort: "created-desc"
state: "open"
}
icon: "glyphicon-align-left"
id: null
index: undefined
name: "Involved Tasks"
recent: false
1: {id: null, appId: 2, name: "My Tasks", recent: false, icon: "glyphicon-inbox", …}
2: {id: null, appId: 2, name: "Queued Tasks", recent: false, icon: "glyphicon-record", …}
3: {id: null, appId: 2, name: "Completed Tasks", recent: true, icon: "glyphicon-ok-sign", …}
```
These filters can now be used to get matching Task Instances for Process App with ID 2,
such as 'Involved Tasks', 'My Tasks', 'Queued Tasks', and 'Completed Tasks'.
#### getTaskListFilters(appId?: number): Observable`<any>`
Get all task filters defined for a Process App:
```ts
const processAppId = 2;
this.taskFilterService.getTaskListFilters(processAppId).subscribe( (filters: FilterRepresentationModel[]) => {
console.log('Task filters: ', filters);
}, error => {
console.log('Error: ', error);
});
```
The response is an array of `FilterRepresentationModel` objects:
```
filters:
0: {id: 10, appId: 2, name: "Involved Tasks", recent: true, icon: "glyphicon-align-left", …}
1: {id: 9, appId: 2, name: "My Tasks", recent: false, icon: "glyphicon-inbox", …}
2: {id: 11, appId: 2, name: "Queued Tasks", recent: false, icon: "glyphicon-record", …}
3: {id: 12, appId: 2, name: "Completed Tasks", recent: false, icon: "glyphicon-ok-sign", …}
4: {id: 4004, appId: 2, name: "Completed Tasks", recent: false, icon: "glyphicon-ok-sign", …}
5: {id: 4005, appId: 2, name: "My Tasks", recent: false, icon: "glyphicon-inbox", …}
6: {id: 4006, appId: 2, name: "Queued Tasks", recent: false, icon: "glyphicon-record", …}
7: {id: 4007, appId: 2, name: "Involved Tasks", recent: false, icon: "glyphicon-align-left", …}
```
In this example I had run the `createDefaultFilters` method once, and that created the duplicate of
the default filters.
These filters can now be used to get matching Task Instances for Process App with ID 2,
such as 'Involved Tasks', 'My Tasks', 'Queued Tasks', and 'Completed Tasks'.
If you want to return all filters regardless of Process App, and filter out duplicates,
then you can just leave out the Process App number:
```ts
this.taskFilterService.getTaskListFilters().subscribe( (filters: FilterRepresentationModel[]) => {
console.log('Task filters: ', filters);
}, error => {
console.log('Error: ', error);
});
```
#### getTaskFilterById(filterId: number, appId?: number): Observable`<FilterRepresentationModel>`
Get a specific Task Filter based on its ID, optionally pass in Process App ID to improve performance
when searching for filter:
```ts
const processAppId = 2;
const taskFilterId = 4007;
this.taskFilterService.getTaskFilterById(taskFilterId, processAppId).subscribe( (filter: FilterRepresentationModel) => {
console.log('Task filter: ', filter);
}, error => {
console.log('Error: ', error);
});
```
The response is a `FilterRepresentationModel` object:
```
Task filter:
appId: 2
filter:
assignment: "involved"
sort: "created-desc"
state: "open"
icon: "glyphicon-align-left"
id: 4007
name: "Involved Tasks"
recent: false
```
The filter can now be used to get 'Involved Tasks' Task Instances for Process App with ID 2.
#### getTaskFilterByName(taskName: string, appId?: number): Observable`<FilterRepresentationModel>`
Get a specific Task Filter based on its name, optionally pass in Process App ID to improve performance
when searching for filter:
```ts
const processAppId = 2;
const taskFilterName = 'Completed Tasks';
this.taskFilterService.getTaskFilterByName(taskFilterName, processAppId).subscribe( (filter: FilterRepresentationModel) => {
console.log('Task filter: ', filter);
}, error => {
console.log('Error: ', error);
});
```
The response is a `FilterRepresentationModel` object:
```
appId: 2
filter: {sort: "created-desc", name: "", state: "completed", assignment: "involved"}
icon: "glyphicon-ok-sign"
id: 12
name: "Completed Tasks"
recent: false
```
If there are several filters with the same name for the Process App, then you get back the
first one found matching the name.
The filter can now be used to get 'Completed Tasks' Task Instances for Process App with ID 2.
#### addFilter(filter: FilterRepresentationModel): Observable`<FilterRepresentationModel>`
Add a new Task Instance filter:
```ts
const processAppId = 2;
const filterName = 'InvolvedAsc';
const filterInvolvedAsc = new FilterRepresentationModel({
'name': filterName,
'appId': processAppId,
'recent': false,
'icon': 'glyphicon-align-left',
'filter': { 'assignment': 'involved', 'sort': 'created-asc', 'state': 'open' }
});
this.taskFilterService.addFilter(filterInvolvedAsc).subscribe( (filterResponse: FilterRepresentationModel) => {
console.log('Task filter: ', filterResponse);
}, error => {
console.log('Error: ', error);
});
```
The response is a `FilterRepresentationModel` object:
```
appId: 2
icon: "glyphicon-align-left"
id: 4008
name: "InvolvedAsc"
recent: false
```
The filter can now be used to get 'Involved' Task Instances for
Process App with ID 2 in created date ascending order.
#### getRunningFilterInstance(appId: number): FilterProcessRepresentationModel
Convenience method to create and return a filter that matches `involved` Task Instances
for passed in Process App ID:
```ts
const processAppId = 2;
const involvedFilter: FilterRepresentationModel = this.taskFilterService.getInvolvedTasksFilterInstance(processAppId);
console.log('Involved filter', involvedFilter);
```
The response is a `FilterRepresentationModel` object:
```
appId: 2
filter:
assignment: "involved"
dueAfter: null
dueBefore: null
name: null
processDefinitionId: null
processDefinitionKey: null
sort: "created-desc"
state: "open"
icon: "glyphicon-align-left"
id: null
index: undefined
name: "Involved Tasks"
recent: false
```
Use the `addFilter` to add this filter to a Process App.
#### getMyTasksFilterInstance(appId: number): FilterProcessRepresentationModel
Convenience method to create and return a filter that matches `My Tasks` Task Instances
for passed in Process App ID:
```ts
const processAppId = 2;
const myTasksFilter: FilterRepresentationModel = this.taskFilterService.getMyTasksFilterInstance(processAppId);
console.log('My Tasks filter', myTasksFilter);
```
The response is a `FilterRepresentationModel` object:
```
appId: 2
filter:
assignment: "assignee"
dueAfter: null
dueBefore: null
name: null
processDefinitionId: null
processDefinitionKey: null
sort: "created-desc"
state: "open"
icon: "glyphicon-inbox"
id: null
index: undefined
name: "My Tasks"
recent: false
```
Use the `addFilter` to add this filter to a Process App.
#### getQueuedTasksFilterInstance(appId: number): FilterProcessRepresentationModel
Convenience method to create and return a filter that matches `Queued Tasks` Task Instances
for passed in Process App ID:
```ts
const processAppId = 2;
const queuedTasksFilter: FilterRepresentationModel = this.taskFilterService.getQueuedTasksFilterInstance(processAppId);
console.log('Queued Tasks filter', queuedTasksFilter);
```
The response is a `FilterRepresentationModel` object:
```
appId: 2
filter:
assignment: "candidate"
dueAfter: null
dueBefore: null
name: null
processDefinitionId: null
processDefinitionKey: null
sort: "created-desc"
state: "open"
icon: "glyphicon-record"
id: null
index: undefined
name: "Queued Tasks"
recent: false
```
Use the `addFilter` to add this filter to a Process App.
#### getCompletedTasksFilterInstance(appId: number): FilterProcessRepresentationModel
Convenience method to create and return a filter that matches `Completed Tasks` Task Instances
for passed in Process App ID:
```ts
const processAppId = 2;
const completedTasksFilter: FilterRepresentationModel = this.taskFilterService.getCompletedTasksFilterInstance(processAppId);
console.log('Completed Tasks filter', completedTasksFilter);
```
The response is a `FilterRepresentationModel` object:
```
appId: 2
filter:
assignment: "involved"
dueAfter: null
dueBefore: null
name: null
processDefinitionId: null
processDefinitionKey: null
sort: "created-desc"
state: "completed"
icon: "glyphicon-ok-sign"
id: null
index: undefined
name: "Completed Tasks"
recent: true
```
Use the `addFilter` to add this filter to a Process App.
<!-- seealso start -->
<!-- seealso end -->

View File

@@ -0,0 +1,67 @@
---
Added: v2.0.0
Status: Active
---
# Task Filters component
Shows all available filters.
## Basic Usage
```html
<adf-filters></adf-filters>
```
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| filterParam | `FilterParamsModel` | | Parameters to use for the task filter. If there is no match then the default filter (the first one the list) is selected. |
| appId | `number` | | Display filters available to the current user for the application with the specified ID. |
| appName | `string` | | Display filters available to the current user for the application with the specified name. |
| hasIcon | `boolean` | `true` | Toggles display of the filter's icon. |
### Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| filterClick | `EventEmitter<FilterRepresentationModel>` | Emitted when a filter in the list is clicked. |
| success | `EventEmitter<any>` | Emitted when the list is loaded. |
| error | `EventEmitter<any>` | Emitted when an error occurs during loading. |
## Details
### How filter the activiti task filters
```html
<adf-filters
[filterParam]="{name:'My tasks'}">
</adf-filters>
```
You can use inside the filterParam one of the properties from [FilterParamsModel](#filterparamsmodel) (see below).
### FilterParamsModel
```json
{
"id": "number",
"name": "string",
"index": "number"
}
```
| Name | Type | Description |
| ---- | ---- | ----------- |
| id | string | The id of the task filter |
| name | string | The name of the task filter, lowercase is checked |
| index | string | The zero-based position of the filter in the array. |
### How to create an accordion menu with the task filter
The task filter often works well as an item in an accordion menu. See the [Accordion component](../core/accordion.component.md)
page for an example of how to do set this up.
## See also
- [Filter model](filter.model.md)

View File

@@ -0,0 +1,57 @@
---
Added: v2.0.0
Status: Active
---
# Task Header component
Shows all the information related to a task.
![adf-task-header](../docassets/images/adf-task-header.png)
## Basic Usage
```html
<adf-task-header
[taskDetails]="taskDetails">
</adf-task-header>
```
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| formName | `string` | `null` | The name of the form. |
| taskDetails | `TaskDetailsModel` | | (required) Details related to the task. |
### Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| claim | `EventEmitter<any>` | Emitted when the task is claimed. |
| unclaim | `EventEmitter<any>` | Emitted when the task is unclaimed (ie, requeued). |
## Details
The purpose of the component is to populate the local variable called `properties` (array of CardViewModel), with all the information that we want to display.
## Customise the property showed
By default all the property are showed :
***assignee***, ***status***, ***priority***, ***dueDate***, ***category***, ***parentName***, ***created-by***, ***created***, ***id***, ***description***, ***formName***.
It is possible to customise the showed property via the "app.config.json".
This is how the configuration looks like:
```json
"adf-task-header": {
"presets": {
"properties" : [ "assignee", "status", "priority", "parentName"]
}
},
```
In this way only the listed property will be showed.
## See also
- [Task Details model](task-details.model.md)

View File

@@ -0,0 +1,210 @@
---
Added: v2.0.0
Status: Active
Last reviewed: 2018-03-12
---
# Task List component
Renders a list containing all the tasks matched by the parameters specified.
## Basic Usage
```html
<adf-tasklist
[appId]="'1'"
[state]="'open'"
[assignment]="'assignee'">
</adf-tasklist>
```
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| appId | `number` | | The id of the app. |
| processInstanceId | `string` | | The Instance Id of the process. |
| processDefinitionKey | `string` | | The Definition Key of the process. |
| state | `string` | | Current state of the process. Possible values are: `completed`, `active`. |
| assignment | `string` | | The assignment of the process. Possible values are: "assignee" (the current user is the assignee), candidate (the current user is a task candidate", "group_x" (the task is assigned to a group where the current user is a member, no value(the current user is involved). |
| sort | `string` | | Define the sort order of the processes. Possible values are : `created-desc`, `created-asc`, `due-desc`, `due-asc` |
| name | `string` | | Name of the tasklist. |
| landingTaskId | `string` | | Define which task id should be selected after reloading. If the task id doesn't exist or nothing is passed then the first task will be selected. |
| data | `any` | | Data source object that represents the number and the type of the columns that you want to show. |
| selectionMode | `string` | `'single'` | Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. |
| presetColumn | `string` | | Custom preset column schema in JSON format. |
| multiselect | `boolean` | `false` | Toggles multiple row selection, renders checkboxes at the beginning of each row |
| page | `number` | `0` | The page number of the tasks to fetch. |
| size | `number` | See description | The number of tasks to fetch. Default value: 25. |
### Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| rowClick | `EventEmitter<string>` | Emitted when a task in the list is clicked |
| rowsSelected | `EventEmitter<any[]>` | Emitted when rows are selected/unselected |
| success | `EventEmitter<any>` | Emitted when the task list is loaded |
| error | `EventEmitter<any>` | Emitted when an error occurs. |
## Details
This component displays lists of process instances both active and completed, using any defined process filter, and
render details of any chosen instance.
### Setting the column schema
You can pass a [DataTableAdapter instance](../core/datatable-adapter.interface.md)
to set a column schema for the tasklist as shown below :
```ts
let data = new ObjectDataTableAdapter(
// Row data
[
{ id: 1, name: 'Name 1' },
{ id: 2, name: 'Name 2' }
],
// Column schema
[
{
type: 'text',
key: 'id',
title: 'Id',
sortable: true
},
{
type: 'text',
key: 'name',
title: 'Name',
sortable: true
}
]
);
```
```html
<adf-tasklist
[data]="'data'">
</adf-tasklist>
```
Alternatively, you can use an HTML-based schema declaration:
```html
<adf-tasklist ...>
<data-columns>
<data-column key="name" title="NAME" class="full-width name-column"></data-column>
<data-column key="created" title="Created" class="hidden"></data-column>
</data-columns>
</adf-tasklist>
```
You can also set a static custom schema declaration in `app.config.json` as shown below:
```json
"adf-task-list": {
"presets": {
"customSchema": [
{
"key": "name",
"type": "text",
"title": "name",
"sortable": true
}],
"default": [
{
"key": "name",
"type": "text",
"title": "name",
"sortable": true
}],
}
}
```
```html
<adf-tasklist
[appId]="'1'"
[presetColumn]="'customSchema'">
</adf-tasklist>
```
You can use an HTML-based schema and an `app.config.json` custom schema declaration at the same time:
```json
"adf-task-list": {
"presets": {
"customSchema": [
{
"key": "id",
"type": "text",
"title": "Id",
"sortable": true
}],
"default": [
{
"key": "name",
"type": "text",
"title": "name",
"sortable": true
}],
}
}
```
```html
<adf-tasklist
[appId]="'1'"
[presetColumn]="'customSchema'">
<data-columns>
<data-column key="assignee" title="Assignee" class="full-width name-column">
<ng-template let-entry="$implicit">
<div>{{getFullName(entry.row.obj.assignee)}}</div>
</ng-template>
</data-column>
</data-columns>
</adf-tasklist>
```
### Pagination strategy
The Tasklist also supports pagination as shown in the example below:
```html
<adf-tasklist
[appId]="'1'"
[page]="page"
[size]="size"
#taskList>
</adf-tasklist>
<adf-pagination
*ngIf="taskList"
[target]="taskList"
[supportedPageSizes]="supportedPages"
#taskListPagination>
</adf-pagination>
```
### DataTableAdapter example
See the [DataTableAdapter](../core/datatable-adapter.interface.md) page for full details of the interface and its standard
implementation, ObjectDataTableAdapter. Below is an example of how you can set up the adapter for a
typical tasklist.
```json
[
{"type": "text", "key": "id", "title": "Id"},
{"type": "text", "key": "name", "title": "Name", "cssClass": "full-width name-column", "sortable": true},
{"type": "text", "key": "formKey", "title": "Form Key", "sortable": true},
{"type": "text", "key": "created", "title": "Created", "sortable": true}
]
```
### DataColumn Features
You can customize the styling of a column and also add features like tooltips and automatic translation of column titles. See the [DataColumn](../core/data-column.component.md) page for more information about these features.
## See also
- [Data column component](../core/data-column.component.md)
- [DataTableAdapter](../core/datatable-adapter.interface.md)
- [Pagination component](../core/pagination.component.md)

View File

@@ -0,0 +1,654 @@
---
Added: v2.0.0
Status: Active
---
# Tasklist Service
Manage Task Instances.
## Importing
```ts
import { TaskListService, TaskDetailsModel, TaskQueryRequestRepresentationModel, TaskListModel, Form } from '@alfresco/adf-process-services';
import { TaskUpdateRepresentation } from 'alfresco-js-api';
export class SomePageComponent implements OnInit {
constructor(private tasklistService: TaskListService) {
}
```
## Methods
#### getTaskDetails(taskId: string): Observable`<TaskDetailsModel>`
Get Task Instance metadata for passed in Task Instance ID:
```ts
const taskInstanceId = '15303';
this.tasklistService.getTaskDetails(taskInstanceId).subscribe( (taskInstance: TaskDetailsModel) => {
console.log('TaskInstance: ', taskInstance);
}, error => {
console.log('Error: ', error);
});
```
The `taskInstanceId` refers to a Task Instance identifier in APS.
The returned `taskInstance` object is of type `TaskDetailsModel` and looks like in this sample:
adhocTaskCanBeReassigned: false
assignee: UserProcessModel {pictureId: null, id: 1, email: "admin@app.activiti.com", firstName: null, lastName: "Administrator"}
category: null
created: Wed Oct 11 2017 09:07:14 GMT+0100 (BST) {}
description: null
dueDate: null
duration: null
endDate: null
executionId: "11337"
formKey: "9"
id: "15303"
initiatorCanCompleteTask: false
involvedPeople: []
managerOfCandidateGroup: false
memberOfCandidateGroup: false
memberOfCandidateUsers: false
name: "Clarify Invoice - Invoice-20302.pdf"
parentTaskId: null
parentTaskName: null
priority: 50
processDefinitionCategory: "http://www.activiti.org/processdef"
processDefinitionDeploymentId: "18"
processDefinitionDescription: "This is a simple invoice approval process that allows a person to assign a dedicated approver for the the invoice. It will then be routed to the Accounting department for payment preparation. Once payment is prepared the invoice will be stored in a specific folder and an email notification will be sent."
processDefinitionId: "InvoiceApprovalProcess:2:21"
processDefinitionKey: "InvoiceApprovalProcess"
processDefinitionName: "Invoice Approval Process"
processDefinitionVersion: 2
processInstanceId: "11337"
processInstanceName: null
processInstanceStartUserId: "1"
taskDefinitionKey: "clarifyInvoice"
#### getTaskChecklist(id: string): Observable`<TaskDetailsModel[]>`
Get all the sub-task instances for a Task Instance, also called the check list:
```ts
const parentTaskId = '15303';
this.tasklistService.getTaskChecklist(parentTaskId).subscribe( (subTasks: TaskDetailsModel[]) => {
console.log('Sub Tasks: ', subTasks);
}, error => {
console.log('Error: ', error);
});
```
The response is an array of `TaskDetailsModel` representing the sub-tasks:
Sub Tasks:
0:
adhocTaskCanBeReassigned: false
assignee: UserProcessModel {pictureId: null, id: 1, email: "admin@app.activiti.com", firstName: null, lastName: "Administrator"}
category: "2"
created: "2017-10-29T07:29:28.881+0000"
description: null
dueDate: null
duration: null
endDate: null
executionId: null
formKey: null
id: "74745"
initiatorCanCompleteTask: false
involvedPeople: undefined
managerOfCandidateGroup: false
memberOfCandidateGroup: false
memberOfCandidateUsers: false
name: "Double check invoice amount"
parentTaskId: "15303"
parentTaskName: "Clarify Invoice - Invoice-10292.pdf"
priority: 50
processDefinitionCategory: null
processDefinitionDeploymentId: null
processDefinitionDescription: null
processDefinitionId: null
processDefinitionKey: null
processDefinitionName: null
processDefinitionVersion: 0
processInstanceId: null
processInstanceName: null
processInstanceStartUserId: null
taskDefinitionKey: null
1 :
{processDefinitionVersion: 0, id: "74746", name: "Verify with the person that did the purchase", priority: 50, assignee: UserProcessModel, …}
Looking at the `TaskDetailsModel` for a sub-task we can see that it has a parent task ID that matches what we specified
when calling this method.
#### getTasks(requestNode: TaskQueryRequestRepresentationModel): Observable`<TaskListModel>`
Get tasks matching passed in query definition:
```ts
const taskQuery: TaskQueryRequestRepresentationModel = {
appDefinitionId: '2',
processInstanceId: null,
processDefinitionId: null,
text: null,
assignment: null,
state: 'open',
sort: 'created_asc',
page: 0,
size: 5,
start: null
};
this.tasklistService.getTasks(taskQuery).subscribe( (taskListModel: TaskListModel) => {
console.log('Task List Model: ', taskListModel);
}, error => {
console.log('Error: ', error);
});
```
In the above example we query for all Task Instances associated with a Process Application with
ID 2. We set `size` to 5, which means that the query will return max 5 task instances.
We can mix and match the query parameters to narrow down the task list that is returned.
If you are just interested in Task Instances related to a specific Process Instance,
then set the `processInstanceId`. If you want to see all tasks related to a specific type of processes,
then you should set the `processDefinitionId` property.
You can use the `state` property to define if only `completed` or only `open` tasks should be returned. If you
specify `null` for state then `open` will be assumed.
The `assignment` property can be used to filter tasks based on how they are assigned (or not assigned yet).
Use `assignee` if you are interested in tasks that are assigned to a user. If you want to see
pooled tasks (i.e. tasks that needs to be claimed by a user), then use `candidate`.
A `TaskListModel` object is returned for a successful query and the `data` property is an array of
`TaskDetailsModel`:
data:
0: {id: "75010", name: "Approve Invoice - Invoice-10202.pdf", description: null, category: null, assignee: {…}, …}
1: {id: "74746", name: "Verify with the person that did the purchase", description: null, category: "2", assignee: {…}, …}
2: {id: "74745", name: "Double check invoice amount", description: null, category: "2", assignee: {…}, …}
3: {id: "20686", name: "Sample checklist task 1", description: null, category: "2", assignee: {…}, …}
4: {id: "15303", name: "Clarify Invoice - Invoice-20302.pdf", description: null, category: null, assignee: {…}, …}
length: 5
size: 5
start: 0
total: 10
We can see that this query resulted in 10 tasks (see `total`), but only 5 were returned as we set `size` to `5`.
#### getTotalTasks(requestNode: TaskQueryRequestRepresentationModel): Observable`<any>`
Get total number of tasks matching passed in query definition:
```ts
const taskQuery: TaskQueryRequestRepresentationModel = {
appDefinitionId: '2',
processInstanceId: null,
processDefinitionId: null,
text: null,
assignment: null,
state: 'open',
sort: 'created_asc',
page: 0,
size: 5,
start: null
};
this.tasklistService.getTotalTasks(taskQuery).subscribe( (response: any) => {
console.log('Total: ', response);
}, error => {
console.log('Error: ', error);
});
```
This is pretty much the same type of query as the `getTasks` method, except that here we just
return how many Task Instances it matched in the `total` property:
data:[]
size: 0
start: 0
total: 10
When you call this method it always sets the `size` property to `0`.
#### findTasksByState(requestNode: TaskQueryRequestRepresentationModel, state?: string): Observable`<TaskListModel>`
Find and return Task Instances by state `open` or `completed` and query model:
```ts
const taskState = 'open';
const taskQuery: TaskQueryRequestRepresentationModel = {
appDefinitionId: '2',
processInstanceId: null,
processDefinitionId: null,
text: null,
assignment: null,
state: 'open',
sort: 'created_asc',
page: 0,
size: 5,
start: null
};
this.tasklistService.findTasksByState(taskQuery, taskState).subscribe( (taskList: TaskListModel) => {
console.log('Task list: ', taskList);
}, error => {
console.log('Error: ', error);
});
```
The number of tasks that are returned is controlled by the `size` property.
This is a convenience method on top of the `getTasks` method. It overwrites the `requestNode.state` property
with passed in `state` before making the call to `getTasks`.
For an example of the response see the `getTasks` method.
#### findAllTaskByState(requestNode: TaskQueryRequestRepresentationModel, state?: string): Observable`<TaskListModel>`
Find and return all Task Instances by state `open` or `completed` and query model:
```ts
const taskState = 'open';
const taskQuery: TaskQueryRequestRepresentationModel = {
appDefinitionId: '2',
processInstanceId: null,
processDefinitionId: null,
text: null,
assignment: null,
state: 'open',
sort: 'created_asc',
page: 0,
size: 5,
start: null
};
this.tasklistService.findAllTaskByState(taskQuery, taskState).subscribe( (taskList: TaskListModel) => {
console.log('Task list: ', taskList);
}, error => {
console.log('Error: ', error);
});
```
This is a convenience method on top of the `getTasks` method. It overwrites the `requestNode.state` property with
passed in `state` before making any other calls. Before making the `getTasks` call it will first call the
`getTotalTasks` method to get the total number of tasks that match query and state. It then overwrite the
`requestNode.size` with the total so all matching tasks are returned when finnally making the `getTasks` call.
**Note** that this can return a lot of data if you are not careful.
#### findAllTasksWithoutState(requestNode: TaskQueryRequestRepresentationModel): Observable`<TaskListModel>`
Find and return all Task Instances that matches query model, regardless of state:
```ts
const taskQuery: TaskQueryRequestRepresentationModel = {
appDefinitionId: '2',
processInstanceId: null,
processDefinitionId: null,
text: null,
assignment: null,
state: null,
sort: 'created_asc',
page: 0,
size: 5,
start: null
};
this.tasklistService.findAllTasksWithoutState(taskQuery).subscribe( (taskList: TaskListModel) => {
console.log('Task list: ', taskList);
}, error => {
console.log('Error: ', error);
});
```
This method can be used when you have a task query that should return all tasks regardless of the state they
are in. You cannot achieve this with the `getTasks` method. If you specify a `size` it is overwritten.
Internally it basically calls `findTasksByState(requestNode, 'open')` and
`findAllTaskByState(requestNode, 'completed')`.
**Note** that this can return a lot of data if you are not careful.
#### assignTaskByUserId(taskId: string, userId: number): Observable`<TaskDetailsModel>`
Assign a Task Instance to a user via the User ID:
```ts
const taskId = '15303';
const userId = 1;
this.tasklistService.assignTaskByUserId(taskId, userId).subscribe( (taskInstance: TaskDetailsModel) => {
console.log('Task instance: ', taskInstance);
}, error => {
console.log('Error: ', error);
});
```
The user ID identifies a User in APS.
#### assignTask(taskId: string, requestNode: any): Observable`<TaskDetailsModel>`
Assign a task to a user via a user object with an `id` property, for example:
```ts
const taskId = '15303';
const user = { id: 1, email: 'admin@app.activiti.com', firstName: 'APS', lastName: 'Admin' };
this.tasklistService.assignTask(taskId, user).subscribe( (taskInstance: TaskDetailsModel) => {
console.log('Task instance: ', taskInstance);
}, error => {
console.log('Error: ', error);
});
```
This method does the same as the `assignTaskByUserId` method, the only difference is that this
method can be used when you have an object where the User ID is contained in an `id` property.
#### claimTask(taskId: string): Observable`<TaskDetailsModel>`
Claim a pooled task (i.e. candidate task) as current user so it can be worked on and later on completed:
```ts
const taskId = '15368';
this.tasklistService.claimTask(taskId).subscribe( (taskInstance: TaskDetailsModel) => {
console.log('Task instance: ', taskInstance);
}, error => {
console.log('Error: ', error);
});
```
The response will be `null` if the task was claimed successfully.
The task assignment changes from `candidate` to `assignee`.
#### unclaimTask(taskId: string): Observable`<TaskDetailsModel>`
Return a claimed task to the pool (i.e. make it a candidate task):
```ts
const taskId = '15368';
this.tasklistService.unclaimTask(taskId).subscribe( (taskInstance: TaskDetailsModel) => {
console.log('Task instance: ', taskInstance);
}, error => {
console.log('Error: ', error);
});
```
The task assignment changes from `assignee` to `candidate`.
#### completeTask(taskId: string)
Complete a Task Instance as current user and progress Process Instance:
```ts
const taskId = '15176';
this.tasklistService.completeTask(taskId);
```
This only works if the Task Instance has only one Outcome (i.e. the default `Complete` one).
If the Task Instance has multiple Outcomes, such as Approve and Reject, then this method does not
work, and the Task Instance has to be completed via its associated form. Otherwise you will see an error such as:
_ERROR Error: Uncaught (in promise): Error: {"message":"Task must be completed using it's form","messageKey":"GENERAL.ERROR.BAD-REQUEST"}_
#### updateTask(taskId: any, updated): Observable`<TaskDetailsModel>`
Update name, description, and due date for a Task Instance:
```ts
const taskId = '80002';
const updateData: TaskUpdateRepresentation = {
description: 'Updated description',
dueDate: new Date(2018, 1, 10, 11, 0, 0, 0),
name: 'Updated name'
};
this.tasklistService.updateTask(taskId, updateData).subscribe( (updatedTaskDetails: TaskDetailsModel) => {
console.log('Updated task: ', updatedTaskDetails);
}, error => {
console.log('Error: ', error);
});
```
The response is all info about the updated Task Instance, in this example a stand-alone task was updated so there
is no associated process:
adhocTaskCanBeReassigned: false
assignee: undefined
category: null
created: Mon Nov 13 2017 16:34:49 GMT+0000 (GMT) {}
description: "Updated description"
dueDate: Sat Feb 10 2018 11:00:00 GMT+0000 (GMT) {}
duration: NaN
endDate: null
executionId: null
formKey: "5005"
id: "80002"
initiatorCanCompleteTask: false
managerOfCandidateGroup: false
memberOfCandidateGroup: false
memberOfCandidateUsers: false
name: "Updated name"
parentTaskId: null
parentTaskName: null
priority: 50
processDefinitionCategory: null
processDefinitionDeploymentId: null
processDefinitionDescription: null
processDefinitionId: null
processDefinitionKey: null
processDefinitionName: null
processDefinitionVersion: 0
processInstanceId: null
processInstanceName: null
processInstanceStartUserId: null
taskDefinitionKey: null
#### createNewTask(task: TaskDetailsModel): Observable`<TaskDetailsModel>`
Create a new stand-alone Task Instance that is not associated with a Process Instance:
```ts
const taskDetails = new TaskDetailsModel({
name: 'Some Task',
description: 'A new stand-alone task'
});
this.tasklistService.createNewTask(taskDetails).subscribe( (createdTaskDetails: TaskDetailsModel) => {
console.log('Created task details: ', createdTaskDetails);
}, error => {
console.log('Error: ', error);
});
```
In this case we are creating a disconnected Task Instance that is not associated with a form (i.e. `formKey: null`)
and that is not assigned to a user (i.e. `assignee: null`).
The response looks like this, we can see that an ID was generated for the Task Instance:
Created task details:
adhocTaskCanBeReassigned: false
assignee: null
category: null
created: Mon Nov 13 2017 16:34:49 GMT+0000 (GMT) {}
description: "A new stand-alone task"
dueDate: null
duration: null
endDate: null
executionId: null
formKey: null
id: "80002"
initiatorCanCompleteTask: false
involvedPeople: undefined
managerOfCandidateGroup: false
memberOfCandidateGroup: false
memberOfCandidateUsers: false
name: "Some Task"
parentTaskId: null
parentTaskName: null
priority: 50
processDefinitionCategory: null
processDefinitionDeploymentId: null
processDefinitionDescription: null
processDefinitionId: null
processDefinitionKey: null
processDefinitionName: null
processDefinitionVersion: 0
processInstanceId: null
processInstanceName: null
processInstanceStartUserId: null
taskDefinitionKey: null
See the `attachFormToATask` method for how to attach a form to the User Task. And see the `assignTaskByUserId` method
for how to assign a user to the new Task Instance.
#### attachFormToATask(taskId: string, formId: number): Observable`<any>`
Attach a form to a User Task:
```ts
const taskId = '80002';
const formId = 5005;
this.tasklistService.attachFormToATask(taskId, formId).subscribe( (response: any) => {
console.log('Assign form response: ', response);
}, error => {
console.log('Error: ', error);
});
```
In this case we need to have a task created and know the ID for it, such as with the `createNewTask` method.
We also need to have a form defined in APS and know the ID for it (you can see the ID for a form in the URL
in APS when you work with it). See the `getFormList` method for how fetch a list of available forms.
The response will be `null` if form was attached successfully to task.
#### getFormList(): Observable`<Form []>`
Get a list of the available reusable forms:
```ts
this.tasklistService.getFormList().subscribe( (formList: Form[]) => {
console.log('Available forms: ', formList);
}, error => {
console.log('Error: ', error);
});
```
A successful response looks like this:
Available forms:
0:
id: 5005
name: "Name Info"
1: {name: "cm:folder", id: 3012}
2: {name: "Alfresco Node Form", id: 3011}
3: {name: "Employee", id: 3010}
The form id property can be used with the `attachFormToATask` method.
**Note**. Referenced forms that are associated with specific tasks in a process are not included in this list.
Only reusable forms are included.
#### addTask(task: TaskDetailsModel): Observable`<TaskDetailsModel>`
Add a Sub-Task (i.e. checklist task) to a parent Task Instance:
```ts
const parentTaskId = '80002';
const subTaskDetails = new TaskDetailsModel({
parentTaskId: parentTaskId,
name: 'Check the invoice amount'
});
this.tasklistService.addTask(subTaskDetails).subscribe( (updatedTaskDetails: TaskDetailsModel) => {
console.log('Sub-task info: ', updatedTaskDetails);
}, error => {
console.log('Error: ', error);
});
```
The response includes the new sub-task id and also parent task name.
In this example the parent task was just a stand-alone task, so no process information is included:
adhocTaskCanBeReassigned: false
assignee: null
category: null
created: Tue Nov 14 2017 13:32:41 GMT+0000 (GMT) {}
description: null
dueDate: null
duration: null
endDate: null
executionId: null
formKey: null
id: "80003"
initiatorCanCompleteTask: false
involvedPeople: undefined
managerOfCandidateGroup: false
memberOfCandidateGroup: false
memberOfCandidateUsers: false
name: "Check the invoice amount"
parentTaskId: "80002"
parentTaskName: "Some Task"
priority: 50
processDefinitionCategory: null
processDefinitionDeploymentId: null
processDefinitionDescription: null
processDefinitionId: null
processDefinitionKey: null
processDefinitionName: null
processDefinitionVersion: 0
processInstanceId: null
processInstanceName: null
processInstanceStartUserId:null
taskDefinitionKey: null
#### deleteTask(taskId: string): Observable`<TaskDetailsModel>`
Delete a Sub-Task (i.e. checklist task):
```ts
const taskId = '75100'; // Sub-task ID
this.tasklistService.deleteTask(taskId).subscribe( (taskDetails: TaskDetailsModel) => {
console.log('Deleted task info: ', taskDetails);
}, error => {
console.log('Error: ', error);
});
```
**Note**. you can only delete so called checklist tasks with this method.
#### fetchTaskAuditJsonById(taskId: string): Observable`<any>`
Fetch Task Audit log as JSON for a Task Instance ID:
```ts
const taskId = '15368';
this.tasklistService.fetchTaskAuditJsonById(taskId)
.subscribe( auditJson => {
console.log('Task Audit: ', auditJson);
}, error => {
console.log('Error: ', error);
});
```
The response is JSON object with the Task Instance audit log:
{
taskId: "15368",
taskName: "Approve by someone in Accounting",
processInstanceId: "15361",
processDefinitionName: "Process With Pooled task",
processDefinitionVersion: 1,
}
#### fetchTaskAuditPdfById(taskId: string): Observable`<Blob>`
Fetch Task Audit log as JSON for a Task Instance ID:
```ts
this.tasklistService.fetchTaskAuditPdfById(taskId)
.subscribe( (auditPdf: Blob) => {
console.log('Task Audit: ', auditPdf);
}, error => {
console.log('Error: ', error);
});
```
The response is PDF with the Task Instance audit log.