2017-12-08 10:51:39 +01:00
|
|
|
import { Injectable, ReflectiveInjector, Injector } from '@angular/core';
|
|
|
|
import { JsonObjest } from '../../app/entities/JsonObject.class';
|
2017-09-14 12:37:36 +02:00
|
|
|
import { DatasetProfile } from '../entities/datasetprofile';
|
2017-12-08 10:51:39 +01:00
|
|
|
import { Project } from '../entities/model/project';
|
|
|
|
import { RestBase } from './rest-base';
|
2017-10-17 11:13:10 +02:00
|
|
|
import 'rxjs/Rx';
|
2017-09-14 12:37:36 +02:00
|
|
|
|
|
|
|
import './../../assets/xml2json.min.js';
|
|
|
|
declare var X2JS: any;
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class ServerService {
|
|
|
|
|
|
|
|
xml2jsonOBJ: any;
|
2017-12-08 10:51:39 +01:00
|
|
|
|
2017-11-08 11:35:56 +01:00
|
|
|
constructor(private restBase: RestBase) {
|
2017-09-14 12:37:36 +02:00
|
|
|
this.xml2jsonOBJ = new X2JS();
|
|
|
|
}
|
|
|
|
|
2017-10-18 18:08:21 +02:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public listDatasetIDs() {
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("dataset");
|
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getAllDatasets() {
|
|
|
|
return this.restBase.get("getAllDatasets");
|
2017-10-18 18:08:21 +02:00
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getAllDatasetIDs(datasetId: string) {
|
|
|
|
return this.restBase.get("dataset/" + datasetId);
|
2017-10-18 18:08:21 +02:00
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getDatasetByID(datasetId: string) {
|
|
|
|
return this.restBase.get("datasets/" + datasetId);
|
2017-11-01 11:27:05 +01:00
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public setDataset(dataset) {
|
2017-11-01 11:27:05 +01:00
|
|
|
return this.restBase.post("dataset/update", dataset);
|
|
|
|
|
|
|
|
}
|
2017-10-18 18:08:21 +02:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getAllDmps() {
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("dmp/getAll");
|
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public listDmpsLabelID() {
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("dmp/listDMPLabelID");
|
2017-12-08 10:51:39 +01:00
|
|
|
}
|
2017-10-18 18:08:21 +02:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getDmp(dmpid: string, eager?: boolean) {
|
|
|
|
if (eager)
|
|
|
|
return this.restBase.get("dmps/" + dmpid, { "eager": true });
|
2017-12-07 16:15:28 +01:00
|
|
|
else
|
2017-12-08 10:51:39 +01:00
|
|
|
return this.restBase.get("dmps/" + dmpid, { "eager": true });
|
2017-10-18 18:08:21 +02:00
|
|
|
}
|
|
|
|
|
2017-12-07 16:15:28 +01:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getDmpHistory(dmpid: string) {
|
|
|
|
return this.restBase.get("dmp/history/" + dmpid);
|
2017-11-24 17:22:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public listDmpIDs() {
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("dmps");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public listProjectIDs() {
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("projects");
|
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getAllProjects() {
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("project/getAll");
|
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getProject(projectID: string, eager?: boolean) {
|
|
|
|
if (eager)
|
|
|
|
return this.restBase.get("projects/" + projectID, { "eager": true });
|
2017-11-24 09:39:24 +01:00
|
|
|
else
|
2017-12-08 10:51:39 +01:00
|
|
|
return this.restBase.get("projects/" + projectID, { "eager": false });
|
2017-10-18 18:08:21 +02:00
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public listProjectsLabelID() {
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("project/listAllLabelIDs");
|
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public listDmpsUser() {
|
2017-10-23 18:16:04 +02:00
|
|
|
return this.restBase.get("dmp/listDMPLabelID");
|
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getProjectsOfUser() {
|
2017-10-23 18:16:04 +02:00
|
|
|
return this.restBase.get("project/getofuser");
|
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public createProject(data: any) {
|
2017-10-23 18:16:04 +02:00
|
|
|
return this.restBase.post("project/createofuser", data);
|
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public updateProject(data: any) {
|
2017-11-06 17:25:23 +01:00
|
|
|
return this.restBase.post("project/update", data);
|
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getDmpsOfProject(projectID: string) {
|
|
|
|
return this.restBase.get("project/dmps", { "id": projectID });
|
2017-11-24 17:22:52 +01:00
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getAllDataSet() {
|
|
|
|
return this.restBase.get("dataset/getAll");
|
2017-10-25 15:17:16 +02:00
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getDmpOfUser() {
|
|
|
|
return this.restBase.get("dmp/getofuser");
|
2017-10-25 15:17:16 +02:00
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public createDmpForCurrentUser(data: any) {
|
|
|
|
return this.restBase.post("dmp/createofuser", data);
|
2017-10-27 09:48:53 +02:00
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public updateDmp(data: any) {
|
2017-11-01 12:30:39 +01:00
|
|
|
return this.restBase.post("dmp/update", data);
|
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public cloneDmp(data: any) {
|
2017-11-07 10:45:19 +01:00
|
|
|
return this.restBase.post("dmp/cloneforuser", data);
|
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public deleteDmp(dmp: any) {
|
2017-11-06 14:11:03 +01:00
|
|
|
return this.restBase.post("dmp/softdelete", dmp);
|
|
|
|
}
|
2017-10-31 18:59:27 +01:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getDatasetForDmp(data: any) {
|
|
|
|
return this.restBase.post("dmp/getdatasets", data);
|
2017-11-24 17:22:52 +01:00
|
|
|
}
|
2017-10-27 16:08:10 +02:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public createDatasetForDmp(data: any) {
|
|
|
|
return this.restBase.post("dataset/create", data);
|
2017-11-24 17:22:52 +01:00
|
|
|
}
|
2017-10-27 16:08:10 +02:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getAllDatsetsProfile() {
|
|
|
|
return this.restBase.get("datasetprofile/getAll");
|
2017-11-24 17:22:52 +01:00
|
|
|
}
|
2017-10-30 15:56:50 +01:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getDatasetProfileByID(id) {
|
|
|
|
return this.restBase.get("datasetprofiles/" + id);
|
2017-11-24 17:22:52 +01:00
|
|
|
}
|
2017-10-30 17:37:17 +01:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public updateDatsetsProfile(data: any) {
|
|
|
|
return this.restBase.post("dataset/update", data);
|
2017-11-24 17:22:52 +01:00
|
|
|
}
|
2017-12-08 10:51:39 +01:00
|
|
|
|
|
|
|
public deleteDataset(dataset: any) {
|
2017-11-24 17:22:52 +01:00
|
|
|
return this.restBase.post("dataset/softdelete", dataset);
|
|
|
|
}
|
2017-11-06 14:11:03 +01:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getUserByID(id: string) {
|
|
|
|
return this.restBase.get("users/" + id);
|
2017-11-24 17:22:52 +01:00
|
|
|
}
|
2017-11-06 14:11:03 +01:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public whoami() {
|
2017-11-24 17:22:52 +01:00
|
|
|
return this.restBase.get("user/whoami");
|
|
|
|
}
|
2017-11-16 13:36:16 +01:00
|
|
|
|
2017-11-06 14:11:03 +01:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public updateDataset(id: string, properties: any) {
|
|
|
|
return this.restBase.post("datasetprofile/save/" + id, properties);
|
2017-12-05 17:56:21 +01:00
|
|
|
}
|
2017-12-07 16:15:28 +01:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public getSingleDataset(id) {
|
|
|
|
return this.restBase.get("datasetprofile/get/" + id);
|
2017-11-01 18:18:27 +01:00
|
|
|
}
|
2017-12-08 10:51:39 +01:00
|
|
|
|
|
|
|
getThroughProxy(url: string, query: string) {
|
2017-11-08 14:33:14 +01:00
|
|
|
return this.restBase.proxy_get_wQuery(url, query);
|
2017-09-14 12:37:36 +02:00
|
|
|
}
|
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public searchDatasetRegistry(like: string) {
|
|
|
|
return this.restBase.get("external/registries" + "?query=" + like);
|
|
|
|
}
|
2017-09-28 17:05:46 +02:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public searchDatasetRepository(like: string) {
|
|
|
|
return this.restBase.get("external/datarepos" + "?query=" + like);
|
|
|
|
}
|
2017-09-28 17:05:46 +02:00
|
|
|
|
2017-12-08 10:51:39 +01:00
|
|
|
public searchDatasetService(like: string) {
|
|
|
|
return this.restBase.get("external/services" + "?query=" + like);
|
|
|
|
}
|
2017-12-08 11:26:52 +01:00
|
|
|
|
|
|
|
public searchDMPResearchers(like: string) {
|
|
|
|
return this.restBase.get("external/researchers" + "?query=" + like);
|
|
|
|
}
|
|
|
|
|
|
|
|
public searchDMPOrganizations(like: string) {
|
|
|
|
return this.restBase.get("external/organisations" + "?query=" + like);
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
}
|