tomasz hanaj f39f104d45
AAE-30864 Refactored services to accept injected validators (#10660)
* [AAE-30864] refactored services to accept injected validators

* [AAE-30864] updated documentation, applied pr comments
2025-02-20 09:22:17 +01:00

7.7 KiB

Title, Added, Status, Last reviewed
Title Added Status Last reviewed
Form cloud service v3.2.0 Active 2019-04-12

Form cloud service

Implements Process Services form methods

Basic Usage

import { FormCloudService } from '@alfresco/adf-process-services-cloud';

@Component(...)
class MyComponent {

    constructor(formCloudService: FormCloudService) {}

}

Class members

Methods

  • completeTaskForm(appName: string, taskId: string, processInstanceId: string, formId: string, formValues: FormValues, outcome: string, version: number): Observable<TaskDetailsCloudModel>
    Completes a task form.

    • appName: string - Name of the app
    • taskId: string - ID of the target task
    • processInstanceId: string - ID of processInstance
    • formId: string - ID of the form to complete
    • formValues: FormValues - Form values object
    • outcome: string - Form outcome
    • version: number - of the form
    • Returns Observable<TaskDetailsCloudModel> - Updated task details
  • createTemporaryRawRelatedContent(file: any, nodeId: string, contentHost: string): Observable<any>

    • file: any -
    • nodeId: string -
    • contentHost: string -
    • Returns Observable<any> -
  • getBasePath(appName: string): string

    • appName: string -
    • Returns string -
  • getForm(appName: string, formKey: string, version?: number): Observable<FormContent>
    Gets a form definition.

    • appName: string - Name of the app
    • formKey: string - key of the target task
    • version: number - (Optional) Version of the form
    • Returns Observable<FormContent> - Form definition
  • getRestWidgetData(formName: string, widgetId: string, body: any = {}): Observable<FormFieldOption[]>

  • getTask(appName: string, taskId: string): Observable<TaskDetailsCloudModel>
    Gets details of a task

  • getTaskForm(appName: string, taskId: string, version?: number): Observable<any>
    Gets the form definition of a task.

    • appName: string - Name of the app
    • taskId: string - ID of the target task
    • version: number - (Optional) Version of the form
    • Returns Observable<any> - Form definition
  • getTaskVariables(appName: string, taskId: string): Observable<TaskVariableCloud[]>
    Gets the variables of a task.

  • parseForm(json: any, data?: TaskVariableCloud[], readOnly: boolean = false): FormModel
    Parses JSON data to create a corresponding form.

    • json: any - JSON data to create the form
    • data: TaskVariableCloud[] - (Optional) Values for the form's fields
    • readOnly: boolean - Toggles whether or not the form should be read-only
    • Returns FormModel - Form created from the JSON specification
  • saveTaskForm(appName: string, taskId: string, processInstanceId: string, formId: string, values: FormValues): Observable<TaskDetailsCloudModel>
    Saves a task form.

    • appName: string - Name of the app
    • taskId: string - ID of the target task
    • processInstanceId: string - ID of processInstance
    • formId: string - ID of the form to save
    • values: FormValues - Form values object
    • Returns Observable<TaskDetailsCloudModel> - Updated task details

Properties

Name Type Description
fieldValidators FormFieldValidator[] Array of Field Validators injected with token and then passed to FormModel

Inject Preference service

Token: [FORM_CLOUD_SERVICE_FIELD_VALIDATORS_TOKEN] A DI token that allows to inject additional form field validators.

import { NgModule } from '@angular/core';
import { FORM_CLOUD_SERVICE_FIELD_VALIDATORS_TOKEN } from '@alfresco/adf-process-services-cloud';

@NgModule({
    imports: [
        ...Import Required Modules
    ],
    providers: [
        { 
            provide: FORM_CLOUD_SERVICE_FIELD_VALIDATORS_TOKEN, 
            useValue: [new AdditionalFormFieldValidator()]
        }
    ]
})
export class ExampleModule {}

See also