From a952cc529d5ac35f869eb99f6e47e489f5e39ed0 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Tue, 7 Nov 2017 13:35:31 +0200 Subject: [PATCH 1/4] added more messages --- dmp-frontend/src/app/dmps/dmp.component.ts | 6 ++++-- dmp-frontend/src/app/dmps/dmps.html | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dmp-frontend/src/app/dmps/dmp.component.ts b/dmp-frontend/src/app/dmps/dmp.component.ts index 624612381..8940766c1 100644 --- a/dmp-frontend/src/app/dmps/dmp.component.ts +++ b/dmp-frontend/src/app/dmps/dmp.component.ts @@ -112,10 +112,12 @@ export class DmpComponent implements OnInit{ -getDmps(){ +getDmps(muted? : boolean){ this.serverService.getDmpOfUser().subscribe( - response => { + response => { this.tableData = response; + if(muted && muted!=true) + simple_notifier("success",null,"Refreshed DMPs"); }, (err: HttpErrorResponse) => { simple_notifier("danger",null,"Could not refresh DMPs"); diff --git a/dmp-frontend/src/app/dmps/dmps.html b/dmp-frontend/src/app/dmps/dmps.html index 2bc8aa4f8..e20ac5b5e 100644 --- a/dmp-frontend/src/app/dmps/dmps.html +++ b/dmp-frontend/src/app/dmps/dmps.html @@ -10,7 +10,7 @@ - From ff856c6d14e9014f8d1d702fa77b319496232c22 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Tue, 7 Nov 2017 14:04:58 +0200 Subject: [PATCH 2/4] Added notifications on dataset table --- .../src/app/datasets/dataset.component.ts | 45 +++++++++++++------ dmp-frontend/src/app/datasets/dataset.html | 2 +- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/dmp-frontend/src/app/datasets/dataset.component.ts b/dmp-frontend/src/app/datasets/dataset.component.ts index 9f0599768..d3da0f538 100644 --- a/dmp-frontend/src/app/datasets/dataset.component.ts +++ b/dmp-frontend/src/app/datasets/dataset.component.ts @@ -12,6 +12,10 @@ import { StatusToString } from '../pipes/various/status-to-string'; declare var $: any; + +import '../../assets/custom.js'; +declare function simple_notifier(type: string, title: string, message:string): any; + @Component({ selector: 'datasets-table', templateUrl: 'dataset.html', @@ -87,11 +91,7 @@ export class DatasetsComponent implements OnInit { //this.projects = this.serverService.getDummyProjects(); this.datasets = []; console.log(this.dmpIdforDatasets); - this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe( - response => { - this.tableData = response; - } - ); + this.getDatasets(); this.serverService.getAllDatsetsProfile().subscribe( response => { @@ -100,7 +100,12 @@ export class DatasetsComponent implements OnInit { params.key = datasetprofile.id; params.value = datasetprofile.label; this.datasetProfileDropDown.options.push(params); - }); + }, + error => { + simple_notifier("danger",null,"Could not load User's Dataset Profiles"); + } + + ); } ) @@ -124,10 +129,13 @@ export class DatasetsComponent implements OnInit { this.dataset.profile = { "id": this.dataset.profile } this.serverService.createDatasetForDmp(this.dataset).subscribe( response => { - console.log(response); + simple_notifier("success",null,"Created dataset"); this.getDatasets(); if (this.saveAndDescribe == true) this.describeDataset(response); + }, + error=>{ + simple_notifier("danger",null,"Could not create Dataset"); } ) $("#newDatasetModal").modal("hide"); @@ -138,10 +146,13 @@ export class DatasetsComponent implements OnInit { this.dataset.profile = { "id": this.dataset.profile } this.serverService.updateDatsetsProfile(this.dataset).subscribe( response => { - console.log(response); + simple_notifier("success",null,"Dataset edited"); this.getDatasets(); if (this.saveAndDescribe == true) this.describeDataset(response); + }, + error => { + simple_notifier("danger",null,"Could not edit dataset"); } ) $("#newDatasetModal").modal("hide"); @@ -149,10 +160,15 @@ export class DatasetsComponent implements OnInit { } - getDatasets(){ + getDatasets(muted?: boolean){ this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe( - response => { + response => { this.tableData = response; + if(muted && muted!=true) + simple_notifier("success",null,"Updated datasets table"); + }, + error => { + simple_notifier("danger",null,"Could not update datasets table"); } ); } @@ -162,6 +178,9 @@ export class DatasetsComponent implements OnInit { this.serverService.getDatasetForDmp({ "id": dmpid }).subscribe( response => { this.tableData = response; + }, + error => { + console.log("could not retrieve dataset for dpm: "+dmpid); } ); } @@ -201,13 +220,13 @@ export class DatasetsComponent implements OnInit { deleteRow(dataset, $event){ this.serverService.deleteDataset(dataset).subscribe( response => { - console.log("Deleted Successfully the dataset") + simple_notifier("success",null,"Deleted dataset"); + this.getDatasets(); }, err => { - console.log("Could not delete the dataset") + simple_notifier("danger",null,"Could not delete the dataset"); } ); - this.getDatasets(); } diff --git a/dmp-frontend/src/app/datasets/dataset.html b/dmp-frontend/src/app/datasets/dataset.html index 4f32337c4..a4621f0b9 100644 --- a/dmp-frontend/src/app/datasets/dataset.html +++ b/dmp-frontend/src/app/datasets/dataset.html @@ -15,7 +15,7 @@ - From ce7e1c739bc6c771859bd47822624cac535c1953 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Tue, 7 Nov 2017 14:15:50 +0200 Subject: [PATCH 3/4] added messages to project --- dmp-frontend/src/app/projects/project.html | 2 +- .../src/app/projects/projects.component.ts | 25 +++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/dmp-frontend/src/app/projects/project.html b/dmp-frontend/src/app/projects/project.html index f91e15b03..8873fb763 100644 --- a/dmp-frontend/src/app/projects/project.html +++ b/dmp-frontend/src/app/projects/project.html @@ -8,7 +8,7 @@ - diff --git a/dmp-frontend/src/app/projects/projects.component.ts b/dmp-frontend/src/app/projects/projects.component.ts index 33ae10f38..3b1c00eb2 100644 --- a/dmp-frontend/src/app/projects/projects.component.ts +++ b/dmp-frontend/src/app/projects/projects.component.ts @@ -22,6 +22,8 @@ import { ProjectTableFilterPipe } from '../pipes/project-table-filter.pipe'; declare var $ :any; +import '../../assets/custom.js'; +declare function simple_notifier(type: string, title: string, message:string): any; @Component({ @@ -118,15 +120,16 @@ getEmptyProject(){ } -getProjects(){ +getProjects(muted? : boolean){ this.serverService.getProjectsOfUser().subscribe( response => { this.tableData = response; - console.log(this.tableData) + if(muted && muted!=true) + simple_notifier("success",null,"Updated projects table"); }, err => { - - } + simple_notifier("danger",null,"Could not retrieve projects"); + } ); } @@ -142,13 +145,17 @@ getDMPs(){ params.key = dmp.id; params.value = dmp.label; this.datasetDropDown.options.push(params); - }); + }, + error => { + + } + ); } ) } -showDatasets(){debugger; //dmpId, event +showDatasets(){ //dmpId, event //this.dataSetVisibe = true; } @@ -165,8 +172,10 @@ SaveProject(){ action.subscribe( response =>{ this.getProjects(); - console.log("response"); - console.log(response); + simple_notifier("success",null, (this.project.id == null) ? "Created" : "Updated" +" projects table"); + }, + error => { + simple_notifier("danger",null, "Could not "+ (this.project.id == null) ? "create" : "update" + " projects table"); } ); From a7b251ed0430dfb10459ba5fc97bde31598c3ea1 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Tue, 7 Nov 2017 14:20:13 +0200 Subject: [PATCH 4/4] Added "description" on tables {Dataset, DMP, DatasetProfile, Project} --- dmp-backend/src/main/java/entities/DMP.java | 16 +++++ .../src/main/java/entities/DMPProfile.java | 7 ++- .../main/java/entities/DataRepository.java | 6 +- .../src/main/java/entities/Dataset.java | 20 ++++++- .../main/java/entities/DatasetProfile.java | 20 ++++++- .../src/main/java/entities/Organisation.java | 7 ++- .../src/main/java/entities/Project.java | 20 ++++++- .../src/main/java/entities/Registry.java | 7 ++- .../src/main/java/entities/Researcher.java | 7 ++- .../src/main/java/entities/Service.java | 7 ++- .../src/main/java/entities/UserInfo.java | 6 ++ .../src/main/java/rest/entities/DMPs.java | 50 +++++++++++++++- .../src/main/java/rest/entities/Projects.java | 34 ++++++++++- dmp-backend/src/test/java/TestRest.java | 59 +++++++++++++++++-- 14 files changed, 232 insertions(+), 34 deletions(-) diff --git a/dmp-backend/src/main/java/entities/DMP.java b/dmp-backend/src/main/java/entities/DMP.java index 0b597d633..9e56fcb5e 100644 --- a/dmp-backend/src/main/java/entities/DMP.java +++ b/dmp-backend/src/main/java/entities/DMP.java @@ -104,12 +104,28 @@ public class DMP implements Serializable { @Column(name = "\"Status\"", nullable = false) private Short status; + @Column(name = "\"Created\"") private Date created = null; @Column(name = "\"Modified\"") private Date modified = new Date(); + + @Column(name = "\"Description\"") + private String description; + + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + public Short getStatus() { return status; diff --git a/dmp-backend/src/main/java/entities/DMPProfile.java b/dmp-backend/src/main/java/entities/DMPProfile.java index c28738562..86fb2c7af 100644 --- a/dmp-backend/src/main/java/entities/DMPProfile.java +++ b/dmp-backend/src/main/java/entities/DMPProfile.java @@ -57,11 +57,12 @@ public class DMPProfile implements Serializable { @Column(name = "\"Status\"", nullable = false) private Short status; - @Column(name = "\"Created\"", nullable = false) + + @Column(name = "\"Created\"") private Date created = null; - @Column(name = "\"Modified\"", nullable = false) - private Date modified = null; + @Column(name = "\"Modified\"") + private Date modified = new Date(); public Short getStatus() { diff --git a/dmp-backend/src/main/java/entities/DataRepository.java b/dmp-backend/src/main/java/entities/DataRepository.java index 65791a0f9..8d4962139 100644 --- a/dmp-backend/src/main/java/entities/DataRepository.java +++ b/dmp-backend/src/main/java/entities/DataRepository.java @@ -72,11 +72,11 @@ public class DataRepository implements Serializable { @Column(name = "\"Status\"", nullable = false) private Short status; - @Column(name = "\"Created\"", nullable = false) + @Column(name = "\"Created\"") private Date created = null; - @Column(name = "\"Modified\"", nullable = false) - private Date modified = null; + @Column(name = "\"Modified\"") + private Date modified = new Date(); public Short getStatus() { diff --git a/dmp-backend/src/main/java/entities/Dataset.java b/dmp-backend/src/main/java/entities/Dataset.java index cb2bb82e5..71b439ad8 100644 --- a/dmp-backend/src/main/java/entities/Dataset.java +++ b/dmp-backend/src/main/java/entities/Dataset.java @@ -99,11 +99,25 @@ public class Dataset implements Serializable { @Column(name = "\"Status\"", nullable = false) private Short status; - @Column(name = "\"Created\"", nullable = false) + + @Column(name = "\"Created\"") private Date created = null; - @Column(name = "\"Modified\"", nullable = false) - private Date modified = null; + @Column(name = "\"Modified\"") + private Date modified = new Date(); + + @Column(name = "\"Description\"") + private String description; + + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } public Short getStatus() { diff --git a/dmp-backend/src/main/java/entities/DatasetProfile.java b/dmp-backend/src/main/java/entities/DatasetProfile.java index bd7840586..d5a1d0ee8 100644 --- a/dmp-backend/src/main/java/entities/DatasetProfile.java +++ b/dmp-backend/src/main/java/entities/DatasetProfile.java @@ -67,13 +67,27 @@ public class DatasetProfile implements Serializable { @Column(name = "\"Status\"", nullable = false) private Short status; - @Column(name = "\"Created\"", nullable = false) + + @Column(name = "\"Created\"") private Date created = null; - @Column(name = "\"Modified\"", nullable = false) - private Date modified = null; + @Column(name = "\"Modified\"") + private Date modified = new Date(); + @Column(name = "\"Description\"") + private String description; + + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Short getStatus() { return status; } diff --git a/dmp-backend/src/main/java/entities/Organisation.java b/dmp-backend/src/main/java/entities/Organisation.java index 0a08eb0ce..d764286d7 100644 --- a/dmp-backend/src/main/java/entities/Organisation.java +++ b/dmp-backend/src/main/java/entities/Organisation.java @@ -74,11 +74,12 @@ public class Organisation implements Serializable { @Column(name = "\"Status\"", nullable = false) private Short status; - @Column(name = "\"Created\"", nullable = false) + + @Column(name = "\"Created\"") private Date created = null; - @Column(name = "\"Modified\"", nullable = false) - private Date modified = null; + @Column(name = "\"Modified\"") + private Date modified = new Date(); public Short getStatus() { diff --git a/dmp-backend/src/main/java/entities/Project.java b/dmp-backend/src/main/java/entities/Project.java index 5582fc8d5..90919e81f 100644 --- a/dmp-backend/src/main/java/entities/Project.java +++ b/dmp-backend/src/main/java/entities/Project.java @@ -80,12 +80,26 @@ public class Project implements Serializable { @Column(name = "\"Status\"", nullable = false) private Short status; - @Column(name = "\"Created\"", nullable = false) + + @Column(name = "\"Created\"") private Date created = null; - @Column(name = "\"Modified\"", nullable = false) - private Date modified = null; + @Column(name = "\"Modified\"") + private Date modified = new Date(); + @Column(name = "\"Description\"") + private String description; + + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + public Short getStatus() { return status; diff --git a/dmp-backend/src/main/java/entities/Registry.java b/dmp-backend/src/main/java/entities/Registry.java index def5da279..82da1e84f 100644 --- a/dmp-backend/src/main/java/entities/Registry.java +++ b/dmp-backend/src/main/java/entities/Registry.java @@ -73,11 +73,12 @@ public class Registry implements Serializable { @Column(name = "\"Status\"", nullable = false) private Short status; - @Column(name = "\"Created\"", nullable = false) + + @Column(name = "\"Created\"") private Date created = null; - @Column(name = "\"Modified\"", nullable = false) - private Date modified = null; + @Column(name = "\"Modified\"") + private Date modified = new Date(); public Short getStatus() { diff --git a/dmp-backend/src/main/java/entities/Researcher.java b/dmp-backend/src/main/java/entities/Researcher.java index a755a03a5..6f73094a0 100644 --- a/dmp-backend/src/main/java/entities/Researcher.java +++ b/dmp-backend/src/main/java/entities/Researcher.java @@ -73,11 +73,12 @@ public class Researcher implements Serializable { @Column(name = "\"Status\"", nullable = false) private Short status; - @Column(name = "\"Created\"", nullable = false) + + @Column(name = "\"Created\"") private Date created = null; - @Column(name = "\"Modified\"", nullable = false) - private Date modified = null; + @Column(name = "\"Modified\"") + private Date modified = new Date(); public Short getStatus() { diff --git a/dmp-backend/src/main/java/entities/Service.java b/dmp-backend/src/main/java/entities/Service.java index fc5b2cd21..51d3b2ed9 100644 --- a/dmp-backend/src/main/java/entities/Service.java +++ b/dmp-backend/src/main/java/entities/Service.java @@ -73,11 +73,12 @@ public class Service implements Serializable { @Column(name = "\"Status\"", nullable = false) private Short status; - @Column(name = "\"Created\"", nullable = false) + + @Column(name = "\"Created\"") private Date created = null; - @Column(name = "\"Modified\"", nullable = false) - private Date modified = null; + @Column(name = "\"Modified\"") + private Date modified = new Date(); public Short getStatus() { diff --git a/dmp-backend/src/main/java/entities/UserInfo.java b/dmp-backend/src/main/java/entities/UserInfo.java index 76482691e..8b107660f 100644 --- a/dmp-backend/src/main/java/entities/UserInfo.java +++ b/dmp-backend/src/main/java/entities/UserInfo.java @@ -4,6 +4,7 @@ import java.io.Serializable; import java.util.Date; import java.util.Set; import java.util.UUID; +import java.util.stream.Collectors; import javax.persistence.Column; import javax.persistence.Entity; @@ -84,6 +85,11 @@ public class UserInfo implements Serializable{ private Set dmps; + + public Set getDmpsNonDeleted(){ + return getDmps().parallelStream().filter(dmp -> dmp.getStatus()>=0).collect(Collectors.toSet()); + } + public Set getDmps() { return dmps; } diff --git a/dmp-backend/src/main/java/rest/entities/DMPs.java b/dmp-backend/src/main/java/rest/entities/DMPs.java index df9223c03..31a5bddde 100644 --- a/dmp-backend/src/main/java/rest/entities/DMPs.java +++ b/dmp-backend/src/main/java/rest/entities/DMPs.java @@ -203,7 +203,7 @@ public class DMPs { d.setStatus(new Short("-1")); try { - int code = updateDMP(dmp).getStatusCodeValue(); + int code = updateDMP(d).getStatusCodeValue(); if(code>199 && code<300) return ResponseEntity.status(HttpStatus.CREATED).body("DELETED!"); else @@ -238,7 +238,8 @@ public class DMPs { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here"); try { - return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(userInfo.getDmps())); + Set nonDeleted = userInfo.getDmpsNonDeleted(); + return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(nonDeleted)); } catch(Exception ex) { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage()); @@ -285,6 +286,51 @@ public class DMPs { } + @RequestMapping(method = RequestMethod.POST, value = { "/dmp/cloneforuser" }, produces="text/plain", consumes = "application/json") + public @ResponseBody ResponseEntity cloneDmpOfUser(@RequestBody DMP dmp){ + + String userID = null; + try { + userID = SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString(); + } catch(NullPointerException ex) { + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("You have not logged in. You shouldn't be here"); + } + + UserInfo userInfo = userInfoDao.read(UUID.fromString(userID)); + + if(userInfo==null) //this should normally never happer + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here"); + + DMP clone = dMPDao.read(dmp.getId()); + + try { + + Set users = new HashSet(); + users.add(userInfo); + clone.setUsers(users); + + clone.setCreated(new Date()); + clone.setModified(new Date()); + clone.setStatus(new Short("0")); + + clone.setVersion(clone.getVersion()+1); + clone.setLabel(clone.getLabel()+"_clone"); + clone.setPrevious(clone.getId()); + + + clone.setId(null); + + clone = dMPDao.create(clone); + + return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(clone)); + } + catch(Exception ex) { + ex.printStackTrace(); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage()); + } + + } + @RequestMapping(method = RequestMethod.POST, value = { "/dmp/adduser" }, produces="text/plain") public @ResponseBody ResponseEntity addUserToDmp(@RequestBody DMP dmp){ diff --git a/dmp-backend/src/main/java/rest/entities/Projects.java b/dmp-backend/src/main/java/rest/entities/Projects.java index 51340808b..2990c5d2b 100644 --- a/dmp-backend/src/main/java/rest/entities/Projects.java +++ b/dmp-backend/src/main/java/rest/entities/Projects.java @@ -1,5 +1,6 @@ package rest.entities; +import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -137,7 +138,15 @@ public class Projects { @Transactional @RequestMapping(method = RequestMethod.POST, value = { "/project/create" }, consumes = "application/json", produces="application/json") - public @ResponseBody ResponseEntity setProject(@RequestBody Project project) { + public @ResponseBody ResponseEntity createProject(@RequestBody Project project) { + Project createdProject = projectDao.update(project); + return ResponseEntity.status(HttpStatus.CREATED).body(createdProject); + } + + + + @RequestMapping(method = RequestMethod.POST, value = { "/project/update" }, consumes = "application/json", produces="application/json") + public @ResponseBody ResponseEntity updateProject(@RequestBody Project project) { Project createdProject = projectDao.update(project); return ResponseEntity.status(HttpStatus.CREATED).body(createdProject); } @@ -159,6 +168,23 @@ public class Projects { } + + @RequestMapping(method = RequestMethod.POST, value = { "/project/softdelete" }, consumes = "application/json", produces="application/json") + public @ResponseBody ResponseEntity softDelete(@RequestBody Project project) { + + project.setStatus(new Short("-1")); + + try { + projectDao.update(project); + return ResponseEntity.status(HttpStatus.CREATED).body("{\"msg\":\"Deleted project!\"}"); + } catch (Exception e) { + e.printStackTrace(); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not delete Project!\"}"); + } + + } + + @Transactional @RequestMapping(method = RequestMethod.POST, value = { "/project/getdmps" }, consumes = "application/json", produces="application/json") public @ResponseBody ResponseEntity getProjectDmps(@RequestBody Project project) { @@ -230,13 +256,18 @@ public class Projects { try { project.setId(null); + project.setStatus(new Short("0")); + project.setCreated(new Date()); + project.setModified(new Date()); Project newproj = projectDao.create(project); DMP newdmp = new DMP(); newdmp.setId(null); newdmp.setLabel("Auto-Generated"); + newdmp.setCreated(new Date()); newdmp.setVersion(1); + newdmp.setStatus(new Short("0")); newdmp.setProject(newproj); Set users = new HashSet(); @@ -248,6 +279,7 @@ public class Projects { return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(newproj)); } catch(Exception ex) { + ex.printStackTrace(); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage()); } diff --git a/dmp-backend/src/test/java/TestRest.java b/dmp-backend/src/test/java/TestRest.java index 3d953f27a..9b9701dc7 100644 --- a/dmp-backend/src/test/java/TestRest.java +++ b/dmp-backend/src/test/java/TestRest.java @@ -181,8 +181,6 @@ public class TestRest { System.out.println(SerializerProvider.toJson(userProjects)); - - assertEquals("aaa", "aaa"); } @@ -204,9 +202,18 @@ public class TestRest { @Test - public void testDataset() { + public void testDmpClone() { - System.out.println(datasetsService.getAllDatasets().getBody()); + System.out.println(dmpsService.getDmpsOfUser().getBody()); + + DMP dmp = new DMP(); + dmp.setId(UUID.fromString("8faad611-7083-497c-ad96-9459e47ee175")); + String clonedJSON = dmpsService.cloneDmpOfUser(dmp).toString(); + + System.out.println(clonedJSON); + + +// System.out.println(datasetsService.getAllDatasets().getBody()); // System.out.println(dmpsService.getDatasetsOfDMP(dmp).getBody()); @@ -215,5 +222,49 @@ public class TestRest { } + + //@Test + public void testProject() { + + String projectJson = "{\"id\":\"d558e52c-a61b-4e16-a401-b27c579cf8e3\",\"dmps\":null,\"label\":\"Sample project\",\"abbreviation\":null,\"reference\":\"agasdfasdf\",\"uri\":\"hadfhadfgazfrg\",\"definition\":\"sdfgsdg\",\"startdate\":\"2017-11-01\",\"enddate\":\"2017-11-30\",\"status\":0,\"created\":1509638367900,\"modified\":1509638367900}"; + try { + Project project = SerializerProvider.fromJson(projectJson, Project.class); + System.out.println(SerializerProvider.toJson(project)); + } catch (Exception e) { + e.printStackTrace(); + } + + + /* +// System.out.println(dmpsService.getAllDMPs().getBody().toString()); + + String dmpJSON = dmpsService.getDMP("d0d01f5e-9aed-4733-a0cf-aabe44cd30c9").getBody().toString(); + System.out.println(dmpJSON); + + try { + DMP dmp = SerializerProvider.fromJson(dmpJSON, DMP.class); + ResponseEntity resp = dmpsService.softDelete(dmp); + resp.getStatusCode(); + + } + catch(Exception ex) { + + } + + //dmpsService.softDelete(dmp) + + //System.out.println(datasetsService.getAllDatasets().getBody()); + +// System.out.println(dmpsService.getDatasetsOfDMP(dmp).getBody()); + + */ + + + + assertEquals("aaa", "aaa"); + + + } + }