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:
@@ -27,12 +27,28 @@ import { TabModel } from './tab.model';
|
||||
import { fakeMetadataForm, fakeViewerForm } from 'process-services-cloud/src/lib/form/mocks/cloud-form.mock';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { UploadWidgetContentLinkModel } from './upload-widget-content-link.model';
|
||||
import { AlfrescoApiService } from '../../../../services';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { CoreTestingModule, setupTestBed } from '../../../../testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CoreModule } from '../../../../core.module';
|
||||
|
||||
describe('FormModel', () => {
|
||||
let formService: FormService;
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
CoreModule.forRoot(),
|
||||
CoreTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
formService = new FormService(null, null, null);
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
|
||||
formService = new FormService(null, alfrescoApiService, null);
|
||||
});
|
||||
|
||||
it('should store original json', () => {
|
||||
|
@@ -28,6 +28,7 @@ import { DropdownEditorComponent } from './dropdown.editor';
|
||||
import { setupTestBed } from '../../../../../../testing/setup-test-bed';
|
||||
import { CoreTestingModule } from '../../../../../../testing/core.testing.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { AlfrescoApiService } from '../../../../../../services';
|
||||
|
||||
describe('DropdownEditorComponent', () => {
|
||||
|
||||
@@ -37,6 +38,7 @@ describe('DropdownEditorComponent', () => {
|
||||
let table: DynamicTableModel;
|
||||
let column: DynamicTableColumn;
|
||||
let row: DynamicTableRow;
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
@@ -46,7 +48,8 @@ describe('DropdownEditorComponent', () => {
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
formService = new FormService(null, null, null);
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
formService = new FormService(null, alfrescoApiService, null);
|
||||
|
||||
row = <DynamicTableRow> {value: {dropdown: 'one'}};
|
||||
column = <DynamicTableColumn> {
|
||||
|
@@ -22,15 +22,29 @@ import { DynamicTableColumn } from './../dynamic-table-column.model';
|
||||
import { DynamicTableRow } from './../dynamic-table-row.model';
|
||||
import { DynamicTableModel } from './../dynamic-table.widget.model';
|
||||
import { RowEditorComponent } from './row.editor';
|
||||
import { AlfrescoApiService } from '../../../../../services';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { CoreTestingModule, setupTestBed } from '../../../../../testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
describe('RowEditorComponent', () => {
|
||||
|
||||
let component: RowEditorComponent;
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
CoreTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
|
||||
component = new RowEditorComponent();
|
||||
const field = new FormFieldModel(new FormModel());
|
||||
component.table = new DynamicTableModel(field, new FormService(null, null, null));
|
||||
component.table = new DynamicTableModel(field, new FormService(null, alfrescoApiService, null));
|
||||
component.row = <DynamicTableRow> {};
|
||||
component.column = <DynamicTableColumn> {};
|
||||
});
|
||||
|
@@ -22,14 +22,28 @@ import { FormFieldModel } from '../core/form-field.model';
|
||||
import { FormModel } from '../core/form.model';
|
||||
import { GroupModel } from '../core/group.model';
|
||||
import { FunctionalGroupWidgetComponent } from './functional-group.widget';
|
||||
import { AlfrescoApiService } from '../../../../services';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { CoreTestingModule, setupTestBed } from '../../../../testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
describe('FunctionalGroupWidgetComponent', () => {
|
||||
let formService: FormService;
|
||||
let elementRef: ElementRef;
|
||||
let widget: FunctionalGroupWidgetComponent;
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
CoreTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
formService = new FormService(null, null, null);
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
|
||||
formService = new FormService(null, alfrescoApiService, null);
|
||||
elementRef = new ElementRef(null);
|
||||
widget = new FunctionalGroupWidgetComponent(formService, elementRef);
|
||||
widget.field = new FormFieldModel(new FormModel());
|
||||
|
@@ -30,11 +30,13 @@ import { MatRadioModule } from '@angular/material/radio';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { CoreTestingModule } from '../../../../testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { AlfrescoApiService } from '../../../../services';
|
||||
|
||||
describe('RadioButtonsWidgetComponent', () => {
|
||||
|
||||
let formService: FormService;
|
||||
let widget: RadioButtonsWidgetComponent;
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
@@ -47,7 +49,9 @@ describe('RadioButtonsWidgetComponent', () => {
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
formService = new FormService(null, null, null);
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
|
||||
formService = new FormService(null, alfrescoApiService, null);
|
||||
widget = new RadioButtonsWidgetComponent(formService, null);
|
||||
widget.field = new FormFieldModel(new FormModel(), { restUrl: '<url>' });
|
||||
});
|
||||
|
@@ -28,12 +28,14 @@ import { TypeaheadWidgetComponent } from './typeahead.widget';
|
||||
import { setupTestBed } from '../../../../testing/setup-test-bed';
|
||||
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
||||
import { CoreTestingModule } from '../../../../testing/core.testing.module';
|
||||
import { AlfrescoApiService } from '../../../../services';
|
||||
|
||||
describe('TypeaheadWidgetComponent', () => {
|
||||
|
||||
let formService: FormService;
|
||||
let widget: TypeaheadWidgetComponent;
|
||||
let translationService: TranslateService;
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
@@ -43,11 +45,12 @@ describe('TypeaheadWidgetComponent', () => {
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
translationService = TestBed.inject(TranslateService);
|
||||
spyOn(translationService, 'instant').and.callFake((key) => { return key; });
|
||||
spyOn(translationService, 'get').and.callFake((key) => { return of(key); });
|
||||
|
||||
formService = new FormService(null, null, null);
|
||||
formService = new FormService(null, alfrescoApiService, null);
|
||||
widget = new TypeaheadWidgetComponent(formService, null);
|
||||
widget.field = new FormFieldModel(new FormModel({ taskId: 'task-id' }));
|
||||
widget.field.restUrl = 'whateverURL';
|
||||
|
@@ -19,7 +19,12 @@ import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { LogService } from '../../services/log.service';
|
||||
import { SitesService } from '../../services/sites.service';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiCompatibility, MinimalNode, RelatedContentRepresentation } from '@alfresco/js-api';
|
||||
import {
|
||||
IntegrationAlfrescoOnPremiseApi,
|
||||
MinimalNode,
|
||||
RelatedContentRepresentation,
|
||||
ActivitiContentApi
|
||||
} from '@alfresco/js-api';
|
||||
import { Observable, from, throwError } from 'rxjs';
|
||||
import { ExternalContent } from '../components/widgets/core/external-content';
|
||||
import { ExternalContentLink } from '../components/widgets/core/external-content-link';
|
||||
@@ -33,9 +38,15 @@ export class ActivitiContentService {
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
integrationAlfrescoOnPremiseApi: IntegrationAlfrescoOnPremiseApi;
|
||||
contentApi: ActivitiContentApi;
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService,
|
||||
private sitesService: SitesService) {
|
||||
|
||||
this.integrationAlfrescoOnPremiseApi = new IntegrationAlfrescoOnPremiseApi(this.apiService.getInstance());
|
||||
this.contentApi = new ActivitiContentApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,9 +56,8 @@ export class ActivitiContentService {
|
||||
* @param folderId
|
||||
*/
|
||||
getAlfrescoNodes(accountId: string, folderId: string): Observable<[ExternalContent]> {
|
||||
const apiService: AlfrescoApiCompatibility = this.apiService.getInstance();
|
||||
const accountShortId = accountId.replace('alfresco-', '');
|
||||
return from(apiService.activiti.alfrescoApi.getContentInFolder(accountShortId, folderId))
|
||||
return from(this.integrationAlfrescoOnPremiseApi.getContentInFolder(accountShortId, folderId))
|
||||
.pipe(
|
||||
map(this.toJsonArray),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -60,12 +70,11 @@ export class ActivitiContentService {
|
||||
* @param includeAccount
|
||||
*/
|
||||
getAlfrescoRepositories(tenantId?: number, includeAccount?: boolean): Observable<any> {
|
||||
const apiService: AlfrescoApiCompatibility = this.apiService.getInstance();
|
||||
const opts = {
|
||||
tenantId,
|
||||
includeAccounts: includeAccount ? includeAccount : true
|
||||
};
|
||||
return from(apiService.activiti.alfrescoApi.getRepositories(opts))
|
||||
return from(this.integrationAlfrescoOnPremiseApi.getRepositories(opts))
|
||||
.pipe(
|
||||
map(this.toJsonArray),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -80,8 +89,7 @@ export class ActivitiContentService {
|
||||
* @param siteId
|
||||
*/
|
||||
linkAlfrescoNode(accountId: string, node: ExternalContent, siteId: string): Observable<ExternalContentLink> {
|
||||
const apiService: AlfrescoApiCompatibility = this.apiService.getInstance();
|
||||
return from(apiService.activiti.contentApi.createTemporaryRelatedContent({
|
||||
return from(this.contentApi.createTemporaryRelatedContent({
|
||||
link: true,
|
||||
name: node.title,
|
||||
simpleType: node.simpleType,
|
||||
@@ -95,7 +103,6 @@ export class ActivitiContentService {
|
||||
}
|
||||
|
||||
applyAlfrescoNode(node: MinimalNode, siteId: string, accountId: string) {
|
||||
const apiService: AlfrescoApiCompatibility = this.apiService.getInstance();
|
||||
const currentSideId = siteId ? siteId : this.sitesService.getSiteNameFromNodePath(node);
|
||||
const params: RelatedContentRepresentation = {
|
||||
source: accountId,
|
||||
@@ -104,7 +111,7 @@ export class ActivitiContentService {
|
||||
name: node.name,
|
||||
link: node.isLink
|
||||
};
|
||||
return from(apiService.activiti.contentApi.createTemporaryRelatedContent(params))
|
||||
return from(this.contentApi.createTemporaryRelatedContent(params))
|
||||
.pipe(
|
||||
map(this.toJson),
|
||||
catchError((err) => this.handleError(err))
|
||||
|
@@ -21,6 +21,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { FormModel } from '../components/widgets/core/form.model';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
import { CustomModelApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -31,8 +32,11 @@ export class EcmModelService {
|
||||
public static MODEL_NAME: string = 'activitiFormsModel';
|
||||
public static TYPE_MODEL: string = 'cm:folder';
|
||||
|
||||
private customModelApi: CustomModelApi;
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.customModelApi = new CustomModelApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
public createEcmTypeForActivitiForm(formName: string, form: FormModel): Observable<any> {
|
||||
@@ -128,7 +132,7 @@ export class EcmModelService {
|
||||
}
|
||||
|
||||
public activeEcmModel(modelName: string): Observable<any> {
|
||||
return from(this.apiService.getInstance().core.customModelApi.activateCustomModel(modelName))
|
||||
return from(this.customModelApi.activateCustomModel(modelName))
|
||||
.pipe(
|
||||
map(this.toJson),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -136,7 +140,7 @@ export class EcmModelService {
|
||||
}
|
||||
|
||||
public createEcmModel(modelName: string, nameSpace: string): Observable<any> {
|
||||
return from(this.apiService.getInstance().core.customModelApi.createCustomModel('DRAFT', '', modelName, modelName, nameSpace))
|
||||
return from(this.customModelApi.createCustomModel('DRAFT', '', modelName, modelName, nameSpace))
|
||||
.pipe(
|
||||
map(this.toJson),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -144,7 +148,7 @@ export class EcmModelService {
|
||||
}
|
||||
|
||||
public getEcmModels(): Observable<any> {
|
||||
return from(this.apiService.getInstance().core.customModelApi.getAllCustomModel())
|
||||
return from(this.customModelApi.getAllCustomModel())
|
||||
.pipe(
|
||||
map(this.toJson),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -152,7 +156,7 @@ export class EcmModelService {
|
||||
}
|
||||
|
||||
public getEcmType(modelName: string): Observable<any> {
|
||||
return from(this.apiService.getInstance().core.customModelApi.getAllCustomType(modelName))
|
||||
return from(this.customModelApi.getAllCustomType(modelName))
|
||||
.pipe(
|
||||
map(this.toJson),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -162,7 +166,7 @@ export class EcmModelService {
|
||||
public createEcmType(typeName: string, modelName: string, parentType: string): Observable<any> {
|
||||
const name = this.cleanNameType(typeName);
|
||||
|
||||
return from(this.apiService.getInstance().core.customModelApi.createCustomType(modelName, name, parentType, typeName, ''))
|
||||
return from(this.customModelApi.createCustomType(modelName, name, parentType, typeName, ''))
|
||||
.pipe(
|
||||
map(this.toJson),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -189,7 +193,7 @@ export class EcmModelService {
|
||||
}
|
||||
}
|
||||
|
||||
return from(this.apiService.getInstance().core.customModelApi.addPropertyToType(modelName, name, properties))
|
||||
return from(this.customModelApi.addPropertyToType(modelName, name, properties))
|
||||
.pipe(
|
||||
map(this.toJson),
|
||||
catchError((err) => this.handleError(err))
|
||||
|
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { formModelTabs } from '../../mock';
|
||||
import { FormService } from './form.service';
|
||||
import { setupTestBed } from '../../testing/setup-test-bed';
|
||||
@@ -53,7 +52,6 @@ const fakePeopleResponse = {
|
||||
describe('Form service', () => {
|
||||
|
||||
let service: FormService;
|
||||
let apiService: AlfrescoApiService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
@@ -64,7 +62,6 @@ describe('Form service', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.inject(FormService);
|
||||
apiService = TestBed.inject(AlfrescoApiService);
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
|
||||
@@ -226,22 +223,6 @@ describe('Form service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should get start form definition by process definition id', (done) => {
|
||||
|
||||
const processApiSpy = jasmine.createSpyObj(['getProcessDefinitionStartForm']);
|
||||
spyOn(apiService, 'getInstance').and.returnValue({
|
||||
activiti: {
|
||||
processApi: processApiSpy
|
||||
}
|
||||
} as any);
|
||||
processApiSpy.getProcessDefinitionStartForm.and.returnValue(Promise.resolve({ id: '1' }));
|
||||
|
||||
service.getStartFormDefinition('myprocess:1').subscribe(() => {
|
||||
expect(processApiSpy.getProcessDefinitionStartForm).toHaveBeenCalledWith('myprocess:1');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle error with generic message', () => {
|
||||
service.handleError(null).subscribe(() => {
|
||||
}, (error) => {
|
||||
|
@@ -31,9 +31,17 @@ import {
|
||||
import { EcmModelService } from './ecm-model.service';
|
||||
import { map, catchError, switchMap, combineAll, defaultIfEmpty } from 'rxjs/operators';
|
||||
import {
|
||||
Activiti,
|
||||
CompleteFormRepresentation,
|
||||
SaveFormRepresentation
|
||||
ModelsApi,
|
||||
ProcessInstanceVariablesApi,
|
||||
SaveFormRepresentation,
|
||||
TasksApi,
|
||||
TaskFormsApi,
|
||||
ProcessInstancesApi,
|
||||
FormModelsApi,
|
||||
ProcessDefinitionsApi,
|
||||
UsersApi,
|
||||
ActivitiGroupsApi
|
||||
} from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
@@ -44,6 +52,16 @@ export class FormService {
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
taskApi: TasksApi;
|
||||
taskFormsApi: TaskFormsApi;
|
||||
modelsApi: ModelsApi;
|
||||
editorApi: FormModelsApi;
|
||||
processDefinitionsApi: ProcessDefinitionsApi;
|
||||
processInstancesApi: ProcessInstancesApi;
|
||||
processInstanceVariablesApi: ProcessInstanceVariablesApi;
|
||||
groupsApi: ActivitiGroupsApi;
|
||||
usersApi: UsersApi;
|
||||
|
||||
formLoaded = new Subject<FormEvent>();
|
||||
formDataRefreshed = new Subject<FormEvent>();
|
||||
formFieldValueChanged = new Subject<FormFieldEvent>();
|
||||
@@ -65,34 +83,16 @@ export class FormService {
|
||||
constructor(private ecmModelService: EcmModelService,
|
||||
private apiService: AlfrescoApiService,
|
||||
protected logService: LogService) {
|
||||
}
|
||||
|
||||
private get taskApi(): Activiti.TaskApi {
|
||||
return this.apiService.getInstance().activiti.taskApi;
|
||||
}
|
||||
|
||||
private get modelsApi(): Activiti.ModelsApi {
|
||||
return this.apiService.getInstance().activiti.modelsApi;
|
||||
}
|
||||
|
||||
private get editorApi(): Activiti.EditorApi {
|
||||
return this.apiService.getInstance().activiti.editorApi;
|
||||
}
|
||||
|
||||
private get processApi(): Activiti.ProcessApi {
|
||||
return this.apiService.getInstance().activiti.processApi;
|
||||
}
|
||||
|
||||
private get processInstanceVariablesApi(): Activiti.ProcessInstanceVariablesApi {
|
||||
return this.apiService.getInstance().activiti.processInstanceVariablesApi;
|
||||
}
|
||||
|
||||
private get usersWorkflowApi(): Activiti.UsersWorkflowApi {
|
||||
return this.apiService.getInstance().activiti.usersWorkflowApi;
|
||||
}
|
||||
|
||||
private get groupsApi(): Activiti.GroupsApi {
|
||||
return this.apiService.getInstance().activiti.groupsApi;
|
||||
this.taskApi = new TasksApi(this.apiService.getInstance());
|
||||
this.modelsApi = new ModelsApi(this.apiService.getInstance());
|
||||
this.editorApi = new FormModelsApi(this.apiService.getInstance());
|
||||
this.processDefinitionsApi = new ProcessDefinitionsApi(this.apiService.getInstance());
|
||||
this.processInstanceVariablesApi = new ProcessInstanceVariablesApi(this.apiService.getInstance());
|
||||
this.processInstancesApi = new ProcessInstancesApi(this.apiService.getInstance());
|
||||
this.usersApi = new UsersApi(this.apiService.getInstance());
|
||||
this.groupsApi = new ActivitiGroupsApi(this.apiService.getInstance());
|
||||
this.taskFormsApi = new TaskFormsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,6 +100,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?
|
||||
* @param fixedSpace
|
||||
* @returns Form model created from input data
|
||||
*/
|
||||
parseForm(json: any, data?: FormValues, readOnly: boolean = false, fixedSpace?: boolean): FormModel {
|
||||
@@ -216,7 +217,7 @@ export class FormService {
|
||||
* @returns List of process definitions
|
||||
*/
|
||||
getProcessDefinitions(): Observable<any> {
|
||||
return from(this.processApi.getProcessDefinitions({}))
|
||||
return from(this.processDefinitionsApi.getProcessDefinitions({}))
|
||||
.pipe(
|
||||
map(this.toJsonArray),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -270,7 +271,7 @@ export class FormService {
|
||||
saveTaskForm(taskId: string, formValues: FormValues): Observable<any> {
|
||||
const saveFormRepresentation = <SaveFormRepresentation> { values: formValues };
|
||||
|
||||
return from(this.taskApi.saveTaskForm(taskId, saveFormRepresentation))
|
||||
return from(this.taskFormsApi.saveTaskForm(taskId, saveFormRepresentation))
|
||||
.pipe(
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
@@ -289,7 +290,7 @@ export class FormService {
|
||||
completeFormRepresentation.outcome = outcome;
|
||||
}
|
||||
|
||||
return from(this.taskApi.completeTaskForm(taskId, completeFormRepresentation))
|
||||
return from(this.taskFormsApi.completeTaskForm(taskId, completeFormRepresentation))
|
||||
.pipe(
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
@@ -301,7 +302,7 @@ export class FormService {
|
||||
* @returns Form definition
|
||||
*/
|
||||
getTaskForm(taskId: string): Observable<any> {
|
||||
return from(this.taskApi.getTaskForm(taskId))
|
||||
return from(this.taskFormsApi.getTaskForm(taskId))
|
||||
.pipe(
|
||||
map(this.toJson),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -346,7 +347,7 @@ export class FormService {
|
||||
* @returns Form definition
|
||||
*/
|
||||
getStartFormInstance(processId: string): Observable<any> {
|
||||
return from(this.processApi.getProcessInstanceStartForm(processId))
|
||||
return from(this.processInstancesApi.getProcessInstanceStartForm(processId))
|
||||
.pipe(
|
||||
map(this.toJson),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -359,7 +360,7 @@ export class FormService {
|
||||
* @returns Process instance
|
||||
*/
|
||||
getProcessInstance(processId: string): Observable<any> {
|
||||
return from(this.processApi.getProcessInstance(processId))
|
||||
return from(this.processInstancesApi.getProcessInstance(processId))
|
||||
.pipe(
|
||||
map(this.toJson),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -372,7 +373,7 @@ export class FormService {
|
||||
* @returns Form definition
|
||||
*/
|
||||
getStartFormDefinition(processId: string): Observable<any> {
|
||||
return from(this.processApi.getProcessDefinitionStartForm(processId))
|
||||
return from(this.processDefinitionsApi.getProcessDefinitionStartForm(processId))
|
||||
.pipe(
|
||||
map(this.toJson),
|
||||
catchError((err) => this.handleError(err))
|
||||
@@ -386,7 +387,7 @@ export class FormService {
|
||||
* @returns Field values
|
||||
*/
|
||||
getRestFieldValues(taskId: string, field: string): Observable<any> {
|
||||
return from(this.taskApi.getRestFieldValues(taskId, field))
|
||||
return from(this.taskFormsApi.getRestFieldValues(taskId, field))
|
||||
.pipe(
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
@@ -399,7 +400,7 @@ export class FormService {
|
||||
* @returns Field values
|
||||
*/
|
||||
getRestFieldValuesByProcessId(processDefinitionId: string, field: string): Observable<any> {
|
||||
return from(this.processApi.getRestFieldValues(processDefinitionId, field))
|
||||
return from(this.processDefinitionsApi.getRestFieldValues(processDefinitionId, field))
|
||||
.pipe(
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
@@ -413,7 +414,7 @@ export class FormService {
|
||||
* @returns Field values
|
||||
*/
|
||||
getRestFieldValuesColumnByProcessId(processDefinitionId: string, field: string, column?: string): Observable<any> {
|
||||
return from(this.processApi.getRestTableFieldValues(processDefinitionId, field, column))
|
||||
return from(this.processDefinitionsApi.getRestTableFieldValues(processDefinitionId, field, column))
|
||||
.pipe(
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
@@ -427,7 +428,7 @@ export class FormService {
|
||||
* @returns Field values
|
||||
*/
|
||||
getRestFieldValuesColumn(taskId: string, field: string, column?: string): Observable<any> {
|
||||
return from(this.taskApi.getRestFieldValuesColumn(taskId, field, column))
|
||||
return from(this.taskFormsApi.getRestFieldColumnValues(taskId, field, column))
|
||||
.pipe(
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
@@ -439,7 +440,7 @@ export class FormService {
|
||||
* @returns URL string
|
||||
*/
|
||||
getUserProfileImageApi(userId: string): string {
|
||||
return this.apiService.getInstance().activiti.userApi.getUserProfilePictureUrl(userId);
|
||||
return this.usersApi.getUserProfilePictureUrl(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -453,7 +454,7 @@ export class FormService {
|
||||
if (groupId) {
|
||||
option.groupId = groupId;
|
||||
}
|
||||
return from(this.usersWorkflowApi.getUsers(option))
|
||||
return from(this.usersApi.getUsers(option))
|
||||
.pipe(
|
||||
switchMap(response => <UserProcessModel[]> response.data || []),
|
||||
map((user) => {
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { LogService } from '../../services/log.service';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { RelatedContentRepresentation } from '@alfresco/js-api';
|
||||
import { ActivitiContentApi, RelatedContentRepresentation } from '@alfresco/js-api';
|
||||
import { Observable, from, throwError } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
@@ -30,12 +30,11 @@ export class ProcessContentService {
|
||||
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
|
||||
static GENERIC_ERROR_MESSAGE: string = 'Server error';
|
||||
|
||||
private contentApi: ActivitiContentApi;
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
}
|
||||
|
||||
private get contentApi(): any {
|
||||
return this.apiService.getInstance().activiti.contentApi;
|
||||
this.contentApi = new ActivitiContentApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,7 +74,7 @@ export class ProcessContentService {
|
||||
*/
|
||||
getContentPreview(contentId: number): Observable<Blob> {
|
||||
return new Observable((observer) => {
|
||||
this.contentApi.getContentPreview(contentId).then(
|
||||
this.contentApi.getRawContent(contentId).then(
|
||||
(result) => {
|
||||
observer.next(result);
|
||||
observer.complete();
|
||||
@@ -111,7 +110,7 @@ export class ProcessContentService {
|
||||
* @returns Binary data of the thumbnail image
|
||||
*/
|
||||
getContentThumbnail(contentId: number): Observable<Blob> {
|
||||
return from(this.contentApi.getContentThumbnail(contentId))
|
||||
return from(this.contentApi.getRawContent(contentId, 'thumbnail'))
|
||||
.pipe(catchError((err) => this.handleError(err)));
|
||||
}
|
||||
|
||||
|
@@ -30,17 +30,20 @@ import {
|
||||
import { TaskProcessVariableModel } from '../models/task-process-variable.model';
|
||||
import { WidgetVisibilityModel, WidgetTypeEnum } from '../models/widget-visibility.model';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
import { TaskFormsApi } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class WidgetVisibilityService {
|
||||
|
||||
private taskFormsApi: TaskFormsApi;
|
||||
private processVarList: TaskProcessVariableModel[];
|
||||
private form: FormModel;
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
this.taskFormsApi = new TaskFormsApi(this.apiService.getInstance());
|
||||
}
|
||||
|
||||
public refreshVisibility(form: FormModel, processVarList?: TaskProcessVariableModel[]) {
|
||||
@@ -319,7 +322,7 @@ export class WidgetVisibilityService {
|
||||
}
|
||||
|
||||
getTaskProcessVariable(taskId: string): Observable<TaskProcessVariableModel[]> {
|
||||
return from(this.apiService.getInstance().activiti.taskFormsApi.getTaskFormVariables(taskId))
|
||||
return from(this.taskFormsApi.getTaskFormVariables(taskId))
|
||||
.pipe(
|
||||
map((res) => {
|
||||
const jsonRes = this.toJson(res);
|
||||
|
Reference in New Issue
Block a user