[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

@@ -95,6 +95,7 @@ export class FormService {
* @param json JSON to create the form
* @param data Values for the form fields
* @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 {
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
* @returns The new form
*/
createFormFromANode(formName: string): Observable<any> {
return Observable.create(observer => {
@@ -138,6 +140,7 @@ export class FormService {
/**
* Create a Form.
* @param formName Name of the new form
* @returns The new form
*/
createForm(formName: string): Observable<any> {
let dataModel = {
@@ -156,6 +159,7 @@ export class FormService {
* Saves a form.
* @param formId ID of the form to save
* @param formModel Model data for the form
* @returns Data for the saved form
*/
saveForm(formId: string, formModel: FormDefinitionModel): Observable<any> {
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
* @returns Form model(s) matching the search name
*/
searchFrom(name: string): Observable<any> {
let opts = {
@@ -196,6 +201,7 @@ export class FormService {
/**
* Gets all the forms.
* @returns List of form models
*/
getForms(): Observable<any> {
let opts = {
@@ -208,7 +214,8 @@ export class FormService {
}
/**
* Get Process Definitions
* Gets process definitions.
* @returns List of process definitions
*/
getProcessDefinitions(): Observable<any> {
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
* @returns List of instance variable information
*/
getProcessVarablesById(processInstanceId: string): Observable<any[]> {
return Observable.fromPromise(this.processInstanceVariablesApi.getProcessInstanceVariables(processInstanceId))
@@ -228,6 +236,7 @@ export class FormService {
/**
* Gets all the tasks.
* @returns List of tasks
*/
getTasks(): Observable<any> {
return Observable.fromPromise(this.taskApi.listTasks({}))
@@ -238,6 +247,7 @@ export class FormService {
/**
* Gets a task.
* @param taskId Task Id
* @returns Task info
*/
getTask(taskId: string): Observable<any> {
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 formValues Form Values
* @returns Null response when the operation is complete
*/
saveTaskForm(taskId: string, formValues: FormValues): Observable<any> {
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 formValues Form Values
* @param outcome Form Outcome
* @returns Null response when the operation is complete
*/
completeTaskForm(taskId: string, formValues: FormValues, outcome?: string): Observable<any> {
let data: any = {values: formValues};
@@ -275,8 +287,9 @@ export class FormService {
}
/**
* Get Form related to a taskId
* @param taskId Task Id
* Gets a form related to a task.
* @param taskId ID of the target task
* @returns Form definition
*/
getTaskForm(taskId: string): Observable<any> {
return Observable.fromPromise(this.taskApi.getTaskForm(taskId))
@@ -285,8 +298,9 @@ export class FormService {
}
/**
* Get Form Definition
* @param formId Form Id
* Gets a form definition.
* @param formId ID of the target form
* @returns Form definition
*/
getFormDefinitionById(formId: string): Observable<any> {
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
* @returns Form definition
*/
getFormDefinitionByName(name: string): Observable<any> {
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
* @returns Form definition
*/
getStartFormInstance(processId: string): Observable<any> {
return Observable.fromPromise(
@@ -324,6 +340,7 @@ export class FormService {
/**
* Gets a process instance.
* @param processId ID of the process to get
* @returns Process instance
*/
getProcessIntance(processId: string): Observable<any> {
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
* @returns Form definition
*/
getStartFormDefinition(processId: string): Observable<any> {
return Observable.fromPromise(
@@ -346,6 +364,7 @@ export class FormService {
* Gets values of fields populated by a REST backend.
* @param taskId Task identifier
* @param field Field identifier
* @returns Field values
*/
getRestFieldValues(taskId: string, field: string): Observable<any> {
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.
* @param processDefinitionId Process identifier
* @param field Field identifier
* @returns Field values
*/
getRestFieldValuesByProcessId(processDefinitionId: string, field: string): Observable<any> {
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 field Field identifier
* @param column Column identifier
* @returns Field values
*/
getRestFieldValuesColumnByProcessId(processDefinitionId: string, field: string, column?: string): Observable<any> {
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 field Field identifier
* @param column Column identifier
* @returns Field values
*/
getRestFieldValuesColumn(taskId: string, field: string, column?: string): Observable<any> {
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.
* @param userId ID of the target user
* @returns URL string
*/
getUserProfileImageApi(userId: number): string {
return this.apiService.getInstance().activiti.userApi.getUserProfilePictureUrl(userId);
@@ -392,6 +415,7 @@ export class FormService {
* Gets a list of workflow users.
* @param filter Filter to select specific users
* @param groupId Group ID for the search
* @returns Array of users
*/
getWorkflowUsers(filter: string, groupId?: string): Observable<UserProcessModel[]> {
let option: any = {filter: filter};
@@ -413,6 +437,7 @@ export class FormService {
* Gets a list of groups in a workflow.
* @param filter Filter to select specific groups
* @param groupId Group ID for the search
* @returns Array of groups
*/
getWorkflowGroups(filter: string, groupId?: string): Observable<GroupModel[]> {
let option: any = {filter: filter};
@@ -427,6 +452,7 @@ export class FormService {
/**
* Gets the ID of a form.
* @param res Object representing a form
* @returns ID string
*/
getFormId(res: any): string {
let result = null;
@@ -441,6 +467,7 @@ export class FormService {
/**
* Creates a JSON representation of form data.
* @param res Object representing form data
* @returns JSON data
*/
toJson(res: any) {
if (res) {
@@ -452,6 +479,7 @@ export class FormService {
/**
* Creates a JSON array representation of form data.
* @param res Object representing form data
* @returns JSON data
*/
toJsonArray(res: any) {
if (res) {
@@ -463,6 +491,7 @@ export class FormService {
/**
* Reports an error message.
* @param error Data object with optional `message` and `status` fields for the error
* @returns Error message
*/
handleError(error: any): Observable<any> {
let errMsg = FormService.UNKNOWN_ERROR_MESSAGE;