mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-5426] Remove compatibility layer from Lib (#7110)
* remove compatibility step 1 * remove compatibility step 2 * remove compatibility step 3 * remove compatibility step 4 * remove compatibility step 5
This commit is contained in:
@@ -92,7 +92,7 @@ describe('ProcessAttachmentListComponent', () => {
|
||||
};
|
||||
|
||||
getProcessRelatedContentSpy = spyOn(service, 'getProcessRelatedContent').and.returnValue(of(mockAttachment));
|
||||
spyOn(service, 'deleteRelatedContent').and.returnValue(of({successCode: true}));
|
||||
spyOn(service, 'deleteRelatedContent').and.returnValue(of({ successCode: true }));
|
||||
|
||||
const blobObj = new Blob();
|
||||
spyOn(service, 'getFileRawContent').and.returnValue(of(blobObj));
|
||||
@@ -128,7 +128,7 @@ describe('ProcessAttachmentListComponent', () => {
|
||||
expect(attachments[0].id).toEqual(mockAttachment.data[0].id);
|
||||
});
|
||||
|
||||
component.ngOnChanges({'taskId': change});
|
||||
component.ngOnChanges({ 'taskId': change });
|
||||
});
|
||||
|
||||
it('should not attach when no processInstanceId is specified', () => {
|
||||
@@ -192,7 +192,7 @@ describe('ProcessAttachmentListComponent', () => {
|
||||
'data': []
|
||||
}));
|
||||
const change = new SimpleChange(null, '123', true);
|
||||
component.ngOnChanges({'processInstanceId': change});
|
||||
component.ngOnChanges({ 'processInstanceId': change });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
expect(fixture.nativeElement.querySelector('div[adf-empty-list-header]').innerText.trim()).toEqual('ADF_PROCESS_LIST.PROCESS-ATTACHMENT.EMPTY.HEADER');
|
||||
@@ -206,7 +206,7 @@ describe('ProcessAttachmentListComponent', () => {
|
||||
'data': []
|
||||
}));
|
||||
const change = new SimpleChange(null, '123', true);
|
||||
component.ngOnChanges({'processInstanceId': change});
|
||||
component.ngOnChanges({ 'processInstanceId': change });
|
||||
component.disabled = true;
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -223,20 +223,20 @@ describe('ProcessAttachmentListComponent', () => {
|
||||
'data': []
|
||||
}));
|
||||
const change = new SimpleChange(null, '123', true);
|
||||
component.ngOnChanges({'processInstanceId': change});
|
||||
component.ngOnChanges({ 'processInstanceId': change });
|
||||
component.disabled = true;
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(fixture.nativeElement.querySelector('div[adf-empty-list-header]').innerText.trim())
|
||||
.toEqual('ADF_PROCESS_LIST.PROCESS-ATTACHMENT.EMPTY.HEADER');
|
||||
.toEqual('ADF_PROCESS_LIST.PROCESS-ATTACHMENT.EMPTY.HEADER');
|
||||
});
|
||||
|
||||
it('should not show the empty list component when the attachments list is not empty for completed process', async () => {
|
||||
getProcessRelatedContentSpy.and.returnValue(of(mockAttachment));
|
||||
const change = new SimpleChange(null, '123', true);
|
||||
component.ngOnChanges({'processInstanceId': change});
|
||||
component.ngOnChanges({ 'processInstanceId': change });
|
||||
component.disabled = true;
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -248,9 +248,9 @@ describe('ProcessAttachmentListComponent', () => {
|
||||
getProcessRelatedContentSpy.and.returnValue(of(mockAttachment));
|
||||
const change = new SimpleChange(null, '123', true);
|
||||
const isRelatedContent = 'true';
|
||||
component.ngOnChanges({'processInstanceId': change});
|
||||
component.ngOnChanges({ 'processInstanceId': change });
|
||||
expect(getProcessRelatedContentSpy).toHaveBeenCalled();
|
||||
expect(getProcessRelatedContentSpy).toHaveBeenCalledWith('123', isRelatedContent);
|
||||
expect(getProcessRelatedContentSpy).toHaveBeenCalledWith('123', { isRelatedContent });
|
||||
});
|
||||
|
||||
describe('change detection', () => {
|
||||
@@ -266,7 +266,8 @@ describe('ProcessAttachmentListComponent', () => {
|
||||
|
||||
it('should fetch new attachments when processInstanceId changed', () => {
|
||||
component.ngOnChanges({ 'processInstanceId': change });
|
||||
expect(getProcessRelatedContentSpy).toHaveBeenCalledWith('456', 'true');
|
||||
const isRelatedContent = 'true';
|
||||
expect(getProcessRelatedContentSpy).toHaveBeenCalledWith('456', { isRelatedContent });
|
||||
});
|
||||
|
||||
it('should NOT fetch new attachments when empty changeset made', () => {
|
||||
@@ -283,12 +284,12 @@ describe('ProcessAttachmentListComponent', () => {
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<adf-process-attachment-list>
|
||||
<adf-empty-list>
|
||||
<div adf-empty-list-header class="adf-empty-list-header">Custom header</div>
|
||||
</adf-empty-list>
|
||||
</adf-process-attachment-list>
|
||||
`
|
||||
<adf-process-attachment-list>
|
||||
<adf-empty-list>
|
||||
<div adf-empty-list-header class="adf-empty-list-header">Custom header</div>
|
||||
</adf-empty-list>
|
||||
</adf-process-attachment-list>
|
||||
`
|
||||
})
|
||||
class CustomEmptyTemplateComponent {
|
||||
}
|
||||
@@ -302,7 +303,7 @@ describe('Custom CustomEmptyTemplateComponent', () => {
|
||||
ProcessTestingModule
|
||||
],
|
||||
declarations: [CustomEmptyTemplateComponent],
|
||||
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -15,8 +15,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ContentService, EmptyListComponent , ThumbnailService, ProcessContentService } from '@alfresco/adf-core';
|
||||
import { AfterContentInit, ContentChild, Component, EventEmitter, Input, NgZone, OnChanges, Output, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
||||
import { ContentService, EmptyListComponent, ThumbnailService, ProcessContentService } from '@alfresco/adf-core';
|
||||
import {
|
||||
AfterContentInit,
|
||||
ContentChild,
|
||||
Component,
|
||||
EventEmitter,
|
||||
Input,
|
||||
NgZone,
|
||||
OnChanges,
|
||||
Output,
|
||||
SimpleChanges,
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-process-attachment-list',
|
||||
@@ -110,8 +121,8 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn
|
||||
if (processInstanceId) {
|
||||
this.reset();
|
||||
this.isLoading = true;
|
||||
const opts: string = 'true';
|
||||
this.activitiContentService.getProcessRelatedContent(processInstanceId, opts).subscribe(
|
||||
const isRelatedContent = 'true';
|
||||
this.activitiContentService.getProcessRelatedContent(processInstanceId, { isRelatedContent }).subscribe(
|
||||
(res: any) => {
|
||||
res.data.forEach((content) => {
|
||||
this.attachments.push({
|
||||
|
@@ -280,9 +280,9 @@ describe('TaskAttachmentList', () => {
|
||||
it('should fetch new attachments when taskId changed', async () => {
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
const isRelatedContent = 'true';
|
||||
component.ngOnChanges({ 'taskId': change });
|
||||
expect(getTaskRelatedContentSpy).toHaveBeenCalledWith('456', 'true');
|
||||
expect(getTaskRelatedContentSpy).toHaveBeenCalledWith('456', { isRelatedContent });
|
||||
});
|
||||
|
||||
it('should NOT fetch new attachments when empty change set made', () => {
|
||||
@@ -311,7 +311,7 @@ describe('TaskAttachmentList', () => {
|
||||
|
||||
expect(deleteContentSpy).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@Component({
|
||||
|
@@ -118,8 +118,8 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit
|
||||
if (taskId) {
|
||||
this.isLoading = true;
|
||||
this.reset();
|
||||
const opts = 'true';
|
||||
this.activitiContentService.getTaskRelatedContent(taskId, opts).subscribe(
|
||||
const isRelatedContent = 'true';
|
||||
this.activitiContentService.getTaskRelatedContent(taskId, { isRelatedContent }).subscribe(
|
||||
(res: any) => {
|
||||
const attachList = [];
|
||||
res.data.forEach((content) => {
|
||||
|
@@ -20,7 +20,7 @@ import { EventEmitter, Injectable, Output } from '@angular/core';
|
||||
import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
|
||||
import { Observable, of, Subject } from 'rxjs';
|
||||
import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface';
|
||||
import { AlfrescoEndpointRepresentation, Node } from '@alfresco/js-api';
|
||||
import { AlfrescoEndpointRepresentation, Node, ContentApi } from '@alfresco/js-api';
|
||||
import { AttachFileWidgetDialogComponent } from './attach-file-widget-dialog.component';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
|
||||
@@ -76,13 +76,14 @@ export class AttachFileWidgetDialogService {
|
||||
|
||||
downloadURL(repository: AlfrescoEndpointRepresentation, sourceId: string): Observable<string> {
|
||||
const { accountIdentifier } = this.constructPayload(repository);
|
||||
const contentApi = new ContentApi(this.externalApis[accountIdentifier].getInstance());
|
||||
|
||||
if (this.externalApis[accountIdentifier]?.getInstance()?.isLoggedIn()) {
|
||||
return of(this.externalApis[accountIdentifier].contentApi.getContentUrl(sourceId));
|
||||
return of(contentApi.getContentUrl(sourceId));
|
||||
}
|
||||
|
||||
return this.showExternalHostLoginDialog(repository).pipe(
|
||||
switchMap(() => of(this.externalApis[accountIdentifier].getInstance().content.getContentUrl(sourceId)))
|
||||
switchMap(() => of(contentApi.getContentUrl(sourceId)))
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -19,15 +19,13 @@ import { TestBed } from '@angular/core/testing';
|
||||
import { mockError, fakeProcessFiltersResponse } from '../../mock';
|
||||
import { FilterProcessRepresentationModel } from '../models/filter-process.model';
|
||||
import { ProcessFilterService } from './process-filter.service';
|
||||
import { AlfrescoApiService, setupTestBed, CoreTestingModule } from '@alfresco/adf-core';
|
||||
import { setupTestBed, CoreTestingModule } from '@alfresco/adf-core';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
describe('Process filter', () => {
|
||||
|
||||
let service: ProcessFilterService;
|
||||
let apiService: AlfrescoApiService;
|
||||
let alfrescoApi: any;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
@@ -36,9 +34,7 @@ describe('Process filter', () => {
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
apiService = TestBed.inject(AlfrescoApiService);
|
||||
service = TestBed.inject(ProcessFilterService);
|
||||
alfrescoApi = apiService.getInstance();
|
||||
});
|
||||
|
||||
describe('filters', () => {
|
||||
@@ -47,7 +43,7 @@ describe('Process filter', () => {
|
||||
let createFilter: jasmine.Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
getFilters = spyOn(alfrescoApi.activiti.userFiltersApi, 'getUserProcessInstanceFilters')
|
||||
getFilters = spyOn(service['userFiltersApi'], 'getUserProcessInstanceFilters')
|
||||
.and
|
||||
.returnValue(Promise.resolve(fakeProcessFiltersResponse));
|
||||
|
||||
@@ -67,7 +63,7 @@ describe('Process filter', () => {
|
||||
|
||||
it('should call the API with the correct appId when specified', () => {
|
||||
service.getProcessFilters(226);
|
||||
expect(getFilters).toHaveBeenCalledWith({appId: 226});
|
||||
expect(getFilters).toHaveBeenCalledWith({ appId: 226 });
|
||||
});
|
||||
|
||||
it('should return the task filter by id', (done) => {
|
||||
@@ -181,7 +177,8 @@ describe('Process filter', () => {
|
||||
getFilters = getFilters.and.returnValue(Promise.reject(mockError));
|
||||
|
||||
service.getProcessFilters(null).subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe(mockError);
|
||||
done();
|
||||
@@ -194,9 +191,9 @@ describe('Process filter', () => {
|
||||
describe('add filter', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
createFilter = spyOn(alfrescoApi.activiti.userFiltersApi, 'createUserProcessInstanceFilter')
|
||||
.and
|
||||
.callFake((processfilter: FilterProcessRepresentationModel) => Promise.resolve(processfilter));
|
||||
createFilter = spyOn(service['userFiltersApi'], 'createUserProcessInstanceFilter')
|
||||
.and
|
||||
.callFake((processfilter: FilterProcessRepresentationModel) => Promise.resolve(processfilter));
|
||||
});
|
||||
|
||||
const filter = fakeProcessFiltersResponse.data[0];
|
||||
@@ -217,7 +214,8 @@ describe('Process filter', () => {
|
||||
createFilter = createFilter.and.returnValue(Promise.reject(mockError));
|
||||
|
||||
service.addProcessFilter(filter).subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe(mockError);
|
||||
done();
|
||||
@@ -228,7 +226,8 @@ describe('Process filter', () => {
|
||||
it('should return a default error if no data is returned by the API', (done) => {
|
||||
createFilter = createFilter.and.returnValue(Promise.reject(null));
|
||||
service.addProcessFilter(filter).subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe('Server error');
|
||||
done();
|
||||
|
@@ -20,14 +20,17 @@ import { Injectable } from '@angular/core';
|
||||
import { Observable, from, forkJoin, throwError } from 'rxjs';
|
||||
import { FilterProcessRepresentationModel } from '../models/filter-process.model';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
import { ResultListDataRepresentationUserProcessInstanceFilterRepresentation } from '@alfresco/js-api';
|
||||
import { ResultListDataRepresentationUserProcessInstanceFilterRepresentation, UserFiltersApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ProcessFilterService {
|
||||
|
||||
private userFiltersApi: UserFiltersApi;
|
||||
|
||||
constructor(private alfrescoApiService: AlfrescoApiService) {
|
||||
this.userFiltersApi = new UserFiltersApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,7 +184,7 @@ export class ProcessFilterService {
|
||||
* @returns The filter just added
|
||||
*/
|
||||
addProcessFilter(filter: FilterProcessRepresentationModel): Observable<FilterProcessRepresentationModel> {
|
||||
return from(this.alfrescoApiService.getInstance().activiti.userFiltersApi.createUserProcessInstanceFilter(filter))
|
||||
return from(this.userFiltersApi.createUserProcessInstanceFilter(filter))
|
||||
.pipe(
|
||||
map((response: FilterProcessRepresentationModel) => {
|
||||
return response;
|
||||
@@ -197,9 +200,9 @@ export class ProcessFilterService {
|
||||
*/
|
||||
callApiProcessFilters(appId?: number): Promise<ResultListDataRepresentationUserProcessInstanceFilterRepresentation> {
|
||||
if (appId) {
|
||||
return this.alfrescoApiService.getInstance().activiti.userFiltersApi.getUserProcessInstanceFilters({ appId: appId });
|
||||
return this.userFiltersApi.getUserProcessInstanceFilters({ appId: appId });
|
||||
} else {
|
||||
return this.alfrescoApiService.getInstance().activiti.userFiltersApi.getUserProcessInstanceFilters();
|
||||
return this.userFiltersApi.getUserProcessInstanceFilters();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@ import { exampleProcess, mockError, fakeProcessDef, fakeTasksList } from '../../
|
||||
import { ProcessFilterParamRepresentationModel } from '../models/filter-process.model';
|
||||
import { ProcessInstanceVariable } from '../models/process-instance-variable.model';
|
||||
import { ProcessService } from './process.service';
|
||||
import { AlfrescoApiService, setupTestBed, CoreModule } from '@alfresco/adf-core';
|
||||
import { setupTestBed, CoreModule } from '@alfresco/adf-core';
|
||||
import { ProcessTestingModule } from '../../testing/process.testing.module';
|
||||
|
||||
declare let moment: any;
|
||||
@@ -28,8 +28,6 @@ declare let moment: any;
|
||||
describe('ProcessService', () => {
|
||||
|
||||
let service: ProcessService;
|
||||
let apiService: AlfrescoApiService;
|
||||
let alfrescoApi: any;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
@@ -39,9 +37,7 @@ describe('ProcessService', () => {
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
apiService = TestBed.inject(AlfrescoApiService);
|
||||
service = new ProcessService(apiService);
|
||||
alfrescoApi = apiService.getInstance();
|
||||
service = TestBed.inject(ProcessService);
|
||||
});
|
||||
|
||||
describe('process instances', () => {
|
||||
@@ -54,9 +50,9 @@ describe('ProcessService', () => {
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(alfrescoApi.activiti.processApi, 'getProcessInstances')
|
||||
spyOn(service['processInstancesApi'], 'getProcessInstances')
|
||||
.and
|
||||
.returnValue(Promise.resolve({ data: [ exampleProcess ] }));
|
||||
.returnValue(Promise.resolve({ data: [exampleProcess] }));
|
||||
});
|
||||
|
||||
it('should return the correct number of instances', (done) => {
|
||||
@@ -75,14 +71,14 @@ describe('ProcessService', () => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('process instance', () => {
|
||||
|
||||
const processId = 'test';
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(alfrescoApi.activiti.processApi, 'getProcessInstance')
|
||||
spyOn(service['processInstancesApi'], 'getProcessInstance')
|
||||
.and
|
||||
.returnValue(Promise.resolve(exampleProcess));
|
||||
});
|
||||
@@ -95,7 +91,7 @@ describe('ProcessService', () => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('start process instance', () => {
|
||||
|
||||
@@ -103,7 +99,7 @@ describe('ProcessService', () => {
|
||||
let startNewProcessInstance: jasmine.Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
startNewProcessInstance = spyOn(alfrescoApi.activiti.processApi, 'startNewProcessInstance')
|
||||
startNewProcessInstance = spyOn(service['processInstancesApi'], 'startNewProcessInstance')
|
||||
.and
|
||||
.returnValue(Promise.resolve(exampleProcess));
|
||||
});
|
||||
@@ -143,7 +139,8 @@ describe('ProcessService', () => {
|
||||
startNewProcessInstance = startNewProcessInstance.and.returnValue(Promise.reject(mockError));
|
||||
|
||||
service.startProcess(processDefId, processName).subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe(mockError);
|
||||
done();
|
||||
@@ -154,14 +151,15 @@ describe('ProcessService', () => {
|
||||
it('should return a default error if no data is returned by the API', (done) => {
|
||||
startNewProcessInstance = startNewProcessInstance.and.returnValue(Promise.reject(null));
|
||||
service.startProcess(processDefId, processName).subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe('Server error');
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('cancel process instance', () => {
|
||||
|
||||
@@ -169,7 +167,7 @@ describe('ProcessService', () => {
|
||||
let deleteProcessInstance: jasmine.Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
deleteProcessInstance = spyOn(alfrescoApi.activiti.processApi, 'deleteProcessInstance')
|
||||
deleteProcessInstance = spyOn(service['processInstancesApi'], 'deleteProcessInstance')
|
||||
.and
|
||||
.returnValue(Promise.resolve());
|
||||
});
|
||||
@@ -193,7 +191,8 @@ describe('ProcessService', () => {
|
||||
it('should pass on any error that is returned by the API', (done) => {
|
||||
deleteProcessInstance = deleteProcessInstance.and.returnValue(Promise.reject(mockError));
|
||||
service.cancelProcess(null).subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe(mockError);
|
||||
done();
|
||||
@@ -204,23 +203,24 @@ describe('ProcessService', () => {
|
||||
it('should return a default error if no data is returned by the API', (done) => {
|
||||
deleteProcessInstance = deleteProcessInstance.and.returnValue(Promise.reject(null));
|
||||
service.cancelProcess(null).subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe('Server error');
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('process definitions', () => {
|
||||
|
||||
let getProcessDefinitions: jasmine.Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
getProcessDefinitions = spyOn(alfrescoApi.activiti.processApi, 'getProcessDefinitions')
|
||||
getProcessDefinitions = spyOn(service['processDefinitionsApi'], 'getProcessDefinitions')
|
||||
.and
|
||||
.returnValue(Promise.resolve({ data: [ fakeProcessDef, fakeProcessDef ] }));
|
||||
.returnValue(Promise.resolve({ data: [fakeProcessDef, fakeProcessDef] }));
|
||||
});
|
||||
|
||||
it('should return the correct number of process defs', (done) => {
|
||||
@@ -251,7 +251,8 @@ describe('ProcessService', () => {
|
||||
it('should pass on any error that is returned by the API', (done) => {
|
||||
getProcessDefinitions = getProcessDefinitions.and.returnValue(Promise.reject(mockError));
|
||||
service.getProcessDefinitions().subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe(mockError);
|
||||
done();
|
||||
@@ -262,14 +263,15 @@ describe('ProcessService', () => {
|
||||
it('should return a default error if no data is returned by the API', (done) => {
|
||||
getProcessDefinitions = getProcessDefinitions.and.returnValue(Promise.reject(null));
|
||||
service.getProcessDefinitions().subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe('Server error');
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('process instance tasks', () => {
|
||||
|
||||
@@ -277,7 +279,7 @@ describe('ProcessService', () => {
|
||||
let listTasks: jasmine.Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
listTasks = spyOn(alfrescoApi.activiti.taskApi, 'listTasks')
|
||||
listTasks = spyOn(service['tasksApi'], 'listTasks')
|
||||
.and
|
||||
.returnValue(Promise.resolve(fakeTasksList));
|
||||
});
|
||||
@@ -323,7 +325,8 @@ describe('ProcessService', () => {
|
||||
it('should pass on any error that is returned by the API', (done) => {
|
||||
listTasks = listTasks.and.returnValue(Promise.reject(mockError));
|
||||
service.getProcessTasks(processId).subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe(mockError);
|
||||
done();
|
||||
@@ -334,14 +337,15 @@ describe('ProcessService', () => {
|
||||
it('should return a default error if no data is returned by the API', (done) => {
|
||||
listTasks = listTasks.and.returnValue(Promise.reject(null));
|
||||
service.getProcessTasks(processId).subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe('Server error');
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('process variables', () => {
|
||||
|
||||
@@ -350,7 +354,7 @@ describe('ProcessService', () => {
|
||||
let deleteProcessInstanceVariableSpy: jasmine.Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
getVariablesSpy = spyOn(alfrescoApi.activiti.processInstanceVariablesApi, 'getProcessInstanceVariables').and.returnValue(Promise.resolve([{
|
||||
getVariablesSpy = spyOn(service['processInstanceVariablesApi'], 'getProcessInstanceVariables').and.returnValue(Promise.resolve([{
|
||||
name: 'var1',
|
||||
value: 'Test1'
|
||||
}, {
|
||||
@@ -358,10 +362,10 @@ describe('ProcessService', () => {
|
||||
value: 'Test3'
|
||||
}]));
|
||||
|
||||
createOrUpdateProcessInstanceVariablesSpy = spyOn(alfrescoApi.activiti.processInstanceVariablesApi,
|
||||
createOrUpdateProcessInstanceVariablesSpy = spyOn(service['processInstanceVariablesApi'],
|
||||
'createOrUpdateProcessInstanceVariables').and.returnValue(Promise.resolve({}));
|
||||
|
||||
deleteProcessInstanceVariableSpy = spyOn(alfrescoApi.activiti.processInstanceVariablesApi,
|
||||
deleteProcessInstanceVariableSpy = spyOn(service['processInstanceVariablesApi'],
|
||||
'deleteProcessInstanceVariable').and.returnValue(Promise.resolve());
|
||||
});
|
||||
|
||||
@@ -375,7 +379,8 @@ describe('ProcessService', () => {
|
||||
it('should pass on any error that is returned by the API', (done) => {
|
||||
getVariablesSpy = getVariablesSpy.and.returnValue(Promise.reject(mockError));
|
||||
service.getProcessInstanceVariables(null).subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe(mockError);
|
||||
done();
|
||||
@@ -386,7 +391,8 @@ describe('ProcessService', () => {
|
||||
it('should return a default error if no data is returned by the API', (done) => {
|
||||
getVariablesSpy = getVariablesSpy.and.returnValue(Promise.reject(null));
|
||||
service.getProcessInstanceVariables(null).subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe('Server error');
|
||||
done();
|
||||
@@ -412,7 +418,8 @@ describe('ProcessService', () => {
|
||||
it('should pass on any error that is returned by the API', (done) => {
|
||||
createOrUpdateProcessInstanceVariablesSpy = createOrUpdateProcessInstanceVariablesSpy.and.returnValue(Promise.reject(mockError));
|
||||
service.createOrUpdateProcessInstanceVariables('123', updatedVariables).subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe(mockError);
|
||||
done();
|
||||
@@ -423,7 +430,8 @@ describe('ProcessService', () => {
|
||||
it('should return a default error if no data is returned by the API', (done) => {
|
||||
createOrUpdateProcessInstanceVariablesSpy = createOrUpdateProcessInstanceVariablesSpy.and.returnValue(Promise.reject(null));
|
||||
service.createOrUpdateProcessInstanceVariables('123', updatedVariables).subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe('Server error');
|
||||
done();
|
||||
@@ -436,7 +444,8 @@ describe('ProcessService', () => {
|
||||
it('should pass on any error that is returned by the API', (done) => {
|
||||
deleteProcessInstanceVariableSpy = deleteProcessInstanceVariableSpy.and.returnValue(Promise.reject(mockError));
|
||||
service.deleteProcessInstanceVariable('123', 'myVar').subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe(mockError);
|
||||
done();
|
||||
@@ -447,7 +456,8 @@ describe('ProcessService', () => {
|
||||
it('should return a default error if no data is returned by the API', (done) => {
|
||||
deleteProcessInstanceVariableSpy = deleteProcessInstanceVariableSpy.and.returnValue(Promise.reject(null));
|
||||
service.deleteProcessInstanceVariable('123', 'myVar').subscribe(
|
||||
() => {},
|
||||
() => {
|
||||
},
|
||||
(res) => {
|
||||
expect(res).toBe('Server error');
|
||||
done();
|
||||
@@ -455,5 +465,5 @@ describe('ProcessService', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -17,7 +17,14 @@
|
||||
|
||||
import { AlfrescoApiService, FormValues } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { RestVariable, ProcessInstanceRepresentation } from '@alfresco/js-api';
|
||||
import {
|
||||
TasksApi,
|
||||
ProcessDefinitionsApi,
|
||||
ProcessInstancesApi,
|
||||
RestVariable,
|
||||
ProcessInstanceRepresentation,
|
||||
ProcessInstanceVariablesApi
|
||||
} from '@alfresco/js-api';
|
||||
import { Observable, from, throwError, of } from 'rxjs';
|
||||
import { TaskDetailsModel } from '../../task-list';
|
||||
import { ProcessFilterParamRepresentationModel } from '../models/filter-process.model';
|
||||
@@ -35,7 +42,16 @@ declare let moment: any;
|
||||
})
|
||||
export class ProcessService {
|
||||
|
||||
private processInstanceVariablesApi: ProcessInstanceVariablesApi;
|
||||
private processInstancesApi: ProcessInstancesApi;
|
||||
private processDefinitionsApi: ProcessDefinitionsApi;
|
||||
private tasksApi: TasksApi;
|
||||
|
||||
constructor(private alfrescoApiService: AlfrescoApiService) {
|
||||
this.processInstanceVariablesApi = new ProcessInstanceVariablesApi(this.alfrescoApiService.getInstance());
|
||||
this.processInstancesApi = new ProcessInstancesApi(this.alfrescoApiService.getInstance());
|
||||
this.processDefinitionsApi = new ProcessDefinitionsApi(this.alfrescoApiService.getInstance());
|
||||
this.tasksApi = new TasksApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,7 +61,7 @@ export class ProcessService {
|
||||
* @returns List of process instances
|
||||
*/
|
||||
getProcessInstances(requestNode: ProcessFilterParamRepresentationModel, processDefinitionKey?: string): Observable<ProcessListModel> {
|
||||
return from(this.alfrescoApiService.getInstance().activiti.processApi.getProcessInstances(requestNode))
|
||||
return from(this.processInstancesApi.getProcessInstances(requestNode))
|
||||
.pipe(
|
||||
map((res: any) => {
|
||||
if (processDefinitionKey) {
|
||||
@@ -109,7 +125,7 @@ export class ProcessService {
|
||||
* @returns Binary PDF data
|
||||
*/
|
||||
fetchProcessAuditPdfById(processId: string): Observable<Blob> {
|
||||
return from(this.alfrescoApiService.getInstance().activiti.processApi.getProcessAuditPdf(processId))
|
||||
return from(this.processInstancesApi.getProcessAuditPdf(processId))
|
||||
.pipe(
|
||||
catchError((err) => this.handleProcessError(err))
|
||||
);
|
||||
@@ -121,7 +137,7 @@ export class ProcessService {
|
||||
* @returns JSON data
|
||||
*/
|
||||
fetchProcessAuditJsonById(processId: string): Observable<any> {
|
||||
return from(this.alfrescoApiService.getInstance().activiti.processApi.getProcessAuditJson(processId))
|
||||
return from(this.processInstancesApi.getTaskAuditLog(processId))
|
||||
.pipe(
|
||||
catchError((err) => this.handleProcessError(err))
|
||||
);
|
||||
@@ -133,7 +149,7 @@ export class ProcessService {
|
||||
* @returns Metadata for the instance
|
||||
*/
|
||||
getProcess(processInstanceId: string): Observable<ProcessInstance> {
|
||||
return from(this.alfrescoApiService.getInstance().activiti.processApi.getProcessInstance(processInstanceId))
|
||||
return from(this.processInstancesApi.getProcessInstance(processInstanceId))
|
||||
.pipe(
|
||||
catchError((err) => this.handleProcessError(err))
|
||||
);
|
||||
@@ -150,9 +166,9 @@ export class ProcessService {
|
||||
processInstanceId: processInstanceId,
|
||||
state: state
|
||||
} : {
|
||||
processInstanceId: processInstanceId
|
||||
};
|
||||
return from(this.alfrescoApiService.getInstance().activiti.taskApi.listTasks(taskOpts))
|
||||
processInstanceId: processInstanceId
|
||||
};
|
||||
return from(this.tasksApi.listTasks(taskOpts))
|
||||
.pipe(
|
||||
map(this.extractData),
|
||||
map((tasks) => tasks.map((task: any) => {
|
||||
@@ -173,10 +189,10 @@ export class ProcessService {
|
||||
latest: true,
|
||||
appDefinitionId: appId
|
||||
} : {
|
||||
latest: true
|
||||
};
|
||||
latest: true
|
||||
};
|
||||
return from(
|
||||
this.alfrescoApiService.getInstance().activiti.processApi.getProcessDefinitions(opts)
|
||||
this.processDefinitionsApi.getProcessDefinitions(opts)
|
||||
)
|
||||
.pipe(
|
||||
map(this.extractData),
|
||||
@@ -209,7 +225,7 @@ export class ProcessService {
|
||||
startRequest.variables = variables;
|
||||
}
|
||||
return from(
|
||||
this.alfrescoApiService.getInstance().activiti.processApi.startNewProcessInstance(startRequest)
|
||||
this.processInstancesApi.startNewProcessInstance(startRequest)
|
||||
)
|
||||
.pipe(
|
||||
map((pd) => new ProcessInstance(pd)),
|
||||
@@ -224,7 +240,7 @@ export class ProcessService {
|
||||
*/
|
||||
cancelProcess(processInstanceId: string): Observable<void> {
|
||||
return from(
|
||||
this.alfrescoApiService.getInstance().activiti.processApi.deleteProcessInstance(processInstanceId)
|
||||
this.processInstancesApi.deleteProcessInstance(processInstanceId)
|
||||
)
|
||||
.pipe(
|
||||
catchError((err) => this.handleProcessError(err))
|
||||
@@ -238,7 +254,7 @@ export class ProcessService {
|
||||
*/
|
||||
getProcessInstanceVariables(processInstanceId: string): Observable<ProcessInstanceVariable[]> {
|
||||
return from(
|
||||
this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.getProcessInstanceVariables(processInstanceId)
|
||||
this.processInstanceVariablesApi.getProcessInstanceVariables(processInstanceId)
|
||||
)
|
||||
.pipe(
|
||||
map((processVars: any[]) => processVars.map((currentProcessVar) => new ProcessInstanceVariable(currentProcessVar))),
|
||||
@@ -254,10 +270,10 @@ export class ProcessService {
|
||||
*/
|
||||
createOrUpdateProcessInstanceVariables(processInstanceId: string, variables: RestVariable[]): Observable<ProcessInstanceVariable[]> {
|
||||
return from(
|
||||
this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.createOrUpdateProcessInstanceVariables(processInstanceId, variables)
|
||||
this.processInstanceVariablesApi.createOrUpdateProcessInstanceVariables(processInstanceId, variables)
|
||||
).pipe(
|
||||
catchError((err) => this.handleProcessError(err))
|
||||
);
|
||||
catchError((err) => this.handleProcessError(err))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,7 +284,7 @@ export class ProcessService {
|
||||
*/
|
||||
deleteProcessInstanceVariable(processInstanceId: string, variableName: string): Observable<void> {
|
||||
return from(
|
||||
this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.deleteProcessInstanceVariable(processInstanceId, variableName)
|
||||
this.processInstanceVariablesApi.deleteProcessInstanceVariable(processInstanceId, variableName)
|
||||
)
|
||||
.pipe(
|
||||
catchError((err) => this.handleProcessError(err))
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService, AppConfigService, DiscoveryApiService, UploadService } from '@alfresco/adf-core';
|
||||
import { ActivitiContentApi } from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { throwError } from 'rxjs';
|
||||
|
||||
@@ -24,8 +25,11 @@ import { throwError } from 'rxjs';
|
||||
})
|
||||
export class ProcessUploadService extends UploadService {
|
||||
|
||||
contentApi: ActivitiContentApi;
|
||||
|
||||
constructor(protected apiService: AlfrescoApiService, appConfigService: AppConfigService, discoveryApiService: DiscoveryApiService) {
|
||||
super(apiService, appConfigService, discoveryApiService);
|
||||
this.contentApi = new ActivitiContentApi(apiService.getInstance());
|
||||
}
|
||||
|
||||
getUploadPromise(file: any): any {
|
||||
@@ -33,7 +37,7 @@ export class ProcessUploadService extends UploadService {
|
||||
isRelatedContent: true
|
||||
};
|
||||
const processInstanceId = file.options.parentId;
|
||||
const promise = this.apiService.getInstance().activiti.contentApi.createRelatedContentOnProcessInstance(processInstanceId, file.file, opts);
|
||||
const promise = this.contentApi.createRelatedContentOnProcessInstance(processInstanceId, file.file, opts);
|
||||
|
||||
promise.catch((err) => this.handleError(err));
|
||||
|
||||
|
@@ -20,14 +20,18 @@ import { Injectable } from '@angular/core';
|
||||
import { Observable, forkJoin, from, throwError } from 'rxjs';
|
||||
import { FilterRepresentationModel } from '../models/filter.model';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
import { UserFiltersApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TaskFilterService {
|
||||
|
||||
private userFiltersApi: UserFiltersApi;
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.userFiltersApi = new UserFiltersApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,13 +64,29 @@ export class TaskFilterService {
|
||||
const filters: FilterRepresentationModel[] = [];
|
||||
res.forEach((filter) => {
|
||||
if (filter.name === involvedTasksFilter.name) {
|
||||
filters.push(new FilterRepresentationModel({ ...filter, filter: involvedTasksFilter.filter, appId }));
|
||||
filters.push(new FilterRepresentationModel({
|
||||
...filter,
|
||||
filter: involvedTasksFilter.filter,
|
||||
appId
|
||||
}));
|
||||
} else if (filter.name === myTasksFilter.name) {
|
||||
filters.push(new FilterRepresentationModel({ ...filter, filter: myTasksFilter.filter, appId }));
|
||||
filters.push(new FilterRepresentationModel({
|
||||
...filter,
|
||||
filter: myTasksFilter.filter,
|
||||
appId
|
||||
}));
|
||||
} else if (filter.name === queuedTasksFilter.name) {
|
||||
filters.push(new FilterRepresentationModel({ ...filter, filter: queuedTasksFilter.filter, appId }));
|
||||
filters.push(new FilterRepresentationModel({
|
||||
...filter,
|
||||
filter: queuedTasksFilter.filter,
|
||||
appId
|
||||
}));
|
||||
} else if (filter.name === completedTasksFilter.name) {
|
||||
filters.push(new FilterRepresentationModel({ ...filter, filter: completedTasksFilter.filter, appId }));
|
||||
filters.push(new FilterRepresentationModel({
|
||||
...filter,
|
||||
filter: completedTasksFilter.filter,
|
||||
appId
|
||||
}));
|
||||
}
|
||||
});
|
||||
observer.next(filters);
|
||||
@@ -130,7 +150,7 @@ export class TaskFilterService {
|
||||
* @returns Details of task filter just added
|
||||
*/
|
||||
addFilter(filter: FilterRepresentationModel): Observable<FilterRepresentationModel> {
|
||||
return from(this.apiService.getInstance().activiti.userFiltersApi.createUserTaskFilter(filter))
|
||||
return from(this.userFiltersApi.createUserTaskFilter(filter))
|
||||
.pipe(
|
||||
map((response: FilterRepresentationModel) => {
|
||||
return response;
|
||||
@@ -146,9 +166,9 @@ export class TaskFilterService {
|
||||
*/
|
||||
callApiTaskFilters(appId?: number): Promise<any> {
|
||||
if (appId) {
|
||||
return this.apiService.getInstance().activiti.userFiltersApi.getUserTaskFilters({appId: appId});
|
||||
return this.userFiltersApi.getUserTaskFilters({ appId: appId });
|
||||
} else {
|
||||
return this.apiService.getInstance().activiti.userFiltersApi.getUserTaskFilters();
|
||||
return this.userFiltersApi.getUserTaskFilters();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +184,7 @@ export class TaskFilterService {
|
||||
'appId': appId,
|
||||
'recent': false,
|
||||
'icon': 'glyphicon-inbox',
|
||||
'filter': {'sort': 'created-desc', 'name': '', 'state': 'open', 'assignment': 'assignee'},
|
||||
'filter': { 'sort': 'created-desc', 'name': '', 'state': 'open', 'assignment': 'assignee' },
|
||||
index
|
||||
});
|
||||
}
|
||||
@@ -181,7 +201,7 @@ export class TaskFilterService {
|
||||
'appId': appId,
|
||||
'recent': false,
|
||||
'icon': 'glyphicon-align-left',
|
||||
'filter': {'sort': 'created-desc', 'name': '', 'state': 'open', 'assignment': 'involved'},
|
||||
'filter': { 'sort': 'created-desc', 'name': '', 'state': 'open', 'assignment': 'involved' },
|
||||
index
|
||||
});
|
||||
}
|
||||
@@ -198,7 +218,7 @@ export class TaskFilterService {
|
||||
'appId': appId,
|
||||
'recent': false,
|
||||
'icon': 'glyphicon-record',
|
||||
'filter': {'sort': 'created-desc', 'name': '', 'state': 'open', 'assignment': 'candidate'},
|
||||
'filter': { 'sort': 'created-desc', 'name': '', 'state': 'open', 'assignment': 'candidate' },
|
||||
index
|
||||
});
|
||||
}
|
||||
@@ -215,7 +235,7 @@ export class TaskFilterService {
|
||||
'appId': appId,
|
||||
'recent': true,
|
||||
'icon': 'glyphicon-ok-sign',
|
||||
'filter': {'sort': 'created-desc', 'name': '', 'state': 'completed', 'assignment': 'involved'},
|
||||
'filter': { 'sort': 'created-desc', 'name': '', 'state': 'completed', 'assignment': 'involved' },
|
||||
index
|
||||
});
|
||||
}
|
||||
|
@@ -18,14 +18,18 @@
|
||||
import { AlfrescoApiService, AppConfigService, DiscoveryApiService, UploadService } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { throwError } from 'rxjs';
|
||||
import { ActivitiContentApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TaskUploadService extends UploadService {
|
||||
|
||||
private contentApi: ActivitiContentApi;
|
||||
|
||||
constructor(protected apiService: AlfrescoApiService, appConfigService: AppConfigService, discoveryApiService: DiscoveryApiService) {
|
||||
super(apiService, appConfigService, discoveryApiService);
|
||||
this.contentApi = new ActivitiContentApi(apiService.getInstance());
|
||||
}
|
||||
|
||||
getUploadPromise(file: any): any {
|
||||
@@ -33,7 +37,7 @@ export class TaskUploadService extends UploadService {
|
||||
isRelatedContent: true
|
||||
};
|
||||
const taskId = file.options.parentId;
|
||||
const promise = this.apiService.getInstance().activiti.contentApi.createRelatedContentOnTask(taskId, file.file, opts);
|
||||
const promise = this.contentApi.createRelatedContentOnTask(taskId, file.file, opts);
|
||||
|
||||
promise.catch((err) => this.handleError(err));
|
||||
|
||||
|
@@ -24,9 +24,9 @@ import { Form } from '../models/form.model';
|
||||
import { TaskDetailsModel } from '../models/task-details.model';
|
||||
import { TaskListModel } from '../models/task-list.model';
|
||||
import {
|
||||
TaskQueryRepresentation,
|
||||
AssigneeIdentifierRepresentation,
|
||||
TaskUpdateRepresentation
|
||||
TaskQueryRepresentation, AssigneeIdentifierRepresentation,
|
||||
TaskUpdateRepresentation, ModelsApi, TaskActionsApi, TasksApi,
|
||||
ChecklistsApi
|
||||
} from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
@@ -34,8 +34,17 @@ import {
|
||||
})
|
||||
export class TaskListService {
|
||||
|
||||
private modelsApi: ModelsApi;
|
||||
private tasksApi: TasksApi;
|
||||
private taskActionsApi: TaskActionsApi;
|
||||
private checklistsApi: ChecklistsApi;
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.modelsApi = new ModelsApi(this.apiService.getInstance());
|
||||
this.taskActionsApi = new TaskActionsApi(this.apiService.getInstance());
|
||||
this.tasksApi = new TasksApi(this.apiService.getInstance());
|
||||
this.checklistsApi = new ChecklistsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,7 +201,7 @@ export class TaskListService {
|
||||
'modelType': 2 // Integer | modelType
|
||||
};
|
||||
|
||||
return from(this.apiService.getInstance().activiti.modelsApi.getModels(opts))
|
||||
return from(this.modelsApi.getModels(opts))
|
||||
.pipe(
|
||||
map(response => {
|
||||
const forms: Form[] = [];
|
||||
@@ -212,7 +221,7 @@ export class TaskListService {
|
||||
* @returns Null response notifying when the operation is complete
|
||||
*/
|
||||
attachFormToATask(taskId: string, formId: number): Observable<any> {
|
||||
return from(this.apiService.taskApi.attachForm(taskId, { 'formId': formId }))
|
||||
return from(this.taskActionsApi.attachForm(taskId, { 'formId': formId }))
|
||||
.pipe(
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
@@ -263,7 +272,7 @@ export class TaskListService {
|
||||
* @returns Null response notifying when the operation is complete
|
||||
*/
|
||||
completeTask(taskId: string) {
|
||||
return from(this.apiService.taskApi.completeTask(taskId))
|
||||
return from(this.taskActionsApi.completeTask(taskId))
|
||||
.pipe(
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
@@ -337,7 +346,7 @@ export class TaskListService {
|
||||
* @returns Details of the claimed task
|
||||
*/
|
||||
claimTask(taskId: string): Observable<TaskDetailsModel> {
|
||||
return from(this.apiService.taskApi.claimTask(taskId))
|
||||
return from(this.taskActionsApi.claimTask(taskId))
|
||||
.pipe(
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
@@ -349,7 +358,7 @@ export class TaskListService {
|
||||
* @returns Null response notifying when the operation is complete
|
||||
*/
|
||||
unclaimTask(taskId: string): Observable<TaskDetailsModel> {
|
||||
return from(this.apiService.taskApi.unclaimTask(taskId))
|
||||
return from(this.taskActionsApi.unclaimTask(taskId))
|
||||
.pipe(
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
@@ -362,7 +371,7 @@ export class TaskListService {
|
||||
* @returns Updated task details
|
||||
*/
|
||||
updateTask(taskId: string, updated: TaskUpdateRepresentation): Observable<TaskDetailsModel> {
|
||||
return from(this.apiService.taskApi.updateTask(taskId, updated))
|
||||
return from(this.tasksApi.updateTask(taskId, updated))
|
||||
.pipe(
|
||||
map((result) => <TaskDetailsModel> result),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -375,7 +384,7 @@ export class TaskListService {
|
||||
* @returns Binary PDF data
|
||||
*/
|
||||
fetchTaskAuditPdfById(taskId: string): Observable<Blob> {
|
||||
return from(this.apiService.taskApi.getTaskAuditPdf(taskId))
|
||||
return from(this.tasksApi.getTaskAuditPdf(taskId))
|
||||
.pipe(
|
||||
map((data) => <Blob> data),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -388,42 +397,42 @@ export class TaskListService {
|
||||
* @returns JSON data
|
||||
*/
|
||||
fetchTaskAuditJsonById(taskId: string): Observable<any> {
|
||||
return from(this.apiService.taskApi.getTaskAuditJson(taskId))
|
||||
return from(this.tasksApi.getTaskAuditLog(taskId))
|
||||
.pipe(
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
}
|
||||
|
||||
private callApiTasksFiltered(requestNode: TaskQueryRepresentation): Promise<TaskListModel> {
|
||||
return this.apiService.taskApi.listTasks(requestNode);
|
||||
return this.tasksApi.listTasks(requestNode);
|
||||
}
|
||||
|
||||
private callApiTaskDetails(taskId: string): Promise<TaskDetailsModel> {
|
||||
return this.apiService.taskApi.getTask(taskId);
|
||||
return this.tasksApi.getTask(taskId);
|
||||
}
|
||||
|
||||
private callApiAddTask(task: TaskDetailsModel): Promise<TaskDetailsModel> {
|
||||
return this.apiService.taskApi.addSubtask(task.parentTaskId, task);
|
||||
return this.checklistsApi.addSubtask(task.parentTaskId, task);
|
||||
}
|
||||
|
||||
private callApiDeleteTask(taskId: string): Promise<any> {
|
||||
return this.apiService.taskApi.deleteTask(taskId);
|
||||
return this.tasksApi.deleteTask(taskId);
|
||||
}
|
||||
|
||||
private callApiDeleteForm(taskId: string): Promise<any> {
|
||||
return this.apiService.taskApi.removeForm(taskId);
|
||||
return this.taskActionsApi.removeForm(taskId);
|
||||
}
|
||||
|
||||
private callApiTaskChecklist(taskId: string): Promise<TaskListModel> {
|
||||
return this.apiService.taskApi.getChecklist(taskId);
|
||||
return this.checklistsApi.getChecklist(taskId);
|
||||
}
|
||||
|
||||
private callApiCreateTask(task: TaskDetailsModel): Promise<TaskDetailsModel> {
|
||||
return this.apiService.taskApi.createNewTask(task);
|
||||
return this.tasksApi.createNewTask(task);
|
||||
}
|
||||
|
||||
private callApiAssignTask(taskId: string, requestNode: AssigneeIdentifierRepresentation): Promise<TaskDetailsModel> {
|
||||
return this.apiService.taskApi.assignTask(taskId, requestNode);
|
||||
return this.taskActionsApi.assignTask(taskId, requestNode);
|
||||
}
|
||||
|
||||
private handleError(error: any) {
|
||||
|
Reference in New Issue
Block a user