mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
fix error handling and "this" context (#1445)
* fix error handling and "this" context * fix typo
This commit is contained in:
parent
dd6baed74b
commit
0ee5c9846a
@ -42,14 +42,14 @@ export class AnalyticsService {
|
|||||||
reports.push(reportModel);
|
reports.push(reportModel);
|
||||||
});
|
});
|
||||||
return reports;
|
return reports;
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
getReportParams(reportId: string): Observable<any> {
|
getReportParams(reportId: string): Observable<any> {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.reportApi.getReportParams(reportId))
|
return Observable.fromPromise(this.apiService.getInstance().activiti.reportApi.getReportParams(reportId))
|
||||||
.map((res: any) => {
|
.map((res: any) => {
|
||||||
return new ReportParametersModel(res);
|
return new ReportParametersModel(res);
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
getParamValuesByType(type: string, appId: string, reportId?: string, processDefinitionId?: string) {
|
getParamValuesByType(type: string, appId: string, reportId?: string, processDefinitionId?: string) {
|
||||||
@ -122,7 +122,7 @@ export class AnalyticsService {
|
|||||||
paramOptions.push(new ParameterValueModel(opt));
|
paramOptions.push(new ParameterValueModel(opt));
|
||||||
});
|
});
|
||||||
return paramOptions;
|
return paramOptions;
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
getProcessDefinitionsValues(appId: string): Observable<any> {
|
getProcessDefinitionsValues(appId: string): Observable<any> {
|
||||||
@ -133,7 +133,7 @@ export class AnalyticsService {
|
|||||||
paramOptions.push(new ParameterValueModel(opt));
|
paramOptions.push(new ParameterValueModel(opt));
|
||||||
});
|
});
|
||||||
return paramOptions;
|
return paramOptions;
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
getTasksByProcessDefinitionId(reportId: string, processDefinitionId: string): Observable<any> {
|
getTasksByProcessDefinitionId(reportId: string, processDefinitionId: string): Observable<any> {
|
||||||
@ -144,7 +144,7 @@ export class AnalyticsService {
|
|||||||
paramOptions.push(new ParameterValueModel({ id: opt, name: opt }));
|
paramOptions.push(new ParameterValueModel({ id: opt, name: opt }));
|
||||||
});
|
});
|
||||||
return paramOptions;
|
return paramOptions;
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
getReportsByParams(reportId: number, paramsQuery: any): Observable<any> {
|
getReportsByParams(reportId: number, paramsQuery: any): Observable<any> {
|
||||||
@ -168,20 +168,20 @@ export class AnalyticsService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return elements;
|
return elements;
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
createDefaultReports(): Observable<any> {
|
createDefaultReports(): Observable<any> {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.reportApi.createDefaultReports())
|
return Observable.fromPromise(this.apiService.getInstance().activiti.reportApi.createDefaultReports())
|
||||||
.map(this.toJson)
|
.map(this.toJson)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
updateReport(reportId: number, name: string): Observable<any> {
|
updateReport(reportId: number, name: string): Observable<any> {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.reportApi.updateReport(reportId, name))
|
return Observable.fromPromise(this.apiService.getInstance().activiti.reportApi.updateReport(reportId, name))
|
||||||
.map((res: any) => {
|
.map((res: any) => {
|
||||||
this.logService.info('upload');
|
this.logService.info('upload');
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleError(error: Response) {
|
private handleError(error: Response) {
|
||||||
|
@ -37,7 +37,7 @@ export class DiagramsService {
|
|||||||
.map((res: any) => {
|
.map((res: any) => {
|
||||||
let body = res.json();
|
let body = res.json();
|
||||||
return body;
|
return body;
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
public getHeaders(): Headers {
|
public getHeaders(): Headers {
|
||||||
|
@ -105,9 +105,7 @@ export class ActivitiStartForm extends ActivitiForm implements AfterViewChecked,
|
|||||||
// this.form.processDefinitionId = this.processDefinitionId;
|
// this.form.processDefinitionId = this.processDefinitionId;
|
||||||
this.formLoaded.emit(this.form);
|
this.formLoaded.emit(this.form);
|
||||||
},
|
},
|
||||||
(error) => {
|
error => this.handleError(error)
|
||||||
this.handleError(error);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,9 +118,7 @@ export class ActivitiStartForm extends ActivitiForm implements AfterViewChecked,
|
|||||||
this.form = this.parseForm(form);
|
this.form = this.parseForm(form);
|
||||||
this.formLoaded.emit(this.form);
|
this.formLoaded.emit(this.form);
|
||||||
},
|
},
|
||||||
(error) => {
|
error => this.handleError(error)
|
||||||
this.handleError(error);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ export class DropdownWidget extends WidgetComponent implements OnInit {
|
|||||||
this.field.options = options.concat((result || []));
|
this.field.options = options.concat((result || []));
|
||||||
this.field.updateForm();
|
this.field.updateForm();
|
||||||
},
|
},
|
||||||
this.handleError
|
err => this.handleError(err)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ export class DropdownWidget extends WidgetComponent implements OnInit {
|
|||||||
this.field.options = options.concat((result || []));
|
this.field.options = options.concat((result || []));
|
||||||
this.field.updateForm();
|
this.field.updateForm();
|
||||||
},
|
},
|
||||||
this.handleError
|
err => this.handleError(err)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ export class RadioButtonsWidget extends WidgetComponent implements OnInit {
|
|||||||
this.field.options = result || [];
|
this.field.options = result || [];
|
||||||
this.field.updateForm();
|
this.field.updateForm();
|
||||||
},
|
},
|
||||||
this.handleError
|
err => this.handleError(err)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ export class RadioButtonsWidget extends WidgetComponent implements OnInit {
|
|||||||
this.field.options = result || [];
|
this.field.options = result || [];
|
||||||
this.field.updateForm();
|
this.field.updateForm();
|
||||||
},
|
},
|
||||||
this.handleError
|
err => this.handleError(err)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ export class TypeaheadWidget extends WidgetComponent implements OnInit {
|
|||||||
this.field.updateForm();
|
this.field.updateForm();
|
||||||
this.visibilityService.refreshEntityVisibility(this.field);
|
this.visibilityService.refreshEntityVisibility(this.field);
|
||||||
},
|
},
|
||||||
this.handleError
|
err => this.handleError(err)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ export class TypeaheadWidget extends WidgetComponent implements OnInit {
|
|||||||
this.field.updateForm();
|
this.field.updateForm();
|
||||||
this.visibilityService.refreshEntityVisibility(this.field);
|
this.visibilityService.refreshEntityVisibility(this.field);
|
||||||
},
|
},
|
||||||
this.handleError
|
err => this.handleError(err)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ export class ActivitiAlfrescoContentService {
|
|||||||
let accountShortId = accountId.replace('alfresco-', '');
|
let accountShortId = accountId.replace('alfresco-', '');
|
||||||
return Observable.fromPromise(apiService.activiti.alfrescoApi.getContentInFolder(accountShortId, folderId))
|
return Observable.fromPromise(apiService.activiti.alfrescoApi.getContentInFolder(accountShortId, folderId))
|
||||||
.map(this.toJsonArray)
|
.map(this.toJsonArray)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,7 +63,7 @@ export class ActivitiAlfrescoContentService {
|
|||||||
simpleType: node.simpleType,
|
simpleType: node.simpleType,
|
||||||
source: accountId,
|
source: accountId,
|
||||||
sourceId: node.id + '@' + siteId
|
sourceId: node.id + '@' + siteId
|
||||||
})).map(this.toJson).catch(this.handleError);
|
})).map(this.toJson).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
toJson(res: any) {
|
toJson(res: any) {
|
||||||
|
@ -49,10 +49,11 @@ export class FormService {
|
|||||||
this.addFieldsToAForm(form.id, formDefinitionModel).subscribe(formData => {
|
this.addFieldsToAForm(form.id, formDefinitionModel).subscribe(formData => {
|
||||||
observer.next(formData);
|
observer.next(formData);
|
||||||
observer.complete();
|
observer.complete();
|
||||||
}, this.handleError);
|
}, err => this.handleError(err));
|
||||||
},
|
},
|
||||||
this.handleError);
|
err => this.handleError(err));
|
||||||
}, this.handleError);
|
},
|
||||||
|
err => this.handleError(err));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,9 +89,13 @@ export class FormService {
|
|||||||
'modelType': 2
|
'modelType': 2
|
||||||
};
|
};
|
||||||
|
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.modelsApi.getModels(opts)).map(function (forms: any) {
|
return Observable.fromPromise(
|
||||||
return forms.data.find(formdata => formdata.name === name);
|
this.apiService.getInstance().activiti.modelsApi.getModels(opts))
|
||||||
}).catch(this.handleError);
|
.map(function (forms: any) {
|
||||||
|
return forms.data.find(formdata => formdata.name === name);
|
||||||
|
})
|
||||||
|
.catch(err => this.handleError(err)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,7 +117,7 @@ export class FormService {
|
|||||||
getProcessDefinitions(): Observable<any> {
|
getProcessDefinitions(): Observable<any> {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.processApi.getProcessDefinitions({}))
|
return Observable.fromPromise(this.apiService.getInstance().activiti.processApi.getProcessDefinitions({}))
|
||||||
.map(this.toJsonArray)
|
.map(this.toJsonArray)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,7 +128,7 @@ export class FormService {
|
|||||||
getTasks(): Observable<any> {
|
getTasks(): Observable<any> {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.listTasks({}))
|
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.listTasks({}))
|
||||||
.map(this.toJsonArray)
|
.map(this.toJsonArray)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,7 +139,7 @@ export class FormService {
|
|||||||
getTask(taskId: string): Observable<any> {
|
getTask(taskId: string): Observable<any> {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.getTask(taskId))
|
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.getTask(taskId))
|
||||||
.map(this.toJson)
|
.map(this.toJson)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,7 +152,7 @@ export class FormService {
|
|||||||
let body = JSON.stringify({values: formValues});
|
let body = JSON.stringify({values: formValues});
|
||||||
|
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.saveTaskForm(taskId, body))
|
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.saveTaskForm(taskId, body))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,7 +170,7 @@ export class FormService {
|
|||||||
let body = JSON.stringify(data);
|
let body = JSON.stringify(data);
|
||||||
|
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.completeTaskForm(taskId, body))
|
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.completeTaskForm(taskId, body))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,7 +181,7 @@ export class FormService {
|
|||||||
getTaskForm(taskId: string): Observable<any> {
|
getTaskForm(taskId: string): Observable<any> {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.getTaskForm(taskId))
|
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.getTaskForm(taskId))
|
||||||
.map(this.toJson)
|
.map(this.toJson)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -187,7 +192,7 @@ export class FormService {
|
|||||||
getFormDefinitionById(formId: string): Observable<any> {
|
getFormDefinitionById(formId: string): Observable<any> {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.editorApi.getForm(formId))
|
return Observable.fromPromise(this.apiService.getInstance().activiti.editorApi.getForm(formId))
|
||||||
.map(this.toJson)
|
.map(this.toJson)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -204,7 +209,7 @@ export class FormService {
|
|||||||
|
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.modelsApi.getModels(opts))
|
return Observable.fromPromise(this.apiService.getInstance().activiti.modelsApi.getModels(opts))
|
||||||
.map(this.getFormId)
|
.map(this.getFormId)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -216,7 +221,7 @@ export class FormService {
|
|||||||
return Observable.fromPromise(
|
return Observable.fromPromise(
|
||||||
this.apiService.getInstance().activiti.processApi.getProcessInstanceStartForm(processId))
|
this.apiService.getInstance().activiti.processApi.getProcessInstanceStartForm(processId))
|
||||||
.map(this.toJson)
|
.map(this.toJson)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -228,7 +233,7 @@ export class FormService {
|
|||||||
return Observable.fromPromise(
|
return Observable.fromPromise(
|
||||||
this.apiService.getInstance().activiti.processApi.getProcessDefinitionStartForm(processId))
|
this.apiService.getInstance().activiti.processApi.getProcessDefinitionStartForm(processId))
|
||||||
.map(this.toJson)
|
.map(this.toJson)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -237,14 +237,14 @@ export class WidgetVisibilityService {
|
|||||||
this.processVarList = <TaskProcessVariableModel[]>jsonRes;
|
this.processVarList = <TaskProcessVariableModel[]>jsonRes;
|
||||||
return jsonRes;
|
return jsonRes;
|
||||||
})
|
})
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
toJson(res: any) {
|
toJson(res: any) {
|
||||||
return res || {};
|
return res || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleError() {
|
private handleError(err) {
|
||||||
this.logService.error('Error while performing a call');
|
this.logService.error('Error while performing a call');
|
||||||
return Observable.throw('Error while performing a call - Server error');
|
return Observable.throw('Error while performing a call - Server error');
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ export class ActivitiProcessService {
|
|||||||
getDeployedApplications(name: string): Observable<AppDefinitionRepresentationModel> {
|
getDeployedApplications(name: string): Observable<AppDefinitionRepresentationModel> {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.appsApi.getAppDefinitions())
|
return Observable.fromPromise(this.apiService.getInstance().activiti.appsApi.getAppDefinitions())
|
||||||
.map((response: any) => response.data.find((p: AppDefinitionRepresentationModel) => p.name === name))
|
.map((response: any) => response.data.find((p: AppDefinitionRepresentationModel) => p.name === name))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
getProcessInstances(requestNode: ProcessFilterRequestRepresentation): Observable<ProcessInstance[]> {
|
getProcessInstances(requestNode: ProcessFilterRequestRepresentation): Observable<ProcessInstance[]> {
|
||||||
@ -50,7 +50,7 @@ export class ActivitiProcessService {
|
|||||||
} else {
|
} else {
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
getProcessFilters(appId: number): Observable<FilterProcessRepresentationModel[]> {
|
getProcessFilters(appId: number): Observable<FilterProcessRepresentationModel[]> {
|
||||||
@ -69,7 +69,7 @@ export class ActivitiProcessService {
|
|||||||
}
|
}
|
||||||
return filters;
|
return filters;
|
||||||
})
|
})
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,12 +148,12 @@ export class ActivitiProcessService {
|
|||||||
addFilter(filter: FilterProcessRepresentationModel): Observable<FilterProcessRepresentationModel> {
|
addFilter(filter: FilterProcessRepresentationModel): Observable<FilterProcessRepresentationModel> {
|
||||||
delete filter.filter.assignment;
|
delete filter.filter.assignment;
|
||||||
return Observable.fromPromise(this.callApiAddFilter(filter))
|
return Observable.fromPromise(this.callApiAddFilter(filter))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
getProcess(id: string): Observable<ProcessInstance> {
|
getProcess(id: string): Observable<ProcessInstance> {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.processApi.getProcessInstance(id))
|
return Observable.fromPromise(this.apiService.getInstance().activiti.processApi.getProcessInstance(id))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
getProcessTasks(id: string, state?: string): Observable<TaskDetailsModel[]> {
|
getProcessTasks(id: string, state?: string): Observable<TaskDetailsModel[]> {
|
||||||
@ -169,7 +169,7 @@ export class ActivitiProcessService {
|
|||||||
task.created = moment(task.created, 'YYYY-MM-DD').format();
|
task.created = moment(task.created, 'YYYY-MM-DD').format();
|
||||||
return task;
|
return task;
|
||||||
}))
|
}))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -192,7 +192,7 @@ export class ActivitiProcessService {
|
|||||||
comments.push(new Comment(comment.id, comment.message, comment.created, user));
|
comments.push(new Comment(comment.id, comment.message, comment.created, user));
|
||||||
});
|
});
|
||||||
return comments;
|
return comments;
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -207,7 +207,7 @@ export class ActivitiProcessService {
|
|||||||
)
|
)
|
||||||
.map((response: Comment) => {
|
.map((response: Comment) => {
|
||||||
return new Comment(response.id, response.message, response.created, response.createdBy);
|
return new Comment(response.id, response.message, response.created, response.createdBy);
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ export class ActivitiProcessService {
|
|||||||
)
|
)
|
||||||
.map(this.extractData)
|
.map(this.extractData)
|
||||||
.map(processDefs => processDefs.map((pd) => new ProcessDefinitionRepresentation(pd)))
|
.map(processDefs => processDefs.map((pd) => new ProcessDefinitionRepresentation(pd)))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
startProcess(processDefinitionId: string, name: string, outcome?: string, startFormValues?: any): Observable<ProcessInstance> {
|
startProcess(processDefinitionId: string, name: string, outcome?: string, startFormValues?: any): Observable<ProcessInstance> {
|
||||||
@ -241,14 +241,14 @@ export class ActivitiProcessService {
|
|||||||
this.apiService.getInstance().activiti.processApi.startNewProcessInstance(startRequest)
|
this.apiService.getInstance().activiti.processApi.startNewProcessInstance(startRequest)
|
||||||
)
|
)
|
||||||
.map((pd) => new ProcessInstance(pd))
|
.map((pd) => new ProcessInstance(pd))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelProcess(processInstanceId: string): Observable<void> {
|
cancelProcess(processInstanceId: string): Observable<void> {
|
||||||
return Observable.fromPromise(
|
return Observable.fromPromise(
|
||||||
this.apiService.getInstance().activiti.processApi.deleteProcessInstance(processInstanceId)
|
this.apiService.getInstance().activiti.processApi.deleteProcessInstance(processInstanceId)
|
||||||
)
|
)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
getProcessInstanceVariables(processDefinitionId: string): Observable<ProcessInstanceVariable[]> {
|
getProcessInstanceVariables(processDefinitionId: string): Observable<ProcessInstanceVariable[]> {
|
||||||
@ -256,21 +256,21 @@ export class ActivitiProcessService {
|
|||||||
this.apiService.getInstance().activiti.processInstanceVariablesApi.getProcessInstanceVariables(processDefinitionId)
|
this.apiService.getInstance().activiti.processInstanceVariablesApi.getProcessInstanceVariables(processDefinitionId)
|
||||||
)
|
)
|
||||||
.map((processVars: any[]) => processVars.map((pd) => new ProcessInstanceVariable(pd)))
|
.map((processVars: any[]) => processVars.map((pd) => new ProcessInstanceVariable(pd)))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
createOrUpdateProcessInstanceVariables(processDefinitionId: string, variables: ProcessInstanceVariable[]): Observable<ProcessInstanceVariable[]> {
|
createOrUpdateProcessInstanceVariables(processDefinitionId: string, variables: ProcessInstanceVariable[]): Observable<ProcessInstanceVariable[]> {
|
||||||
return Observable.fromPromise(
|
return Observable.fromPromise(
|
||||||
this.apiService.getInstance().activiti.processInstanceVariablesApi.createOrUpdateProcessInstanceVariables(processDefinitionId, variables)
|
this.apiService.getInstance().activiti.processInstanceVariablesApi.createOrUpdateProcessInstanceVariables(processDefinitionId, variables)
|
||||||
)
|
)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteProcessInstanceVariable(processDefinitionId: string, variableName: string): Observable<void> {
|
deleteProcessInstanceVariable(processDefinitionId: string, variableName: string): Observable<void> {
|
||||||
return Observable.fromPromise(
|
return Observable.fromPromise(
|
||||||
this.apiService.getInstance().activiti.processInstanceVariablesApi.deleteProcessInstanceVariable(processDefinitionId, variableName)
|
this.apiService.getInstance().activiti.processInstanceVariablesApi.deleteProcessInstanceVariable(processDefinitionId, variableName)
|
||||||
)
|
)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
private callApiGetUserProcessInstanceFilters(filterOpts) {
|
private callApiGetUserProcessInstanceFilters(filterOpts) {
|
||||||
|
@ -32,19 +32,19 @@ export class ActivitiPeopleService {
|
|||||||
let option = {excludeTaskId: taskId, filter: searchWord};
|
let option = {excludeTaskId: taskId, filter: searchWord};
|
||||||
return Observable.fromPromise(this.getWorkflowUserApi(option))
|
return Observable.fromPromise(this.getWorkflowUserApi(option))
|
||||||
.map((response: any) => <User[]> response.data || [])
|
.map((response: any) => <User[]> response.data || [])
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
involveUserWithTask(taskId: string, idToInvolve: string): Observable<User[]> {
|
involveUserWithTask(taskId: string, idToInvolve: string): Observable<User[]> {
|
||||||
let node = {userId: idToInvolve};
|
let node = {userId: idToInvolve};
|
||||||
return Observable.fromPromise(this.involveUserToTaskApi(taskId, node))
|
return Observable.fromPromise(this.involveUserToTaskApi(taskId, node))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
removeInvolvedUser(taskId: string, idToRemove: string): Observable<User[]> {
|
removeInvolvedUser(taskId: string, idToRemove: string): Observable<User[]> {
|
||||||
let node = {userId: idToRemove};
|
let node = {userId: idToRemove};
|
||||||
return Observable.fromPromise(this.removeInvolvedUserFromTaskApi(taskId, node))
|
return Observable.fromPromise(this.removeInvolvedUserFromTaskApi(taskId, node))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
private getWorkflowUserApi(options: any) {
|
private getWorkflowUserApi(options: any) {
|
||||||
|
@ -43,7 +43,7 @@ export class ActivitiTaskListService {
|
|||||||
}
|
}
|
||||||
return response.data;
|
return response.data;
|
||||||
})
|
})
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,7 +62,7 @@ export class ActivitiTaskListService {
|
|||||||
return this.createDefaultFilter(appId);
|
return this.createDefaultFilter(appId);
|
||||||
}
|
}
|
||||||
return filters;
|
return filters;
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,7 +78,7 @@ export class ActivitiTaskListService {
|
|||||||
} else {
|
} else {
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,7 +91,7 @@ export class ActivitiTaskListService {
|
|||||||
.map(res => res)
|
.map(res => res)
|
||||||
.map((details: any) => {
|
.map((details: any) => {
|
||||||
return new TaskDetailsModel(details);
|
return new TaskDetailsModel(details);
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,7 +109,7 @@ export class ActivitiTaskListService {
|
|||||||
comments.push(new Comment(comment.id, comment.message, comment.created, user));
|
comments.push(new Comment(comment.id, comment.message, comment.created, user));
|
||||||
});
|
});
|
||||||
return comments;
|
return comments;
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,7 +126,7 @@ export class ActivitiTaskListService {
|
|||||||
checklists.push(new TaskDetailsModel(checklist));
|
checklists.push(new TaskDetailsModel(checklist));
|
||||||
});
|
});
|
||||||
return checklists;
|
return checklists;
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,7 +147,7 @@ export class ActivitiTaskListService {
|
|||||||
forms.push(new Form(form.id, form.name));
|
forms.push(new Form(form.id, form.name));
|
||||||
});
|
});
|
||||||
return forms;
|
return forms;
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
attachFormToATask(taskId: string, formId: number): Observable<any> {
|
attachFormToATask(taskId: string, formId: number): Observable<any> {
|
||||||
@ -191,7 +191,7 @@ export class ActivitiTaskListService {
|
|||||||
.map(res => res)
|
.map(res => res)
|
||||||
.map((response: TaskDetailsModel) => {
|
.map((response: TaskDetailsModel) => {
|
||||||
return new TaskDetailsModel(response);
|
return new TaskDetailsModel(response);
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -204,7 +204,7 @@ export class ActivitiTaskListService {
|
|||||||
.map(res => res)
|
.map(res => res)
|
||||||
.map((response: FilterRepresentationModel) => {
|
.map((response: FilterRepresentationModel) => {
|
||||||
return response;
|
return response;
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -218,7 +218,7 @@ export class ActivitiTaskListService {
|
|||||||
.map(res => res)
|
.map(res => res)
|
||||||
.map((response: Comment) => {
|
.map((response: Comment) => {
|
||||||
return new Comment(response.id, response.message, response.created, response.createdBy);
|
return new Comment(response.id, response.message, response.created, response.createdBy);
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ export class ActivitiTaskListService {
|
|||||||
return Observable.fromPromise(this.callApiTasksFiltered(requestNode))
|
return Observable.fromPromise(this.callApiTasksFiltered(requestNode))
|
||||||
.map((res: any) => {
|
.map((res: any) => {
|
||||||
return res;
|
return res;
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -255,7 +255,7 @@ export class ActivitiTaskListService {
|
|||||||
.map(res => res)
|
.map(res => res)
|
||||||
.map((response: TaskDetailsModel) => {
|
.map((response: TaskDetailsModel) => {
|
||||||
return new TaskDetailsModel(response);
|
return new TaskDetailsModel(response);
|
||||||
}).catch(this.handleError);
|
}).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -264,7 +264,7 @@ export class ActivitiTaskListService {
|
|||||||
*/
|
*/
|
||||||
claimTask(taskId: string): Observable<TaskDetailsModel> {
|
claimTask(taskId: string): Observable<TaskDetailsModel> {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.claimTask(taskId))
|
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.claimTask(taskId))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
private callApiTasksFiltered(requestNode: TaskQueryRequestRepresentationModel) {
|
private callApiTasksFiltered(requestNode: TaskQueryRequestRepresentationModel) {
|
||||||
|
@ -63,17 +63,17 @@ export class RenditionsService {
|
|||||||
|
|
||||||
getRendition(nodeId: string, encoding: string) {
|
getRendition(nodeId: string, encoding: string) {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().core.renditionsApi.getRendition(nodeId, encoding))
|
return Observable.fromPromise(this.apiService.getInstance().core.renditionsApi.getRendition(nodeId, encoding))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
getRenditionsListByNodeId(nodeId: string) {
|
getRenditionsListByNodeId(nodeId: string) {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().core.renditionsApi.getRenditions(nodeId))
|
return Observable.fromPromise(this.apiService.getInstance().core.renditionsApi.getRenditions(nodeId))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
createRendition(nodeId: string, encoding: string) {
|
createRendition(nodeId: string, encoding: string) {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().core.renditionsApi.createRendition(nodeId, {id: encoding}))
|
return Observable.fromPromise(this.apiService.getInstance().core.renditionsApi.createRendition(nodeId, {id: encoding}))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleError(error: any): Observable<any> {
|
private handleError(error: any): Observable<any> {
|
||||||
|
@ -103,7 +103,7 @@ export class DocumentListService {
|
|||||||
*/
|
*/
|
||||||
createFolder(name: string, parentId: string): Observable<MinimalNodeEntity> {
|
createFolder(name: string, parentId: string): Observable<MinimalNodeEntity> {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().nodes.createFolder(name, '/', parentId))
|
return Observable.fromPromise(this.apiService.getInstance().nodes.createFolder(name, '/', parentId))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -115,7 +115,7 @@ export class DocumentListService {
|
|||||||
getFolder(folder: string, opts?: any) {
|
getFolder(folder: string, opts?: any) {
|
||||||
return Observable.fromPromise(this.getNodesPromise(folder, opts))
|
return Observable.fromPromise(this.getNodesPromise(folder, opts))
|
||||||
.map(res => <NodePaging> res)
|
.map(res => <NodePaging> res)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
getFolderNode(nodeId: string): Promise<MinimalNodeEntryEntity> {
|
getFolderNode(nodeId: string): Promise<MinimalNodeEntryEntity> {
|
||||||
|
@ -39,7 +39,7 @@ export class AlfrescoSearchService {
|
|||||||
public getNodeQueryResults(term: string, options?: SearchOptions): Observable<any> {
|
public getNodeQueryResults(term: string, options?: SearchOptions): Observable<any> {
|
||||||
return Observable.fromPromise(this.getQueryNodesPromise(term, options))
|
return Observable.fromPromise(this.getQueryNodesPromise(term, options))
|
||||||
.map(res => <any> res)
|
.map(res => <any> res)
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
private getQueryNodesPromise(term: string, opts: SearchOptions) {
|
private getQueryNodesPromise(term: string, opts: SearchOptions) {
|
||||||
|
@ -37,12 +37,12 @@ export class TagService {
|
|||||||
|
|
||||||
getTagsByNodeId(nodeId: string): any {
|
getTagsByNodeId(nodeId: string): any {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().core.tagsApi.getNodeTags(nodeId))
|
return Observable.fromPromise(this.apiService.getInstance().core.tagsApi.getNodeTags(nodeId))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllTheTags() {
|
getAllTheTags() {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().core.tagsApi.getTags())
|
return Observable.fromPromise(this.apiService.getInstance().core.tagsApi.getTags())
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
addTag(nodeId: string, tagName: string): any {
|
addTag(nodeId: string, tagName: string): any {
|
||||||
@ -51,12 +51,12 @@ export class TagService {
|
|||||||
tagBody.tag = tagName;
|
tagBody.tag = tagName;
|
||||||
|
|
||||||
return Observable.fromPromise(this.apiService.getInstance().core.tagsApi.addTag(nodeId, tagBody))
|
return Observable.fromPromise(this.apiService.getInstance().core.tagsApi.addTag(nodeId, tagBody))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
removeTag(nodeId: string, tag: string): any {
|
removeTag(nodeId: string, tag: string): any {
|
||||||
return Observable.fromPromise(this.apiService.getInstance().core.tagsApi.removeTag(nodeId, tag))
|
return Observable.fromPromise(this.apiService.getInstance().core.tagsApi.removeTag(nodeId, tag))
|
||||||
.catch(this.handleError);
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleError(error: any) {
|
private handleError(error: any) {
|
||||||
|
@ -167,7 +167,7 @@ export class UploadService {
|
|||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.do(data => this.logService.info('Node data', data)) // eyeball results in the console
|
.do(data => this.logService.info('Node data', data)) // eyeball results in the console
|
||||||
.catch((err) => this.handleError(err));
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
private callApiCreateFolder(relativePath: string, name: string) {
|
private callApiCreateFolder(relativePath: string, name: string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user