You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2021/09/24 13:26:21 UTC

[incubator-streampipes] 07/12: [STREAMPIPES-427] Modify paths of file resource

This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 08ec202a66be22f7d53f957515477f045d92527a
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Fri Sep 24 14:38:26 2021 +0200

    [STREAMPIPES-427] Modify paths of file resource
---
 .../streampipes/rest/impl/PipelineElementFile.java |  11 +-
 .../file-overview/file-overview.component.ts       |  35 +--
 .../file-upload/file-upload-dialog.component.ts    |  20 +-
 ui/src/app/platform-services/apis/files.service.ts |  28 +-
 ui/src/app/services/rest-api.service.ts            | 350 ++++++---------------
 5 files changed, 144 insertions(+), 300 deletions(-)

diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementFile.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementFile.java
index e57a26d..e27d16e 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementFile.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementFile.java
@@ -19,7 +19,7 @@ package org.apache.streampipes.rest.impl;
 
 import org.apache.streampipes.manager.file.FileManager;
 import org.apache.streampipes.model.client.file.FileMetadata;
-import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
+import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
 import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
 import org.glassfish.jersey.media.multipart.FormDataParam;
 
@@ -28,16 +28,15 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import java.io.InputStream;
 
-@Path("/v2/users/{username}/files")
-public class PipelineElementFile extends AbstractRestResource {
+@Path("/v2/files")
+public class PipelineElementFile extends AbstractAuthGuardedRestResource {
 
   @POST
   @Consumes(MediaType.MULTIPART_FORM_DATA)
-  public Response storeFile(@PathParam("username") String username,
-                            @FormDataParam("file_upload") InputStream uploadedInputStream,
+  public Response storeFile(@FormDataParam("file_upload") InputStream uploadedInputStream,
                             @FormDataParam("file_upload") FormDataContentDisposition fileDetail) {
     try {
-      FileMetadata metadata = FileManager.storeFile(username, fileDetail.getFileName(), uploadedInputStream);
+      FileMetadata metadata = FileManager.storeFile(getAuthenticatedUsername(), fileDetail.getFileName(), uploadedInputStream);
       return ok(metadata);
     } catch (Exception e) {
       return fail();
diff --git a/ui/src/app/files/components/file-overview/file-overview.component.ts b/ui/src/app/files/components/file-overview/file-overview.component.ts
index 80f53f7..06a6c56 100644
--- a/ui/src/app/files/components/file-overview/file-overview.component.ts
+++ b/ui/src/app/files/components/file-overview/file-overview.component.ts
@@ -16,14 +16,13 @@
  *
  */
 
-import {Component, OnInit, ViewChild} from "@angular/core";
-import {FilesService} from "../../../platform-services/apis/files.service";
-import {FileMetadata} from "../../../core-model/gen/streampipes-model-client";
-import {MatTableDataSource} from "@angular/material/table";
-import {MatPaginator} from "@angular/material/paginator";
-import {DialogService} from "../../../core-ui/dialog/base-dialog/base-dialog.service";
-import {ConfirmDialogComponent} from "../../../core-ui/dialog/confirm-dialog/confirm-dialog.component";
-import {MatDialog} from "@angular/material/dialog";
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { FilesService } from '../../../platform-services/apis/files.service';
+import { FileMetadata } from '../../../core-model/gen/streampipes-model-client';
+import { MatTableDataSource } from '@angular/material/table';
+import { MatPaginator } from '@angular/material/paginator';
+import { ConfirmDialogComponent } from '../../../core-ui/dialog/confirm-dialog/confirm-dialog.component';
+import { MatDialog } from '@angular/material/dialog';
 
 @Component({
   selector: 'file-overview',
@@ -35,10 +34,10 @@ export class FileOverviewComponent implements OnInit {
   displayedColumns: string[] = ['filename', 'filetype', 'uploaded', 'action'];
 
   dataSource: MatTableDataSource<FileMetadata>;
-  filesAvailable: boolean = false;
+  filesAvailable = false;
 
   @ViewChild(MatPaginator) paginator: MatPaginator;
-  pageSize: number = 1;
+  pageSize = 1;
 
   constructor(private filesService: FilesService,
               private dialog: MatDialog) {
@@ -60,14 +59,14 @@ export class FileOverviewComponent implements OnInit {
   }
 
   deleteFile(fileMetadata: FileMetadata) {
-    let dialogRef = this.dialog.open(ConfirmDialogComponent, {
+    const dialogRef = this.dialog.open(ConfirmDialogComponent, {
       width: '500px',
       data: {
-        "title": "Do you really want to delete this file?",
-        "subtitle": "This cannot be undone.",
-        "cancelTitle": "No",
-        "okTitle": "Yes",
-        "confirmAndCancel": true
+        'title': 'Do you really want to delete this file?',
+        'subtitle': 'This cannot be undone.',
+        'cancelTitle': 'No',
+        'okTitle': 'Yes',
+        'confirmAndCancel': true
       },
     });
 
@@ -77,6 +76,6 @@ export class FileOverviewComponent implements OnInit {
           this.refreshFiles();
         });
       }
-    })
+    });
   }
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/files/dialog/file-upload/file-upload-dialog.component.ts b/ui/src/app/files/dialog/file-upload/file-upload-dialog.component.ts
index 52b5ffa..d0ebec8 100644
--- a/ui/src/app/files/dialog/file-upload/file-upload-dialog.component.ts
+++ b/ui/src/app/files/dialog/file-upload/file-upload-dialog.component.ts
@@ -16,10 +16,10 @@
  *
  */
 
-import {Component, OnInit} from '@angular/core';
-import {DialogRef} from "../../../core-ui/dialog/base-dialog/dialog-ref";
-import {HttpEventType, HttpResponse} from "@angular/common/http";
-import {FilesService} from "../../../platform-services/apis/files.service";
+import { Component, OnInit } from '@angular/core';
+import { DialogRef } from '../../../core-ui/dialog/base-dialog/dialog-ref';
+import { HttpEventType, HttpResponse } from '@angular/common/http';
+import { FilesService } from '../../../platform-services/apis/files.service';
 
 @Component({
   selector: 'file-upload-dialog-component',
@@ -28,13 +28,13 @@ import {FilesService} from "../../../platform-services/apis/files.service";
 })
 export class FileUploadDialogComponent implements OnInit {
 
-  inputValue: String;
-  fileName: String;
+  inputValue: string;
+  fileName: string;
 
   selectedUploadFile: File;
 
-  hasInput: Boolean;
-  errorMessage = "Please enter a value";
+  hasInput: boolean;
+  errorMessage = 'Please enter a value';
 
   uploadStatus = 0;
 
@@ -57,7 +57,7 @@ export class FileUploadDialogComponent implements OnInit {
     if (this.selectedUploadFile !== undefined) {
       this.filesService.uploadFile(this.selectedUploadFile).subscribe(
           event => {
-            if (event.type == HttpEventType.UploadProgress) {
+            if (event.type === HttpEventType.UploadProgress) {
               this.uploadStatus = Math.round(100 * event.loaded / event.total);
             } else if (event instanceof HttpResponse) {
               this.dialogRef.close();
@@ -73,4 +73,4 @@ export class FileUploadDialogComponent implements OnInit {
     this.dialogRef.close();
   }
 
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/platform-services/apis/files.service.ts b/ui/src/app/platform-services/apis/files.service.ts
index 017f193..480cc55 100644
--- a/ui/src/app/platform-services/apis/files.service.ts
+++ b/ui/src/app/platform-services/apis/files.service.ts
@@ -16,12 +16,12 @@
  *
  */
 
-import {Injectable} from "@angular/core";
-import {HttpClient, HttpEvent, HttpParams, HttpRequest} from "@angular/common/http";
-import {PlatformServicesCommons} from "./commons.service";
-import {Observable} from "rxjs";
-import {map} from "rxjs/operators";
-import {FileMetadata} from "../../core-model/gen/streampipes-model-client";
+import { Injectable } from '@angular/core';
+import { HttpClient, HttpEvent, HttpParams, HttpRequest } from '@angular/common/http';
+import { PlatformServicesCommons } from './commons.service';
+import { Observable } from 'rxjs';
+import { map } from 'rxjs/operators';
+import { FileMetadata } from '../../core-model/gen/streampipes-model-client';
 
 @Injectable()
 export class FilesService {
@@ -35,29 +35,29 @@ export class FilesService {
     const data: FormData = new FormData();
     data.append('file_upload', file, file.name);
 
-    let params = new HttpParams();
+    const params = new HttpParams();
     const options = {
-      params: params,
+      params,
       reportProgress: true,
     };
 
-    const req = new HttpRequest('POST', this.platformServicesCommons.authUserBasePath() + "/files", data, options);
+    const req = new HttpRequest('POST', this.platformServicesCommons.apiBasePath() + '/files', data, options);
     return this.http.request(req);
   }
 
   getFileMetadata(requiredFiletypes?: string[]): Observable<FileMetadata[]> {
-    let requiredFiletypeAppendix: string = "";
+    let requiredFiletypeAppendix = '';
     if (requiredFiletypes && requiredFiletypes.length > 0) {
-      requiredFiletypeAppendix = "?filetypes=" + requiredFiletypes.join();
+      requiredFiletypeAppendix = '?filetypes=' + requiredFiletypes.join();
     }
     return this.http
-        .get(this.platformServicesCommons.authUserBasePath() + "/files" + requiredFiletypeAppendix)
+        .get(this.platformServicesCommons.apiBasePath() + '/files' + requiredFiletypeAppendix)
         .pipe(map(response => {
           return (response as any[]).map(fm => FileMetadata.fromData(fm));
         }));
   }
 
   deleteFile(fileId: string) {
-    return this.http.delete(this.platformServicesCommons.authUserBasePath() + "/files/" + fileId);
+    return this.http.delete(this.platformServicesCommons.apiBasePath() + '/files/' + fileId);
   }
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/services/rest-api.service.ts b/ui/src/app/services/rest-api.service.ts
index 00e9abe..dbf50c4 100644
--- a/ui/src/app/services/rest-api.service.ts
+++ b/ui/src/app/services/rest-api.service.ts
@@ -16,24 +16,23 @@
  *
  */
 
-//import _ from 'lodash';
+// import _ from 'lodash';
 
 
-import {Injectable} from "@angular/core";
-import {AuthStatusService} from "./auth-status.service";
-import {PlatformServicesCommons} from "../platform-services/apis/commons.service";
-import {HttpClient} from "@angular/common/http";
-import {Observable} from "rxjs";
+import { Injectable } from '@angular/core';
+import { AuthStatusService } from './auth-status.service';
+import { PlatformServicesCommons } from '../platform-services/apis/commons.service';
+import { HttpClient } from '@angular/common/http';
+import { Observable } from 'rxjs';
 
 @Injectable()
 export class RestApi {
 
     encodeURIComponent: any;
-    
-    constructor (private AuthStatusService: AuthStatusService,
+
+    constructor (private authStatusService: AuthStatusService,
                  private platformServicesCommons: PlatformServicesCommons,
                  private $http: HttpClient) {
-        this.AuthStatusService = AuthStatusService;
     }
 
     getServerUrl() {
@@ -42,22 +41,14 @@ export class RestApi {
 
     urlBase() {
         return this.platformServicesCommons.authUserBasePath();
-    };
+    }
 
     urlApiBase() {
         return this.platformServicesCommons.apiBasePath();
     }
 
     getAssetUrl(appId) {
-        return this.getServerUrl() +"/pe/" +appId +"/assets";
-    }
-
-    getFileUrl(appId) {
-        return this.getServerUrl() + "/pe/" + appId + "/file"
-    }
-
-    getUserDetails() {
-        return this.$http.get(this.urlBase());
+        return this.getServerUrl() + '/pe/' + appId + '/assets';
     }
 
     updateUserDetails(user) {
@@ -65,406 +56,261 @@ export class RestApi {
     }
 
     getBlocks() {
-        return this.$http.get(this.urlBase() + "/block");
-    };
-    saveBlock(block) {
-        return this.$http.post(this.urlBase() + "/block", block);
-    };
+        return this.$http.get(this.urlBase() + '/block');
+    }
 
     getOwnActions() {
-        return this.$http.get(this.urlBase() +"/actions/own");
-    };
+        return this.$http.get(this.urlBase() + '/actions/own');
+    }
 
     getAvailableActions() {
-        return this.$http.get(this.urlBase() +"/actions/available");
-    };
+        return this.$http.get(this.urlBase() + '/actions/available');
+    }
 
     getPreferredActions() {
-        return this.$http.get(this.urlBase() +"/actions/favorites");
-    };
-
-    // addPreferredAction(elementUri) {
-    //     return this.$http({
-    //         method: 'POST',
-    //         url: this.urlBase() + "/actions/favorites",
-    //         data: $.param({uri: elementUri}),
-    //         headers: {'Content-Type': 'application/x-www-form-urlencoded'}
-    //     })
-    // }
-    //
-    // removePreferredAction(elementUri) {
-    //     return this.$http({
-    //         method: 'DELETE',
-    //         url: this.urlBase() + "/actions/favorites/" + encodeURIComponent(elementUri)
-    //     })
-    // }
+        return this.$http.get(this.urlBase() + '/actions/favorites');
+    }
 
     getOwnSepas() {
-        return this.$http.get(this.urlBase() +"/sepas/own");
-    };
+        return this.$http.get(this.urlBase() + '/sepas/own');
+    }
 
     getAvailableSepas() {
-        return this.$http.get(this.urlBase() +"/sepas/available");
-    };
+        return this.$http.get(this.urlBase() + '/sepas/available');
+    }
 
     getPreferredSepas() {
-        return this.$http.get(this.urlBase() +"/sepas/favorites");
-    };
-
-    // addPreferredSepa(elementUri) {
-    //     return this.$http({
-    //         method: 'POST',
-    //         url: this.urlBase() + "/sepas/favorites",
-    //         data: $.param({uri: elementUri}),
-    //         headers: {'Content-Type': 'application/x-www-form-urlencoded'}
-    //     })
-    // }
-    //
-    // removePreferredSepa(elementUri) {
-    //     return this.$http({
-    //         method: 'DELETE',
-    //         url: this.urlBase() + "/sepas/favorites/" + encodeURIComponent(elementUri)
-    //     })
-    // }
+        return this.$http.get(this.urlBase() + '/sepas/favorites');
+    }
 
     getOwnSources(): Observable<any> {
-        return this.$http.get(this.urlBase() +"/sources/own");
-    };
+        return this.$http.get(this.urlBase() + '/sources/own');
+    }
 
     getAvailableSources() {
-        return this.$http.get(this.urlBase() +"/sources/available");
-    };
+        return this.$http.get(this.urlBase() + '/sources/available');
+    }
 
     getPreferredSources() {
-        return this.$http.get(this.urlBase() +"/sources/favorites");
-    };
-
-    // addPreferredSource(elementUri) {
-    //     return this.$http({
-    //         method: 'POST',
-    //         url: this.urlBase() + "/sources/favorites",
-    //         data: $.param({uri: elementUri}),
-    //         headers: {'Content-Type': 'application/x-www-form-urlencoded'}
-    //     })
-    // }
-    //
-    // removePreferredSource(elementUri) {
-    //     return this.$http({
-    //         method: 'DELETE',
-    //         url: this.urlBase() + "/sources/favorites/" + encodeURIComponent(elementUri)
-    //     })
-    // }
-
-    getOwnStreams(source){
-        return this.$http.get(this.urlBase() + "/sources/" + encodeURIComponent(source.uri) + "/streams");
-
-    };
+        return this.$http.get(this.urlBase() + '/sources/favorites');
+    }
+
+    getOwnStreams(source) {
+        return this.$http.get(this.urlBase() + '/sources/' + encodeURIComponent(source.uri) + '/streams');
+
+    }
 
     jsonld(elementUri) {
-        return this.$http.get(this.urlBase() +"/element/" + encodeURIComponent(elementUri) +"/jsonld");
+        return this.$http.get(this.urlBase() + '/element/' + encodeURIComponent(elementUri) + '/jsonld');
     }
 
     configured(): Observable<any> {
-        return this.$http.get(this.getServerUrl() + "/setup/configured", {
+        return this.$http.get(this.getServerUrl() + '/setup/configured', {
             headers: { ignoreLoadingBar: '' }
         });
     }
 
-    getConfiguration() {
-        return this.$http.get(this.getServerUrl() +"/setup/configuration");
-        //return this.$http.get(this.getServerUrl() +"/semantic-epa-backend/api/v2/setup/configured");
-    }
-
     updateConfiguration(config) {
-        return this.$http.put(this.getServerUrl() +"/setup/configuration", config);
-        //return this.$http.get(this.getServerUrl() +"/semantic-epa-backend/api/v2/setup/configured");
-    };
+        return this.$http.put(this.getServerUrl() + '/setup/configuration', config);
+        // return this.$http.get(this.getServerUrl() +"/semantic-epa-backend/api/v2/setup/configured");
+    }
 
     getOwnPipelines(): Observable<any> {
-        return this.$http.get(this.urlBase() +"/pipelines/own");
-        //return this.$http.get("/semantic-epa-backend/api/pipelines");
-    };
-
-    getSystemPipelines() {
-        return this.$http.get(this.urlBase() +"/pipelines/system");
-    };
+        return this.$http.get(this.urlBase() + '/pipelines/own');
+        // return this.$http.get("/semantic-epa-backend/api/pipelines");
+    }
 
     storePipeline(pipeline) {
-        return this.$http.post(this.urlBase() +"/pipelines", pipeline);
+        return this.$http.post(this.urlBase() + '/pipelines', pipeline);
     }
 
     updateStream(stream) {
-        return this.$http.post(this.urlBase() +"/streams/update", stream);
+        return this.$http.post(this.urlBase() + '/streams/update', stream);
     }
 
     getPipelineCategories() {
-        return this.$http.get(this.urlBase() +"/pipelinecategories");
-    };
+        return this.$http.get(this.urlBase() + '/pipelinecategories');
+    }
 
     storePipelineCategory(pipelineCategory) {
-        return this.$http.post(this.urlBase() +"/pipelinecategories", pipelineCategory);
-    };
+        return this.$http.post(this.urlBase() + '/pipelinecategories', pipelineCategory);
+    }
 
     startPipeline(pipelineId) {
-        return this.$http.get(this.urlBase() +"/pipelines/" +pipelineId +"/start");
+        return this.$http.get(this.urlBase() + '/pipelines/' + pipelineId + '/start');
     }
 
     stopPipeline(pipelineId) {
-        return this.$http.get(this.urlBase() +"/pipelines/" +pipelineId +"/stop");
+        return this.$http.get(this.urlBase() + '/pipelines/' + pipelineId + '/stop');
     }
 
     getPipelineById(pipelineId) {
-        return this.$http.get(this.urlBase() + "/pipelines/" + pipelineId);
+        return this.$http.get(this.urlBase() + '/pipelines/' + pipelineId);
     }
 
     getPipelineStatusById(pipelineId) {
-        return this.$http.get(this.urlBase() + "/pipelines/" + pipelineId +"/status");
-    }
-
-    updatePipeline(pipeline){
-        var pipelineId = pipeline._id;
-        return this.$http.put(this.urlBase() + "/pipelines/" + pipelineId, pipeline);
+        return this.$http.get(this.urlBase() + '/pipelines/' + pipelineId + '/status');
     }
 
     getNotifications() {
-        return this.$http.get(this.urlApiBase() +"/notifications");
+        return this.$http.get(this.urlApiBase() + '/notifications');
     }
 
     getUnreadNotificationsCount(): Observable<any> {
-        return this.$http.get(this.urlApiBase() +"/notifications/count");
+        return this.$http.get(this.urlApiBase() + '/notifications/count');
     }
 
     getUnreadNotifications() {
-        return this.$http.get(this.urlApiBase() +"/notifications/unread");
+        return this.$http.get(this.urlApiBase() + '/notifications/unread');
     }
 
     getSepaById(elementId) {
-        return this.$http.get(this.urlBase() +"/sepas/" + encodeURIComponent(elementId));
+        return this.$http.get(this.urlBase() + '/sepas/' + encodeURIComponent(elementId));
     }
 
-    getActionById(elementId) {
-        return this.$http.get(this.urlBase() +"/actions/" + encodeURIComponent(elementId));
-    };
-
     getOntologyProperties() {
-        return this.$http.get( this.getServerUrl() + "/ontology/properties");
-    };
+        return this.$http.get( this.getServerUrl() + '/ontology/properties');
+    }
 
     getOntologyPropertyDetails(propertyId) {
-        return this.$http.get(this.getServerUrl() + "/ontology/properties/" + encodeURIComponent(propertyId));
+        return this.$http.get(this.getServerUrl() + '/ontology/properties/' + encodeURIComponent(propertyId));
     }
 
     addOntologyProperty(propertyData) {
-        return this.$http.post(this.getServerUrl() + "/ontology/properties", propertyData);
+        return this.$http.post(this.getServerUrl() + '/ontology/properties', propertyData);
     }
 
     getOntologyConcepts() {
-        return this.$http.get(this.getServerUrl() + "/ontology/types");
-    };
+        return this.$http.get(this.getServerUrl() + '/ontology/types');
+    }
 
     getOntologyConceptDetails(conceptId) {
-        return this.$http.get(this.getServerUrl() + "/ontology/types/" + encodeURIComponent(conceptId));
+        return this.$http.get(this.getServerUrl() + '/ontology/types/' + encodeURIComponent(conceptId));
     }
 
     getOntologyNamespaces() {
-        return this.$http.get(this.getServerUrl() + "/ontology/namespaces");
+        return this.$http.get(this.getServerUrl() + '/ontology/namespaces');
     }
 
     addOntologyNamespace(namespace) {
-        return this.$http.post(this.getServerUrl() + "/ontology/namespaces", namespace);
+        return this.$http.post(this.getServerUrl() + '/ontology/namespaces', namespace);
     }
 
     addOntologyConcept(conceptData) {
-        return this.$http.post(this.getServerUrl() + "/ontology/types", conceptData);
-    }
-
-    addOntologyInstance(instanceData) {
-        return this.$http.post(this.getServerUrl() + "/ontology/instances", instanceData);
+        return this.$http.post(this.getServerUrl() + '/ontology/types', conceptData);
     }
 
     getOntologyInstanceDetails(instanceId) {
-        return this.$http.get(this.getServerUrl() + "/ontology/instances/" + encodeURIComponent(instanceId));
-    }
-
-    updateOntologyProperty(propertyId, propertyData) {
-        return this.$http.put(this.getServerUrl() + "/ontology/properties/" + encodeURIComponent(propertyId), propertyData);
+        return this.$http.get(this.getServerUrl() + '/ontology/instances/' + encodeURIComponent(instanceId));
     }
 
     updateOntologyConcept(conceptId, conceptData) {
-        return this.$http.put(this.getServerUrl() + "/ontology/types/" + encodeURIComponent(conceptId), conceptData);
+        return this.$http.put(this.getServerUrl() + '/ontology/types/' + encodeURIComponent(conceptId), conceptData);
     }
 
     updateOntologyInstance(instanceId, instanceData) {
-        return this.$http.put(this.getServerUrl() + "/ontology/instances/" + encodeURIComponent(instanceId), instanceData);
-    }
-
-    // deleteOntologyInstance(instanceId) {
-    //     return this.$http({
-    //         method: 'DELETE',
-    //         url: this.getServerUrl() + "/ontology/instances/" + encodeURIComponent(instanceId)
-    //     });
-    // }
-    //
-    // deleteOntologyProperty(propertyId) {
-    //     return this.$http({
-    //         method: 'DELETE',
-    //         url: this.getServerUrl() + "/ontology/properties/" + encodeURIComponent(propertyId)
-    //     });
-    // }
-    //
-    // deleteOntologyConcept(conceptId) {
-    //     return this.$http({
-    //         method: 'DELETE',
-    //         url: this.getServerUrl() + "/ontology/types/" + encodeURIComponent(conceptId)
-    //     });
-    // }
+        return this.$http.put(this.getServerUrl() + '/ontology/instances/' + encodeURIComponent(instanceId), instanceData);
+    }
 
     getAvailableContexts() {
-        return this.$http.get(this.getServerUrl()+ "/contexts");
-    };
-
-    // deleteContext(contextId) {
-    //     return this.$http({
-    //         method: 'DELETE',
-    //         url: this.getServerUrl() + "/contexts/" + encodeURIComponent(contextId)
-    //     });
-    // }
+        return this.$http.get(this.getServerUrl() + '/contexts');
+    }
 
     getDomainKnowledgeItems(query) {
-        return this.$http.post(this.getServerUrl() + "/autocomplete/domain", query);
-    };
+        return this.$http.post(this.getServerUrl() + '/autocomplete/domain', query);
+    }
 
 
     getSepasFromOntology() {
-        return this.$http.get(this.getServerUrl() + "/ontology/sepas")
+        return this.$http.get(this.getServerUrl() + '/ontology/sepas');
     }
 
     getSepaDetailsFromOntology(uri, keepIds) {
-        return this.$http.get(this.getServerUrl() + "/ontology/sepas/" + encodeURIComponent(uri) +"?keepIds=" +keepIds);
+        return this.$http.get(this.getServerUrl() + '/ontology/sepas/' + encodeURIComponent(uri) + '?keepIds=' + keepIds);
     }
 
     getSourcesFromOntology() {
-        return this.$http.get(this.getServerUrl() + "/ontology/sources")
+        return this.$http.get(this.getServerUrl() + '/ontology/sources');
     }
 
     getSourceDetailsFromOntology(uri, keepIds) {
-        return this.$http.get(this.getServerUrl() + "/ontology/sources/" + encodeURIComponent(uri) +"?keepIds=" +keepIds);
+        return this.$http.get(this.getServerUrl() + '/ontology/sources/' + encodeURIComponent(uri) + '?keepIds=' + keepIds);
     }
 
     getActionsFromOntology() {
-        return this.$http.get(this.getServerUrl() + "/ontology/actions")
+        return this.$http.get(this.getServerUrl() + '/ontology/actions');
     }
 
     getActionDetailsFromOntology(uri, keepIds) {
-        return this.$http.get(this.getServerUrl() + "/ontology/actions/" + encodeURIComponent(uri) +"?keepIds=" +keepIds);
+        return this.$http.get(this.getServerUrl() + '/ontology/actions/' + encodeURIComponent(uri) + '?keepIds=' + keepIds);
     }
 
     getAllUnits() {
-        return this.$http.get(this.getServerUrl() + "/units/instances");
+        return this.$http.get(this.getServerUrl() + '/units/instances');
     }
 
     getAllUnitTypes() {
-        return this.$http.get(this.getServerUrl() + "/units/types");
+        return this.$http.get(this.getServerUrl() + '/units/types');
     }
 
     getUnit(resource) {
-        return this.$http.get(this.getServerUrl() + "/units/instances/" + encodeURIComponent(resource));
+        return this.$http.get(this.getServerUrl() + '/units/instances/' + encodeURIComponent(resource));
     }
 
     getEpaCategories() {
-        return this.$http.get(this.getServerUrl() + "/categories/epa");
-    }
-
-    getEcCategories() {
-        return this.$http.get(this.getServerUrl() + "/categories/ec");
-    }
-
-    getEpCategories() {
-        return this.$http.get(this.getServerUrl() + "/categories/ep");
+        return this.$http.get(this.getServerUrl() + '/categories/epa');
     }
 
     getAdapterCategories() {
-        return this.$http.get(this.getServerUrl() + "/categories/adapter");
+        return this.$http.get(this.getServerUrl() + '/categories/adapter');
     }
 
     getAvailableApps(elementId) {
-        return this.$http.get(this.urlBase() +"/marketplace");
-    }
-
-    installApp(bundleInfo) {
-        return this.$http.post(this.urlBase() +"/marketplace/install", bundleInfo);
-    }
-
-    uninstallApp(bundleInfo) {
-        return this.$http.post(this.urlBase() +"/marketplace/uninstall", bundleInfo);
+        return this.$http.get(this.urlBase() + '/marketplace');
     }
 
     getTargetPods() {
-        return this.$http.get(this.urlBase() +"/marketplace/pods");
+        return this.$http.get(this.urlBase() + '/marketplace/pods');
     }
 
 
     getAuthc(): Observable<any> {
-        return this.$http.get(this.getServerUrl() + "/admin/authc");
-    }
-
-    loginSso(credentials, componentId, sessionId) {
-        return this.$http.post(this.getServerUrl() + "/admin/login/" +componentId +"?session=" +sessionId, credentials);
+        return this.$http.get(this.getServerUrl() + '/admin/authc');
     }
 
     logout() {
-        return this.$http.get(this.getServerUrl() + "/admin/logout");
+        return this.$http.get(this.getServerUrl() + '/admin/logout');
     }
 
     register(payload) {
-        return this.$http.post(this.getServerUrl() +"/admin/register", payload);
+        return this.$http.post(this.getServerUrl() + '/admin/register', payload);
     }
 
