[ADF-2905] Updated JSDocs for core (#3271)

This commit is contained in:
Andy Stark 2018-05-04 19:03:13 +01:00 committed by Eugenio Romano
parent fe0ac0e474
commit c824e646de
18 changed files with 256 additions and 119 deletions

View File

@ -2,10 +2,35 @@
Added: v2.0.0 Added: v2.0.0
Status: Active Status: Active
--- ---
# App Config service # App Config service
Supports app configuration settings, stored server side. Supports app configuration settings, stored server side.
## Class members
### Methods
- `get(key: string = null, defaultValue?: T = null): T`<br/>
Gets the value of a named property.
- `key: string = null` - Name of the property
- `defaultValue?: T = null` - (Optional) Value to return if the key is not found
- **Returns** `T` - Value of the property
- `getLocationHostname(): string`<br/>
Gets the location.hostname property.
- **Returns** `string` - Value of the property
- `getLocationPort(prefix: string = ""): string`<br/>
Gets the location.port property.
- `prefix: string = ""` - Text added before port value
- **Returns** `string` - Port with prefix
- `load(): Promise<any>`<br/>
Loads the config file.
- **Returns** `Promise<any>` - Notification when loading is complete
- `select(property: string = null): Observable<any>`<br/>
Requests notification of a property value when it is loaded.
- `property: string = null` - The desired property value
- **Returns** `Observable<any>` - Property value, when loaded
## Details ## Details
The `AppConfigService` service provides support for loading and accessing global application configuration settings that you store on the server side in the form of a JSON file. The `AppConfigService` service provides support for loading and accessing global application configuration settings that you store on the server side in the form of a JSON file.
@ -100,10 +125,10 @@ The supported variables are:
| port | `location.port` | | port | `location.port` |
## App Config onLoad Stream ## App Config onLoad Stream
When the app config is loaded correctly an onChange event is sent with the whole set app config properties. This comes in handy when a component wants to react to some property change or interact with the app config when it's correctly loaded. When the app config is loaded correctly an onChange event is sent with the whole set app config properties. This comes in handy when a component wants to react to some property change or interact with the app config when it's correctly loaded.
```ts ```ts
appConfig.onLoad.subscribe((appConfig) => { appConfig.onLoad.subscribe((appConfig) => {
console.log(appConfig); //this is the representation of the app-config console.log(appConfig); //this is the representation of the app-config
}); });
@ -122,4 +147,4 @@ We have added also the `select` method where the user can give the property name
appConfig.select('logLevel').subscribe((logLevelValue) => { appConfig.select('logLevel').subscribe((logLevelValue) => {
console.log(logLevelValue); //this will be 'trace'; console.log(logLevelValue); //this will be 'trace';
}); });
``` ```

View File

@ -1,7 +1,9 @@
--- ---
Added: v2.0.0 Added: v2.0.0
Status: Active Status: Active
Last reviewed: 2018-05-04
--- ---
# Bpm User service # Bpm User service
Gets information about the current Process Services user. Gets information about the current Process Services user.
@ -10,11 +12,12 @@ Gets information about the current Process Services user.
### Methods ### Methods
`getCurrentUserInfo(): Observable<BpmUserModel>`<br/> - `getCurrentUserInfo(): Observable<BpmUserModel>`<br/>
Gets information about the current user. Gets information about the current user.
- **Returns** `Observable<BpmUserModel>` - User information object
`getCurrentUserProfileImage(): string`<br/> - `getCurrentUserProfileImage(): string`<br/>
Returns the current user's profile image as a URL. Gets the current user's profile image as a URL.
- **Returns** `string` - URL string
## Details ## Details

View File

@ -2,12 +2,29 @@
Added: v2.0.0 Added: v2.0.0
Status: Active Status: Active
--- ---
# Card View component # Card View component
Displays a configurable property list renderer. Displays a configurable property list renderer.
![adf-custom-view](../docassets/images/adf-custom-view.png) ![adf-custom-view](../docassets/images/adf-custom-view.png)
## Contents
- [Basic Usage](#basic-usage)
- [Class members](#class-members)
- [Properties](#properties)
- [Details](#details)
- [Editing](#editing)
- [Defining properties](#defining-properties)
- [Defining your custom card Item](#defining-your-custom-card-item)
- [See also](#see-also)
## Basic Usage ## Basic Usage
```html ```html
@ -21,11 +38,11 @@ Displays a configurable property list renderer.
### Properties ### Properties
| Name | Type | Default | Description | | Name | Type | Default value | Description |
| ---- | ---- | ------- | ----------- | | -- | -- | -- | -- |
| properties | [CardViewItem](#defining-properties)\[] | - | (**required**) The custom view to render | | displayEmpty | `boolean` | true | Toggles whether or not to show empty items in non-editable mode. |
| editable | boolean | - | If the component editable or not | | editable | `boolean` | | Toggles whether or not the items can be edited. |
| displayEmpty | boolean | true | Whether to show empty properties in non-editable mode | | properties | `CardViewItem[]` | | (**required**) Items to show in the card view. |
## Details ## Details
@ -145,7 +162,7 @@ const textItemProperty = new CardViewTextItemModel(options);
| displayValue\* | string | --- | The value to render | | displayValue\* | string | --- | The value to render |
| editable | boolean | false | Whether the property editable or not | | editable | boolean | false | Whether the property editable or not |
| clickable | boolean | false | Whether the property clickable or not | | clickable | boolean | false | Whether the property clickable or not |
| icon | string | The material icon to show against the clickable property | | icon | string | The material icon to show against the clickable property | |
| multiline | string | false | Single or multiline text | | multiline | string | false | Single or multiline text |
| pipes | CardViewTextItemPipeProperty\[] | \[] | Pipes to be applied on the displayValue | | pipes | CardViewTextItemPipeProperty\[] | \[] | Pipes to be applied on the displayValue |

View File

@ -12,12 +12,12 @@ Adds and retrieves comments for nodes in Content Services.
### Methods ### Methods
- `addNodeComment(nodeId: string, message: string): Observable<CommentModel>`<br/> - `addNodeComment(nodeId: string = null, message: string = null): Observable<CommentModel>`<br/>
Adds a comment to a node. Adds a comment to a node.
- `nodeId: string` - ID of the target node - `nodeId: string = null` - ID of the target node
- `message: string` - Text for the comment - `message: string = null` - Text for the comment
- **Returns** `Observable<CommentModel>` - Details of the comment added - **Returns** `Observable<CommentModel>` - Details of the comment added
- `getNodeComments(nodeId: string): Observable<CommentModel[]>`<br/> - `getNodeComments(nodeId: string = null): Observable<CommentModel[]>`<br/>
Gets all comments that have been added to a node. Gets all comments that have been added to a node.
- `nodeId: string = null` - ID of the target node - `nodeId: string = null` - ID of the target node
- **Returns** `Observable<CommentModel[]>` - Details for each comment - **Returns** `Observable<CommentModel[]>` - Details for each comment

View File

@ -12,46 +12,58 @@ Accesses app-generated data objects via URLs and file downloads.
### Methods ### Methods
- `downloadBlob(blob: Blob, fileName: string)` - `createFolder(relativePath: string = null, name: string = null, parentId?: string = null): Observable<FolderCreatedEvent>`<br/>
Invokes content download for a Blob with a file name. Creates a folder.
- `blob` - Content to download. - `relativePath: string = null` - Location to create the folder
- `fileName` - Name of the resulting file. - `name: string = null` - Folder name
- `downloadData(data: any, fileName: string)` - `parentId?: string = null` - (Optional) Node ID of parent folder
Invokes content download for a data array with a file name. - **Returns** `Observable<FolderCreatedEvent>` - Information about the new folder
- `data` - Data to download. - `createTrustedUrl(blob: Blob = null): string`<br/>
- `fileName` - Name of the resulting file. Creates a trusted object URL from the Blob. WARNING: calling this method with untrusted user data exposes your application to XSS security risks!
- `downloadJSON(json: any, fileName)` - `blob: Blob = null` - Data to wrap into object URL
Invokes content download for a JSON object with a file name. - **Returns** `string` - URL string
- `json` - JSON object to download. - `downloadBlob(blob: Blob = null, fileName: string = null)`<br/>
- `fileName` - Name of the resulting file. Invokes content download for a Blob with a file name.
- `createTrustedUrl(blob: Blob): string` - `blob: Blob = null` - Content to download.
Creates a trusted object URL from the Blob. WARNING: calling this method with untrusted user data exposes your application to XSS security risks! - `fileName: string = null` - Name of the resulting file.
- `blob` - Data to wrap into object URL - `downloadData(data: any = null, fileName: string = null)`<br/>
- `getDocumentThumbnailUrl(node: any, attachment?: boolean, ticket?: string): string` Invokes content download for a data array with a file name.
Get thumbnail URL for the given document node. - `data: any = null` - Data to download.
- `node` - Node to get URL for. - `fileName: string = null` - Name of the resulting file.
- `attachment` - (Optional) Retrieve content as an attachment for download - `downloadJSON(json: any = null, fileName: string = null)`<br/>
- `ticket` - (Optional) Custom ticket to use for authentication Invokes content download for a JSON object with a file name.
- `getContentUrl(node: any, attachment?: boolean, ticket?: string): string` - `json: any = null` - JSON object to download.
Get content URL for the given node. - `fileName: string = null` - Name of the resulting file.
- `node` - nodeId or node to get URL for. - `getContentUrl(node: any = null, attachment?: boolean = null, ticket?: string = null): string`<br/>
- `attachment` - (Optional) Retrieve content as an attachment for download Gets a content URL for the given node.
- `ticket` - (Optional) Custom ticket to use for authentication - `node: any = null` - Node to get URL for.
- `getNodeContent(nodeId: string): Observable<any>` - `attachment?: boolean = null` - (Optional) Toggles whether to retrieve content as an attachment for download
Get content for the given node. - `ticket?: string = null` - (Optional) Custom ticket to use for authentication
- `nodeId` - ID of the target node - **Returns** `string` - URL string
- `createFolder(relativePath: string, name: string, parentId?: string): Observable<FolderCreatedEvent>` - `getDocumentThumbnailUrl(node: any = null, attachment?: boolean = null, ticket?: string = null): string`<br/>
Create a folder Gets a thumbnail URL for the given document node.
- `relativePath` - Location to create the folder - `node: any = null` - Node to get URL for.
- `name` - Folder name - `attachment?: boolean = null` - (Optional) Toggles whether to retrieve content as an attachment for download
- `parentId` - (Optional) Node ID of parent folder - `ticket?: string = null` - (Optional) Custom ticket to use for authentication
- `hasPermission(node: any, permission: PermissionsEnum | string): boolean` - **Returns** `string` - URL string
Check if the user has permissions on that node - `getNode(nodeId: string = null, opts?: any = null): Observable<NodeEntry>`<br/>
- `node` - Node to check allowableOperations Gets a Node via its node ID.
- `permission` - Create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions - `nodeId: string = null` - ID of the target node
- `hasAllowableOperations(node: any): boolean` - `opts?: any = null` - (Optional) Options supported by JSAPI
Check if the node has the properties allowableOperations - **Returns** `Observable<NodeEntry>` - Details of the folder
- `node` - Node to check allowableOperations - `getNodeContent(nodeId: string = null): Observable<any>`<br/>
Gets content for the given node.
- `nodeId: string = null` - ID of the target node
- **Returns** `Observable<any>` - Content data
- `hasAllowableOperations(node: any = null): boolean`<br/>
Checks if the node has the properties allowableOperations
- `node: any = null` - Node to check allowableOperations
- **Returns** `boolean` - True if the node has the property, false otherwise
- `hasPermission(node: Node = null, permission: PermissionsEnum | string = null): boolean`<br/>
Checks if the user has permissions on that node
- `node: Node = null` - Node to check allowableOperations
- `permission: PermissionsEnum | string = null` - Create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions
- **Returns** `boolean` - True if the user has the required permissions, false otherwise
## Details ## Details

View File

@ -48,8 +48,8 @@ export class MyComponent implements OnInit {
| Name | Type | Default value | Description | | Name | Type | Default value | Description |
| -- | -- | -- | -- | | -- | -- | -- | -- |
| context-menu-enabled | `boolean` | false | | | context-menu-enabled | `boolean` | false | Is the menu enabled? |
| context-menu | `any[]` | | | | context-menu | `any[]` | | Items for the menu. |
## Details ## Details

View File

@ -1,7 +1,9 @@
--- ---
Added: v2.0.0 Added: v2.0.0
Status: Active Status: Active
Last reviewed: 2018-05-04
--- ---
# Favorites Api service # Favorites Api service
Gets a list of items a user has marked as their favorites. Gets a list of items a user has marked as their favorites.
@ -10,8 +12,11 @@ Gets a list of items a user has marked as their favorites.
### Methods ### Methods
`getFavorites(personId: string, options?: any): Observable<NodePaging>`<br/> - `getFavorites(personId: string = null, options?: any = null): Observable<NodePaging>`<br/>
Gets the favorites for a user. Gets the favorites for a user.
- `personId: string = null` - ID of the user
- `options?: any = null` - (Optional) Options supported by JSAPI
- **Returns** `Observable<NodePaging>` - List of favorites
## Details ## Details

View File

@ -2,6 +2,7 @@
Added: v2.0.0 Added: v2.0.0
Status: Active Status: Active
--- ---
# Form Rendering service # Form Rendering service
Maps an APS form field type string onto the corresponding form widget component type. Maps an APS form field type string onto the corresponding form widget component type.
@ -10,19 +11,21 @@ Maps an APS form field type string onto the corresponding form widget component
### Methods ### Methods
- `getComponentTypeResolver(type: string, defaultValue: Type<{}> = this.defaultValue): DynamicComponentResolveFunction` - `getComponentTypeResolver(type: string = null, defaultValue: Type<__type> = this.defaultValue): DynamicComponentResolveFunction`<br/>
Gets the currently active ComponentTypeResolver function for a field type. Gets the currently active ComponentTypeResolver function for a field type.
- `type` - The type whose resolver you want - `type: string = null` - The type whose resolver you want
- `defaultValue` - Default type returned for types that are not yet mapped - `defaultValue: Type<__type> = this.defaultValue` - Default type returned for types that are not yet mapped
- `setComponentTypeResolver(type: string, resolver: DynamicComponentResolveFunction, override: boolean = false)` - **Returns** `DynamicComponentResolveFunction` - Resolver function
Sets or optionally replaces a ComponentTypeResolver function for a field type. - `resolveComponentType(model: DynamicComponentModel = null, defaultValue: Type<__type> = this.defaultValue): Type<__type>`<br/>
- `type` - The type whose resolver you want to set Finds the component type that is needed to render a form field.
- `resolver` - The new resolver function - `model: DynamicComponentModel = null` - (form-field.model.md) for the field to render
- `override` - The new resolver will only replace an existing one if this parameter is true - `defaultValue: Type<__type> = this.defaultValue` - Default type returned for field types that are not yet mapped.
- `resolveComponentType(model: DynamicComponentModel, defaultValue: Type<{}> = this.defaultValue): Type<{}>` - **Returns** `Type<__type>` - Component type
Finds the component type that is needed to render a form field. - `setComponentTypeResolver(type: string = null, resolver: DynamicComponentResolveFunction = null, override: boolean = false)`<br/>
- `model` - [Form field model](form-field.model.md) for the field to render Sets or optionally replaces a ComponentTypeResolver function for a field type.
- `defaultValue` - Default type returned for field types that are not yet mapped. - `type: string = null` - The type whose resolver you want to set
- `resolver: DynamicComponentResolveFunction = null` - The new resolver function
- `override: boolean = false` - The new resolver will only replace an existing one if this parameter is true
## Details ## Details

View File

@ -2,6 +2,7 @@
Added: v2.0.0 Added: v2.0.0
Status: Active Status: Active
--- ---
# Form service # Form service
Implements Process Services form methods Implements Process Services form methods
@ -66,7 +67,6 @@ class MyComponent {
- `formId` - ID of the form to save - `formId` - ID of the form to save
- `formModel` - Model data for the form - `formModel` - Model data for the form
- `addFieldsToAForm(formId: string, formModel: FormDefinitionModel): Observable<any>` - `addFieldsToAForm(formId: string, formModel: FormDefinitionModel): Observable<any>`
- `formId` - ID of the form - `formId` - ID of the form
- `formModel` - Form definition - `formModel` - Form definition
- `searchFrom(name: string): Observable<any>` - `searchFrom(name: string): Observable<any>`

View File

@ -44,10 +44,21 @@ export class AppConfigService {
this.onLoad = this.onLoadSubject.asObservable(); this.onLoad = this.onLoadSubject.asObservable();
} }
/**
* Requests notification of a property value when it is loaded.
* @param property The desired property value
* @returns Property value, when loaded
*/
select(property: string): Observable<any> { select(property: string): Observable<any> {
return this.onLoadSubject.map((config) => config[property]).distinctUntilChanged(); return this.onLoadSubject.map((config) => config[property]).distinctUntilChanged();
} }
/**
* Gets the value of a named property.
* @param key Name of the property
* @param defaultValue Value to return if the key is not found
* @returns Value of the property
*/
get<T>(key: string, defaultValue?: T): T { get<T>(key: string, defaultValue?: T): T {
let result: any = ObjectUtils.getValue(this.config, key); let result: any = ObjectUtils.getValue(this.config, key);
if (typeof result === 'string') { if (typeof result === 'string') {
@ -63,14 +74,27 @@ export class AppConfigService {
return <T> result; return <T> result;
} }
/**
* Gets the location.hostname property.
* @returns Value of the property
*/
getLocationHostname(): string { getLocationHostname(): string {
return location.hostname; return location.hostname;
} }
/**
* Gets the location.port property.
* @param prefix Text added before port value
* @returns Port with prefix
*/
getLocationPort(prefix: string = ''): string { getLocationPort(prefix: string = ''): string {
return location.port ? prefix + location.port : ''; return location.port ? prefix + location.port : '';
} }
/**
* Loads the config file.
* @returns Notification when loading is complete
*/
load(): Promise<any> { load(): Promise<any> {
return new Promise(resolve => { return new Promise(resolve => {
this.http.get('app.config.json').subscribe( this.http.get('app.config.json').subscribe(

View File

@ -24,12 +24,15 @@ import { CardViewItem } from '../../interfaces/card-view-item.interface';
styleUrls: ['./card-view.component.scss'] styleUrls: ['./card-view.component.scss']
}) })
export class CardViewComponent { export class CardViewComponent {
/** (**required**) Items to show in the card view. */
@Input() @Input()
properties: CardViewItem []; properties: CardViewItem [];
/** Toggles whether or not the items can be edited. */
@Input() @Input()
editable: boolean; editable: boolean;
/** Toggles whether or not to show empty items in non-editable mode. */
@Input() @Input()
displayEmpty: boolean = true; displayEmpty: boolean = true;
} }

View File

@ -25,9 +25,11 @@ import { ContextMenuService } from './context-menu.service';
selector: '[adf-context-menu], [context-menu]' selector: '[adf-context-menu], [context-menu]'
}) })
export class ContextMenuDirective { export class ContextMenuDirective {
/** Items for the menu. */
@Input('context-menu') @Input('context-menu')
links: any[]; links: any[];
/** Is the menu enabled? */
@Input('context-menu-enabled') @Input('context-menu-enabled')
enabled: boolean = false; enabled: boolean = false;

View File

@ -95,6 +95,7 @@ export class FormService {
* @param json JSON to create the form * @param json JSON to create the form
* @param data Values for the form fields * @param data Values for the form fields
* @param readOnly Should the form fields be read-only? * @param readOnly Should the form fields be read-only?
* @returns Form model created from input data
*/ */
parseForm(json: any, data?: FormValues, readOnly: boolean = false): FormModel { parseForm(json: any, data?: FormValues, readOnly: boolean = false): FormModel {
if (json) { if (json) {
@ -114,8 +115,9 @@ export class FormService {
} }
/** /**
* Create a Form with a field for each metadata property. * Creates a Form with a field for each metadata property.
* @param formName Name of the new form * @param formName Name of the new form
* @returns The new form
*/ */
createFormFromANode(formName: string): Observable<any> { createFormFromANode(formName: string): Observable<any> {
return Observable.create(observer => { return Observable.create(observer => {
@ -138,6 +140,7 @@ export class FormService {
/** /**
* Create a Form. * Create a Form.
* @param formName Name of the new form * @param formName Name of the new form
* @returns The new form
*/ */
createForm(formName: string): Observable<any> { createForm(formName: string): Observable<any> {
let dataModel = { let dataModel = {
@ -156,6 +159,7 @@ export class FormService {
* Saves a form. * Saves a form.
* @param formId ID of the form to save * @param formId ID of the form to save
* @param formModel Model data for the form * @param formModel Model data for the form
* @returns Data for the saved form
*/ */
saveForm(formId: string, formModel: FormDefinitionModel): Observable<any> { saveForm(formId: string, formModel: FormDefinitionModel): Observable<any> {
return Observable.fromPromise( return Observable.fromPromise(
@ -177,8 +181,9 @@ export class FormService {
} }
/** /**
* Search for a form by name. * Searches for a form by name.
* @param name The form name to search for * @param name The form name to search for
* @returns Form model(s) matching the search name
*/ */
searchFrom(name: string): Observable<any> { searchFrom(name: string): Observable<any> {
let opts = { let opts = {
@ -196,6 +201,7 @@ export class FormService {
/** /**
* Gets all the forms. * Gets all the forms.
* @returns List of form models
*/ */
getForms(): Observable<any> { getForms(): Observable<any> {
let opts = { let opts = {
@ -208,7 +214,8 @@ export class FormService {
} }
/** /**
* Get Process Definitions * Gets process definitions.
* @returns List of process definitions
*/ */
getProcessDefinitions(): Observable<any> { getProcessDefinitions(): Observable<any> {
return Observable.fromPromise(this.processApi.getProcessDefinitions({})) return Observable.fromPromise(this.processApi.getProcessDefinitions({}))
@ -217,8 +224,9 @@ export class FormService {
} }
/** /**
* Get instance variables for a process. * Gets instance variables for a process.
* @param processInstanceId ID of the target process * @param processInstanceId ID of the target process
* @returns List of instance variable information
*/ */
getProcessVarablesById(processInstanceId: string): Observable<any[]> { getProcessVarablesById(processInstanceId: string): Observable<any[]> {
return Observable.fromPromise(this.processInstanceVariablesApi.getProcessInstanceVariables(processInstanceId)) return Observable.fromPromise(this.processInstanceVariablesApi.getProcessInstanceVariables(processInstanceId))
@ -228,6 +236,7 @@ export class FormService {
/** /**
* Gets all the tasks. * Gets all the tasks.
* @returns List of tasks
*/ */
getTasks(): Observable<any> { getTasks(): Observable<any> {
return Observable.fromPromise(this.taskApi.listTasks({})) return Observable.fromPromise(this.taskApi.listTasks({}))
@ -238,6 +247,7 @@ export class FormService {
/** /**
* Gets a task. * Gets a task.
* @param taskId Task Id * @param taskId Task Id
* @returns Task info
*/ */
getTask(taskId: string): Observable<any> { getTask(taskId: string): Observable<any> {
return Observable.fromPromise(this.taskApi.getTask(taskId)) return Observable.fromPromise(this.taskApi.getTask(taskId))
@ -246,9 +256,10 @@ export class FormService {
} }
/** /**
* Save Task Form. * Saves a task form.
* @param taskId Task Id * @param taskId Task Id
* @param formValues Form Values * @param formValues Form Values
* @returns Null response when the operation is complete
*/ */
saveTaskForm(taskId: string, formValues: FormValues): Observable<any> { saveTaskForm(taskId: string, formValues: FormValues): Observable<any> {
let body = JSON.stringify({values: formValues}); let body = JSON.stringify({values: formValues});
@ -258,10 +269,11 @@ export class FormService {
} }
/** /**
* Complete Task Form * Completes a Task Form.
* @param taskId Task Id * @param taskId Task Id
* @param formValues Form Values * @param formValues Form Values
* @param outcome Form Outcome * @param outcome Form Outcome
* @returns Null response when the operation is complete
*/ */
completeTaskForm(taskId: string, formValues: FormValues, outcome?: string): Observable<any> { completeTaskForm(taskId: string, formValues: FormValues, outcome?: string): Observable<any> {
let data: any = {values: formValues}; let data: any = {values: formValues};
@ -275,8 +287,9 @@ export class FormService {
} }
/** /**
* Get Form related to a taskId * Gets a form related to a task.
* @param taskId Task Id * @param taskId ID of the target task
* @returns Form definition
*/ */
getTaskForm(taskId: string): Observable<any> { getTaskForm(taskId: string): Observable<any> {
return Observable.fromPromise(this.taskApi.getTaskForm(taskId)) return Observable.fromPromise(this.taskApi.getTaskForm(taskId))
@ -285,8 +298,9 @@ export class FormService {
} }
/** /**
* Get Form Definition * Gets a form definition.
* @param formId Form Id * @param formId ID of the target form
* @returns Form definition
*/ */
getFormDefinitionById(formId: string): Observable<any> { getFormDefinitionById(formId: string): Observable<any> {
return Observable.fromPromise(this.editorApi.getForm(formId)) return Observable.fromPromise(this.editorApi.getForm(formId))
@ -295,8 +309,9 @@ export class FormService {
} }
/** /**
* Returns form definition with a given name. * Gets the form definition with a given name.
* @param name The form name * @param name The form name
* @returns Form definition
*/ */
getFormDefinitionByName(name: string): Observable<any> { getFormDefinitionByName(name: string): Observable<any> {
let opts = { let opts = {
@ -311,8 +326,9 @@ export class FormService {
} }
/** /**
* Get start form instance for a given processId * Gets the start form instance for a given process.
* @param processId Process definition ID * @param processId Process definition ID
* @returns Form definition
*/ */
getStartFormInstance(processId: string): Observable<any> { getStartFormInstance(processId: string): Observable<any> {
return Observable.fromPromise( return Observable.fromPromise(
@ -324,6 +340,7 @@ export class FormService {
/** /**
* Gets a process instance. * Gets a process instance.
* @param processId ID of the process to get * @param processId ID of the process to get
* @returns Process instance
*/ */
getProcessIntance(processId: string): Observable<any> { getProcessIntance(processId: string): Observable<any> {
return Observable.fromPromise(this.processApi.getProcessInstance(processId)) return Observable.fromPromise(this.processApi.getProcessInstance(processId))
@ -332,8 +349,9 @@ export class FormService {
} }
/** /**
* Get start form definition for a given process * Gets the start form definition for a given process.
* @param processId Process definition ID * @param processId Process definition ID
* @returns Form definition
*/ */
getStartFormDefinition(processId: string): Observable<any> { getStartFormDefinition(processId: string): Observable<any> {
return Observable.fromPromise( return Observable.fromPromise(
@ -346,6 +364,7 @@ export class FormService {
* Gets values of fields populated by a REST backend. * Gets values of fields populated by a REST backend.
* @param taskId Task identifier * @param taskId Task identifier
* @param field Field identifier * @param field Field identifier
* @returns Field values
*/ */
getRestFieldValues(taskId: string, field: string): Observable<any> { getRestFieldValues(taskId: string, field: string): Observable<any> {
return Observable.fromPromise(this.taskApi.getRestFieldValues(taskId, field)).catch(err => this.handleError(err)); return Observable.fromPromise(this.taskApi.getRestFieldValues(taskId, field)).catch(err => this.handleError(err));
@ -355,6 +374,7 @@ export class FormService {
* Gets values of fields populated by a REST backend using a process ID. * Gets values of fields populated by a REST backend using a process ID.
* @param processDefinitionId Process identifier * @param processDefinitionId Process identifier
* @param field Field identifier * @param field Field identifier
* @returns Field values
*/ */
getRestFieldValuesByProcessId(processDefinitionId: string, field: string): Observable<any> { getRestFieldValuesByProcessId(processDefinitionId: string, field: string): Observable<any> {
return Observable.fromPromise(this.processApi.getRestFieldValues(processDefinitionId, field)).catch(err => this.handleError(err)); return Observable.fromPromise(this.processApi.getRestFieldValues(processDefinitionId, field)).catch(err => this.handleError(err));
@ -365,6 +385,7 @@ export class FormService {
* @param processDefinitionId Process identifier * @param processDefinitionId Process identifier
* @param field Field identifier * @param field Field identifier
* @param column Column identifier * @param column Column identifier
* @returns Field values
*/ */
getRestFieldValuesColumnByProcessId(processDefinitionId: string, field: string, column?: string): Observable<any> { getRestFieldValuesColumnByProcessId(processDefinitionId: string, field: string, column?: string): Observable<any> {
return Observable.fromPromise(this.processApi.getRestTableFieldValues(processDefinitionId, field, column)).catch(err => this.handleError(err)); return Observable.fromPromise(this.processApi.getRestTableFieldValues(processDefinitionId, field, column)).catch(err => this.handleError(err));
@ -375,6 +396,7 @@ export class FormService {
* @param taskId Task identifier * @param taskId Task identifier
* @param field Field identifier * @param field Field identifier
* @param column Column identifier * @param column Column identifier
* @returns Field values
*/ */
getRestFieldValuesColumn(taskId: string, field: string, column?: string): Observable<any> { getRestFieldValuesColumn(taskId: string, field: string, column?: string): Observable<any> {
return Observable.fromPromise(this.taskApi.getRestFieldValuesColumn(taskId, field, column)).catch(err => this.handleError(err)); return Observable.fromPromise(this.taskApi.getRestFieldValuesColumn(taskId, field, column)).catch(err => this.handleError(err));
@ -383,6 +405,7 @@ export class FormService {
/** /**
* Returns a URL for the profile picture of a user. * Returns a URL for the profile picture of a user.
* @param userId ID of the target user * @param userId ID of the target user
* @returns URL string
*/ */
getUserProfileImageApi(userId: number): string { getUserProfileImageApi(userId: number): string {
return this.apiService.getInstance().activiti.userApi.getUserProfilePictureUrl(userId); return this.apiService.getInstance().activiti.userApi.getUserProfilePictureUrl(userId);
@ -392,6 +415,7 @@ export class FormService {
* Gets a list of workflow users. * Gets a list of workflow users.
* @param filter Filter to select specific users * @param filter Filter to select specific users
* @param groupId Group ID for the search * @param groupId Group ID for the search
* @returns Array of users
*/ */
getWorkflowUsers(filter: string, groupId?: string): Observable<UserProcessModel[]> { getWorkflowUsers(filter: string, groupId?: string): Observable<UserProcessModel[]> {
let option: any = {filter: filter}; let option: any = {filter: filter};
@ -413,6 +437,7 @@ export class FormService {
* Gets a list of groups in a workflow. * Gets a list of groups in a workflow.
* @param filter Filter to select specific groups * @param filter Filter to select specific groups
* @param groupId Group ID for the search * @param groupId Group ID for the search
* @returns Array of groups
*/ */
getWorkflowGroups(filter: string, groupId?: string): Observable<GroupModel[]> { getWorkflowGroups(filter: string, groupId?: string): Observable<GroupModel[]> {
let option: any = {filter: filter}; let option: any = {filter: filter};
@ -427,6 +452,7 @@ export class FormService {
/** /**
* Gets the ID of a form. * Gets the ID of a form.
* @param res Object representing a form * @param res Object representing a form
* @returns ID string
*/ */
getFormId(res: any): string { getFormId(res: any): string {
let result = null; let result = null;
@ -441,6 +467,7 @@ export class FormService {
/** /**
* Creates a JSON representation of form data. * Creates a JSON representation of form data.
* @param res Object representing form data * @param res Object representing form data
* @returns JSON data
*/ */
toJson(res: any) { toJson(res: any) {
if (res) { if (res) {
@ -452,6 +479,7 @@ export class FormService {
/** /**
* Creates a JSON array representation of form data. * Creates a JSON array representation of form data.
* @param res Object representing form data * @param res Object representing form data
* @returns JSON data
*/ */
toJsonArray(res: any) { toJsonArray(res: any) {
if (res) { if (res) {
@ -463,6 +491,7 @@ export class FormService {
/** /**
* Reports an error message. * Reports an error message.
* @param error Data object with optional `message` and `status` fields for the error * @param error Data object with optional `message` and `status` fields for the error
* @returns Error message
*/ */
handleError(error: any): Observable<any> { handleError(error: any): Observable<any> {
let errMsg = FormService.UNKNOWN_ERROR_MESSAGE; let errMsg = FormService.UNKNOWN_ERROR_MESSAGE;

View File

@ -31,6 +31,12 @@ export class CommentContentService {
private logService: LogService) { private logService: LogService) {
} }
/**
* Adds a comment to a node.
* @param nodeId ID of the target node
* @param message Text for the comment
* @returns Details of the comment added
*/
addNodeComment(nodeId: string, message: string): Observable<CommentModel> { addNodeComment(nodeId: string, message: string): Observable<CommentModel> {
return Observable.fromPromise(this.apiService.getInstance().core.commentsApi.addComment(nodeId, {content: message})) return Observable.fromPromise(this.apiService.getInstance().core.commentsApi.addComment(nodeId, {content: message}))
.map((response: any) => { .map((response: any) => {
@ -43,6 +49,11 @@ export class CommentContentService {
}).catch(err => this.handleError(err)); }).catch(err => this.handleError(err));
} }
/**
* Gets all comments that have been added to a node.
* @param nodeId ID of the target node
* @returns Details for each comment
*/
getNodeComments(nodeId: string): Observable<CommentModel[]> { getNodeComments(nodeId: string): Observable<CommentModel[]> {
return Observable.fromPromise(this.apiService.getInstance().core.commentsApi.getComments(nodeId)) return Observable.fromPromise(this.apiService.getInstance().core.commentsApi.getComments(nodeId))
.map((response: any) => { .map((response: any) => {

View File

@ -79,11 +79,8 @@ export class ContentService {
/** /**
* Invokes content download for a Blob with a file name. * Invokes content download for a Blob with a file name.
*
* @param blob Content to download. * @param blob Content to download.
* @param fileName Name of the resulting file. * @param fileName Name of the resulting file.
*
* @memberOf ContentService
*/ */
downloadBlob(blob: Blob, fileName: string): void { downloadBlob(blob: Blob, fileName: string): void {
this.saveData(blob, 'blob', fileName); this.saveData(blob, 'blob', fileName);
@ -91,11 +88,8 @@ export class ContentService {
/** /**
* Invokes content download for a data array with a file name. * Invokes content download for a data array with a file name.
*
* @param data Data to download. * @param data Data to download.
* @param fileName Name of the resulting file. * @param fileName Name of the resulting file.
*
* @memberOf ContentService
*/ */
downloadData(data: any, fileName: string): void { downloadData(data: any, fileName: string): void {
this.saveData(data, 'data', fileName); this.saveData(data, 'data', fileName);
@ -103,11 +97,8 @@ export class ContentService {
/** /**
* Invokes content download for a JSON object with a file name. * Invokes content download for a JSON object with a file name.
*
* @param json JSON object to download. * @param json JSON object to download.
* @param fileName Name of the resulting file. * @param fileName Name of the resulting file.
*
* @memberOf ContentService
*/ */
downloadJSON(json: any, fileName: string): void { downloadJSON(json: any, fileName: string): void {
this.saveData(json, 'json', fileName); this.saveData(json, 'json', fileName);
@ -117,8 +108,7 @@ export class ContentService {
* Creates a trusted object URL from the Blob. * Creates a trusted object URL from the Blob.
* WARNING: calling this method with untrusted user data exposes your application to XSS security risks! * WARNING: calling this method with untrusted user data exposes your application to XSS security risks!
* @param blob Data to wrap into object URL * @param blob Data to wrap into object URL
* * @returns URL string
* @memberOf ContentService
*/ */
createTrustedUrl(blob: Blob): string { createTrustedUrl(blob: Blob): string {
let url = window.URL.createObjectURL(blob); let url = window.URL.createObjectURL(blob);
@ -130,11 +120,11 @@ export class ContentService {
} }
/** /**
* Get thumbnail URL for the given document node. * Gets a thumbnail URL for the given document node.
*
* @param node Node to get URL for. * @param node Node to get URL for.
* @param [attachment] Retrieve content as an attachment for download * @param attachment Toggles whether to retrieve content as an attachment for download
* @param [ticket] Custom ticket to use for authentication * @param ticket Custom ticket to use for authentication
* @returns URL string
*/ */
getDocumentThumbnailUrl(node: any, attachment?: boolean, ticket?: string): string { getDocumentThumbnailUrl(node: any, attachment?: boolean, ticket?: string): string {
@ -146,11 +136,11 @@ export class ContentService {
} }
/** /**
* Get content URL for the given node. * Gets a content URL for the given node.
* * @param node Node to get URL for.
* @param nodeId or node to get URL for. * @param attachment Toggles whether to retrieve content as an attachment for download
* @param [attachment] Retrieve content as an attachment for download * @param ticket Custom ticket to use for authentication
* @param [ticket] Custom ticket to use for authentication * @returns URL string
*/ */
getContentUrl(node: any, attachment?: boolean, ticket?: string): string { getContentUrl(node: any, attachment?: boolean, ticket?: string): string {
@ -162,9 +152,9 @@ export class ContentService {
} }
/** /**
* Get content for the given node. * Gets content for the given node.
* @param nodeId ID of the target node * @param nodeId ID of the target node
* * @returns Content data
*/ */
getNodeContent(nodeId: string): Observable<any> { getNodeContent(nodeId: string): Observable<any> {
return Observable.fromPromise(this.apiService.getInstance().core.nodesApi.getFileContent(nodeId).then((dataContent) => { return Observable.fromPromise(this.apiService.getInstance().core.nodesApi.getFileContent(nodeId).then((dataContent) => {
@ -173,10 +163,11 @@ export class ContentService {
} }
/** /**
* Create a folder * Creates a folder.
* @param relativePath Location to create the folder * @param relativePath Location to create the folder
* @param name Folder name * @param name Folder name
* @param parentId Node ID of parent folder * @param parentId Node ID of parent folder
* @returns Information about the new folder
*/ */
createFolder(relativePath: string, name: string, parentId?: string): Observable<FolderCreatedEvent> { createFolder(relativePath: string, name: string, parentId?: string): Observable<FolderCreatedEvent> {
return Observable.fromPromise(this.apiService.getInstance().nodes.createFolder(name, relativePath, parentId)) return Observable.fromPromise(this.apiService.getInstance().nodes.createFolder(name, relativePath, parentId))
@ -193,8 +184,8 @@ export class ContentService {
/** /**
* Gets a Node via its node ID. * Gets a Node via its node ID.
* @param nodeId * @param nodeId ID of the target node
* @param opts * @param opts Options supported by JSAPI
* @returns Details of the folder * @returns Details of the folder
*/ */
getNode(nodeId: string, opts?: any): Observable<NodeEntry> { getNode(nodeId: string, opts?: any): Observable<NodeEntry> {
@ -202,10 +193,10 @@ export class ContentService {
} }
/** /**
* Check if the user has permissions on that node * Checks if the user has permissions on that node
* @param node Node to check allowableOperations * @param node Node to check allowableOperations
* @param permission Create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions * @param permission Create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions
* * @returns True if the user has the required permissions, false otherwise
*/ */
hasPermission(node: Node, permission: PermissionsEnum | string): boolean { hasPermission(node: Node, permission: PermissionsEnum | string): boolean {
let hasPermission = false; let hasPermission = false;
@ -239,9 +230,9 @@ export class ContentService {
} }
/** /**
* Check if the node has the properties allowableOperations * Checks if the node has the properties allowableOperations
* @param node Node to check allowableOperations * @param node Node to check allowableOperations
* * @returns True if the node has the property, false otherwise
*/ */
hasAllowableOperations(node: any): boolean { hasAllowableOperations(node: any): boolean {
return node && node.allowableOperations ? true : false; return node && node.allowableOperations ? true : false;

View File

@ -35,6 +35,7 @@ export abstract class DynamicComponentMapper {
* Gets the currently active ComponentTypeResolver function for a field type. * Gets the currently active ComponentTypeResolver function for a field type.
* @param type The type whose resolver you want * @param type The type whose resolver you want
* @param defaultValue Default type returned for types that are not yet mapped * @param defaultValue Default type returned for types that are not yet mapped
* @returns Resolver function
*/ */
getComponentTypeResolver(type: string, defaultValue: Type<{}> = this.defaultValue): DynamicComponentResolveFunction { getComponentTypeResolver(type: string, defaultValue: Type<{}> = this.defaultValue): DynamicComponentResolveFunction {
if (type) { if (type) {
@ -70,6 +71,7 @@ export abstract class DynamicComponentMapper {
* Finds the component type that is needed to render a form field. * Finds the component type that is needed to render a form field.
* @param model [Form field model](form-field.model.md) for the field to render * @param model [Form field model](form-field.model.md) for the field to render
* @param defaultValue Default type returned for field types that are not yet mapped. * @param defaultValue Default type returned for field types that are not yet mapped.
* @returns Component type
*/ */
resolveComponentType(model: DynamicComponentModel, defaultValue: Type<{}> = this.defaultValue): Type<{}> { resolveComponentType(model: DynamicComponentModel, defaultValue: Type<{}> = this.defaultValue): Type<{}> {
if (model) { if (model) {

View File

@ -62,6 +62,12 @@ export class FavoritesApiService {
return this.apiService.getInstance().core.favoritesApi; return this.apiService.getInstance().core.favoritesApi;
} }
/**
* Gets the favorites for a user.
* @param personId ID of the user
* @param options Options supported by JSAPI
* @returns List of favorites
*/
getFavorites(personId: string, options?: any): Observable<NodePaging> { getFavorites(personId: string, options?: any): Observable<NodePaging> {
const { favoritesApi, handleError } = this; const { favoritesApi, handleError } = this;
const defaultOptions = { const defaultOptions = {

View File

@ -36,8 +36,8 @@ export class BpmUserService {
} }
/** /**
* get Current User information for BPM * Gets information about the current user.
* @param userName - the user name * @returns User information object
*/ */
getCurrentUserInfo(): Observable<BpmUserModel> { getCurrentUserInfo(): Observable<BpmUserModel> {
return Observable.fromPromise(this.apiService.getInstance().activiti.profileApi.getProfile()) return Observable.fromPromise(this.apiService.getInstance().activiti.profileApi.getProfile())
@ -45,6 +45,10 @@ export class BpmUserService {
.catch(err => this.handleError(err)); .catch(err => this.handleError(err));
} }
/**
* Gets the current user's profile image as a URL.
* @returns URL string
*/
getCurrentUserProfileImage(): string { getCurrentUserProfileImage(): string {
return this.apiService.getInstance().activiti.profileApi.getProfilePictureUrl(); return this.apiService.getInstance().activiti.profileApi.getProfilePictureUrl();
} }