195 lines
4.8 KiB
TypeScript
195 lines
4.8 KiB
TypeScript
import { Injectable, ReflectiveInjector, Injector } from '@angular/core';
|
|
import { JsonObjest } from '../../app/entities/JsonObject.class';
|
|
import { DatasetProfile } from '../entities/datasetprofile';
|
|
import { Project } from '../entities/model/project';
|
|
import { RestBase } from './rest-base';
|
|
import 'rxjs/Rx';
|
|
|
|
import './../../assets/xml2json.min.js';
|
|
declare var X2JS: any;
|
|
|
|
@Injectable()
|
|
export class ServerService {
|
|
|
|
xml2jsonOBJ: any;
|
|
|
|
constructor(private restBase: RestBase) {
|
|
this.xml2jsonOBJ = new X2JS();
|
|
}
|
|
|
|
|
|
public listDatasetIDs() {
|
|
return this.restBase.get("dataset");
|
|
}
|
|
|
|
public getAllDatasets() {
|
|
return this.restBase.get("getAllDatasets");
|
|
}
|
|
|
|
public getAllDatasetIDs(datasetId: string) {
|
|
return this.restBase.get("dataset/" + datasetId);
|
|
}
|
|
|
|
public getDatasetByID(datasetId: string) {
|
|
return this.restBase.get("datasets/" + datasetId);
|
|
}
|
|
|
|
public setDataset(dataset) {
|
|
return this.restBase.post("dataset/update", dataset);
|
|
|
|
}
|
|
|
|
public getAllDmps() {
|
|
return this.restBase.get("dmp/getAll");
|
|
}
|
|
|
|
public listDmpsLabelID() {
|
|
return this.restBase.get("dmp/listDMPLabelID");
|
|
}
|
|
|
|
public getDmp(dmpid: string, eager?: boolean) {
|
|
if (eager)
|
|
return this.restBase.get("dmps/" + dmpid, { "eager": true });
|
|
else
|
|
return this.restBase.get("dmps/" + dmpid, { "eager": true });
|
|
}
|
|
|
|
|
|
public getDmpHistory(dmpid: string) {
|
|
return this.restBase.get("dmp/history/" + dmpid);
|
|
}
|
|
|
|
|
|
public listDmpIDs() {
|
|
return this.restBase.get("dmps");
|
|
}
|
|
|
|
|
|
public listProjectIDs() {
|
|
return this.restBase.get("projects");
|
|
}
|
|
|
|
public getAllProjects() {
|
|
return this.restBase.get("project/getAll");
|
|
}
|
|
|
|
public getProject(projectID: string, eager?: boolean) {
|
|
if (eager)
|
|
return this.restBase.get("projects/" + projectID, { "eager": true });
|
|
else
|
|
return this.restBase.get("projects/" + projectID, { "eager": false });
|
|
}
|
|
|
|
public listProjectsLabelID() {
|
|
return this.restBase.get("project/listAllLabelIDs");
|
|
}
|
|
|
|
public listDmpsUser() {
|
|
return this.restBase.get("dmp/listDMPLabelID");
|
|
}
|
|
|
|
public getProjectsOfUser() {
|
|
return this.restBase.get("project/getofuser");
|
|
}
|
|
|
|
public createProject(data: any) {
|
|
return this.restBase.post("project/createofuser", data);
|
|
}
|
|
|
|
public updateProject(data: any) {
|
|
return this.restBase.post("project/update", data);
|
|
}
|
|
|
|
public getDmpsOfProject(projectID: string) {
|
|
return this.restBase.get("project/dmps", { "id": projectID });
|
|
}
|
|
|
|
public getAllDataSet() {
|
|
return this.restBase.get("dataset/getAll");
|
|
}
|
|
|
|
public getDmpOfUser() {
|
|
return this.restBase.get("dmp/getofuser");
|
|
}
|
|
|
|
public createDmpForCurrentUser(data: any) {
|
|
return this.restBase.post("dmp/createofuser", data);
|
|
}
|
|
|
|
public updateDmp(data: any) {
|
|
return this.restBase.post("dmp/update", data);
|
|
}
|
|
|
|
public cloneDmp(data: any) {
|
|
return this.restBase.post("dmp/cloneforuser", data);
|
|
}
|
|
|
|
public deleteDmp(dmp: any) {
|
|
return this.restBase.post("dmp/softdelete", dmp);
|
|
}
|
|
|
|
public getDatasetForDmp(data: any) {
|
|
return this.restBase.post("dmp/getdatasets", data);
|
|
}
|
|
|
|
public createDatasetForDmp(data: any) {
|
|
return this.restBase.post("dataset/create", data);
|
|
}
|
|
|
|
public getAllDatsetsProfile() {
|
|
return this.restBase.get("datasetprofile/getAll");
|
|
}
|
|
|
|
public getDatasetProfileByID(id) {
|
|
return this.restBase.get("datasetprofiles/" + id);
|
|
}
|
|
|
|
public updateDatsetsProfile(data: any) {
|
|
return this.restBase.post("dataset/update", data);
|
|
}
|
|
|
|
public deleteDataset(dataset: any) {
|
|
return this.restBase.post("dataset/softdelete", dataset);
|
|
}
|
|
|
|
public getUserByID(id: string) {
|
|
return this.restBase.get("users/" + id);
|
|
}
|
|
|
|
public whoami() {
|
|
return this.restBase.get("user/whoami");
|
|
}
|
|
|
|
|
|
public updateDataset(id: string, properties: any) {
|
|
return this.restBase.post("datasetprofile/save/" + id, properties);
|
|
}
|
|
|
|
public getSingleDataset(id) {
|
|
return this.restBase.get("datasetprofile/get/" + id);
|
|
}
|
|
|
|
getThroughProxy(url: string, query: string) {
|
|
return this.restBase.proxy_get_wQuery(url, query);
|
|
}
|
|
|
|
public searchDatasetRegistry(like: string) {
|
|
return this.restBase.get("external/registries" + "?query=" + like);
|
|
}
|
|
|
|
public searchDatasetRepository(like: string) {
|
|
return this.restBase.get("external/datarepos" + "?query=" + like);
|
|
}
|
|
|
|
public searchDatasetService(like: string) {
|
|
return this.restBase.get("external/services" + "?query=" + like);
|
|
}
|
|
|
|
public searchDMPResearchers(like: string) {
|
|
return this.restBase.get("external/researchers" + "?query=" + like);
|
|
}
|
|
|
|
public searchDMPOrganizations(like: string) {
|
|
return this.restBase.get("external/organisations" + "?query=" + like);
|
|
}
|
|
} |