-    // deployStorm(payload) {
-    //     return this.$http({method: 'GET', responseType : 'arraybuffer', headers: {'Accept' : 'application/zip'}, url: this.urlBase() + '/deploy/storm'})
-    //
-    // }
-
     getApplicationLinks() {
-        return this.$http.get(this.getServerUrl() + "/applink");
-    };
-
-    // getRuntimeInfo(dataStream) {
-    //     return this.$http.post(this.urlBase() +"/pipeline-element/runtime", dataStream, {
-    //         ignoreLoadingBar: true
-    //     });
-    // }
-
-    getDocumentation(appId) {
-        return this.$http.get(this.getAssetUrl(appId) +"/documentation");
+        return this.$http.get(this.getServerUrl() + '/applink');
     }
 
-    // uploadFile(data) {
-    //     return this.$http.post(this.urlBase() + "/files", data, {headers: {'Content-Type': undefined },
-    //         transformRequest: angular.identity});
-    // }
-
     getFileMetadata() {
-        return this.$http.get(this.urlBase() + "/files");
+        return this.$http.get(this.urlApiBase() + '/files');
     }
 
     getCachedPipeline() {
-        return this.$http.get(this.urlApiBase() + "/pipeline-cache");
+        return this.$http.get(this.urlApiBase() + '/pipeline-cache');
     }
 
     updateCachedPipeline(rawPipelineModel: any) {
-        return this.$http.post(this.urlApiBase() + "/pipeline-cache", rawPipelineModel);
+        return this.$http.post(this.urlApiBase() + '/pipeline-cache', rawPipelineModel);
     }
 
     removePipelineFromCache() {
-        return this.$http.delete(this.urlApiBase() + "/pipeline-cache");
+        return this.$http.delete(this.urlApiBase() + '/pipeline-cache');
     }
 
     getVersionInfo() {
-        return this.$http.get(this.getServerUrl() + "/info/versions");
+        return this.$http.get(this.getServerUrl() + '/info/versions');
     }
 
     getSystemInfo() {
-        return this.$http.get(this.getServerUrl() + "/info/system");
+        return this.$http.get(this.getServerUrl() + '/info/system');
     }
 }