Merge branch 'master' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot

This commit is contained in:
annampak 2017-10-30 10:37:26 +02:00
commit 51f19c166a
10 changed files with 184 additions and 64 deletions

View File

@ -59,6 +59,7 @@ import { ServiceEditorComponent } from './managers/service-editor/service-editor
import { ResearcherEditorComponent } from './managers/researcher-editor/researcher-editor.component';
import { DatareposEditorComponent } from './managers/datarepos-editor/datarepos-editor.component';
import { DatasetprofileEditorComponent } from './managers/datasetprofile-editor/datasetprofile-editor.component';
import { DatasetProfileGUIEditorComponent } from './dataset-profile-gui-editor/dataset-profile-gui-editor.component';
@ -92,7 +93,8 @@ import { DatasetprofileEditorComponent } from './managers/datasetprofile-editor/
MainSignInComponent,
ResearcherEditorComponent,
DatareposEditorComponent,
DatasetprofileEditorComponent
DatasetprofileEditorComponent,
DatasetProfileGUIEditorComponent
],
imports: [
BrowserModule,

View File

@ -0,0 +1,68 @@
<div class="panel panel-default margin10">
<div class="panel-heading">
<div class="row">
<div class="col col-xs-6">
<h3 class="panel-title">Editing profile: {{profile?.label}}</h3>
</div>
<div class="col col-xs-6 text-right">
<button type="button" class="btn btn-sm btn-primary btn-create" (click)="goToMain()" > <span class="glyphicon glyphicon-arrow-left"></span> Go back</button>
</div>
</div>
</div>
<div class="panel-body">
<ul class="nav nav-tabs content-tabs" id="maincontent" role="tablist">
<li class="active"><a href="#profile" role="tab" data-toggle="tab">Profile</a></li>
<li class=""><a href="#viewstyle" role="tab" data-toggle="tab">Profile's viewstyle</a></li>
<li class=""><a href="#ruleset" role="tab" data-toggle="tab">Profile's ruleset</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="profile">
<br />
<div class="custom-table">
<input name="profile-label" type="text" placeholder="Enter profile label" [ngModel]="profile?.label" (ngModelChange)="profile.label=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)">
<label for="profile-label">Label</label>
</div>
<br />
<div class="custom-table">
<textarea class="form-control custom" rows="10" cols="65" name="profile-definition" [ngModel]="profile?.definition" (ngModelChange)="profile.definition=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)" placeholder="Enter profile definition"></textarea>
<label for="profile-definition">Definition</label>
</div>
</div>
<div class="tab-pane fade" id="viewstyle">
<br />
<div class="custom-table">
<input name="viewstyle-label" type="text" placeholder="Enter viewstyle label" [ngModel]="profile?.viewstyle?.label" (ngModelChange)="profile.viewstyle.label=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)">
<label for="viewstyle-label">Label</label>
</div>
<br />
<div class="custom-table">
<textarea class="form-control custom" rows="10" cols="65" name="viewstyle-definition" [ngModel]="profile?.viewstyle?.definition" (ngModelChange)="profile.viewstyle.definition=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)"></textarea>
<label for="viewstyle-definition">Definition</label>
</div>
</div>
<div class="tab-pane fade" id="ruleset">
<br />
<div class="custom-table">
<input name="ruleset-label" type="text" placeholder="Enter ruleset label" [ngModel]="profile?.ruleset?.label" (ngModelChange)="profile.ruleset.label=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)">
<label for="ruleset-label">Label</label>
</div>
<br />
<div class="custom-table">
<textarea class="form-control custom" rows="10" cols="65" name="ruleset-definition" [ngModel]="profile?.ruleset?.definition" (ngModelChange)="profile.ruleset.definition=$event" (focusin)="onFocusIn($event)" (ngModelChange)="onValueChanged($event)" (focusout)="onFocusOutProfileWin($event)" (keydown)="preventDefaults($event)"></textarea>
<label for="ruleset-definition">Definition</label>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DatasetProfileGUIEditorComponent } from './dataset-profile-gui-editor.component';
describe('DatasetProfileEditorComponent', () => {
let component: DatasetProfileGUIEditorComponent;
let fixture: ComponentFixture<DatasetProfileGUIEditorComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DatasetProfileGUIEditorComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DatasetProfileGUIEditorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,24 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'dataset-profile-gui-editor',
templateUrl: './dataset-profile-gui-editor.component.html',
styleUrls: ['./dataset-profile-gui-editor.component.css']
})
export class DatasetProfileGUIEditorComponent implements OnInit {
constructor() { }
@Input() profile: any;
@Output() notifyClick: EventEmitter<any> = new EventEmitter<any>();
ngOnInit() {
}
goToMain(){
this.notifyClick.emit(1);
}
}

View File

@ -97,9 +97,28 @@
</div>
</div>
<!-- END oF DatasetViewer -->
<!-- END of DatasetViewer -->
<!-- Profile Editor -->
<!-- new profile editor -->
<div [ngClass]="{true:'visible', false:'invisible'}[viewingComponent==2]">
<dataset-profile-gui-editor [profile]=profile (notifyClick)="goToMain()" ></dataset-profile-gui-editor>
</div>
<!-- end of new profile editor -->
<!-- OLD Profile Editor -->
<!--
<div [ngClass]="{true:'visible', false:'invisible'}[viewingComponent==2]">
<div class="panel panel-default margin10">
<div class="panel-heading">
@ -170,6 +189,6 @@
</div>
</div>
</div>
<!-- End of Profile Editor -->
-->
<!-- End of OLD Profile Editor -->

