argos/dmp-frontend/src/app/services/server.service.ts

160 lines
3.6 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 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){
return this.restBase.get("projects/"+projectID);
}
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 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 whoami(){
return this.restBase.get("user/whoami");
}
/*
logOut() {
this.tokenService.logout();
}
*/
getThroughProxy(url : string, query: string){
return this.restBase.proxy_get_wQuery(url, query);
}
}