diff --git a/dmp-admin/src/app/app.module.ts b/dmp-admin/src/app/app.module.ts
index 2dc57045a..615c8976a 100644
--- a/dmp-admin/src/app/app.module.ts
+++ b/dmp-admin/src/app/app.module.ts
@@ -19,6 +19,7 @@ import { DatasetProfileService } from './services/dataset-profile.service';
import { DmpsServiceService } from './services/dmps-service.service';
import { ProjectService } from './services/project-service';
import { ServiceService } from './services/service-service';
+import { ResearcherService } from './services/researcher-service';
import { OrganisationService } from './services/organisation-service';
import { DmpProfileService } from './services/dmpprofile-service';
import { RegistryService } from './services/registry-service';
@@ -31,6 +32,8 @@ import { DmpProfileTableFilterPipe } from './pipes/dmp-profile-table-filter.pipe
import { ProjectTableFilterPipe } from './pipes/project-table-filter.pipe';
import { RegistryTableFilterPipe } from './pipes/registry-table-filter.pipe';
import { OrganisationTableFilterPipe } from './pipes/organisation-table-filter.pipe';
+import { ResearcherTableFilterPipe } from './pipes/researcher-table-filter.pipe';
+
import { GooggleSignInComponent } from './login/googgle-sign-in/googgle-sign-in.component';
import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component';
@@ -49,6 +52,7 @@ import { DmpProfileEditorComponent } from './managers/dmp-profile-editor/dmp-pro
import { OrganisationEditorComponent } from './managers/organisation-editor/organisation-editor.component';
import { RegistryEditorComponent } from './managers/registry-editor/registry-editor.component';
import { ServiceEditorComponent } from './managers/service-editor/service-editor.component';
+import { ResearcherEditorComponent } from './managers/researcher-editor/researcher-editor.component';
@@ -61,6 +65,7 @@ import { ServiceEditorComponent } from './managers/service-editor/service-editor
OrganisationTableFilterPipe,
RegistryTableFilterPipe,
ServiceTableFilterPipe,
+ ResearcherTableFilterPipe,
AppComponent,
GooggleSignInComponent,
@@ -76,7 +81,8 @@ import { ServiceEditorComponent } from './managers/service-editor/service-editor
OrganisationEditorComponent,
RegistryEditorComponent,
ServiceEditorComponent,
- MainSignInComponent
+ MainSignInComponent,
+ ResearcherEditorComponent
],
imports: [
BrowserModule,
@@ -90,7 +96,7 @@ import { ServiceEditorComponent } from './managers/service-editor/service-editor
NgbModule.forRoot(),
AppRouting
],
- providers: [ DatasetsServiceService, TokenService, DmpsServiceService,
+ providers: [ DatasetsServiceService, TokenService, DmpsServiceService, ResearcherService,
DialogService, DatasetProfileService, ProjectService, OrganisationService,
DmpProfileService, RegistryService, ServiceService, NativeLoginService, HttpModule, Toolbox, HttpClient, RestBase],
bootstrap: [AppComponent]
diff --git a/dmp-admin/src/app/login/main-sign-in/main-sign-in.component.ts b/dmp-admin/src/app/login/main-sign-in/main-sign-in.component.ts
index e4f88c1b4..2881383f1 100644
--- a/dmp-admin/src/app/login/main-sign-in/main-sign-in.component.ts
+++ b/dmp-admin/src/app/login/main-sign-in/main-sign-in.component.ts
@@ -45,6 +45,7 @@ export class MainSignInComponent implements OnInit {
this.nativeLogin.login(this.creds.username, this.creds.password).subscribe(
response => {
+
simple_notifier("success",null,"Successful login");
this.tokenService.setLoggedIn(true);
diff --git a/dmp-admin/src/app/main-window/main-window.component.html b/dmp-admin/src/app/main-window/main-window.component.html
index a98c2963c..54c8892b4 100644
--- a/dmp-admin/src/app/main-window/main-window.component.html
+++ b/dmp-admin/src/app/main-window/main-window.component.html
@@ -59,6 +59,13 @@
All services
+
+ Manage Researchers
+
+
+
Users
@@ -76,78 +83,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dmp-admin/src/app/managers/dmp-editor/dmp-editor.component.ts b/dmp-admin/src/app/managers/dmp-editor/dmp-editor.component.ts
index 39a4589d6..0c77497ad 100644
--- a/dmp-admin/src/app/managers/dmp-editor/dmp-editor.component.ts
+++ b/dmp-admin/src/app/managers/dmp-editor/dmp-editor.component.ts
@@ -137,10 +137,11 @@ export class DmpEditorComponent implements OnInit {
this.dmpsServiceService.delete(dmp).subscribe(
(response) => {
simple_notifier("success",null,"Deleted dataset");
- console.log(response);
+ this.getAllDmps(false);
+ this.switchToTable();
},
(err) => {
-
+ simple_notifier("danger",null,"Could not delete dmp");
}
)
}
diff --git a/dmp-admin/src/app/managers/dmp-profile-editor/dmp-profile-editor.component.ts b/dmp-admin/src/app/managers/dmp-profile-editor/dmp-profile-editor.component.ts
index 65a9f7189..42ad076ec 100644
--- a/dmp-admin/src/app/managers/dmp-profile-editor/dmp-profile-editor.component.ts
+++ b/dmp-admin/src/app/managers/dmp-profile-editor/dmp-profile-editor.component.ts
@@ -111,9 +111,11 @@ export class DmpProfileEditorComponent implements OnInit {
this.dmpProfileService.delete(dmpProfile).subscribe(
(response) => {
simple_notifier("success",null,"Deleted DMP Profile");
+ this.getAllDmpProfiles(false);
+ this.switchToTable();
},
(err) => {
-
+ simple_notifier("danger",null,"Could not delete DMP Profile");
}
)
}
diff --git a/dmp-admin/src/app/managers/organisation-editor/organisation-editor.component.ts b/dmp-admin/src/app/managers/organisation-editor/organisation-editor.component.ts
index 54272a416..d91a877b5 100644
--- a/dmp-admin/src/app/managers/organisation-editor/organisation-editor.component.ts
+++ b/dmp-admin/src/app/managers/organisation-editor/organisation-editor.component.ts
@@ -111,10 +111,11 @@ export class OrganisationEditorComponent implements OnInit {
this.organisationService.delete(organisation).subscribe(
(response) => {
simple_notifier("success",null,"Deleted organisation");
+ this.refreshTable(false);
+ this.switchToTable();
},
(err) => {
simple_notifier("danger",null,"Could not delete organisation");
- console.log(err);
}
)
}
diff --git a/dmp-admin/src/app/managers/project-editor/project-editor.component.ts b/dmp-admin/src/app/managers/project-editor/project-editor.component.ts
index f3218aea4..8a4703332 100644
--- a/dmp-admin/src/app/managers/project-editor/project-editor.component.ts
+++ b/dmp-admin/src/app/managers/project-editor/project-editor.component.ts
@@ -116,11 +116,11 @@ export class ProjectEditorComponent implements OnInit {
this.projectService.delete(project).subscribe(
(response) => {
simple_notifier("success",null,"Deleted project");
- console.log(response);
+ this.getAllProjects(false);
+ this.switchToTable();
},
(err) => {
simple_notifier("danger",null,"Could not delete project");
- console.log(err);
}
)
}
diff --git a/dmp-admin/src/app/managers/registry-editor/registry-editor.component.ts b/dmp-admin/src/app/managers/registry-editor/registry-editor.component.ts
index 007e1085b..31df22a8d 100644
--- a/dmp-admin/src/app/managers/registry-editor/registry-editor.component.ts
+++ b/dmp-admin/src/app/managers/registry-editor/registry-editor.component.ts
@@ -113,9 +113,11 @@ export class RegistryEditorComponent implements OnInit {
this.registryService.delete(registry).subscribe(
(response) => {
simple_notifier("success",null,"Deleted registry");
+ this.switchToTable();
+ this.refreshTable(false);
},
(err) => {
-
+ simple_notifier("danger",null,"Could not delete registry");
}
)
}
diff --git a/dmp-admin/src/app/managers/researcher-editor/researcher-editor.component.css b/dmp-admin/src/app/managers/researcher-editor/researcher-editor.component.css
new file mode 100644
index 000000000..002b130b0
--- /dev/null
+++ b/dmp-admin/src/app/managers/researcher-editor/researcher-editor.component.css
@@ -0,0 +1,33 @@
+.invisible {
+ display:none;
+}
+
+.visible {
+ display:block;
+}
+
+tr.hover:hover > * {
+ background-color: #eeeeee;
+}
+
+.editor-container{
+ padding-top: 10px;
+ padding-right: 10px;
+ padding-bottom: 10px;
+ padding-left: 10px;
+}
+
+.button-150px {
+ max-width: 150px;
+}
+
+.ng-template{
+ text-align: right;
+}
+
+.grayout-empty-table {
+ opacity: 0.6; /* Real browsers */
+ filter: alpha(opacity = 60); /* MSIE */
+ text-align: center;
+ vertical-align: middle;
+}
\ No newline at end of file
diff --git a/dmp-admin/src/app/managers/researcher-editor/researcher-editor.component.html b/dmp-admin/src/app/managers/researcher-editor/researcher-editor.component.html
new file mode 100644
index 000000000..43aa334e8
--- /dev/null
+++ b/dmp-admin/src/app/managers/researcher-editor/researcher-editor.component.html
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Form value: {{ researcherEditorForm.value | json }}
+
+
+
+
+
+
+
+
+
+
+ Manage researchers
+
+
+
+ Create researcher
+
+
+ Edit this researcher
+
+
+ Delete this
+
+
+
+ Show full tree connections
+
+
+
\ No newline at end of file
diff --git a/dmp-admin/src/app/managers/researcher-editor/researcher-editor.component.spec.ts b/dmp-admin/src/app/managers/researcher-editor/researcher-editor.component.spec.ts
new file mode 100644
index 000000000..88793a6a9
--- /dev/null
+++ b/dmp-admin/src/app/managers/researcher-editor/researcher-editor.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ResearcherEditorComponent } from './researcher-editor.component';
+
+describe('ResearcherEditorComponent', () => {
+ let component: ResearcherEditorComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ ResearcherEditorComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ResearcherEditorComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should be created', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/dmp-admin/src/app/managers/researcher-editor/researcher-editor.component.ts b/dmp-admin/src/app/managers/researcher-editor/researcher-editor.component.ts
new file mode 100644
index 000000000..b9c96c688
--- /dev/null
+++ b/dmp-admin/src/app/managers/researcher-editor/researcher-editor.component.ts
@@ -0,0 +1,134 @@
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { ResearcherService } from '../../services/researcher-service';
+import { ContextMenuComponent } from 'ngx-contextmenu';
+import { ReactiveFormsModule } from '@angular/forms';
+import { FormBuilder, FormGroup, Validators } from '@angular/forms';
+
+import '../../../assets/custom.js';
+declare function simple_notifier(type: string, title: string, message:string): any;
+
+@Component({
+ selector: 'app-researcher-editor',
+ templateUrl: './researcher-editor.component.html',
+ styleUrls: ['./researcher-editor.component.css']
+})
+export class ResearcherEditorComponent implements OnInit {
+
+ constructor(private researcherService : ResearcherService, private fb: FormBuilder) {
+
+ }
+
+ //whole dmp data model
+ tableData : any[] = new Array();
+
+ //researcher editor data model
+ editingResearcher: any = {};
+ researcherEditorForm : any;
+
+ //required by the table
+ public filterQuery = "";
+ public rowsOnPage = 10;
+ //public sortBy = "email";
+ public sortOrder = "asc";
+
+ //visibility rules for containers
+ tableVisible: boolean = true;
+ editorVisible: boolean = false;
+
+
+ // for tableIds
+ showIDs : boolean = false;
+
+
+
+ ngOnInit() {
+ this.getAllResearchers(false);
+ this.createResearcherEditorForm();
+ }
+
+ createResearcherEditorForm(){
+ this.researcherEditorForm = this.fb.group({
+ id: null,
+ label: ['', Validators.required ],
+ uri: '',
+ primaryEmail: '',
+ definition: '',
+ reference: ''
+ });
+
+ }
+
+ switchToTable(){
+ this.tableVisible = true;
+ this.editorVisible = false;
+ }
+
+ switchToEditor(researcherID){
+
+ this.tableVisible = false;
+ this.editorVisible = true;
+ if(researcherID == null){
+ this.editingResearcher = {id: null, label: "", uri: "", primaryEmail: "", definition: "", reference: "" };
+ }
+ else{
+ this.editingResearcher = this.tableData.filter((researcher) => researcher.id === researcherID)[0];
+ }
+ }
+
+
+ getAllResearchers(showNotification : boolean){
+ this.researcherService.getAllResearchers().subscribe( (data) => {
+ this.tableData = data;
+ if(showNotification)
+ simple_notifier("info",null,"Refreshed the table");
+ });
+ }
+
+
+ editResearcher(researcher){
+ this.switchToEditor(researcher);
+ }
+
+ newResearcher(){
+ this.switchToEditor(null);
+ }
+
+
+
+ save(mouseEvent){
+ this.researcherService.create(this.researcherEditorForm.value).subscribe(
+ response => {
+ simple_notifier("success",null,"Saved resercher");
+ this.getAllResearchers(false);
+ },
+ err => {
+ simple_notifier("danger",null,"Could not save researcher");
+ }
+ );
+ }
+
+ delete(resercher){
+ this.researcherService.delete(resercher).subscribe(
+ (response) => {
+ simple_notifier("success",null,"Deleted researcher");
+ this.getAllResearchers(false);
+ this.switchToTable();
+ },
+ (err) => {
+ simple_notifier("danger",null,"Could not delete researcher");
+ }
+ )
+ }
+
+
+
+ refreshTable($event){
+ this.getAllResearchers(true);
+ }
+
+
+ @ViewChild(ContextMenuComponent) public basicMenu: ContextMenuComponent;
+
+
+
+}
diff --git a/dmp-admin/src/app/pipes/researcher-table-filter.pipe.ts b/dmp-admin/src/app/pipes/researcher-table-filter.pipe.ts
new file mode 100644
index 000000000..64d8b5c56
--- /dev/null
+++ b/dmp-admin/src/app/pipes/researcher-table-filter.pipe.ts
@@ -0,0 +1,29 @@
+import * as _ from "lodash";
+import {Pipe, PipeTransform} from "@angular/core";
+
+@Pipe({
+ name: "researcherTableFilter"
+})
+export class ResearcherTableFilterPipe implements PipeTransform {
+
+ transform(array: any[], query: string): any {
+
+ if (query) {
+
+ return _.filter(array, row => {
+ if (row.uri == null) row.uri = "";
+ if (row.label == null) row.label = "";
+ if (row.id == null) row.id = "";
+ return (
+
+ row.label.indexOf(query) > -1 ||
+
+ //row.version == query ||
+ row.id.indexOf(query) > -1
+ )
+ });
+
+ }
+ return array;
+ }
+}
\ No newline at end of file
diff --git a/dmp-admin/src/app/routes.ts b/dmp-admin/src/app/routes.ts
index 50a463cc8..9d87c9a9e 100644
--- a/dmp-admin/src/app/routes.ts
+++ b/dmp-admin/src/app/routes.ts
@@ -10,6 +10,7 @@ import { ProjectEditorComponent } from './managers/project-editor/project-editor
import { ServiceEditorComponent } from './managers/service-editor/service-editor.component';
import { RegistryEditorComponent } from './managers/registry-editor/registry-editor.component';
import { OrganisationEditorComponent } from './managers/organisation-editor/organisation-editor.component';
+import { ResearcherEditorComponent } from './managers/researcher-editor/researcher-editor.component';
import { MainWindowComponent } from './main-window/main-window.component';
@@ -57,6 +58,10 @@ export const routes: Routes = [
path: 'registries',
component: RegistryEditorComponent
},
+ {
+ path: 'researchers',
+ component: ResearcherEditorComponent
+ },
{
path: 'main',
component: MainWindowComponent
diff --git a/dmp-admin/src/app/services/researcher-service.ts b/dmp-admin/src/app/services/researcher-service.ts
new file mode 100644
index 000000000..25ff71cdf
--- /dev/null
+++ b/dmp-admin/src/app/services/researcher-service.ts
@@ -0,0 +1,46 @@
+import { Component, Input, OnInit, AfterViewChecked, ViewChild } from '@angular/core';
+import { HttpClient , HttpHeaders, HttpParams} from '@angular/common/http';
+import { TokenService, TokenProvider } from './login/token.service'
+import { Injectable } from '@angular/core';
+import { Toolbox } from '../services/toolbox';
+import {RestBase} from './rest-base';
+import 'rxjs/Rx';
+
+
+@Injectable()
+export class ResearcherService implements OnInit {
+
+
+ constructor(public restBase: RestBase) {
+ }
+
+ ngOnInit(){
+
+ }
+
+ getResearcherIdsLabels() {
+ return this.restBase.get("researcher/listAllLabelIDs");
+ }
+
+ getResearcherIds(){
+ return this.restBase.get("researchers");
+ }
+
+ getAllResearchers(){
+ return this.restBase.get("researcher/getAll");
+ }
+
+ create(researcher){
+ return this.restBase.post("researcher/create", researcher);
+ }
+
+
+ delete(researcherID){
+ var researcher = {"id": researcherID};
+ return this.restBase.post("researcher/delete", researcher);
+ }
+
+
+}
+
+
diff --git a/dmp-admin/src/app/services/rest-base.ts b/dmp-admin/src/app/services/rest-base.ts
index f610ef02e..dc9ff97e0 100644
--- a/dmp-admin/src/app/services/rest-base.ts
+++ b/dmp-admin/src/app/services/rest-base.ts
@@ -22,12 +22,13 @@ export class RestBase {
restpath: string = "rest";
- loginPath : string = this.protocol+"://"+this.hostname+":"+this.port+"/"+this.webappname+"/";
+ loginPath : string = this.protocol+"://"+this.hostname+":"+this.port+"/"+this.webappname+"/login/";
restBasePath: string = this.protocol+"://"+this.hostname+":"+this.port+"/"+this.webappname+"/"+this.restpath+"/";
public login(path : string, data : any){
- return this.http.post(this.loginPath + path, JSON.stringify(data));
+ let options = { headers: new HttpHeaders().set('Content-Type', 'application/json') };
+ return this.http.post(this.loginPath + path, JSON.stringify(data), options);
}
public get(path : string){
diff --git a/dmp-backend/src/main/java/entities/DataRepository.java b/dmp-backend/src/main/java/entities/DataRepository.java
index 70c58534e..f1ca03ec8 100644
--- a/dmp-backend/src/main/java/entities/DataRepository.java
+++ b/dmp-backend/src/main/java/entities/DataRepository.java
@@ -23,8 +23,7 @@ import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
-
-@Entity(name="\"DataRepository\"")
+@Entity
@Table(name="\"DataRepository\"")
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
public class DataRepository implements Serializable {
diff --git a/dmp-backend/src/main/java/rest/entities/DataRepositories.java b/dmp-backend/src/main/java/rest/entities/DataRepositories.java
index 940aa35f5..0edaab611 100644
--- a/dmp-backend/src/main/java/rest/entities/DataRepositories.java
+++ b/dmp-backend/src/main/java/rest/entities/DataRepositories.java
@@ -2,6 +2,9 @@ package rest.entities;
import java.util.List;
import java.util.UUID;
+import java.util.stream.Collectors;
+
+import javax.transaction.Transactional;
import org.apache.commons.lang3.SerializationUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -66,11 +69,11 @@ public class DataRepositories {
@Autowired private ServiceDao serviceDao;
-
+ private ObjectMapper objectMapper = new ObjectMapper();
// MANAGE DATAREPOSITORy(IES)
- @RequestMapping(method = RequestMethod.GET, value = { "/datarepositories" })
+ @RequestMapping(method = RequestMethod.GET, value = { "/datarepos" })
public @ResponseBody ResponseEntity