View File

@ -4,6 +4,7 @@ import { Router } from '@angular/router';
import { DatasetsServiceService } from '../services/datasets-service.service';
import { DatasetProfileService } from '../services/dataset-profile.service';
import { DmpsServiceService } from '../services/dmps-service.service';
import { DatasetProfileGUIEditorComponent } from '../dataset-profile-gui-editor/dataset-profile-gui-editor.component';
import '../../assets/custom.js';
declare function simple_notifier(type: string, title: string, message:string): any;

View File

@ -1,12 +1,17 @@
package helpers;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module;
import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module.Feature;
@ -52,5 +57,17 @@ public class SerializerProvider {
return "["+StringUtils.join(list.toArray(), ",")+"]";
}
public static <T> T fromJson(String jsonObject, Class<T> type) throws Exception {
return getJsonSerializer().readValue(jsonObject, type);
}
public static <T> T fromJson(String jsonObject, JavaType type) throws Exception {
return getJsonSerializer().readValue(jsonObject, type);
}
public static <T> T fromJson(String jsonObject, TypeReference type) throws Exception {
return getJsonSerializer().readValue(jsonObject, type);
}
}

View File

@ -1,48 +0,0 @@
##########################Security##########################################
#security.portmapping.http = 7081
#security.portmapping.https = 7444
##########################/Security########################################
##########################Persistence##########################################
persistence.jdbc.driver = org.postgresql.Driver
persistence.jdbc.url = jdbc:postgresql://host:5432/dbname
persistence.dbusername = valid-user
persistence.dbpassword = valid-pass
##########################/Persistence##########################################
###################Allowed Proxy Service Host ############################
proxy.allowed.host = https://eestore.paas2.uninett.no
#######################################################
########################Persistence/Hibernate Generic#############################
persistence.hibernate.show_sql = false
persistence.hibernate.hbm2dll = validate
persistence.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
#persistence.hibernate.dialect = org.hibernate.spatial.dialect.postgis.PostgisDialect
########################Persistence/Hibernate Generic#############################
########################Persistence/Hibernate/Batch##############################
persistence.hibernate.jdbc.batch_size = 30
persistence.hibernate.order_inserts = true
persistence.hibernate.order_updates = true
persistence.hibernate.batch_versioned_data = true
persistence.hibernate.jdbc.batch_versioned_data = DELAYED_ACQUISITION_AND_RELEASE_AFTER_TRANSACTION
########################Persistence/Hibernate/Batch##############################
########################Persistence/Hibernate/Connection pool####################
persistence.hibernate.connectionpool.provider_class = org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider
persistence.hibernate.connectionpool.c3p0.min_size = 5
persistence.hibernate.connectionpool.c3p0.max_size = 100
persistence.hibernate.connectionpool.c3p0.timeout = 0
persistence.hibernate.connectionpool.c3p0.max_statements = 50
persistence.hibernate.connectionpool.c3p0.acquire_retry_attempts = 30
persistence.hibernate.connectionpool.c3p0.acquire_retry_delay = 1000
persistence.hibernate.connectionpool.c3p0.idle_test_period = 3000
persistence.hibernate.connectionpool.c3p0.break_after_acquire_failure = false
persistence.hibernate.connectionpool.c3p0.idle_connection_test_period = 3600
persistence.hibernate.connectionpool.c3p0.test_connection_on_checkin = true
persistence.hibernate.connectionpool.c3p0.test_connection_on_checkout = false
persistence.hibernate.connectionpool.c3p0.preferred_test_query = select 1
########################Persistence/Hibernate/Connection pool####################

View File

@ -2,6 +2,7 @@ import static org.junit.Assert.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.junit.Before;
@ -17,6 +18,8 @@ import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.CollectionType;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
@ -36,6 +39,7 @@ import dao.entities.UserInfoDao;
import entities.DatasetProfile;
import entities.DatasetProfileRuleset;
import entities.DatasetProfileViewstyle;
import entities.Project;
import entities.Service;
import helpers.SerializerProvider;
import rest.entities.DMPs;
@ -156,29 +160,37 @@ public class TestRest {
// @Test
public void testProject() {
@Test
public void testUserProject() {
// System.out.println(projectsService.listProjects().getBody());
// System.out.println(dmpsService.listDMPs().getBody());
// System.out.println(projectsService.getProjectsOfUser().getBody());
CollectionType typeReference = TypeFactory.defaultInstance().constructCollectionType(List.class, Project.class);
List<Project> userProjects = null;
try {
userProjects = SerializerProvider.fromJson(projectsService.getProjectsOfUser().getBody().toString(), typeReference) ;
} catch (Exception e) {
fail("Should not have thrown any exception");
}
assertNotNull(userProjects);
System.out.println(userProjects.size());
System.out.println(SerializerProvider.toJson(userProjects));
System.out.println(projectsService.getProjectsOfUser().getBody());
assertEquals("aaa", "aaa");
}
@Test
// @Test
public void testDmpUser() {
System.out.println(dmpsService.getDmpsOfUser().getBody());
// System.out.println(projectsService.listProjects().getBody());
// System.out.println(dmpsService.listDMPs().getBody());
assertEquals("aaa", "aaa");