Skip to content

Commit

Permalink
[ADF-5426] Remove compatibility layer from Lib (#7110)
Browse files Browse the repository at this point in the history
* remove compatibility step 1

* remove compatibility step 2

* remove compatibility step 3

* remove compatibility step 4

* remove compatibility step 5
  • Loading branch information
eromano committed Aug 4, 2021
1 parent 5d5b582 commit f30b20c
Show file tree
Hide file tree
Showing 113 changed files with 1,369 additions and 2,342 deletions.
Expand Up @@ -31,7 +31,8 @@ import {
import { ActivatedRoute, Router } from '@angular/router';
import {
Pagination,
UserProcessInstanceFilterRepresentation
UserProcessInstanceFilterRepresentation,
ScriptFilesApi
} from '@alfresco/js-api';
import {
FORM_FIELD_VALIDATORS, FormRenderingService, FormService,
Expand Down Expand Up @@ -167,6 +168,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
];

private onDestroy$ = new Subject<boolean>();
private scriptFileApi: ScriptFilesApi;

constructor(private elementRef: ElementRef,
private route: ActivatedRoute,
Expand All @@ -181,6 +183,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
private notificationService: NotificationService,
private preferenceService: UserPreferencesService) {

this.scriptFileApi = new ScriptFilesApi(this.apiService.getInstance());
this.defaultProcessName = this.appConfig.get<string>('adf-start-process.name');
this.defaultProcessDefinitionName = this.appConfig.get<string>('adf-start-process.processDefinitionName');
this.defaultTaskName = this.appConfig.get<string>('adf-start-task.name');
Expand Down Expand Up @@ -488,7 +491,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
}

loadStencilScriptsInPageFromProcessService() {
this.apiService.getInstance().activiti.scriptFileApi.getControllers().then((response) => {
this.scriptFileApi.getControllers().then((response) => {
if (response) {
const stencilScript = document.createElement('script');
stencilScript.type = 'text/javascript';
Expand Down
199 changes: 0 additions & 199 deletions lib/content-services/src/lib/aspect-list/aspect-list.service.spec.ts

This file was deleted.

Expand Up @@ -22,17 +22,20 @@ import { from, Observable, of, Subject, zip } from 'rxjs';
import { AspectListDialogComponentData } from './aspect-list-dialog-data.interface';
import { AspectListDialogComponent } from './aspect-list-dialog.component';
import { catchError, map } from 'rxjs/operators';
import { AspectEntry, AspectPaging } from '@alfresco/js-api';
import { AspectEntry, AspectPaging, AspectsApi } from '@alfresco/js-api';

@Injectable({
providedIn: 'root'
})
export class AspectListService {

private aspectsApi: AspectsApi;

constructor(private alfrescoApiService: AlfrescoApiService,
private appConfigService: AppConfigService,
private dialog: MatDialog,
private logService: LogService) {
this.aspectsApi = new AspectsApi(this.alfrescoApiService.getInstance());
}

getAspects(): Observable<AspectEntry[]> {
Expand All @@ -50,7 +53,7 @@ export class AspectListService {
where,
include: ['properties']
};
return from(this.alfrescoApiService.aspectsApi.listAspects(opts))
return from(this.aspectsApi.listAspects(opts))
.pipe(
map((result: AspectPaging) => this.filterAspectByConfig(whiteList, result?.list?.entries)),
catchError((error) => {
Expand All @@ -66,7 +69,7 @@ export class AspectListService {
where,
include: ['properties']
};
return from(this.alfrescoApiService.aspectsApi.listAspects(opts))
return from(this.aspectsApi.listAspects(opts))
.pipe(
map((result: AspectPaging) => result?.list?.entries),
catchError((error) => {
Expand Down
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { AlfrescoApiService, AppConfigService, setupTestBed } from '@alfresco/adf-core';
import { AppConfigService, setupTestBed } from '@alfresco/adf-core';
import { ClassesApi, Node } from '@alfresco/js-api';
import { TestBed } from '@angular/core/testing';
import { ContentMetadataService } from './content-metadata.service';
Expand All @@ -24,6 +24,7 @@ import { PropertyGroup } from '../interfaces/property-group.interface';
import { TranslateModule } from '@ngx-translate/core';
import { ContentTypePropertiesService } from './content-type-property.service';
import { ContentTestingModule } from '../../testing/content.testing.module';
import { PropertyDescriptorsService } from './property-descriptors.service';

describe('ContentMetaDataService', () => {

Expand Down Expand Up @@ -67,8 +68,8 @@ describe('ContentMetaDataService', () => {
beforeEach(() => {
service = TestBed.inject(ContentMetadataService);
contentPropertyService = TestBed.inject(ContentTypePropertiesService);
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
classesApi = alfrescoApiService.classesApi;
const propertyDescriptorsService = TestBed.inject(PropertyDescriptorsService);
classesApi = propertyDescriptorsService['classesApi'];
appConfig = TestBed.inject(AppConfigService);
});

Expand Down
Expand Up @@ -17,7 +17,7 @@

import { TestBed } from '@angular/core/testing';
import { PropertyDescriptorsService } from './property-descriptors.service';
import { AlfrescoApiService, setupTestBed } from '@alfresco/adf-core';
import { setupTestBed } from '@alfresco/adf-core';
import { ClassesApi } from '@alfresco/js-api';
import { PropertyGroup } from '../interfaces/content-metadata.interfaces';
import { ContentTestingModule } from '../../testing/content.testing.module';
Expand All @@ -37,8 +37,7 @@ describe('PropertyDescriptorLoaderService', () => {

beforeEach(() => {
service = TestBed.inject(PropertyDescriptorsService);
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
classesApi = alfrescoApiService.classesApi;
classesApi = service['classesApi'];
});

it('should load the groups passed by paramter', () => {
Expand Down
Expand Up @@ -20,18 +20,22 @@ import { AlfrescoApiService } from '@alfresco/adf-core';
import { Observable, defer, forkJoin } from 'rxjs';
import { PropertyGroup, PropertyGroupContainer } from '../interfaces/content-metadata.interfaces';
import { map } from 'rxjs/operators';
import { ClassesApi } from '@alfresco/js-api';

@Injectable({
providedIn: 'root'
})
export class PropertyDescriptorsService {
private classesApi: ClassesApi;

constructor(private alfrescoApiService: AlfrescoApiService) {}
constructor(private alfrescoApiService: AlfrescoApiService) {
this.classesApi = new ClassesApi(this.alfrescoApiService.getInstance());
}

load(groupNames: string[]): Observable<PropertyGroupContainer> {
const groupFetchStreams = groupNames
.map((groupName) => groupName.replace(':', '_'))
.map((groupName) => defer( () => this.alfrescoApiService.classesApi.getClass(groupName)) );
.map((groupName) => defer(() => this.classesApi.getClass(groupName)));

return forkJoin(groupFetchStreams).pipe(
map(this.convertToObject)
Expand Down
Expand Up @@ -17,7 +17,7 @@

import { Directive, Input, HostListener, OnChanges, NgZone, OnDestroy } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { NodeEntry, Node } from '@alfresco/js-api';
import { NodeEntry, NodesApi } from '@alfresco/js-api';

import { ShareDialogComponent } from './content-node-share.dialog';
import { Observable, from, Subject } from 'rxjs';
Expand All @@ -43,11 +43,13 @@ export class NodeSharedDirective implements OnChanges, OnDestroy {
baseShareUrl: string;

private onDestroy$ = new Subject<boolean>();
private nodesApi = new NodesApi();

constructor(
private dialog: MatDialog,
private zone: NgZone,
private alfrescoApiService: AlfrescoApiService) {
this.nodesApi = new NodesApi(this.alfrescoApiService.getInstance());
}

ngOnDestroy() {
Expand All @@ -61,22 +63,22 @@ export class NodeSharedDirective implements OnChanges, OnDestroy {
const nodeId = nodeEntry.entry['nodeId'] || nodeEntry.entry['guid'];

if (nodeId) {
this.getNodeInfo(nodeId).subscribe((entry) => {
this.openShareLinkDialog({ entry });
this.getNodeInfo(nodeId).subscribe((node) => {
this.openShareLinkDialog(node);
});
} else {
this.openShareLinkDialog(nodeEntry);
}
}
}

private getNodeInfo(nodeId: string): Observable<Node> {
private getNodeInfo(nodeId: string): Observable<NodeEntry> {
const options = {
include: ['allowableOperations']
include: ['allowableOperations']
};

return from(this.alfrescoApiService.nodesApi.getNodeInfo(nodeId, options));
}
return from(this.nodesApi.getNode(nodeId, options));
}

private openShareLinkDialog(node: NodeEntry) {
this.dialog.open(ShareDialogComponent, {
Expand Down

0 comments on commit f30b20c

Please sign in to comment.