2017-09-14 12:37:36 +02:00
|
|
|
import {Injectable, ReflectiveInjector, Injector} from '@angular/core';
|
|
|
|
import {FieldBase} from '../../app/form/fields/field-base';
|
|
|
|
import {JsonObjest} from '../../app/entities/JsonObject.class';
|
|
|
|
import {dataModelBuilder} from '../../app/services/dataModelBuilder.service';
|
|
|
|
import { DatasetProfile } from '../entities/datasetprofile';
|
2017-09-28 17:05:46 +02:00
|
|
|
import {DataModel} from '../entities/DataModel';
|
|
|
|
import {Project} from '../entities/model/project';
|
2017-10-18 18:08:21 +02:00
|
|
|
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-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-10-18 20:30:55 +02:00
|
|
|
public listDatasetIDs(){
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("dataset");
|
|
|
|
}
|
|
|
|
|
2017-10-18 20:30:55 +02:00
|
|
|
public getAllDatasets(){
|
|
|
|
return this.restBase.get("getAllDatasets");
|
2017-10-18 18:08:21 +02:00
|
|
|
}
|
|
|
|
|
2017-10-18 20:30:55 +02:00
|
|
|
public getAllDatasetIDs(datasetId: string){
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("dataset/"+datasetId);
|
|
|
|
}
|
|
|
|
|
2017-11-01 11:27:05 +01:00
|
|
|
public getDatasetByID(datasetId: string){
|
|
|
|
return this.restBase.get("datasets/"+datasetId);
|
|
|
|
}
|
|
|
|
|
|
|
|
public setDataset(dataset){
|
|
|
|
return this.restBase.post("dataset/update", dataset);
|
|
|
|
|
|
|
|
}
|
2017-10-18 18:08:21 +02:00
|
|
|
|
2017-10-18 20:30:55 +02:00
|
|
|
public getAllDmps(){
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("dmp/getAll");
|
|
|
|
}
|
|
|
|
|
2017-10-18 20:30:55 +02:00
|
|
|
public listDmpsLabelID(){
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("dmp/listDMPLabelID");
|
2017-10-23 18:16:04 +02:00
|
|
|
}
|
2017-10-18 18:08:21 +02:00
|
|
|
|
2017-10-18 20:30:55 +02:00
|
|
|
public getDmp(dmpid : string){
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("dmps/"+dmpid);
|
|
|
|
}
|
|
|
|
|
2017-10-18 20:30:55 +02:00
|
|
|
public listDmpIDs(){
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("dmps");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-10-18 20:30:55 +02:00
|
|
|
public listProjectIDs(){
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("projects");
|
|
|
|
}
|
|
|
|
|
2017-10-18 20:30:55 +02:00
|
|
|
public getAllProjects(){
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("project/getAll");
|
|
|
|
}
|
|
|
|
|
2017-10-18 20:30:55 +02:00
|
|
|
public getProject(projectID : string){
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("projects/"+projectID);
|
|
|
|
}
|
|
|
|
|
2017-10-18 20:30:55 +02:00
|
|
|
public listProjectsLabelID(){
|
2017-10-18 18:08:21 +02:00
|
|
|
return this.restBase.get("project/listAllLabelIDs");
|
|
|
|
}
|
|
|
|
|
2017-10-23 18:16:04 +02:00
|
|
|
public listDmpsUser(){
|
|
|
|
return this.restBase.get("dmp/listDMPLabelID");
|
|
|
|
}
|
|
|
|
|
2017-11-06 17:25:23 +01:00
|
|
|
public getProjectsOfUser(){
|
2017-10-23 18:16:04 +02:00
|
|
|
return this.restBase.get("project/getofuser");
|
|
|
|
}
|
|
|
|
|
|
|
|
public createProject(data:any){
|
|
|
|
return this.restBase.post("project/createofuser", data);
|
|
|
|
}
|
|
|
|
|
2017-11-06 17:25:23 +01:00
|
|
|
public updateProject(data:any){
|
|
|
|
return this.restBase.post("project/update", data);
|
|
|
|
}
|
|
|
|
|
2017-10-25 15:17:16 +02:00
|
|
|
public getAllDataSet(){
|
|
|
|
return this.restBase.get("dataset/getAll");
|
|
|
|
}
|
|
|
|
|
|
|
|
public getDmpOfUser(){
|
|
|
|
return this.restBase.get("dmp/getofuser");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-10-27 11:52:27 +02:00
|
|
|
public createDmpForCurrentUser(data:any){
|
2017-10-27 16:08:10 +02:00
|
|
|
return this.restBase.post("dmp/createofuser", data);
|
2017-10-27 09:48:53 +02:00
|
|
|
}
|
|
|
|
|
2017-11-01 12:30:39 +01:00
|
|
|
public updateDmp(data:any){
|
|
|
|
return this.restBase.post("dmp/update", data);
|
|
|
|
}
|
|
|
|
|
2017-11-07 10:45:19 +01:00
|
|
|
public cloneDmp(data: any){
|
|
|
|
return this.restBase.post("dmp/cloneforuser", data);
|
|
|
|
}
|
|
|
|
|
2017-11-06 14:11:03 +01:00
|
|
|
public deleteDmp(dmp: any){
|
|
|
|
return this.restBase.post("dmp/softdelete", dmp);
|
|
|
|
}
|
2017-10-31 18:59:27 +01:00
|
|
|
|
2017-10-27 16:08:10 +02:00
|
|
|
public getDatasetForDmp(data:any){
|
2017-10-31 11:19:16 +01:00
|
|
|
return this.restBase.post("dmp/getdatasets", data);
|
2017-10-27 16:08:10 +02:00
|
|
|
}
|
|
|
|
|
2017-10-27 18:38:31 +02:00
|
|
|
public createDatasetForDmp(data:any){
|
2017-10-27 16:08:10 +02:00
|
|
|
return this.restBase.post("dataset/create", data);
|
|
|
|
}
|
|
|
|
|
|
|
|
public getAllDatsetsProfile(){
|
|
|
|
return this.restBase.get("datasetprofile/getAll");
|
|
|
|
}
|
2017-10-30 15:56:50 +01:00
|
|
|
|
2017-11-01 11:27:05 +01:00
|
|
|
public getDatasetProfileByID(id){
|
2017-10-30 15:56:50 +01:00
|
|
|
return this.restBase.get("datasetprofiles/"+id);
|
|
|
|
}
|
2017-10-30 17:37:17 +01:00
|
|
|
|
|
|
|
public updateDatsetsProfile(data:any){
|
|
|
|
return this.restBase.post("dataset/update", data);
|
|
|
|
}
|
2017-10-27 16:08:10 +02:00
|
|
|
|
2017-11-06 14:11:03 +01:00
|
|
|
public deleteDataset(dataset: any){
|
|
|
|
return this.restBase.post("dataset/softdelete", dataset);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-11-08 11:35:56 +01:00
|
|
|
/*
|
2017-10-25 15:17:16 +02:00
|
|
|
logOut() {
|
2017-11-01 18:18:27 +01:00
|
|
|
this.tokenService.logout();
|
|
|
|
}
|
2017-10-17 11:13:10 +02:00
|
|
|
*/
|
2017-11-08 11:35:56 +01:00
|
|
|
|
2017-11-08 14:33:14 +01:00
|
|
|
getThroughProxy(url : string, query: string){
|
|
|
|
return this.restBase.proxy_get_wQuery(url, query);
|
2017-09-14 12:37:36 +02:00
|
|
|
}
|
|
|
|
|
2017-09-28 17:05:46 +02:00
|
|
|
|
2017-11-08 11:35:56 +01:00
|
|
|
|
2017-09-28 17:05:46 +02:00
|
|
|
|
2017-09-14 12:37:36 +02:00
|
|
|
}
|