[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:
Eugenio Romano
2021-08-04 17:31:35 +02:00
committed by GitHub
parent 5d5b582e32
commit f30b20cc46
113 changed files with 1375 additions and 2348 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { NodeEntry, DownloadEntry, DownloadBodyCreate } from '@alfresco/js-api';
import { DownloadEntry, DownloadBodyCreate, DownloadsApi } from '@alfresco/js-api';
import { Injectable } from '@angular/core';
import { Observable, from, throwError } from 'rxjs';
import { LogService } from './log.service';
@@ -27,8 +27,11 @@ import { catchError } from 'rxjs/operators';
})
export class DownloadZipService {
downloadsApi: DownloadsApi;
constructor(private apiService: AlfrescoApiService,
private logService: LogService) {
this.downloadsApi = new DownloadsApi(this.apiService.getInstance());
}
/**
@@ -37,37 +40,18 @@ export class DownloadZipService {
* @returns Status object for the download
*/
createDownload(payload: DownloadBodyCreate): Observable<DownloadEntry> {
return from(this.apiService.getInstance().core.downloadsApi.createDownload(payload)).pipe(
return from(this.downloadsApi.createDownload(payload)).pipe(
catchError((err) => this.handleError(err))
);
}
/**
* Gets a content URL for the given node.
* @param nodeId Node to get URL for.
* @param attachment Toggles whether to retrieve content as an attachment for download
* @returns URL string
*/
getContentUrl(nodeId: string, attachment?: boolean): string {
return this.apiService.getInstance().content.getContentUrl(nodeId, attachment);
}
/**
* Gets a Node via its node ID.
* @param nodeId ID of the target node
* @returns Details of the node
*/
getNode(nodeId: string): Observable<NodeEntry> {
return from(this.apiService.getInstance().core.nodesApi.getNode(nodeId));
}
/**
* Gets status information for a download node.
* @param downloadId ID of the download node
* @returns Status object for the download
*/
getDownload(downloadId: string): Observable<DownloadEntry> {
return from(this.apiService.getInstance().core.downloadsApi.getDownload(downloadId));
return from(this.downloadsApi.getDownload(downloadId));
}
/**
@@ -75,7 +59,7 @@ export class DownloadZipService {
* @param downloadId ID of the target download node
*/
cancelDownload(downloadId: string) {
this.apiService.getInstance().core.downloadsApi.cancelDownload(downloadId);
this.downloadsApi.cancelDownload(downloadId);
}
private handleError(error: any) {