no message

This commit is contained in:
Ioannis Kalyvas 2018-02-16 12:34:02 +02:00
parent 8892c62791
commit bf10c0c31c
268 changed files with 5286 additions and 5535 deletions

5
dmp-backend/Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
ADD ${JAR_FILE} app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

View File

@ -1,16 +1,11 @@
package eu.eudat;
import eu.eudat.handlers.PrincipalArgumentResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import java.util.List;
@SpringBootApplication
public class EuDatApplication extends SpringBootServletInitializer {

View File

@ -4,9 +4,6 @@ import eu.eudat.builders.Builder;
import eu.eudat.entities.Credential;
import eu.eudat.entities.UserInfo;
import javax.persistence.Column;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import java.util.Date;
import java.util.UUID;
@ -71,7 +68,7 @@ public class CredentialBuilder extends Builder<Credential> {
return this;
}
public Credential build(){
public Credential build() {
Credential credential = new Credential();
credential.setStatus(status);
credential.setLastUpdateTime(lastUpdateTime);

View File

@ -3,11 +3,7 @@ package eu.eudat.builders.entity;
import eu.eudat.builders.Builder;
import eu.eudat.entities.Dataset;
import eu.eudat.entities.DatasetProfile;
import org.hibernate.annotations.Type;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import java.util.Date;
import java.util.Set;
import java.util.UUID;

View File

@ -5,9 +5,7 @@ import eu.eudat.entities.Credential;
import eu.eudat.entities.DMP;
import eu.eudat.entities.UserInfo;
import eu.eudat.entities.UserRole;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

View File

@ -4,10 +4,6 @@ import eu.eudat.builders.Builder;
import eu.eudat.entities.UserInfo;
import eu.eudat.entities.UserRole;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import java.util.UUID;
/**

View File

@ -4,10 +4,6 @@ import eu.eudat.builders.Builder;
import eu.eudat.entities.UserInfo;
import eu.eudat.entities.UserToken;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import java.util.Date;
import java.util.UUID;

View File

@ -1,7 +1,6 @@
package eu.eudat.builders.model.criteria;
import eu.eudat.builders.Builder;
import eu.eudat.entities.Registry;
import eu.eudat.models.criteria.RegistryCriteria;
/**

View File

@ -1,43 +1,41 @@
package eu.eudat.cache;
import com.google.common.cache.CacheBuilder;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.guava.GuavaCache;
import org.springframework.cache.support.SimpleCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.support.SimpleCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.cache.guava.GuavaCache;
import com.google.common.cache.CacheBuilder;
@Component
@EnableCaching
public class ResponsesCache {
public static long HOW_MANY = 30;
public static TimeUnit TIME_UNIT = TimeUnit.MINUTES;
@Bean
public CacheManager cacheManager() {
System.out.print("Loading ResponsesCache...");
SimpleCacheManager simpleCacheManager = new SimpleCacheManager();
List<GuavaCache> caches = new ArrayList<GuavaCache>();
caches.add(new GuavaCache("repositories", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
caches.add(new GuavaCache("projects", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
caches.add(new GuavaCache("organisations", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
caches.add(new GuavaCache("registries", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
caches.add(new GuavaCache("services", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
caches.add(new GuavaCache("researchers", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
simpleCacheManager.setCaches(caches);
System.out.println("OK");
return simpleCacheManager;
}
public static long HOW_MANY = 30;
public static TimeUnit TIME_UNIT = TimeUnit.MINUTES;
@Bean
public CacheManager cacheManager() {
System.out.print("Loading ResponsesCache...");
SimpleCacheManager simpleCacheManager = new SimpleCacheManager();
List<GuavaCache> caches = new ArrayList<GuavaCache>();
caches.add(new GuavaCache("repositories", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
caches.add(new GuavaCache("projects", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
caches.add(new GuavaCache("organisations", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
caches.add(new GuavaCache("registries", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
caches.add(new GuavaCache("services", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
caches.add(new GuavaCache("researchers", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
simpleCacheManager.setCaches(caches);
System.out.println("OK");
return simpleCacheManager;
}
}

View File

@ -15,6 +15,7 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import java.util.Properties;
@ -67,7 +68,7 @@ public class DevelDatabaseConfiguration {
Properties properties = new Properties();
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQL92Dialect");
properties.setProperty("hibernate.show_sql", "true");
properties.setProperty("hibernate.temp.use_jdbc_metadata_defaults","false");
properties.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false");
return properties;
}
}

View File

@ -70,7 +70,7 @@ public class ProductionDatabaseConfiguration {
Properties properties = new Properties();
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQL92Dialect");
properties.setProperty("hibernate.show_sql", "true");
properties.setProperty("hibernate.temp.use_jdbc_metadata_defaults","false");
properties.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false");
return properties;
}
}

View File

@ -3,14 +3,9 @@ package eu.eudat.configurations;
import eu.eudat.handlers.PrincipalArgumentResolver;
import eu.eudat.services.AuthenticationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.web.servlet.ErrorPage;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import java.util.List;
@ -21,6 +16,7 @@ public class WebMVCConfiguration extends WebMvcConfigurerAdapter {
@Autowired
AuthenticationService authenticationService;
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(new PrincipalArgumentResolver(this.authenticationService));

View File

@ -1,32 +1,20 @@
package eu.eudat.controllers;
import java.util.UUID;
import eu.eudat.dao.entities.*;
import eu.eudat.managers.DashBoardManager;
import eu.eudat.models.dashboard.DashBoardStatistics;
import eu.eudat.managers.AdminManager;
import eu.eudat.models.admin.composite.DatasetProfile;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.models.security.Principal;
import eu.eudat.security.claims.ClaimedAuthorities;
import eu.eudat.services.ApiContext;
import eu.eudat.types.ApiMessageCode;
import eu.eudat.types.Authorities;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import eu.eudat.managers.AdminManager;
import eu.eudat.models.admin.composite.DatasetProfile;
import org.springframework.web.bind.annotation.*;
import javax.transaction.Transactional;
import javax.validation.Valid;
import java.util.UUID;
import static eu.eudat.types.Authorities.ADMIN;
@ -44,7 +32,7 @@ public class Admin extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = {"/admin/addDmp"}, consumes = "application/json", produces = "application/json")
public ResponseEntity<Object> addDmp(@Valid @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
try {
eu.eudat.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile,getApiContext());
eu.eudat.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext());
this.getApiContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
return ResponseEntity.status(HttpStatus.OK).body(modelDefinition.getId());
} catch (Exception ex) {
@ -57,7 +45,7 @@ public class Admin extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = {"/admin/addDmp/{id}"}, consumes = "application/json", produces = "application/json")
public ResponseEntity<ResponseItem<UUID>> updateDmp(@PathVariable String id, @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
try {
eu.eudat.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile,getApiContext());
eu.eudat.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext());
eu.eudat.entities.DatasetProfile datasetprofile = this.getApiContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
datasetprofile.setDefinition(modelDefinition.getDefinition());

View File

@ -5,8 +5,6 @@ import eu.eudat.validators.DataManagementPlanTableRequestValidator;
import eu.eudat.validators.DatasetProfileValidator;
import eu.eudat.validators.ProjectModelValidator;
import eu.eudat.validators.ProjectTableRequestValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
@ -19,16 +17,20 @@ public abstract class BaseController {
return apiContext;
}
public BaseController(ApiContext apiContext){
public BaseController(ApiContext apiContext) {
this.apiContext = apiContext;
}
@InitBinder()
protected void initBinder(WebDataBinder binder) {
if (binder.getTarget() != null && DataManagementPlanTableRequestValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.apiContext.getApplicationContext().getBean("dataManagementPlanTableRequestValidator",DataManagementPlanTableRequestValidator.class));
if (binder.getTarget() != null && ProjectTableRequestValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.apiContext.getApplicationContext().getBean("projectTableRequestValidator",ProjectTableRequestValidator.class));
if (binder.getTarget() != null && DatasetProfileValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.apiContext.getApplicationContext().getBean("datasetProfileValidator",DatasetProfileValidator.class));
if (binder.getTarget() != null && ProjectModelValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.apiContext.getApplicationContext().getBean("projectModelValidator",ProjectModelValidator.class));
if (binder.getTarget() != null && DataManagementPlanTableRequestValidator.supportsType((binder.getTarget().getClass())))
binder.addValidators(this.apiContext.getApplicationContext().getBean("dataManagementPlanTableRequestValidator", DataManagementPlanTableRequestValidator.class));
if (binder.getTarget() != null && ProjectTableRequestValidator.supportsType((binder.getTarget().getClass())))
binder.addValidators(this.apiContext.getApplicationContext().getBean("projectTableRequestValidator", ProjectTableRequestValidator.class));
if (binder.getTarget() != null && DatasetProfileValidator.supportsType((binder.getTarget().getClass())))
binder.addValidators(this.apiContext.getApplicationContext().getBean("datasetProfileValidator", DatasetProfileValidator.class));
if (binder.getTarget() != null && ProjectModelValidator.supportsType((binder.getTarget().getClass())))
binder.addValidators(this.apiContext.getApplicationContext().getBean("projectModelValidator", ProjectModelValidator.class));
}
}

View File

@ -1,17 +1,14 @@
package eu.eudat.controllers;
import java.util.*;
import javax.validation.Valid;
import eu.eudat.entities.DMP;
import eu.eudat.exceptions.datamanagementplan.DMPWithDatasetsException;
import eu.eudat.managers.DataManagementPlanManager;
import eu.eudat.models.dmp.DataManagementPlan;
import eu.eudat.models.dmp.DataManagementPlanCriteriaRequest;
import eu.eudat.models.dmp.DataManagementPlanTableRequest;
import eu.eudat.models.helpers.common.DataTableData;
import eu.eudat.models.helpers.responses.*;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.models.listingmodels.DataManagementPlanListingModel;
import eu.eudat.models.security.Principal;
import eu.eudat.services.ApiContext;
@ -19,11 +16,12 @@ import eu.eudat.types.ApiMessageCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import eu.eudat.managers.DataManagementPlanManager;
import javax.validation.Valid;
import java.util.List;
import java.util.UUID;
@RestController
@ -119,9 +117,9 @@ public class DMPs extends BaseController {
try {
DataManagementPlanManager.delete(this.getApiContext(), id);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully Deleted Dataset"));
} catch (DMPWithDatasetsException ex){
} catch (DMPWithDatasetsException ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DMP>().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()));
}catch (Exception ex) {
} catch (Exception ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DMP>().status(ApiMessageCode.DEFAULT_ERROR_MESSAGE).message(ex.getMessage()));
}

View File

@ -1,5 +1,7 @@
package eu.eudat.controllers;
import eu.eudat.managers.DashBoardManager;
import eu.eudat.models.dashboard.DashBoardStatistics;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.models.security.Principal;
import eu.eudat.services.ApiContext;
@ -12,45 +14,37 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import eu.eudat.dao.entities.DMPDao;
import eu.eudat.dao.entities.DatasetDao;
import eu.eudat.dao.entities.ProjectDao;
import eu.eudat.managers.DashBoardManager;
import eu.eudat.models.dashboard.DashBoardStatistics;
@RestController
@CrossOrigin
@RequestMapping(value = {"/api"})
public class DashBoardController extends BaseController{
public class DashBoardController extends BaseController {
@Autowired
public DashBoardController(ApiContext apiContext) {
super(apiContext);
}
@Autowired
public DashBoardController(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = { "/dashboard/getStatistics" }, produces="application/json")
public ResponseEntity<ResponseItem<DashBoardStatistics>> getStatistics(){
try {
DashBoardStatistics statistics = new DashBoardManager().getStatistics(this.getApiContext().getDatabaseRepository().getDatasetDao(), this.getApiContext().getDatabaseRepository().getDmpDao()
, this.getApiContext().getDatabaseRepository().getProjectDao());
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DashBoardStatistics>().status(ApiMessageCode.NO_MESSAGE).payload(statistics));
}
catch(Exception ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DashBoardStatistics>().status(ApiMessageCode.DEFAULT_ERROR_MESSAGE).message(ex.getMessage()));
}
}
@RequestMapping(method = RequestMethod.GET, value = {"/dashboard/getStatistics"}, produces = "application/json")
public ResponseEntity<ResponseItem<DashBoardStatistics>> getStatistics() {
try {
DashBoardStatistics statistics = new DashBoardManager().getStatistics(this.getApiContext().getDatabaseRepository().getDatasetDao(), this.getApiContext().getDatabaseRepository().getDmpDao()
, this.getApiContext().getDatabaseRepository().getProjectDao());
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DashBoardStatistics>().status(ApiMessageCode.NO_MESSAGE).payload(statistics));
} catch (Exception ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DashBoardStatistics>().status(ApiMessageCode.DEFAULT_ERROR_MESSAGE).message(ex.getMessage()));
}
}
@RequestMapping(method = RequestMethod.GET, value = { "/dashboard/me/getStatistics" }, produces="application/json")
public ResponseEntity<ResponseItem<DashBoardStatistics>> getStatistics(Principal principal){
try {
DashBoardStatistics statistics = new DashBoardManager().getMeStatistics(this.getApiContext().getDatabaseRepository().getDatasetDao(), this.getApiContext().getDatabaseRepository().getDmpDao()
, this.getApiContext().getDatabaseRepository().getProjectDao(),principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DashBoardStatistics>().status(ApiMessageCode.NO_MESSAGE).payload(statistics));
}
catch(Exception ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DashBoardStatistics>().status(ApiMessageCode.DEFAULT_ERROR_MESSAGE).message(ex.getMessage()));
}
}
@RequestMapping(method = RequestMethod.GET, value = {"/dashboard/me/getStatistics"}, produces = "application/json")
public ResponseEntity<ResponseItem<DashBoardStatistics>> getStatistics(Principal principal) {
try {
DashBoardStatistics statistics = new DashBoardManager().getMeStatistics(this.getApiContext().getDatabaseRepository().getDatasetDao(), this.getApiContext().getDatabaseRepository().getDmpDao()
, this.getApiContext().getDatabaseRepository().getProjectDao(), principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DashBoardStatistics>().status(ApiMessageCode.NO_MESSAGE).payload(statistics));
} catch (Exception ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DashBoardStatistics>().status(ApiMessageCode.DEFAULT_ERROR_MESSAGE).message(ex.getMessage()));
}
}
}

View File

@ -1,48 +1,41 @@
package eu.eudat.controllers;
import java.util.List;
import java.util.Map;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.proxy.config.exceptions.HugeResultSet;
import eu.eudat.proxy.config.exceptions.NoURLFound;
import eu.eudat.services.ApiContext;
import eu.eudat.types.ApiMessageCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import eu.eudat.proxy.config.exceptions.HugeResultSet;
import eu.eudat.proxy.config.exceptions.NoURLFound;
import java.util.List;
import java.util.Map;
@RestController
@CrossOrigin
@RequestMapping(value = {"/api"})
public class DataRepositories extends BaseController{
public class DataRepositories extends BaseController {
@Autowired
public DataRepositories(ApiContext apiContext) {
super(apiContext);
}
@Autowired
public DataRepositories(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = {"/external/datarepos"}, produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<List<Map<String, String>>>> listExternalDataRepositories(@RequestParam(value = "query", required = false) String query) {
try {
List<Map<String, String>> remoteRepos = this.getApiContext().getRemoteFetcher().getRepositories(query);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Map<String, String>>>().status(ApiMessageCode.NO_MESSAGE).payload(remoteRepos));
} catch (NoURLFound ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<List<Map<String, String>>>().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()).payload(null));
} catch (HugeResultSet ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<List<Map<String, String>>>().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()).payload(null));
}
}
@RequestMapping(method = RequestMethod.GET, value = { "/external/datarepos" }, produces="application/json")
public @ResponseBody ResponseEntity<ResponseItem<List<Map<String,String>>>> listExternalDataRepositories(@RequestParam(value="query", required=false) String query ){
try {
List<Map<String,String>> remoteRepos = this.getApiContext().getRemoteFetcher().getRepositories(query);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Map<String,String>>>().status(ApiMessageCode.NO_MESSAGE).payload(remoteRepos));
}
catch(NoURLFound ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<List<Map<String,String>>>().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()).payload(null));
}
catch(HugeResultSet ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<List<Map<String,String>>>().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()).payload(null));
}
}
}

View File

@ -1,14 +1,10 @@
package eu.eudat.controllers;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import eu.eudat.managers.UserManager;
import eu.eudat.models.components.commons.datafield.AutoCompleteData;
import eu.eudat.models.helpers.common.AutoCompleteLookupItem;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.models.user.composite.DatasetProfile;
import eu.eudat.models.properties.PropertiesModel;
import eu.eudat.models.user.composite.PagedDatasetProfile;
import eu.eudat.services.ApiContext;
import eu.eudat.types.ApiMessageCode;
@ -17,16 +13,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import eu.eudat.managers.UserManager;
import eu.eudat.models.helpers.common.AutoCompleteLookupItem;
import eu.eudat.models.properties.PropertiesModel;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@RestController
@CrossOrigin

View File

@ -1,7 +1,5 @@
package eu.eudat.controllers;
import java.util.List;
import eu.eudat.managers.DatasetProfileManager;
import eu.eudat.models.datasetprofile.DatasetProfileAutocompleteItem;
import eu.eudat.models.datasetprofile.DatasetProfileAutocompleteRequest;
@ -14,12 +12,9 @@ import eu.eudat.types.ApiMessageCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController

View File

@ -1,13 +1,10 @@
package eu.eudat.controllers;
import java.util.Locale;
import java.util.UUID;
import eu.eudat.entities.Dataset;
import eu.eudat.managers.DatasetManager;
import eu.eudat.models.dataset.DatasetTableRequest;
import eu.eudat.models.helpers.common.DataTableData;
import eu.eudat.models.helpers.responses.*;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.models.listingmodels.DatasetListingModel;
import eu.eudat.models.security.Principal;
import eu.eudat.services.ApiContext;
@ -16,13 +13,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Locale;
import java.util.UUID;
@RestController

View File

@ -20,7 +20,7 @@ import java.util.UUID;
@RestController
@CrossOrigin
@RequestMapping(value = {"/api"})
public class ExternalDatasets extends BaseController{
public class ExternalDatasets extends BaseController {
@Autowired
public ExternalDatasets(ApiContext apiContext) {
@ -28,7 +28,8 @@ public class ExternalDatasets extends BaseController{
}
@RequestMapping(method = RequestMethod.POST, value = {"/externaldatasets/getPaged"}, consumes = "application/json", produces = "application/json")
public @ResponseBody ResponseEntity<ResponseItem<DataTableData<ExternalDatasetListingModel>>> getPaged(@RequestBody ExternalDatasetTableRequest datasetTableRequest, Principal principal) {
public @ResponseBody
ResponseEntity<ResponseItem<DataTableData<ExternalDatasetListingModel>>> getPaged(@RequestBody ExternalDatasetTableRequest datasetTableRequest, Principal principal) {
try {
DataTableData<ExternalDatasetListingModel> dataTable = new ExternalDatasetManager().getPaged(this.getApiContext(), datasetTableRequest);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<ExternalDatasetListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
@ -40,7 +41,8 @@ public class ExternalDatasets extends BaseController{
}
@RequestMapping(method = RequestMethod.GET, value = {"/external/datasets"}, produces = "application/json")
public @ResponseBody ResponseEntity<ResponseItem<List<ExternalDatasetListingModel>>> getWithExternal(@RequestParam(value = "query", required = false) String query, Principal principal) {
public @ResponseBody
ResponseEntity<ResponseItem<List<ExternalDatasetListingModel>>> getWithExternal(@RequestParam(value = "query", required = false) String query, Principal principal) {
try {
List<ExternalDatasetListingModel> dataTable = new ExternalDatasetManager().getWithExternal(this.getApiContext(), query, this.getApiContext().getRemoteFetcher());
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<ExternalDatasetListingModel>>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE));
@ -51,10 +53,11 @@ public class ExternalDatasets extends BaseController{
}
@RequestMapping(method = RequestMethod.POST, value = {"/externaldatasets/getSingle/{id}"}, consumes = "application/json", produces = "application/json")
public @ResponseBody ResponseItem<ExternalDatasetListingModel> getWithExternal(@PathVariable UUID id, Principal principal) {
public @ResponseBody
ResponseItem<ExternalDatasetListingModel> getWithExternal(@PathVariable UUID id, Principal principal) {
try {
ExternalDatasetListingModel externalDatasetModel = new ExternalDatasetManager().getSingle(this.getApiContext().getDatabaseRepository().getExternalDatasetDao(), id);
return new ResponseItem<ExternalDatasetListingModel>().payload(externalDatasetModel ).status(ApiMessageCode.NO_MESSAGE);
return new ResponseItem<ExternalDatasetListingModel>().payload(externalDatasetModel).status(ApiMessageCode.NO_MESSAGE);
} catch (Exception ex) {
ex.printStackTrace();
return new ResponseItem<ExternalDatasetListingModel>().status(ApiMessageCode.DEFAULT_ERROR_MESSAGE).message(ex.getMessage());

View File

@ -2,8 +2,8 @@ package eu.eudat.controllers;
import eu.eudat.exceptions.security.UnauthorisedException;
import eu.eudat.managers.UserManager;
import eu.eudat.models.login.Credentials;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.models.login.Credentials;
import eu.eudat.models.login.LoginInfo;
import eu.eudat.models.security.Principal;
import eu.eudat.security.CustomAuthenticationProvider;

View File

@ -1,52 +1,45 @@
package eu.eudat.controllers;
import java.util.List;
import java.util.Map;
import eu.eudat.models.external.OrganisationsExternalSourcesModel;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.proxy.config.exceptions.HugeResultSet;
import eu.eudat.proxy.config.exceptions.NoURLFound;
import eu.eudat.services.ApiContext;
import eu.eudat.types.ApiMessageCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import eu.eudat.proxy.config.exceptions.HugeResultSet;
import eu.eudat.proxy.config.exceptions.NoURLFound;
import java.util.List;
import java.util.Map;
@RestController
@CrossOrigin
@RequestMapping(value = {"/api"})
public class Organisations extends BaseController{
public class Organisations extends BaseController {
@Autowired
public Organisations(ApiContext apiContext) {
super(apiContext);
}
@Autowired
public Organisations(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = { "/external/organisations" }, produces="application/json")
public @ResponseBody ResponseEntity<ResponseItem<OrganisationsExternalSourcesModel>> listExternalOrganisations(@RequestParam(value="query", required=false) String query ){
try {
List<Map<String,String>> remoteRepos = this.getApiContext().getRemoteFetcher().getOrganisations(query);
OrganisationsExternalSourcesModel projectsExternalSourcesModel = new OrganisationsExternalSourcesModel().fromExternalItem(remoteRepos);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<OrganisationsExternalSourcesModel>().payload(projectsExternalSourcesModel).status(ApiMessageCode.SUCCESS_MESSAGE));
}
catch(NoURLFound ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<OrganisationsExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("External Url Not Found"));
}
catch(HugeResultSet ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<OrganisationsExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("Huge Result Set"));
}catch (Exception ex){
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<OrganisationsExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()));
}
}
@RequestMapping(method = RequestMethod.GET, value = {"/external/organisations"}, produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<OrganisationsExternalSourcesModel>> listExternalOrganisations(@RequestParam(value = "query", required = false) String query) {
try {
List<Map<String, String>> remoteRepos = this.getApiContext().getRemoteFetcher().getOrganisations(query);
OrganisationsExternalSourcesModel projectsExternalSourcesModel = new OrganisationsExternalSourcesModel().fromExternalItem(remoteRepos);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<OrganisationsExternalSourcesModel>().payload(projectsExternalSourcesModel).status(ApiMessageCode.SUCCESS_MESSAGE));
} catch (NoURLFound ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<OrganisationsExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("External Url Not Found"));
} catch (HugeResultSet ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<OrganisationsExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("Huge Result Set"));
} catch (Exception ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<OrganisationsExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()));
}
}
}

View File

@ -1,41 +1,27 @@
package eu.eudat.controllers;
import java.util.List;
import java.util.Map;
import javax.transaction.Transactional;
import javax.validation.Valid;
import eu.eudat.entities.Project;
import eu.eudat.managers.ProjectManager;
import eu.eudat.models.external.ProjectsExternalSourcesModel;
import eu.eudat.models.helpers.responses.*;
import eu.eudat.models.helpers.common.DataTableData;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.models.project.ProjectCriteriaRequest;
import eu.eudat.models.project.ProjectListingModel;
import eu.eudat.models.project.ProjectTableRequest;
import eu.eudat.models.security.Principal;
import eu.eudat.security.claims.ClaimedAuthorities;
import eu.eudat.proxy.config.exceptions.HugeResultSet;
import eu.eudat.proxy.config.exceptions.NoURLFound;
import eu.eudat.services.ApiContext;
import eu.eudat.types.ApiMessageCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import eu.eudat.entities.Project;
import eu.eudat.managers.ProjectManager;
import eu.eudat.models.helpers.common.DataTableData;
import eu.eudat.models.project.ProjectTableRequest;
import eu.eudat.proxy.config.exceptions.HugeResultSet;
import eu.eudat.proxy.config.exceptions.NoURLFound;
import static eu.eudat.types.Authorities.ADMIN;
import static eu.eudat.types.Authorities.USER;
import javax.transaction.Transactional;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@RestController

View File

@ -1,55 +1,48 @@
package eu.eudat.controllers;
import java.util.List;
import java.util.Map;
import eu.eudat.models.external.RegistriesExternalSourcesModel;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.proxy.config.exceptions.HugeResultSet;
import eu.eudat.proxy.config.exceptions.NoURLFound;
import eu.eudat.services.ApiContext;
import eu.eudat.types.ApiMessageCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import eu.eudat.proxy.config.exceptions.HugeResultSet;
import eu.eudat.proxy.config.exceptions.NoURLFound;
import java.util.List;
import java.util.Map;
@RestController
@CrossOrigin
@RequestMapping(value = {"/api"})
public class Registries extends BaseController{
public class Registries extends BaseController {
@Autowired
public Registries(ApiContext apiContext) {
super(apiContext);
}
@Autowired
public Registries(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = {"/external/registries"}, produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<RegistriesExternalSourcesModel>> listExternalRegistries(@RequestParam(value = "query", required = false) String query) {
try {
List<Map<String, String>> remoteRepos = this.getApiContext().getRemoteFetcher().getRegistries(query);
RegistriesExternalSourcesModel registriesExternalSourcesModel = new RegistriesExternalSourcesModel().fromExternalItem(remoteRepos);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<RegistriesExternalSourcesModel>().payload(registriesExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
} catch (NoURLFound ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<RegistriesExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("External Url Not Found"));
} catch (HugeResultSet ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<RegistriesExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("Huge Result Set"));
} catch (Exception ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<RegistriesExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()));
}
}
@RequestMapping(method = RequestMethod.GET, value = { "/external/registries" }, produces="application/json")
public @ResponseBody ResponseEntity<ResponseItem<RegistriesExternalSourcesModel>> listExternalRegistries(@RequestParam(value="query", required=false) String query ){
try {
List<Map<String,String>> remoteRepos = this.getApiContext().getRemoteFetcher().getRegistries(query);
RegistriesExternalSourcesModel registriesExternalSourcesModel = new RegistriesExternalSourcesModel().fromExternalItem(remoteRepos);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<RegistriesExternalSourcesModel>().payload(registriesExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
}
catch(NoURLFound ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<RegistriesExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("External Url Not Found"));
}
catch(HugeResultSet ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<RegistriesExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("Huge Result Set"));
}catch (Exception ex){
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<RegistriesExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()));
}
}
}

View File

@ -1,14 +1,13 @@
package eu.eudat.controllers;
import java.util.List;
import java.util.Map;
import eu.eudat.exceptions.security.UnauthorisedException;
import eu.eudat.managers.ResearcherManager;
import eu.eudat.models.dmp.Researcher;
import eu.eudat.models.external.ResearchersExternalSourcesModel;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.models.security.Principal;
import eu.eudat.proxy.config.exceptions.HugeResultSet;
import eu.eudat.proxy.config.exceptions.NoURLFound;
import eu.eudat.services.ApiContext;
import eu.eudat.types.ApiMessageCode;
import org.springframework.beans.factory.annotation.Autowired;
@ -17,53 +16,52 @@ import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import eu.eudat.proxy.config.exceptions.HugeResultSet;
import eu.eudat.proxy.config.exceptions.NoURLFound;
import java.util.List;
import java.util.Map;
@RestController
@CrossOrigin
@RequestMapping(value = {"/api"})
public class Researchers extends BaseController{
public class Researchers extends BaseController {
@Autowired
public Researchers(ApiContext apiContext) {
super(apiContext);
}
@Autowired
public Researchers(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = { "/external/researchers" }, produces="application/json")
public @ResponseBody ResponseEntity<ResponseItem<ResearchersExternalSourcesModel>> listExternalResearchers(@RequestParam(value="query", required=false) String query ){
try {
List<Map<String,String>> remoteRepos = this.getApiContext().getRemoteFetcher().getResearchers(query);
ResearchersExternalSourcesModel researchersExternalSourcesModel = new ResearchersExternalSourcesModel().fromExternalItem(remoteRepos);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<ResearchersExternalSourcesModel>().payload(researchersExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
}
catch(NoURLFound ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<ResearchersExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("External Url Not Found"));
}
catch(HugeResultSet ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<ResearchersExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("Huge Result Set"));
}catch (Exception ex){
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<ResearchersExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()));
}
}
@RequestMapping(method = RequestMethod.GET, value = {"/external/researchers"}, produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<ResearchersExternalSourcesModel>> listExternalResearchers(@RequestParam(value = "query", required = false) String query) {
try {
List<Map<String, String>> remoteRepos = this.getApiContext().getRemoteFetcher().getResearchers(query);
ResearchersExternalSourcesModel researchersExternalSourcesModel = new ResearchersExternalSourcesModel().fromExternalItem(remoteRepos);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<ResearchersExternalSourcesModel>().payload(researchersExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
} catch (NoURLFound ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<ResearchersExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("External Url Not Found"));
} catch (HugeResultSet ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<ResearchersExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("Huge Result Set"));
} catch (Exception ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<ResearchersExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()));
}
}
@Transactional
@RequestMapping(method = RequestMethod.POST, value = { "/researchers/create" }, consumes = "application/json",produces="application/json")
public @ResponseBody ResponseEntity<ResponseItem<Researcher>> create(@RequestBody eu.eudat.models.researcher.Researcher researcher, Principal principal) {
try {
ResearcherManager.create(this.getApiContext(),researcher);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Researcher>().status(ApiMessageCode.SUCCESS_MESSAGE));
}catch (UnauthorisedException e){
e.printStackTrace();
throw e;
}
catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<Researcher>().status(ApiMessageCode.SUCCESS_MESSAGE).message(e.getMessage()));
}
}
@Transactional
@RequestMapping(method = RequestMethod.POST, value = {"/researchers/create"}, consumes = "application/json", produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<Researcher>> create(@RequestBody eu.eudat.models.researcher.Researcher researcher, Principal principal) {
try {
ResearcherManager.create(this.getApiContext(), researcher);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Researcher>().status(ApiMessageCode.SUCCESS_MESSAGE));
} catch (UnauthorisedException e) {
e.printStackTrace();
throw e;
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<Researcher>().status(ApiMessageCode.SUCCESS_MESSAGE).message(e.getMessage()));
}
}
}

View File

@ -1,52 +1,45 @@
package eu.eudat.controllers;
import java.util.List;
import java.util.Map;
import eu.eudat.models.external.ServiceExternalSourcesModel;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.proxy.config.exceptions.HugeResultSet;
import eu.eudat.proxy.config.exceptions.NoURLFound;
import eu.eudat.services.ApiContext;
import eu.eudat.types.ApiMessageCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import eu.eudat.proxy.config.exceptions.HugeResultSet;
import eu.eudat.proxy.config.exceptions.NoURLFound;
import java.util.List;
import java.util.Map;
@RestController
@CrossOrigin
@RequestMapping(value = {"/api"})
public class Services extends BaseController{
public class Services extends BaseController {
@Autowired
public Services(ApiContext apiContext) {
super(apiContext);
}
@Autowired
public Services(ApiContext apiContext) {
super(apiContext);
}
@RequestMapping(method = RequestMethod.GET, value = { "/external/services" }, produces="application/json")
public @ResponseBody ResponseEntity<ResponseItem<ServiceExternalSourcesModel>> listExternalServices(@RequestParam(value="query", required=false) String query ){
try {
List<Map<String,String>> remoteRepos = this.getApiContext().getRemoteFetcher().getServices(query);
ServiceExternalSourcesModel serviceExternalSourcesModel = new ServiceExternalSourcesModel().fromExternalItem(remoteRepos);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<ServiceExternalSourcesModel>().payload(serviceExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
}
catch(NoURLFound ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<ServiceExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("External Url Not Found"));
}
catch(HugeResultSet ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<ServiceExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("Huge Result Set"));
}catch (Exception ex){
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<ServiceExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()));
}
}
@RequestMapping(method = RequestMethod.GET, value = {"/external/services"}, produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<ServiceExternalSourcesModel>> listExternalServices(@RequestParam(value = "query", required = false) String query) {
try {
List<Map<String, String>> remoteRepos = this.getApiContext().getRemoteFetcher().getServices(query);
ServiceExternalSourcesModel serviceExternalSourcesModel = new ServiceExternalSourcesModel().fromExternalItem(remoteRepos);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<ServiceExternalSourcesModel>().payload(serviceExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
} catch (NoURLFound ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<ServiceExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("External Url Not Found"));
} catch (HugeResultSet ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<ServiceExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message("Huge Result Set"));
} catch (Exception ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<ServiceExternalSourcesModel>().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()));
}
}
}

View File

@ -22,7 +22,7 @@ import java.util.UUID;
@RequestMapping("api/invite/")
@RestController
@CrossOrigin
public class UserInvitationController extends BaseController{
public class UserInvitationController extends BaseController {
@Autowired
public UserInvitationController(ApiContext apiContext) {
@ -30,10 +30,11 @@ public class UserInvitationController extends BaseController{
}
@Transactional
@RequestMapping(method = RequestMethod.POST, value = { "/users" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<ResponseItem<Invitation>> users(@RequestBody Invitation invitation, Principal principal) {
@RequestMapping(method = RequestMethod.POST, value = {"/users"}, consumes = "application/json", produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<Invitation>> users(@RequestBody Invitation invitation, Principal principal) {
try {
InvitationsManager.inviteUsers(this.getApiContext(),invitation,principal);
InvitationsManager.inviteUsers(this.getApiContext(), invitation, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Invitation>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Users have beeen invited"));
} catch (Exception e) {
e.printStackTrace();
@ -42,25 +43,26 @@ public class UserInvitationController extends BaseController{
}
@Transactional
@RequestMapping(method = RequestMethod.GET, value = { "/exchange/{invitationID}" }, produces="application/json")
public @ResponseBody ResponseEntity<ResponseItem<UUID>> exchange(@PathVariable UUID invitationID, Principal principal) {
@RequestMapping(method = RequestMethod.GET, value = {"/exchange/{invitationID}"}, produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<UUID>> exchange(@PathVariable UUID invitationID, Principal principal) {
try {
UUID dmpId = InvitationsManager.assignUserAcceptedInvitation(this.getApiContext(),invitationID,principal);
UUID dmpId = InvitationsManager.assignUserAcceptedInvitation(this.getApiContext(), invitationID, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.SUCCESS_MESSAGE).payload(dmpId));
}catch (UnauthorisedException e){
} catch (UnauthorisedException e) {
e.printStackTrace();
throw e;
}
catch (Exception e) {
throw e;
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<UUID>().status(ApiMessageCode.SUCCESS_MESSAGE).message(e.getMessage()));
}
}
@RequestMapping(method = RequestMethod.POST, value = { "/getUsers" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<ResponseItem<List<UserInfoInvitationModel>>> getUsers(@RequestBody UserInfoRequestItem userInfoRequestItem) {
@RequestMapping(method = RequestMethod.POST, value = {"/getUsers"}, consumes = "application/json", produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<List<UserInfoInvitationModel>>> getUsers(@RequestBody UserInfoRequestItem userInfoRequestItem) {
try {
List<UserInfoInvitationModel> users = InvitationsManager.getUsers(this.getApiContext(),userInfoRequestItem);
List<UserInfoInvitationModel> users = InvitationsManager.getUsers(this.getApiContext(), userInfoRequestItem);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<UserInfoInvitationModel>>().status(ApiMessageCode.SUCCESS_MESSAGE).payload(users));
} catch (Exception e) {
e.printStackTrace();

View File

@ -1,11 +1,8 @@
package eu.eudat.controllers;
import eu.eudat.managers.ProjectManager;
import eu.eudat.managers.UserManager;
import eu.eudat.models.helpers.common.DataTableData;
import eu.eudat.models.helpers.responses.ResponseItem;
import eu.eudat.models.project.ProjectListingModel;
import eu.eudat.models.project.ProjectTableRequest;
import eu.eudat.models.security.Principal;
import eu.eudat.models.userinfo.UserInfoTableRequestItem;
import eu.eudat.models.userinfo.UserListingModel;
@ -21,7 +18,6 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import static eu.eudat.types.Authorities.ADMIN;
import static eu.eudat.types.Authorities.USER;
@RestController

View File

@ -40,7 +40,7 @@ public class ControllerErrorHandler {
private ValidationErrorContext processFieldErrors(List<FieldError> fieldErrors) {
ValidationErrorContext dto = new ValidationErrorContext();
for (FieldError fieldError: fieldErrors) {
for (FieldError fieldError : fieldErrors) {
String localizedErrorMessage = resolveLocalizedErrorMessage(fieldError);
dto.addFieldError(fieldError.getField(), localizedErrorMessage);
}
@ -49,7 +49,7 @@ public class ControllerErrorHandler {
}
private String resolveLocalizedErrorMessage(FieldError fieldError) {
Locale currentLocale = LocaleContextHolder.getLocale();
Locale currentLocale = LocaleContextHolder.getLocale();
String localizedErrorMessage = messageSource.getMessage(fieldError, currentLocale);
if (localizedErrorMessage.equals(fieldError.getDefaultMessage())) {

View File

@ -7,12 +7,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.*;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import java.util.List;
import java.util.UUID;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceContext;
@Repository("databaseCtx")
@ -35,11 +32,11 @@ public class DatabaseContext<T extends DataEntity<T>> {
EntityManager entityManager = this.entityManager;
if (item.getKeys()[0] != null) {
T oldItem = entityManager.find(type, item.getKeys()[0]);
if(oldItem!=null) {
if (oldItem != null) {
oldItem.update(item);
entityManager.merge(oldItem);
return oldItem;
}else {
} else {
entityManager.persist(item);
}
} else entityManager.persist(item);
@ -51,7 +48,7 @@ public class DatabaseContext<T extends DataEntity<T>> {
return ((Number) entityManager.createQuery("select count(e) from " + entityClass.getSimpleName() + " e").getSingleResult()).longValue();
}
public void delete(T item){
public void delete(T item) {
this.entityManager.remove(item);
}
}

View File

@ -6,10 +6,8 @@ import eu.eudat.entities.DataEntity;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Set;
import java.util.UUID;
@Service("databaseService")
@ -26,19 +24,19 @@ public class DatabaseService<T extends DataEntity<T>> {
return this.databaseCtx.getQueryable(tClass);
}
public QueryableList<T> getQueryable(Set<String> hints,Class<T> tClass) {
public QueryableList<T> getQueryable(Set<String> hints, Class<T> tClass) {
return this.databaseCtx.getQueryable(tClass).setHints(hints);
}
public T createOrUpdate(T item,Class<T> tClass) {
public T createOrUpdate(T item, Class<T> tClass) {
return this.databaseCtx.createOrUpdate(item, tClass);
}
public Long count(Class<T> tClass){
public Long count(Class<T> tClass) {
return this.databaseCtx.count(tClass);
}
public void delete(T item){
public void delete(T item) {
this.databaseCtx.delete(item);
}

View File

@ -1,7 +1,5 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.DMP;
import eu.eudat.entities.UserInfo;
@ -9,13 +7,15 @@ import eu.eudat.models.criteria.DataManagementPlanCriteria;
import eu.eudat.models.datasetwizard.DatasetWizardAutocompleteRequest;
import eu.eudat.queryable.QueryableList;
import java.util.UUID;
public interface DMPDao extends DatabaseAccessLayer<DMP, UUID> {
QueryableList<DMP> getWithCriteria(DataManagementPlanCriteria criteria);
QueryableList<DMP> getWithCriteria(DataManagementPlanCriteria criteria);
QueryableList<DMP> getUserDmps(DatasetWizardAutocompleteRequest datasetWizardAutocompleteRequest, UserInfo userInfo);
QueryableList<DMP> getUserDmps(DatasetWizardAutocompleteRequest datasetWizardAutocompleteRequest, UserInfo userInfo);
QueryableList<DMP> getAuthenticated(QueryableList<DMP> query,UserInfo principal);
QueryableList<DMP> getAuthenticated(QueryableList<DMP> query, UserInfo principal);
Long count();
Long count();
}

View File

@ -1,24 +1,20 @@
package eu.eudat.dao.entities;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.Dataset;
import eu.eudat.entities.DatasetProfile;
import eu.eudat.entities.DMP;
import eu.eudat.entities.UserInfo;
import eu.eudat.models.criteria.DataManagementPlanCriteria;
import eu.eudat.models.datasetwizard.DatasetWizardAutocompleteRequest;
import eu.eudat.queryable.QueryableList;
import eu.eudat.entities.DMP;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.UUID;
@Component("dMPDao")
public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {

View File

@ -1,12 +1,12 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.DataRepository;
import eu.eudat.models.criteria.DataRepositoryCriteria;
import eu.eudat.queryable.QueryableList;
public interface DataRepositoryDao extends DatabaseAccessLayer<DataRepository,UUID> {
QueryableList<DataRepository> getWithCriteria(DataRepositoryCriteria criteria);
import java.util.UUID;
public interface DataRepositoryDao extends DatabaseAccessLayer<DataRepository, UUID> {
QueryableList<DataRepository> getWithCriteria(DataRepositoryCriteria criteria);
}

View File

@ -1,16 +1,15 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.DataRepository;
import eu.eudat.models.criteria.DataRepositoryCriteria;
import eu.eudat.queryable.QueryableList;
import eu.eudat.entities.DataRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.UUID;
@Component("dataRepositoryDao")
public class DataRepositoryDaoImpl extends DatabaseAccess<DataRepository> implements DataRepositoryDao {

View File

@ -1,25 +1,23 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.DataRepository;
import eu.eudat.entities.Dataset;
import eu.eudat.entities.UserInfo;
import eu.eudat.models.criteria.DatasetCriteria;
import eu.eudat.queryable.QueryableList;
import org.springframework.transaction.annotation.Transactional;
public interface DatasetDao extends DatabaseAccessLayer<Dataset,UUID> {
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
QueryableList<Dataset> getWithCriteria(DatasetCriteria criteria);
public interface DatasetDao extends DatabaseAccessLayer<Dataset, UUID> {
QueryableList<Dataset> getAuthenticated(QueryableList<Dataset> query, UserInfo principal);
QueryableList<Dataset> getWithCriteria(DatasetCriteria criteria);
CompletableFuture<Dataset> createOrUpdateAsync(Dataset item);
QueryableList<Dataset> getAuthenticated(QueryableList<Dataset> query, UserInfo principal);
Dataset find(UUID id,String hint);
CompletableFuture<Dataset> createOrUpdateAsync(Dataset item);
Long count();
Dataset find(UUID id, String hint);
Long count();
}

View File

@ -1,21 +1,18 @@
package eu.eudat.dao.entities;
import java.util.Arrays;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.DataRepository;
import eu.eudat.entities.Dataset;
import eu.eudat.entities.UserInfo;
import eu.eudat.models.criteria.DatasetCriteria;
import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("datasetDao")
public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDao {

View File

@ -1,12 +1,12 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.DatasetProfile;
import eu.eudat.models.criteria.DatasetProfileCriteria;
import eu.eudat.queryable.QueryableList;
import java.util.UUID;
public interface DatasetProfileDao extends DatabaseAccessLayer<DatasetProfile, UUID> {
QueryableList<DatasetProfile> getWithCriteria(DatasetProfileCriteria criteria);

View File

@ -1,53 +1,53 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.Dataset;
import eu.eudat.entities.DatasetProfile;
import eu.eudat.models.criteria.DatasetProfileCriteria;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.UUID;
@Component("datasetProfileDao")
public class DatasetProfileDaoImpl extends DatabaseAccess<DatasetProfile> implements DatasetProfileDao {
@Autowired
public DatasetProfileDaoImpl(DatabaseService<DatasetProfile> databaseService) {
this.setDatabaseService(databaseService);
}
@Autowired
public DatasetProfileDaoImpl(DatabaseService<DatasetProfile> databaseService) {
this.setDatabaseService(databaseService);
}
@Override
public QueryableList<DatasetProfile> getWithCriteria(DatasetProfileCriteria criteria) {
QueryableList<DatasetProfile> query = getDatabaseService().getQueryable(DatasetProfile.class);
if(criteria.getLike()!=null&&!criteria.getLike().isEmpty())query.where((builder, root) -> builder.like(root.get("label"),"%"+criteria.getLike()+"%"));
return query;
}
@Override
public QueryableList<DatasetProfile> getWithCriteria(DatasetProfileCriteria criteria) {
QueryableList<DatasetProfile> query = getDatabaseService().getQueryable(DatasetProfile.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%"));
return query;
}
@Override
public DatasetProfile createOrUpdate(DatasetProfile item) {
return this.getDatabaseService().createOrUpdate(item,DatasetProfile.class);
}
@Override
public DatasetProfile createOrUpdate(DatasetProfile item) {
return this.getDatabaseService().createOrUpdate(item, DatasetProfile.class);
}
@Override
public DatasetProfile find(UUID id) {
return getDatabaseService().getQueryable(DatasetProfile.class).where((builder, root) -> builder.equal(root.get("id"),id)).getSingle();
}
@Override
public DatasetProfile find(UUID id) {
return getDatabaseService().getQueryable(DatasetProfile.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public QueryableList<DatasetProfile> getAll() {
return getDatabaseService().getQueryable(DatasetProfile.class);
}
@Override
public QueryableList<DatasetProfile> getAll() {
return getDatabaseService().getQueryable(DatasetProfile.class);
}
@Override
public void delete(DatasetProfile item) {
this.getDatabaseService().delete(item);
}
@Override
public void delete(DatasetProfile item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<DatasetProfile> asQueryable() {
return this.getDatabaseService().getQueryable(DatasetProfile.class);
}
@Override
public QueryableList<DatasetProfile> asQueryable() {
return this.getDatabaseService().getQueryable(DatasetProfile.class);
}
}

View File

@ -1,11 +1,8 @@
package eu.eudat.dao.entities;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.DMP;
import eu.eudat.entities.ExternalDataset;
import eu.eudat.entities.Invitation;
import eu.eudat.models.criteria.ExternalDatasetCriteria;
import eu.eudat.models.criteria.InvitationCriteria;
import eu.eudat.queryable.QueryableList;
import java.util.UUID;

View File

@ -1,9 +1,8 @@
package eu.eudat.dao.entities;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.DatasetProfile;
import eu.eudat.entities.ExternalDataset;
import eu.eudat.entities.Project;
import eu.eudat.models.criteria.ExternalDatasetCriteria;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
@ -23,18 +22,19 @@ public class ExternalDatasetDaoImpl extends DatabaseAccess<ExternalDataset> impl
@Override
public QueryableList<ExternalDataset> getWithCriteria(ExternalDatasetCriteria criteria) {
QueryableList<ExternalDataset> query = this.getDatabaseService().getQueryable(ExternalDataset.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty()) query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%"));
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%"));
return query;
}
@Override
public ExternalDataset createOrUpdate(ExternalDataset item) {
return this.getDatabaseService().createOrUpdate(item,ExternalDataset.class);
return this.getDatabaseService().createOrUpdate(item, ExternalDataset.class);
}
@Override
public ExternalDataset find(UUID id) {
return this.getDatabaseService().getQueryable(ExternalDataset.class).where((builder, root) -> builder.equal(root.get("id"),id)).getSingle();
return this.getDatabaseService().getQueryable(ExternalDataset.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override

View File

@ -1,10 +1,7 @@
package eu.eudat.dao.entities;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.Dataset;
import eu.eudat.entities.ExternalDataset;
import eu.eudat.entities.Invitation;
import eu.eudat.models.criteria.DatasetCriteria;
import eu.eudat.models.criteria.InvitationCriteria;
import eu.eudat.queryable.QueryableList;

View File

@ -2,8 +2,6 @@ package eu.eudat.dao.entities;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.DMP;
import eu.eudat.entities.ExternalDataset;
import eu.eudat.entities.Invitation;
import eu.eudat.models.criteria.InvitationCriteria;
import eu.eudat.queryable.QueryableList;

View File

@ -1,15 +1,14 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.Invitation;
import eu.eudat.entities.Organisation;
import eu.eudat.models.criteria.OrganisationCriteria;
import eu.eudat.queryable.QueryableList;
import java.util.UUID;
public interface OrganisationDao extends DatabaseAccessLayer<Organisation, UUID> {
QueryableList<Organisation> getWithCriteria(OrganisationCriteria criteria);
QueryableList<Organisation> getWithCriteria(OrganisationCriteria criteria);
}

View File

@ -1,17 +1,15 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.Invitation;
import eu.eudat.entities.Organisation;
import eu.eudat.models.criteria.OrganisationCriteria;
import eu.eudat.queryable.QueryableList;
import eu.eudat.entities.Organisation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.UUID;
@Component("organisationDao")
public class OrganisationDaoImpl extends DatabaseAccess<Organisation> implements OrganisationDao {
@ -30,7 +28,7 @@ public class OrganisationDaoImpl extends DatabaseAccess<Organisation> implements
@Override
public Organisation createOrUpdate(Organisation item) {
return this.getDatabaseService().createOrUpdate(item,Organisation.class);
return this.getDatabaseService().createOrUpdate(item, Organisation.class);
}
@Override

View File

@ -1,20 +1,18 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.Dataset;
import eu.eudat.entities.Organisation;
import eu.eudat.entities.Project;
import eu.eudat.entities.UserInfo;
import eu.eudat.models.criteria.ProjectCriteria;
import eu.eudat.queryable.QueryableList;
import java.util.UUID;
public interface ProjectDao extends DatabaseAccessLayer<Project, UUID> {
QueryableList<Project> getWithCriteria(ProjectCriteria criteria);
QueryableList<Project> getWithCriteria(ProjectCriteria criteria);
QueryableList<Project> getAuthenticated(QueryableList<Project> query, UserInfo principal);
QueryableList<Project> getAuthenticated(QueryableList<Project> query, UserInfo principal);
Long count();
Long count();
}

View File

@ -1,16 +1,16 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.*;
import eu.eudat.entities.Project;
import eu.eudat.entities.UserInfo;
import eu.eudat.models.criteria.ProjectCriteria;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.UUID;
@Component("projectDao")
public class ProjectDaoImpl extends DatabaseAccess<Project> implements ProjectDao {

View File

@ -1,15 +1,14 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.Project;
import eu.eudat.entities.Registry;
import eu.eudat.models.criteria.RegistryCriteria;
import eu.eudat.queryable.QueryableList;
import java.util.UUID;
public interface RegistryDao extends DatabaseAccessLayer<Registry, UUID> {
QueryableList<Registry> getWithCriteria(RegistryCriteria criteria);
QueryableList<Registry> getWithCriteria(RegistryCriteria criteria);
}

View File

@ -1,49 +1,48 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.Organisation;
import eu.eudat.entities.Registry;
import eu.eudat.models.criteria.RegistryCriteria;
import eu.eudat.queryable.QueryableList;
import eu.eudat.entities.Registry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.UUID;
@Component("registryDao")
public class RegistryDaoImpl extends DatabaseAccess<Registry> implements RegistryDao {
@Autowired
public RegistryDaoImpl(DatabaseService<Registry> databaseService) {
this.setDatabaseService(databaseService);
}
@Autowired
public RegistryDaoImpl(DatabaseService<Registry> databaseService) {
this.setDatabaseService(databaseService);
}
@Override
public QueryableList<Registry> getWithCriteria(RegistryCriteria criteria) {
QueryableList<Registry> query = this.getDatabaseService().getQueryable(Registry.class);
if(criteria.getLike()!=null) query.where((builder, root) -> builder.equal(root.get("reference"),criteria.getLike()));
return query;
}
@Override
public QueryableList<Registry> getWithCriteria(RegistryCriteria criteria) {
QueryableList<Registry> query = this.getDatabaseService().getQueryable(Registry.class);
if (criteria.getLike() != null)
query.where((builder, root) -> builder.equal(root.get("reference"), criteria.getLike()));
return query;
}
@Override
public Registry createOrUpdate(Registry item) {
return this.getDatabaseService().createOrUpdate(item,Registry.class);
}
@Override
public Registry createOrUpdate(Registry item) {
return this.getDatabaseService().createOrUpdate(item, Registry.class);
}
@Override
public Registry find(UUID id) {
return this.getDatabaseService().getQueryable(Registry.class).where((builder, root) -> builder.equal(root.get("id"),id)).getSingle();
}
@Override
public Registry find(UUID id) {
return this.getDatabaseService().getQueryable(Registry.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public void delete(Registry item) {
this.getDatabaseService().delete(item);
}
@Override
public void delete(Registry item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Registry> asQueryable() {
return this.getDatabaseService().getQueryable(Registry.class);
}
@Override
public QueryableList<Registry> asQueryable() {
return this.getDatabaseService().getQueryable(Registry.class);
}
}

View File

@ -1,15 +1,14 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.Registry;
import eu.eudat.entities.Researcher;
import eu.eudat.models.criteria.ResearcherCriteria;
import eu.eudat.queryable.QueryableList;
import java.util.UUID;
public interface ResearcherDao extends DatabaseAccessLayer<Researcher, UUID> {
QueryableList<Researcher> getWithCriteria(ResearcherCriteria criteria);
QueryableList<Researcher> getWithCriteria(ResearcherCriteria criteria);
}

View File

@ -1,49 +1,48 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.Organisation;
import eu.eudat.entities.Researcher;
import eu.eudat.models.criteria.ResearcherCriteria;
import eu.eudat.queryable.QueryableList;
import eu.eudat.entities.Researcher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.UUID;
@Component("researcherDao")
public class ResearcherDaoImpl extends DatabaseAccess<Researcher> implements ResearcherDao {
@Autowired
public ResearcherDaoImpl(DatabaseService<Researcher> databaseService) {
this.setDatabaseService(databaseService);
}
@Autowired
public ResearcherDaoImpl(DatabaseService<Researcher> databaseService) {
this.setDatabaseService(databaseService);
}
@Override
public QueryableList<Researcher> getWithCriteria(ResearcherCriteria criteria) {
QueryableList<Researcher> query = this.getDatabaseService().getQueryable(Researcher.class);
if(criteria.getLike()!=null) query.where((builder, root) -> builder.equal(root.get("reference"),criteria.getLike()));
return query;
}
@Override
public QueryableList<Researcher> getWithCriteria(ResearcherCriteria criteria) {
QueryableList<Researcher> query = this.getDatabaseService().getQueryable(Researcher.class);
if (criteria.getLike() != null)
query.where((builder, root) -> builder.equal(root.get("reference"), criteria.getLike()));
return query;
}
@Override
public Researcher createOrUpdate(Researcher item) {
return this.getDatabaseService().createOrUpdate(item,Researcher.class);
}
@Override
public Researcher createOrUpdate(Researcher item) {
return this.getDatabaseService().createOrUpdate(item, Researcher.class);
}
@Override
public Researcher find(UUID id) {
return this.getDatabaseService().getQueryable(Researcher.class).where((builder, root) -> builder.equal(root.get("id"),id)).getSingle();
}
@Override
public Researcher find(UUID id) {
return this.getDatabaseService().getQueryable(Researcher.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public void delete(Researcher item) {
this.getDatabaseService().delete(item);
}
@Override
public void delete(Researcher item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Researcher> asQueryable() {
return this.getDatabaseService().getQueryable(Researcher.class);
}
@Override
public QueryableList<Researcher> asQueryable() {
return this.getDatabaseService().getQueryable(Researcher.class);
}
}

View File

@ -1,15 +1,14 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.Researcher;
import eu.eudat.entities.Service;
import eu.eudat.models.criteria.ServiceCriteria;
import eu.eudat.queryable.QueryableList;
import java.util.UUID;
public interface ServiceDao extends DatabaseAccessLayer<Service, UUID> {
QueryableList<Service> getWithCriteria(ServiceCriteria criteria);
QueryableList<Service> getWithCriteria(ServiceCriteria criteria);
}

View File

@ -1,49 +1,48 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.Organisation;
import eu.eudat.entities.Service;
import eu.eudat.models.criteria.ServiceCriteria;
import eu.eudat.queryable.QueryableList;
import eu.eudat.entities.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.UUID;
@Component("serviceDao")
public class ServiceDaoImpl extends DatabaseAccess<Service> implements ServiceDao {
@Autowired
public ServiceDaoImpl(DatabaseService<Service> databaseService) {
this.setDatabaseService(databaseService);
}
@Autowired
public ServiceDaoImpl(DatabaseService<Service> databaseService) {
this.setDatabaseService(databaseService);
}
@Override
public QueryableList<Service> getWithCriteria(ServiceCriteria criteria) {
QueryableList<Service> query = this.getDatabaseService().getQueryable(Service.class);
if(criteria.getLike()!=null) query.where((builder, root) -> builder.equal(root.get("reference"),criteria.getLike()));
return query;
}
@Override
public QueryableList<Service> getWithCriteria(ServiceCriteria criteria) {
QueryableList<Service> query = this.getDatabaseService().getQueryable(Service.class);
if (criteria.getLike() != null)
query.where((builder, root) -> builder.equal(root.get("reference"), criteria.getLike()));
return query;
}
@Override
public Service createOrUpdate(Service item) {
return this.getDatabaseService().createOrUpdate(item,Service.class);
}
@Override
public Service createOrUpdate(Service item) {
return this.getDatabaseService().createOrUpdate(item, Service.class);
}
@Override
public Service find(UUID id) {
return this.getDatabaseService().getQueryable(Service.class).where((builder, root) -> builder.equal(root.get("id"),id)).getSingle();
}
@Override
public Service find(UUID id) {
return this.getDatabaseService().getQueryable(Service.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public void delete(Service item) {
this.getDatabaseService().delete(item);
}
@Override
public void delete(Service item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Service> asQueryable() {
return this.getDatabaseService().getQueryable(Service.class);
}
@Override
public QueryableList<Service> asQueryable() {
return this.getDatabaseService().getQueryable(Service.class);
}
}

View File

@ -1,7 +1,6 @@
package eu.eudat.dao.entities;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.Service;
import eu.eudat.entities.UserDMP;
import java.util.UUID;

View File

@ -1,9 +1,7 @@
package eu.eudat.dao.entities;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.Service;
import eu.eudat.entities.UserDMP;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,15 +1,14 @@
package eu.eudat.dao.entities;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.Service;
import eu.eudat.entities.UserInfo;
import eu.eudat.models.criteria.UserInfoCriteria;
import eu.eudat.queryable.QueryableList;
import java.util.UUID;
public interface UserInfoDao extends DatabaseAccessLayer<UserInfo, UUID> {
QueryableList<UserInfo> getWithCriteria(UserInfoCriteria criteria);
QueryableList<UserInfo> getWithCriteria(UserInfoCriteria criteria);
}

View File

@ -1,17 +1,15 @@
package eu.eudat.dao.entities;
import java.util.Arrays;
import java.util.UUID;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.Organisation;
import eu.eudat.entities.UserInfo;
import eu.eudat.models.criteria.UserInfoCriteria;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.UUID;
@Component("userInfoDao")
public class UserInfoDaoImpl extends DatabaseAccess<UserInfo> implements UserInfoDao {

View File

@ -1,7 +1,6 @@
package eu.eudat.dao.entities;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.UserInfo;
import eu.eudat.entities.UserRole;

View File

@ -2,13 +2,12 @@ package eu.eudat.dao.entities.security;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.Credential;
import eu.eudat.entities.Dataset;
import eu.eudat.models.login.Credentials;
import java.util.UUID;
public interface CredentialDao extends DatabaseAccessLayer<Credential,UUID> {
public interface CredentialDao extends DatabaseAccessLayer<Credential, UUID> {
Credential getLoggedInCredentials(Credentials credentials);
}

View File

@ -3,7 +3,6 @@ package eu.eudat.dao.entities.security;
import eu.eudat.dao.DatabaseAccess;
import eu.eudat.dao.databaselayer.service.DatabaseService;
import eu.eudat.entities.Credential;
import eu.eudat.entities.UserInfo;
import eu.eudat.models.login.Credentials;
import eu.eudat.queryable.QueryableList;
import eu.eudat.security.validators.TokenValidatorFactoryImpl;

View File

@ -1,13 +1,12 @@
package eu.eudat.dao.entities.security;
import eu.eudat.dao.DatabaseAccessLayer;
import eu.eudat.entities.Credential;
import eu.eudat.entities.UserToken;
import java.util.UUID;
public interface UserTokenDao extends DatabaseAccessLayer<UserToken,UUID> {
public interface UserTokenDao extends DatabaseAccessLayer<UserToken, UUID> {
UserToken createOrUpdate(UserToken item);

View File

@ -1,7 +1,5 @@
package eu.eudat.entities;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.Date;
import java.util.UUID;

View File

@ -1,17 +1,12 @@
package eu.eudat.entities;
import java.io.Serializable;
import java.util.*;
import javax.persistence.*;
import eu.eudat.types.Authorities;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import java.io.Serializable;
import java.util.*;
@Entity
@ -279,7 +274,7 @@ public class DMP implements Serializable, DataEntity<DMP> {
@Override
public void update(DMP entity) {
this.associatedDmps = entity.associatedDmps ;
this.associatedDmps = entity.associatedDmps;
this.label = entity.getLabel();
this.status = entity.getStatus();
this.created = entity.created;

View File

@ -1,71 +1,63 @@
package eu.eudat.entities;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.io.Serializable;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
@Entity
@Table(name="\"DMPOrganisation\"")
@Table(name = "\"DMPOrganisation\"")
public class DMPOrganisation implements Serializable {
@Id
@GeneratedValue
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
private UUID id;
@Column(name = "\"DMP\"")
private UUID dmp;
private UUID dmp;
@Column(name = "\"Organisation\"")
private UUID organisation;
@Column(name = "\"Role\"")
private Integer role;
private UUID organisation;
public UUID getId() {
return id;
}
@Column(name = "\"Role\"")
private Integer role;
public void setId(UUID id) {
this.id = id;
}
public UUID getId() {
return id;
}
public UUID getDmp() {
return dmp;
}
public void setId(UUID id) {
this.id = id;
}
public void setDmp(UUID dmp) {
this.dmp = dmp;
}
public UUID getDmp() {
return dmp;
}
public UUID getOrganisation() {
return organisation;
}
public void setDmp(UUID dmp) {
this.dmp = dmp;
}
public void setOrganisation(UUID organisation) {
this.organisation = organisation;
}
public UUID getOrganisation() {
return organisation;
}
public Integer getRole() {
return role;
}
public void setOrganisation(UUID organisation) {
this.organisation = organisation;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
public void setRole(Integer role) {
this.role = role;
}
}

View File

@ -1,121 +1,110 @@
package eu.eudat.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import java.util.Date;
import java.util.Set;
import java.util.UUID;
@Entity
@Table(name="\"DMPProfile\"")
@Table(name = "\"DMPProfile\"")
public class DMPProfile {
@Id
@GeneratedValue
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "profile")
private Set<DMP> dmps;
private UUID id;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "profile")
private Set<DMP> dmps;
@Column(name = "\"Label\"")
private String label;
@Type(type="eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
private String label;
@Column(name = "\"Status\"", nullable = false)
private Short status;
@Column(name = "\"Created\"")
private Date created = null;
@Column(name = "\"Modified\"")
private Date modified = new Date();
public Short getStatus() {
return status;
}
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
public void setStatus(Short status) {
this.status = status;
}
@Column(name = "\"Status\"", nullable = false)
private Short status;
public Date getCreated() {
return created;
}
@Column(name = "\"Created\"")
private Date created = null;
@Column(name = "\"Modified\"")
private Date modified = new Date();
public void setCreated(Date created) {
this.created = created;
}
public Short getStatus() {
return status;
}
public Date getModified() {
return modified;
}
public void setStatus(Short status) {
this.status = status;
}
public void setModified(Date modified) {
this.modified = modified;
}
public UUID getId() {
return id;
}
public Date getCreated() {
return created;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setCreated(Date created) {
this.created = created;
}
public void setLabel(String label) {
this.label = label;
}
public String getDefinition() {
return definition;
}
public Date getModified() {
return modified;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Set<DMP> getDmps() {
return dmps;
}
public void setModified(Date modified) {
this.modified = modified;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Set<DMP> getDmps() {
return dmps;
}
public void setDmps(Set<DMP> dmps) {
this.dmps = dmps;
}
public void setDmps(Set<DMP> dmps) {
this.dmps = dmps;
}
}

View File

@ -1,74 +1,65 @@
package eu.eudat.entities;
import java.io.Serializable;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import java.util.UUID;
@Entity
@Table(name="\"DMPResearcher\"")
@Table(name = "\"DMPResearcher\"")
public class DMPResearcher {
@Id
@GeneratedValue
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@Type(type="org.hibernate.type.PostgresUUIDType")
private UUID id;
@Type(type = "org.hibernate.type.PostgresUUIDType")
@Column(name = "\"DMP\"")
private UUID dmp;
@Type(type="org.hibernate.type.PostgresUUIDType")
private UUID dmp;
@Type(type = "org.hibernate.type.PostgresUUIDType")
@Column(name = "\"Researcher\"")
private UUID researcher;
@Column(name = "\"Role\"")
private Integer role;
public UUID getId() {
return id;
}
private UUID researcher;
public void setId(UUID id) {
this.id = id;
}
@Column(name = "\"Role\"")
private Integer role;
public UUID getDmp() {
return dmp;
}
public UUID getId() {
return id;
}
public void setDmp(UUID dmp) {
this.dmp = dmp;
}
public void setId(UUID id) {
this.id = id;
}
public UUID getResearcher() {
return researcher;
}
public UUID getDmp() {
return dmp;
}
public void setResearcher(UUID researcher) {
this.researcher = researcher;
}
public void setDmp(UUID dmp) {
this.dmp = dmp;
}
public Integer getRole() {
return role;
}
public UUID getResearcher() {
return researcher;
}
public void setResearcher(UUID researcher) {
this.researcher = researcher;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
public void setRole(Integer role) {
this.role = role;
}
}

View File

@ -1,9 +1,5 @@
package eu.eudat.entities;
import javax.persistence.Tuple;
import java.util.Map;
import java.util.Set;
public interface DataEntity<T> {
void update(T entity);

View File

@ -1,167 +1,153 @@
package eu.eudat.entities;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
@Entity
@Table(name="\"DataRepository\"")
public class DataRepository implements Serializable,DataEntity<DataRepository> {
@Id
@GeneratedValue
@Table(name = "\"DataRepository\"")
public class DataRepository implements Serializable, DataEntity<DataRepository> {
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@Column(name = "\"Label\"")
private String label;
@Column(name = "\"Abbreviation\"")
private String abbreviation;
private UUID id;
@Column(name = "\"Reference\"", nullable = false)
private String reference;
@Column(name = "\"Uri\"")
private String uri;
@Type(type="eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
@Column(name = "\"Label\"")
private String label;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name="\"DatasetDataRepository\"",
joinColumns={@JoinColumn(name="\"DataRepository\"", referencedColumnName="\"ID\"")},
inverseJoinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")}
)
@Column(name = "\"Abbreviation\"")
private String abbreviation;
@Column(name = "\"Reference\"", nullable = false)
private String reference;
@Column(name = "\"Uri\"")
private String uri;
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name = "\"DatasetDataRepository\"",
joinColumns = {@JoinColumn(name = "\"DataRepository\"", referencedColumnName = "\"ID\"")},
inverseJoinColumns = {@JoinColumn(name = "\"Dataset\"", referencedColumnName = "\"ID\"")}
)
private Set<Dataset> datasets;
@Column(name = "\"Status\"", nullable = false)
private Short status;
@Column(name = "\"Created\"")
private Date created = null;
@Column(name = "\"Modified\"")
private Date modified = new Date();
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
@Column(name = "\"Status\"", nullable = false)
private Short status;
@Column(name = "\"Created\"")
private Date created = null;
@Column(name = "\"Modified\"")
private Date modified = new Date();
public Date getCreated() {
return created;
}
public Short getStatus() {
return status;
}
public void setCreated(Date created) {
this.created = created;
}
public void setStatus(Short status) {
this.status = status;
}
public Date getModified() {
return modified;
}
public Date getCreated() {
return created;
}
public void setModified(Date modified) {
this.modified = modified;
}
public UUID getId() {
return id;
}
public void setCreated(Date created) {
this.created = created;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public Date getModified() {
return modified;
}
public void setLabel(String label) {
this.label = label;
}
public String getAbbreviation() {
return abbreviation;
}
public void setModified(Date modified) {
this.modified = modified;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getReference() {
return reference;
}
public UUID getId() {
return id;
}
public void setReference(String reference) {
this.reference = reference;
}
public void setId(UUID id) {
this.id = id;
}
public String getUri() {
return uri;
}
public String getLabel() {
return label;
}
public void setUri(String uri) {
this.uri = uri;
}
public void setLabel(String label) {
this.label = label;
}
public String getDefinition() {
return definition;
}
public String getAbbreviation() {
return abbreviation;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public Set<Dataset> getDatasets() {
return datasets;
}
public String getReference() {
return reference;
}
public void setDatasets(Set<Dataset> datasets) {
this.datasets = datasets;
}
public void setReference(String reference) {
this.reference = reference;
}
@Override
public void update(DataRepository entity) {
public String getUri() {
return uri;
}
}
public void setUri(String uri) {
this.uri = uri;
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Set<Dataset> getDatasets() {
return datasets;
}
public void setDatasets(Set<Dataset> datasets) {
this.datasets = datasets;
}
@Override
public void update(DataRepository entity) {
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
}

View File

@ -1,18 +1,11 @@
package eu.eudat.entities;
import java.io.Serializable;
import java.util.*;
import javax.persistence.*;
import eu.eudat.models.project.*;
import eu.eudat.models.project.Project;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import java.util.*;
@Entity
@Table(name = "\"Dataset\"")

View File

@ -7,9 +7,8 @@ import javax.persistence.*;
import java.util.UUID;
@Entity
@Table(name="\"DatasetExternalDataset\"")
@Table(name = "\"DatasetExternalDataset\"")
public class DatasetExternalDataset {
@Id
@ -19,16 +18,16 @@ public class DatasetExternalDataset {
private UUID id;
@Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
@Type(type = "org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
@Column(name = "\"Dataset\"", nullable = false)
private UUID dataset;
@Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
@Type(type = "org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
@Column(name = "\"ExternalDataset\"", nullable = false)
private UUID externalDataset;
@Column(name = "\"Role\"")
private Integer role;
private Integer role;
public UUID getId() {
return id;

View File

@ -1,153 +1,138 @@
package eu.eudat.entities;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
@Entity
@Table(name="\"DatasetProfile\"")
public class DatasetProfile implements Serializable,DataEntity<DatasetProfile> {
@Id
@GeneratedValue
@Table(name = "\"DatasetProfile\"")
public class DatasetProfile implements Serializable, DataEntity<DatasetProfile> {
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@Column(name = "\"Label\"")
private String label;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "profile")
private Set<Dataset> dataset;
private UUID id;
@Type(type="eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
private String definition;
@Column(name = "\"Label\"")
private String label;
@Column(name = "\"Status\"", nullable = false)
private Short status;
@Column(name = "\"Created\"")
private Date created;
@Column(name = "\"Modified\"")
private Date modified = new Date();
@Column(name = "\"Description\"")
private String description;
public String getDescription() {
return description;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "profile")
private Set<Dataset> dataset;
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
private String definition;
public void setDescription(String description) {
this.description = description;
}
public Short getStatus() {
return status;
}
@Column(name = "\"Status\"", nullable = false)
private Short status;
public void setStatus(Short status) {
this.status = status;
}
@Column(name = "\"Created\"")
private Date created;
@Column(name = "\"Modified\"")
private Date modified = new Date();
@Column(name = "\"Description\"")
private String description;
public Date getCreated() {
return created;
}
public String getDescription() {
return description;
}
public void setCreated(Date created) {
this.created = created;
}
public void setDescription(String description) {
this.description = description;
}
public Date getModified() {
return modified;
}
public Short getStatus() {
return status;
}
public void setModified(Date modified) {
this.modified = modified;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public void setStatus(Short status) {
this.status = status;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Date getCreated() {
return created;
}
public Set<Dataset> getDataset() {
return dataset;
}
public void setDataset(Set<Dataset> dataset) {
this.dataset = dataset;
}
@Override
public String toString() {
return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + "]";
}
public void setCreated(Date created) {
this.created = created;
}
@Override
public void update(DatasetProfile entity) {
public Date getModified() {
return modified;
}
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
public void setModified(Date modified) {
this.modified = modified;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Set<Dataset> getDataset() {
return dataset;
}
public void setDataset(Set<Dataset> dataset) {
this.dataset = dataset;
}
@Override
public String toString() {
return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + "]";
}
@Override
public void update(DatasetProfile entity) {
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
}

View File

@ -1,68 +1,57 @@
package eu.eudat.entities;
import java.io.Serializable;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import java.io.Serializable;
import java.util.UUID;
@Entity
@Table(name="\"DatasetProfileRuleset\"")
@Table(name = "\"DatasetProfileRuleset\"")
public class DatasetProfileRuleset implements Serializable {
@Id
@GeneratedValue
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
private UUID id;
@Column(name = "\"Label\"")
private String label;
@Type(type="eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
private String definition;
@Column(name = "\"Label\"")
private String label;
public UUID getId() {
return id;
}
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
private String definition;
public void setId(UUID id) {
this.id = id;
}
public UUID getId() {
return id;
}
public String getLabel() {
return label;
}
public void setId(UUID id) {
this.id = id;
}
public void setLabel(String label) {
this.label = label;
}
public String getLabel() {
return label;
}
public String getDefinition() {
public void setLabel(String label) {
this.label = label;
}
public String getDefinition() {
// return XML.toJSONObject(definition).toString(); //return definition as json
return definition;
}
return definition;
}
public void setDefinition(String definition) {
public void setDefinition(String definition) {
// this.definition = XML.toString(definition); //if definition is in json
this.definition = definition;
}
this.definition = definition;
}
}

View File

@ -1,69 +1,57 @@
package eu.eudat.entities;
import java.io.Serializable;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import java.util.UUID;
@Entity
@Table(name="\"DatasetProfileViewstyle\"")
@Table(name = "\"DatasetProfileViewstyle\"")
public class DatasetProfileViewstyle {
@Id
@GeneratedValue
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
private UUID id;
@Column(name = "\"Label\"")
private String label;
@Type(type="eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
private String definition;
@Column(name = "\"Label\"")
private String label;
public UUID getId() {
return id;
}
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
private String definition;
public void setId(UUID id) {
this.id = id;
}
public UUID getId() {
return id;
}
public String getLabel() {
return label;
}
public void setId(UUID id) {
this.id = id;
}
public void setLabel(String label) {
this.label = label;
}
public String getLabel() {
return label;
}
public String getDefinition() {
public void setLabel(String label) {
this.label = label;
}
public String getDefinition() {
// return XML.toJSONObject(definition).toString(); //return definition as json
return definition;
}
return definition;
}
public void setDefinition(String definition) {
public void setDefinition(String definition) {
// this.definition = XML.toString(definition); //if definition is in json
this.definition = definition;
}
this.definition = definition;
}
}

View File

@ -1,75 +1,67 @@
package eu.eudat.entities;
import java.io.Serializable;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import java.io.Serializable;
import java.util.UUID;
@Entity
@Table(name="\"DatasetRegistry\"")
@Table(name = "\"DatasetRegistry\"")
public class DatasetRegistry implements Serializable {
@Id
@GeneratedValue
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
@Column(name = "\"Dataset\"", nullable = false)
private UUID dataset;
@Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
@Column(name = "\"Registry\"", nullable = false)
private UUID registry;
private UUID id;
@Column(name = "\"Role\"")
private Integer role;
public UUID getId() {
return id;
}
@Type(type = "org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
@Column(name = "\"Dataset\"", nullable = false)
private UUID dataset;
public void setId(UUID id) {
this.id = id;
}
@Type(type = "org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
@Column(name = "\"Registry\"", nullable = false)
private UUID registry;
public UUID getDataset() {
return dataset;
}
@Column(name = "\"Role\"")
private Integer role;
public void setDataset(UUID dataset) {
this.dataset = dataset;
}
public UUID getId() {
return id;
}
public UUID getRegistry() {
return registry;
}
public void setId(UUID id) {
this.id = id;
}
public void setRegistry(UUID registry) {
this.registry = registry;
}
public UUID getDataset() {
return dataset;
}
public void setDataset(UUID dataset) {
this.dataset = dataset;
}
public UUID getRegistry() {
return registry;
}
public void setRegistry(UUID registry) {
this.registry = registry;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
}

View File

@ -1,75 +1,67 @@
package eu.eudat.entities;
import java.io.Serializable;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import java.io.Serializable;
import java.util.UUID;
@Entity
@Table(name="\"DatasetService\"")
@Table(name = "\"DatasetService\"")
public class DatasetService implements Serializable {
@Id
@GeneratedValue
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
@Column(name = "\"Dataset\"", nullable = false)
private UUID dataset;
@Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
@Column(name = "\"Service\"", nullable = false)
private UUID service;
private UUID id;
@Column(name = "\"Role\"")
private Integer role;
public UUID getId() {
return id;
}
@Type(type = "org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
@Column(name = "\"Dataset\"", nullable = false)
private UUID dataset;
public void setId(UUID id) {
this.id = id;
}
@Type(type = "org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
@Column(name = "\"Service\"", nullable = false)
private UUID service;
public UUID getDataset() {
return dataset;
}
@Column(name = "\"Role\"")
private Integer role;
public void setDataset(UUID dataset) {
this.dataset = dataset;
}
public UUID getId() {
return id;
}
public UUID getService() {
return service;
}
public void setId(UUID id) {
this.id = id;
}
public void setService(UUID service) {
this.service = service;
}
public UUID getDataset() {
return dataset;
}
public void setDataset(UUID dataset) {
this.dataset = dataset;
}
public UUID getService() {
return service;
}
public void setService(UUID service) {
this.service = service;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
}

View File

@ -1,7 +1,5 @@
package eu.eudat.entities;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
@ -11,8 +9,8 @@ import java.util.UUID;
@Entity
@Table(name="\"ExternalDataset\"")
public class ExternalDataset implements DataEntity<ExternalDataset>{
@Table(name = "\"ExternalDataset\"")
public class ExternalDataset implements DataEntity<ExternalDataset> {
@Id
@GeneratedValue
@ -36,9 +34,9 @@ public class ExternalDataset implements DataEntity<ExternalDataset>{
private Date modified;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name="\"DatasetExternalDataset\"",
joinColumns={@JoinColumn(name="\"ExternalDataset\"", referencedColumnName="\"Id\"")},
inverseJoinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")}
@JoinTable(name = "\"DatasetExternalDataset\"",
joinColumns = {@JoinColumn(name = "\"ExternalDataset\"", referencedColumnName = "\"Id\"")},
inverseJoinColumns = {@JoinColumn(name = "\"Dataset\"", referencedColumnName = "\"ID\"")}
)
private Set<Dataset> datasets;

View File

@ -4,13 +4,12 @@ import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.Date;
import java.util.UUID;
@Entity
@Table(name="\"Invitation\"")
public class Invitation implements DataEntity<Invitation>{
@Table(name = "\"Invitation\"")
public class Invitation implements DataEntity<Invitation> {
@Id
@GeneratedValue
@ -35,7 +34,7 @@ public class Invitation implements DataEntity<Invitation>{
@Column(name = "\"AcceptedInvitation\"", nullable = false)
private boolean acceptedInvitation;
@Type(type="eu.eudat.typedefinition.XMLType")
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "\"Properties\"", columnDefinition = "xml", nullable = true)
private String properties;

View File

@ -1,170 +1,157 @@
package eu.eudat.entities;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
@Entity
@Table(name="\"Organisation\"")
public class Organisation implements Serializable,DataEntity<Organisation> {
@Id
@GeneratedValue
@Table(name = "\"Organisation\"")
public class Organisation implements Serializable, DataEntity<Organisation> {
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@Column(name = "\"Label\"")
private String label;
@Column(name = "\"Abbreviation\"")
private String abbreviation;
private UUID id;
@Type(type="eu.eudat.typedefinition.XMLType")
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
private String reference;
@Column(name = "\"Uri\"")
private String uri;
@Type(type="eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
@Column(name = "\"Label\"")
private String label;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name="\"DMPOrganisation\"",
joinColumns={@JoinColumn(name="\"Organisation\"", referencedColumnName="\"ID\"")},
inverseJoinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")}
)
@Column(name = "\"Abbreviation\"")
private String abbreviation;
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
private String reference;
@Column(name = "\"Uri\"")
private String uri;
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name = "\"DMPOrganisation\"",
joinColumns = {@JoinColumn(name = "\"Organisation\"", referencedColumnName = "\"ID\"")},
inverseJoinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")}
)
private Set<DMP> dMPs;
@Column(name = "\"Status\"", nullable = false)
private Short status;
@Column(name = "\"Created\"")
private Date created = null;
@Column(name = "\"Modified\"")
private Date modified = new Date();
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
@Column(name = "\"Status\"", nullable = false)
private Short status;
public Date getCreated() {
return created;
}
@Column(name = "\"Created\"")
private Date created = null;
@Column(name = "\"Modified\"")
private Date modified = new Date();
public void setCreated(Date created) {
this.created = created;
}
public Short getStatus() {
return status;
}
public Date getModified() {
return modified;
}
public void setStatus(Short status) {
this.status = status;
}
public void setModified(Date modified) {
this.modified = modified;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Set<DMP> getdMPs() {
return dMPs;
}
public void setdMPs(Set<DMP> dMPs) {
this.dMPs = dMPs;
}
public Date getCreated() {
return created;
}
@Override
public void update(Organisation entity) {
public void setCreated(Date created) {
this.created = created;
}
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Set<DMP> getdMPs() {
return dMPs;
}
public void setdMPs(Set<DMP> dMPs) {
this.dMPs = dMPs;
}
@Override
public void update(Organisation entity) {
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
}

View File

@ -1,267 +1,254 @@
package eu.eudat.entities;
import java.io.Serializable;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.Date;
import java.util.Set;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
@Entity
@Table(name="\"Project\"")
@Table(name = "\"Project\"")
public class Project implements DataEntity<Project> {
public enum Status {
ACTIVE((short) 1), INACTIVE((short) 0), DELETED((short) 99);
public enum Status {
ACTIVE((short) 1), INACTIVE((short) 0), DELETED((short) 99);
private short value;
private short value;
private Status(short value) {
this.value = value;
}
private Status(short value) {
this.value = value;
}
public short getValue() {
return value;
}
public short getValue() {
return value;
}
public static Status fromInteger(int value) {
switch (value) {
case 0:
return INACTIVE;
case 1:
return ACTIVE;
case 99:
return DELETED;
default:
throw new RuntimeException("Unsupported Project Status");
}
}
}
@Id
@GeneratedValue
public static Status fromInteger(int value) {
switch (value) {
case 0:
return INACTIVE;
case 1:
return ACTIVE;
case 99:
return DELETED;
default:
throw new RuntimeException("Unsupported Project Status");
}
}
}
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@OneToMany(mappedBy = "project")
private Set<DMP> dmps;
@Column(name = "\"Label\"")
private String label;
@Column(name = "\"Abbreviation\"")
private String abbreviation;
private UUID id;
@OneToMany(mappedBy = "project")
private Set<DMP> dmps;
@Column(name = "\"Label\"")
private String label;
@Column(name = "\"Abbreviation\"")
private String abbreviation;
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
private String reference;
@Column(name = "\"Uri\"")
private String uri;
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
@Column(name = "\"StartDate\"", nullable = false)
private Date startdate = null;
@Column(name = "\"EndDate\"", nullable = false)
private Date enddate = null;
@Column(name = "\"Status\"", nullable = false)
private Short status;
@Type(type="eu.eudat.typedefinition.XMLType")
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
private String reference;
@Column(name = "\"Uri\"")
private String uri;
@Type(type="eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
@Column(name = "\"StartDate\"", nullable = false)
private Date startdate = null;
@Column(name = "\"EndDate\"", nullable = false)
private Date enddate = null;
@Column(name = "\"Status\"", nullable = false)
private Short status;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "\"CreationUser\"", nullable = true)
private UserInfo creationUser;
@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;
}
private UserInfo creationUser;
public void setDescription(String description) {
this.description = description;
}
@Column(name = "\"Created\"")
private Date created = null;
@Column(name = "\"Modified\"")
private Date modified = new Date();
@Column(name = "\"Description\"")
private String description;
public Short getStatus() {
return status;
}
public String getDescription() {
return description;
}
public void setStatus(Short status) {
this.status = status;
}
public void setDescription(String description) {
this.description = description;
}
public Date getCreated() {
return created;
}
public Short getStatus() {
return status;
}
public void setCreated(Date created) {
this.created = created;
}
public void setStatus(Short status) {
this.status = status;
}
public Date getModified() {
return modified;
}
public Date getCreated() {
return created;
}
public void setModified(Date modified) {
this.modified = modified;
}
public Date getStartdate() {
return startdate;
}
public void setCreated(Date created) {
this.created = created;
}
public void setStartdate(Date startdate) {
this.startdate = startdate;
}
public Date getModified() {
return modified;
}
public Date getEnddate() {
return enddate;
}
public void setModified(Date modified) {
this.modified = modified;
}
public void setEnddate(Date enddate) {
this.enddate = enddate;
}
public Date getStartdate() {
return startdate;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public void setStartdate(Date startdate) {
this.startdate = startdate;
}
public Set<DMP> getDmps() {
return dmps;
}
public void setDmps(Set<DMP> dmps) {
this.dmps = dmps;
}
public Date getEnddate() {
return enddate;
}
public UserInfo getCreationUser() {
return creationUser;
}
public void setEnddate(Date enddate) {
this.enddate = enddate;
}
public void setCreationUser(UserInfo creationUser) {
this.creationUser = creationUser;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public String toString() {
try {
return new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(this).replace("\"", "&quot;");
} catch (JsonProcessingException e) {
return "";
}
}
public Set<DMP> getDmps() {
return dmps;
}
@Override
public void update(Project entity) {
this.description = entity.getDescription();
this.label = entity.getLabel();
this.abbreviation = entity.getAbbreviation();
this.created = entity.getCreated();
this.definition = entity.getDefinition();
this.dmps = entity.getDmps();
this.enddate = entity.getEnddate();
//this.creationUser = entity.getCreationUser(); //TODO
}
public void setDmps(Set<DMP> dmps) {
this.dmps = dmps;
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
public UserInfo getCreationUser() {
return creationUser;
}
public void setCreationUser(UserInfo creationUser) {
this.creationUser = creationUser;
}
public String toString() {
try {
return new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(this).replace("\"", "&quot;");
} catch (JsonProcessingException e) {
return "";
}
}
@Override
public void update(Project entity) {
this.description = entity.getDescription();
this.label = entity.getLabel();
this.abbreviation = entity.getAbbreviation();
this.created = entity.getCreated();
this.definition = entity.getDefinition();
this.dmps = entity.getDmps();
this.enddate = entity.getEnddate();
//this.creationUser = entity.getCreationUser(); //TODO
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
}

View File

@ -1,169 +1,155 @@
package eu.eudat.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import java.util.Date;
import java.util.Set;
import java.util.UUID;
@Entity
@Table(name="\"Registry\"")
@Table(name = "\"Registry\"")
public class Registry implements DataEntity<Registry> {
@Id
@GeneratedValue
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@Column(name = "\"Label\"")
private String label;
@Column(name = "\"Abbreviation\"")
private String abbreviation;
private UUID id;
@Column(name = "\"Reference\"", nullable = true)
private String reference;
@Column(name = "\"Uri\"")
private String uri;
@Type(type="eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
@Column(name = "\"Label\"")
private String label;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name="\"DatasetRegistry\"",
joinColumns={@JoinColumn(name="\"Registry\"", referencedColumnName="\"ID\"")},
inverseJoinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")}
)
@Column(name = "\"Abbreviation\"")
private String abbreviation;
@Column(name = "\"Reference\"", nullable = true)
private String reference;
@Column(name = "\"Uri\"")
private String uri;
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name = "\"DatasetRegistry\"",
joinColumns = {@JoinColumn(name = "\"Registry\"", referencedColumnName = "\"ID\"")},
inverseJoinColumns = {@JoinColumn(name = "\"Dataset\"", referencedColumnName = "\"ID\"")}
)
private Set<Dataset> datasets;
@Column(name = "\"Status\"", nullable = false)
private Short status;
@Column(name = "\"Created\"")
private Date created = null;
@Column(name = "\"Modified\"")
private Date modified = new Date();
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
@Column(name = "\"Status\"", nullable = false)
private Short status;
public Date getCreated() {
return created;
}
@Column(name = "\"Created\"")
private Date created = null;
@Column(name = "\"Modified\"")
private Date modified = new Date();
public void setCreated(Date created) {
this.created = created;
}
public Short getStatus() {
return status;
}
public Date getModified() {
return modified;
}
public void setStatus(Short status) {
this.status = status;
}
public void setModified(Date modified) {
this.modified = modified;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Set<Dataset> getDatasets() {
return datasets;
}
public void setDatasets(Set<Dataset> datasets) {
this.datasets = datasets;
}
public Date getCreated() {
return created;
}
@Override
public void update(Registry entity) {
public void setCreated(Date created) {
this.created = created;
}
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Set<Dataset> getDatasets() {
return datasets;
}
public void setDatasets(Set<Dataset> datasets) {
this.datasets = datasets;
}
@Override
public void update(Registry entity) {
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
}

View File

@ -1,169 +1,156 @@
package eu.eudat.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import java.util.Date;
import java.util.Set;
import java.util.UUID;
@Entity
@Table(name="\"Researcher\"")
@Table(name = "\"Researcher\"")
public class Researcher implements DataEntity<Researcher> {
@Id
@GeneratedValue
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@Column(name = "\"Label\"")
private String label;
@Column(name = "\"Uri\"")
private String uri;
private UUID id;
@Column(name = "\"PrimaryEmail\"")
private String primaryEmail;
@Type(type="eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
@Type(type="eu.eudat.typedefinition.XMLType")
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
private String reference;
@Column(name = "\"Label\"")
private String label;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name="\"DMPResearcher\"",
joinColumns={@JoinColumn(name="\"Researcher\"", referencedColumnName="\"ID\"")},
inverseJoinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")}
)
@Column(name = "\"Uri\"")
private String uri;
@Column(name = "\"PrimaryEmail\"")
private String primaryEmail;
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
private String reference;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name = "\"DMPResearcher\"",
joinColumns = {@JoinColumn(name = "\"Researcher\"", referencedColumnName = "\"ID\"")},
inverseJoinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")}
)
private Set<DMP> dMPs;
@Column(name = "\"Status\"", nullable = false)
private Short status;
@Column(name = "\"Created\"")
private Date created = null;
@Column(name = "\"Modified\"")
private Date modified = new Date();
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
@Column(name = "\"Status\"", nullable = false)
private Short status;
public Date getCreated() {
return created;
}
@Column(name = "\"Created\"")
private Date created = null;
@Column(name = "\"Modified\"")
private Date modified = new Date();
public void setCreated(Date created) {
this.created = created;
}
public Short getStatus() {
return status;
}
public Date getModified() {
return modified;
}
public void setStatus(Short status) {
this.status = status;
}
public void setModified(Date modified) {
this.modified = modified;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getPrimaryEmail() {
return primaryEmail;
}
public void setPrimaryEmail(String primaryEmail) {
this.primaryEmail = primaryEmail;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Set<DMP> getdMPs() {
return dMPs;
}
public void setdMPs(Set<DMP> dMPs) {
this.dMPs = dMPs;
}
public Date getCreated() {
return created;
}
@Override
public void update(Researcher entity) {
public void setCreated(Date created) {
this.created = created;
}
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getPrimaryEmail() {
return primaryEmail;
}
public void setPrimaryEmail(String primaryEmail) {
this.primaryEmail = primaryEmail;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Set<DMP> getdMPs() {
return dMPs;
}
public void setdMPs(Set<DMP> dMPs) {
this.dMPs = dMPs;
}
@Override
public void update(Researcher entity) {
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
}

View File

@ -1,169 +1,156 @@
package eu.eudat.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import java.util.Date;
import java.util.Set;
import java.util.UUID;
@Entity
@Table(name="\"Service\"")
@Table(name = "\"Service\"")
public class Service implements DataEntity<Service> {
@Id
@GeneratedValue
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@Column(name = "\"Label\"")
private String label;
@Column(name = "\"Abbreviation\"")
private String abbreviation;
private UUID id;
@Column(name = "\"Reference\"", nullable = true)
private String reference;
@Column(name = "\"Uri\"")
private String uri;
@Type(type="eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
private String definition;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name="\"DatasetService\"",
joinColumns={@JoinColumn(name="\"Service\"", referencedColumnName="\"ID\"")},
inverseJoinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")}
)
@Column(name = "\"Label\"")
private String label;
@Column(name = "\"Abbreviation\"")
private String abbreviation;
@Column(name = "\"Reference\"", nullable = true)
private String reference;
@Column(name = "\"Uri\"")
private String uri;
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
private String definition;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name = "\"DatasetService\"",
joinColumns = {@JoinColumn(name = "\"Service\"", referencedColumnName = "\"ID\"")},
inverseJoinColumns = {@JoinColumn(name = "\"Dataset\"", referencedColumnName = "\"ID\"")}
)
private Set<Dataset> datasets;
@Column(name = "\"Status\"", nullable = false)
private Short status;
@Column(name = "\"Created\"")
private Date created = null;
@Column(name = "\"Modified\"")
private Date modified = new Date();
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
@Column(name = "\"Status\"", nullable = false)
private Short status;
public Date getCreated() {
return created;
}
@Column(name = "\"Created\"")
private Date created = null;
@Column(name = "\"Modified\"")
private Date modified = new Date();
public void setCreated(Date created) {
this.created = created;
}
public Short getStatus() {
return status;
}
public Date getModified() {
return modified;
}
public void setStatus(Short status) {
this.status = status;
}
public void setModified(Date modified) {
this.modified = modified;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Set<Dataset> getDatasets() {
return datasets;
}
public void setDatasets(Set<Dataset> datasets) {
this.datasets = datasets;
}
public Date getCreated() {
return created;
}
@Override
public void update(Service entity) {
public void setCreated(Date created) {
this.created = created;
}
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDefinition() {
return definition;
}
public void setDefinition(String definition) {
this.definition = definition;
}
public Set<Dataset> getDatasets() {
return datasets;
}
public void setDatasets(Set<Dataset> datasets) {
this.datasets = datasets;
}
@Override
public void update(Service entity) {
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
}

View File

@ -1,23 +1,16 @@
package eu.eudat.entities;
import java.io.Serializable;
import java.util.UUID;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import eu.eudat.types.ApiMessageCode;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import java.util.UUID;
@Entity
@Table(name = "\"UserDMP\"")
public class UserDMP implements DataEntity<UserDMP> {
public enum UserDMPRoles {
OWNER(0) , USER(1);
OWNER(0), USER(1);
private Integer value;
@ -49,11 +42,11 @@ public class UserDMP implements DataEntity<UserDMP> {
private UUID id;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name="usr")
@JoinColumn(name = "usr")
private UserInfo user;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name="dmp")
@JoinColumn(name = "dmp")
private DMP dmp;
@Column(name = "role")

View File

@ -1,184 +1,179 @@
package eu.eudat.entities;
import java.io.Serializable;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
@Entity
@Table(name="\"UserInfo\"")
@Table(name = "\"UserInfo\"")
@NamedEntityGraphs({
@NamedEntityGraph(
name = "userInfo",
attributeNodes = {@NamedAttributeNode("userRoles"), @NamedAttributeNode("credentials")})
@NamedEntityGraph(
name = "userInfo",
attributeNodes = {@NamedAttributeNode("userRoles"), @NamedAttributeNode("credentials")})
})
public class UserInfo implements DataEntity<UserInfo>{
public class UserInfo implements DataEntity<UserInfo> {
@Id
@GeneratedValue
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@Column(name = "email", nullable = false)
private String email = null;
@Column(name = "authorization_level", nullable = false)
private Short authorization_level; //0 admin, 1 user
@Column(name = "usertype", nullable = false)
private Short usertype; // 0 internal, 1 external
@Column(name = "verified_email", nullable = true)
private Boolean verified_email = null;
@Column(name = "name", nullable = true)
private String name = null;
@Column(name = "created", nullable = false)
private Date created = null;
@Column(name = "lastloggedin", nullable = true)
private Date lastloggedin = null;
private UUID id;
@Type(type="eu.eudat.typedefinition.XMLType")
@Column(name = "additionalinfo", columnDefinition = "xml", nullable = true)
private String additionalinfo;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name="\"UserDMP\"",
joinColumns={@JoinColumn(name="usr", referencedColumnName="id")},
inverseJoinColumns={@JoinColumn(name="dmp", referencedColumnName="\"ID\"")}
)
@Column(name = "email", nullable = false)
private String email = null;
@Column(name = "authorization_level", nullable = false)
private Short authorization_level; //0 admin, 1 user
@Column(name = "usertype", nullable = false)
private Short usertype; // 0 internal, 1 external
@Column(name = "verified_email", nullable = true)
private Boolean verified_email = null;
@Column(name = "name", nullable = true)
private String name = null;
@Column(name = "created", nullable = false)
private Date created = null;
@Column(name = "lastloggedin", nullable = true)
private Date lastloggedin = null;
@Type(type = "eu.eudat.typedefinition.XMLType")
@Column(name = "additionalinfo", columnDefinition = "xml", nullable = true)
private String additionalinfo;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name = "\"UserDMP\"",
joinColumns = {@JoinColumn(name = "usr", referencedColumnName = "id")},
inverseJoinColumns = {@JoinColumn(name = "dmp", referencedColumnName = "\"ID\"")}
)
private Set<DMP> dmps;
@OneToMany(mappedBy="userInfo",fetch = FetchType.LAZY)
private Set<Credential> credentials = new HashSet<>();
@OneToMany(mappedBy = "userInfo", fetch = FetchType.LAZY)
private Set<Credential> credentials = new HashSet<>();
@OneToMany(mappedBy="userInfo",fetch = FetchType.LAZY)
private Set<UserRole> userRoles = new HashSet<>();
public Set<DMP> getDmps() {
return dmps;
}
@OneToMany(mappedBy = "userInfo", fetch = FetchType.LAZY)
private Set<UserRole> userRoles = new HashSet<>();
public void setDmps(Set<DMP> dmps) {
this.dmps = dmps;
}
public Set<DMP> getDmps() {
return dmps;
}
public UUID getId() {
return id;
}
public void setDmps(Set<DMP> dmps) {
this.dmps = dmps;
}
public void setId(UUID id) {
this.id = id;
}
public UUID getId() {
return id;
}
public Date getCreated() {
return created;
}
public void setId(UUID id) {
this.id = id;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getCreated() {
return created;
}
public Date getLastloggedin() {
return lastloggedin;
}
public void setCreated(Date created) {
this.created = created;
}
public void setLastloggedin(Date lastloggedin) {
this.lastloggedin = lastloggedin;
}
public Date getLastloggedin() {
return lastloggedin;
}
public String getEmail() {
return email;
}
public void setLastloggedin(Date lastloggedin) {
this.lastloggedin = lastloggedin;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmail() {
return email;
}
public Short getAuthorization_level() {
return authorization_level;
}
public void setEmail(String email) {
this.email = email;
}
public void setAuthorization_level(Short authorization_level) {
this.authorization_level = authorization_level;
}
public Short getAuthorization_level() {
return authorization_level;
}
public Short getUsertype() {
return usertype;
}
public void setAuthorization_level(Short authorization_level) {
this.authorization_level = authorization_level;
}
public void setUsertype(Short usertype) {
this.usertype = usertype;
}
public Short getUsertype() {
return usertype;
}
public Boolean getVerified_email() {
return verified_email;
}
public void setUsertype(Short usertype) {
this.usertype = usertype;
}
public void setVerified_email(Boolean verified_email) {
this.verified_email = verified_email;
}
public Boolean getVerified_email() {
return verified_email;
}
public String getName() {
return name;
}
public void setVerified_email(Boolean verified_email) {
this.verified_email = verified_email;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public String getAdditionalinfo() {
return additionalinfo;
}
public void setName(String name) {
this.name = name;
}
public void setAdditionalinfo(String additionalinfo) {
this.additionalinfo = additionalinfo;
}
public String getAdditionalinfo() {
return additionalinfo;
}
public Set<Credential> getCredentials() {
return credentials;
}
public void setAdditionalinfo(String additionalinfo) {
this.additionalinfo = additionalinfo;
}
public void setCredentials(Set<Credential> credentials) {
this.credentials = credentials;
}
public Set<Credential> getCredentials() {
return credentials;
}
public Set<UserRole> getUserRoles() {
return userRoles;
}
public void setCredentials(Set<Credential> credentials) {
this.credentials = credentials;
}
public void setUserRoles(Set<UserRole> userRoles) {
this.userRoles = userRoles;
}
public Set<UserRole> getUserRoles() {
return userRoles;
}
@Override
public void update(UserInfo entity) {
this.name = entity.getName();
this.email = entity.getEmail();
this.additionalinfo = entity.getAdditionalinfo();
this.lastloggedin = entity.getLastloggedin();
this.userRoles = entity.getUserRoles();
}
public void setUserRoles(Set<UserRole> userRoles) {
this.userRoles = userRoles;
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
@Override
public void update(UserInfo entity) {
this.name = entity.getName();
this.email = entity.getEmail();
this.additionalinfo = entity.getAdditionalinfo();
this.lastloggedin = entity.getLastloggedin();
this.userRoles = entity.getUserRoles();
}
@Override
public Object[] getKeys() {
return new UUID[]{this.id == null ? null : this.id};
}
}

View File

@ -3,7 +3,6 @@ package eu.eudat.entities;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.Date;
import java.util.UUID;

View File

@ -6,8 +6,8 @@ import java.util.UUID;
@Entity
@Table(name="\"UserToken\"")
public class UserToken implements DataEntity<UserToken>{
@Table(name = "\"UserToken\"")
public class UserToken implements DataEntity<UserToken> {
@Id
@Column(name = "\"Token\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")

View File

@ -2,6 +2,6 @@ package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
import eu.eudat.utilities.DatabaseDefinition;
public interface DatabaseViewStyleDefinition extends DatabaseDefinition{
public interface DatabaseViewStyleDefinition extends DatabaseDefinition {
}

View File

@ -1,147 +1,155 @@
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
import eu.eudat.models.components.commons.DefaultValue;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import eu.eudat.models.components.commons.ViewStyle;
import eu.eudat.models.components.commons.Visibility;
import eu.eudat.models.components.commons.datafield.FieldData;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.builders.ModelBuilder;
import eu.eudat.utilities.builders.XmlBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.util.LinkedList;
import java.util.List;
public class Field implements DatabaseViewStyleDefinition,XmlSerializable<Field>{
private String id;
private int ordinal;
private ViewStyle viewStyle;
private DefaultValue defaultValue;
private Visibility visible;
private FieldData data;
private List<eu.eudat.models.admin.components.datasetprofile.Field.ValidationType> validations;
public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field> {
private String id;
private int ordinal;
private ViewStyle viewStyle;
private DefaultValue defaultValue;
private Visibility visible;
private FieldData data;
private List<eu.eudat.models.admin.components.datasetprofile.Field.ValidationType> validations;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getOrdinal() {
return ordinal;
}
public void setOrdinal(int ordinal) {
this.ordinal = ordinal;
}
public ViewStyle getViewStyle() {
return viewStyle;
}
public void setViewStyle(ViewStyle viewStyle) {
this.viewStyle = viewStyle;
}
public FieldData getData() {
return data;
}
public void setData(FieldData data) {
this.data = data;
}
public String getId() {
return id;
}
public DefaultValue getDefaultValue() {
return defaultValue;
}
public void setId(String id) {
this.id = id;
}
public void setDefaultValue(DefaultValue defaultValue) {
this.defaultValue = defaultValue;
}
public int getOrdinal() {
return ordinal;
}
public Visibility getVisible() {
return visible;
}
public void setVisible(Visibility visible) {
this.visible = visible;
}
public void setOrdinal(int ordinal) {
this.ordinal = ordinal;
}
public List<eu.eudat.models.admin.components.datasetprofile.Field.ValidationType> getValidations() {
return validations;
}
public ViewStyle getViewStyle() {
return viewStyle;
}
public void setValidations(List<eu.eudat.models.admin.components.datasetprofile.Field.ValidationType> validations) {
this.validations = validations;
}
public void setViewStyle(ViewStyle viewStyle) {
this.viewStyle = viewStyle;
}
@Override
public Element toXml(Document doc) {
Element rootElement = doc.createElement("field");
rootElement.setAttribute("id", this.id);
rootElement.setAttribute("ordinal", ""+this.ordinal);
public FieldData getData() {
return data;
}
Element viewStyle = doc.createElement("viewStyle");
viewStyle.setAttribute("renderstyle", this.viewStyle.getRenderStyle());
viewStyle.setAttribute("cssClass", this.viewStyle.getCssClass());
public void setData(FieldData data) {
this.data = data;
}
Element visibility = this.visible.toXml(doc);
public DefaultValue getDefaultValue() {
return defaultValue;
}
Element defaultValue = doc.createElement("defaultValue");
defaultValue.setAttribute("type",this.defaultValue.getType());
defaultValue.setAttribute("value",this.defaultValue.getValue());
public void setDefaultValue(DefaultValue defaultValue) {
this.defaultValue = defaultValue;
}
Element validations = doc.createElement("validations");
for(eu.eudat.models.admin.components.datasetprofile.Field.ValidationType validationType: this.validations){
Element validation = doc.createElement("validation");
validation.setAttribute("type",""+validationType.getValue());
validations.appendChild(validation);
}
public Visibility getVisible() {
return visible;
}
rootElement.appendChild(validations);
rootElement.appendChild(defaultValue);
rootElement.appendChild(visibility);
rootElement.appendChild(viewStyle);
if(this.data!=null)rootElement.appendChild(this.data.toXml(doc));
return rootElement;
}
@Override
public Field fromXml(Element element) {
this.id = element.getAttribute("id");
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
public void setVisible(Visibility visible) {
this.visible = visible;
}
this.viewStyle = new ViewStyle();
Element viewStyle = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "viewStyle");
public List<eu.eudat.models.admin.components.datasetprofile.Field.ValidationType> getValidations() {
return validations;
}
this.viewStyle.setRenderStyle(viewStyle.getAttribute("renderstyle"));
this.viewStyle.setCssClass(viewStyle.getAttribute("cssClass"));
public void setValidations(List<eu.eudat.models.admin.components.datasetprofile.Field.ValidationType> validations) {
this.validations = validations;
}
Element visibility = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "visible");
@Override
public Element toXml(Document doc) {
Element rootElement = doc.createElement("field");
rootElement.setAttribute("id", this.id);
rootElement.setAttribute("ordinal", "" + this.ordinal);
this.visible = new Visibility().fromXml(visibility);
Element viewStyle = doc.createElement("viewStyle");
viewStyle.setAttribute("renderstyle", this.viewStyle.getRenderStyle());
viewStyle.setAttribute("cssClass", this.viewStyle.getCssClass());
Element dataElement = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "data");
Element visibility = this.visible.toXml(doc);
Element defaultValue = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "defaultValue");
Element defaultValue = doc.createElement("defaultValue");
defaultValue.setAttribute("type", this.defaultValue.getType());
defaultValue.setAttribute("value", this.defaultValue.getValue());
this.defaultValue = new DefaultValue();
this.defaultValue.setType(defaultValue.getAttribute("type"));
this.defaultValue.setValue(defaultValue.getAttribute("value"));
this.data = new ModelBuilder().toFieldData(null, this.viewStyle.getRenderStyle(),dataElement);
if(this.data!=null)this.data.fromXml(dataElement);
Element validations = doc.createElement("validations");
for (eu.eudat.models.admin.components.datasetprofile.Field.ValidationType validationType : this.validations) {
Element validation = doc.createElement("validation");
validation.setAttribute("type", "" + validationType.getValue());
validations.appendChild(validation);
}
this.validations = new LinkedList<>();
Element validations = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "validations");
if(validations!=null){
NodeList validationElements = validations.getChildNodes();
for (int temp = 0; temp < validationElements.getLength(); temp++) {
Node validationElement = validationElements.item(temp);
if (validationElement.getNodeType() == Node.ELEMENT_NODE) {
int enumValue = Integer.parseInt(((Element)validationElement).getAttribute("type"));
eu.eudat.models.admin.components.datasetprofile.Field.ValidationType validationType = eu.eudat.models.admin.components.datasetprofile.Field.ValidationType.fromInteger(enumValue);
this.validations.add(validationType);
}
}
}
return this;
}
rootElement.appendChild(validations);
rootElement.appendChild(defaultValue);
rootElement.appendChild(visibility);
rootElement.appendChild(viewStyle);
if (this.data != null) rootElement.appendChild(this.data.toXml(doc));
return rootElement;
}
@Override
public Field fromXml(Element element) {
this.id = element.getAttribute("id");
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
this.viewStyle = new ViewStyle();
Element viewStyle = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "viewStyle");
this.viewStyle.setRenderStyle(viewStyle.getAttribute("renderstyle"));
this.viewStyle.setCssClass(viewStyle.getAttribute("cssClass"));
Element visibility = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "visible");
this.visible = new Visibility().fromXml(visibility);
Element dataElement = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "data");
Element defaultValue = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "defaultValue");
this.defaultValue = new DefaultValue();
this.defaultValue.setType(defaultValue.getAttribute("type"));
this.defaultValue.setValue(defaultValue.getAttribute("value"));
this.data = new ModelBuilder().toFieldData(null, this.viewStyle.getRenderStyle(), dataElement);
if (this.data != null) this.data.fromXml(dataElement);
this.validations = new LinkedList<>();
Element validations = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "validations");
if (validations != null) {
NodeList validationElements = validations.getChildNodes();
for (int temp = 0; temp < validationElements.getLength(); temp++) {
Node validationElement = validationElements.item(temp);
if (validationElement.getNodeType() == Node.ELEMENT_NODE) {
int enumValue = Integer.parseInt(((Element) validationElement).getAttribute("type"));
eu.eudat.models.admin.components.datasetprofile.Field.ValidationType validationType = eu.eudat.models.admin.components.datasetprofile.Field.ValidationType.fromInteger(enumValue);
this.validations.add(validationType);
}
}
}
return this;
}
}

View File

@ -1,169 +1,168 @@
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
import java.util.LinkedList;
import java.util.List;
import eu.eudat.models.components.commons.Multiplicity;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.builders.XmlBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.builders.XmlBuilder;
import java.util.LinkedList;
import java.util.List;
public class FieldSet implements DatabaseViewStyleDefinition,XmlSerializable<FieldSet>{
private String id;
private int ordinal;
private List<Field> fields;
private String title;
private String description;
private String extendedDescription;
private Multiplicity multiplicity;
private boolean hasCommentField;
private String commentFieldValue;
public List<Field> getFields() {
return fields;
}
public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<FieldSet> {
private String id;
private int ordinal;
private List<Field> fields;
private String title;
private String description;
private String extendedDescription;
private Multiplicity multiplicity;
private boolean hasCommentField;
private String commentFieldValue;
public void setFields(List<Field> fields) {
this.fields = fields;
}
public List<Field> getFields() {
return fields;
}
public String getId() {
return id;
}
public void setFields(List<Field> fields) {
this.fields = fields;
}
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public int getOrdinal() {
return ordinal;
}
public void setId(String id) {
this.id = id;
}
public void setOrdinal(int ordinal) {
this.ordinal = ordinal;
}
public int getOrdinal() {
return ordinal;
}
public String getTitle() {
return title;
}
public void setOrdinal(int ordinal) {
this.ordinal = ordinal;
}
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public void setTitle(String title) {
this.title = title;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
public String getExtendedDescription() {
return extendedDescription;
}
public void setDescription(String description) {
this.description = description;
}
public void setExtendedDescription(String extendedDescription) {
this.extendedDescription = extendedDescription;
}
public String getExtendedDescription() {
return extendedDescription;
}
public Multiplicity getMultiplicity() {
return multiplicity;
}
public void setExtendedDescription(String extendedDescription) {
this.extendedDescription = extendedDescription;
}
public void setMultiplicity(Multiplicity multiplicity) {
this.multiplicity = multiplicity;
}
public Multiplicity getMultiplicity() {
return multiplicity;
}
public boolean getHasCommentField() {
return hasCommentField;
}
public void setMultiplicity(Multiplicity multiplicity) {
this.multiplicity = multiplicity;
}
public void setHasCommentField(boolean hasCommentField) {
this.hasCommentField = hasCommentField;
}
public boolean getHasCommentField() {
return hasCommentField;
}
public String getCommentFieldValue() {
return commentFieldValue;
}
public void setHasCommentField(boolean hasCommentField) {
this.hasCommentField = hasCommentField;
}
public void setCommentFieldValue(String commentFieldValue) {
this.commentFieldValue = commentFieldValue;
}
public String getCommentFieldValue() {
return commentFieldValue;
}
@Override
public Element toXml(Document doc) {
Element fieldSet = doc.createElement("fieldSet");
fieldSet.setAttribute("id", this.id);
fieldSet.setAttribute("ordinal", ""+this.ordinal);
Element title = doc.createElement("title");
title.setTextContent(this.title);
public void setCommentFieldValue(String commentFieldValue) {
this.commentFieldValue = commentFieldValue;
}
Element description = doc.createElement("description");
description.setTextContent(this.description);
@Override
public Element toXml(Document doc) {
Element fieldSet = doc.createElement("fieldSet");
fieldSet.setAttribute("id", this.id);
fieldSet.setAttribute("ordinal", "" + this.ordinal);
Element title = doc.createElement("title");
title.setTextContent(this.title);
Element extendedDescription = doc.createElement("extendedDescription");
extendedDescription.setTextContent(this.extendedDescription);
Element description = doc.createElement("description");
description.setTextContent(this.description);
Element multiplicity = doc.createElement("multiplicity");
multiplicity.setAttribute("min", ""+this.multiplicity.getMin());
multiplicity.setAttribute("max", ""+this.multiplicity.getMax());
Element extendedDescription = doc.createElement("extendedDescription");
extendedDescription.setTextContent(this.extendedDescription);
Element commentField = doc.createElement("commentField");
commentField.setAttribute("hasCommentField",""+this.hasCommentField);
commentField.setAttribute("commentFieldValue",this.commentFieldValue);
Element multiplicity = doc.createElement("multiplicity");
multiplicity.setAttribute("min", "" + this.multiplicity.getMin());
multiplicity.setAttribute("max", "" + this.multiplicity.getMax());
Element commentField = doc.createElement("commentField");
commentField.setAttribute("hasCommentField", "" + this.hasCommentField);
commentField.setAttribute("commentFieldValue", this.commentFieldValue);
Element fieldsElement = doc.createElement("fields");
for (Field field : fields) {
fieldsElement.appendChild(field.toXml(doc));
}
fieldSet.appendChild(commentField);
fieldSet.appendChild(fieldsElement);
fieldSet.appendChild(multiplicity);
fieldSet.appendChild(title);
fieldSet.appendChild(description);
fieldSet.appendChild(extendedDescription);
return fieldSet;
}
Element fieldsElement = doc.createElement("fields");
for(Field field : fields){
fieldsElement.appendChild(field.toXml(doc));
}
fieldSet.appendChild(commentField);
fieldSet.appendChild(fieldsElement);
fieldSet.appendChild(multiplicity);
fieldSet.appendChild(title);
fieldSet.appendChild(description);
fieldSet.appendChild(extendedDescription);
return fieldSet;
}
@Override
public FieldSet fromXml(Element element) {
this.id = element.getAttribute("id");
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
this.fields = new LinkedList();
Element title = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "title");
this.title = title.getTextContent();
Element description = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "description");
this.description = description.getTextContent();
Element extendedDescription = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "extendedDescription");
this.extendedDescription = extendedDescription.getTextContent();
Element commentField = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "commentField");
this.hasCommentField = Boolean.parseBoolean(commentField.getAttribute("hasCommentField"));
this.commentFieldValue = commentField.getAttribute("commentFieldValue");
Element fields = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fields");
@Override
public FieldSet fromXml(Element element) {
this.id = element.getAttribute("id");
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
this.fields = new LinkedList();
Element title = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "title");
this.title = title.getTextContent();
Element description = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "description");
this.description = description.getTextContent();
Element extendedDescription = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "extendedDescription");
this.extendedDescription = extendedDescription.getTextContent();
Element commentField = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "commentField");
this.hasCommentField = Boolean.parseBoolean(commentField.getAttribute("hasCommentField"));
this.commentFieldValue = commentField.getAttribute("commentFieldValue");
Element fields = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fields");
if (fields != null) {
NodeList fieldElements = fields.getChildNodes();
for (int temp = 0; temp < fieldElements.getLength(); temp++) {
Node fieldElement = fieldElements.item(temp);
if (fieldElement.getNodeType() == Node.ELEMENT_NODE) {
this.fields.add(new Field().fromXml((Element) fieldElement));
}
}
}
if(fields!=null){
NodeList fieldElements = fields.getChildNodes();
for (int temp = 0; temp < fieldElements.getLength(); temp++) {
Node fieldElement = fieldElements.item(temp);
if (fieldElement.getNodeType() == Node.ELEMENT_NODE) {
this.fields.add(new Field().fromXml((Element)fieldElement));
}
}
}
this.multiplicity = new Multiplicity();
Element multiplicity = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "multiplicity");
this.multiplicity = new Multiplicity();
Element multiplicity = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "multiplicity");
this.multiplicity.setMin(Integer.parseInt(multiplicity.getAttribute("min")));
this.multiplicity.setMax(Integer.parseInt(multiplicity.getAttribute("max")));
this.multiplicity.setMin(Integer.parseInt(multiplicity.getAttribute("min")));
this.multiplicity.setMax(Integer.parseInt(multiplicity.getAttribute("max")));
return this;
}
return this;
}
}

View File

@ -5,7 +5,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class Page implements DatabaseViewStyleDefinition,XmlSerializable<Page> {
public class Page implements DatabaseViewStyleDefinition, XmlSerializable<Page> {
private String id;
private int ordinal;
private String title;
@ -37,9 +37,9 @@ public class Page implements DatabaseViewStyleDefinition,XmlSerializable<Page> {
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("page");
root.setAttribute("title",this.title);
root.setAttribute("ordinal",""+this.ordinal);
root.setAttribute("id",this.id);
root.setAttribute("title", this.title);
root.setAttribute("ordinal", "" + this.ordinal);
root.setAttribute("id", this.id);
return root;
}

View File

@ -1,167 +1,182 @@
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
import java.util.LinkedList;
import java.util.List;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.builders.XmlBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.builders.XmlBuilder;
import java.util.LinkedList;
import java.util.List;
public class Section implements DatabaseViewStyleDefinition,XmlSerializable<Section>{
private String id;
private int ordinal;
private boolean defaultVisibility;
private String page;
private String title;
private String description;
private String extendedDescription;
private List<Section> sections;
private List<FieldSet> fieldSets;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getOrdinal() {
return ordinal;
}
public void setOrdinal(int ordinal) {
this.ordinal = ordinal;
}
public boolean isDefaultVisibility() {
return defaultVisibility;
}
public void setDefaultVisibility(boolean defaultVisibility) {
this.defaultVisibility = defaultVisibility;
}
public String getPage() {
return page;
}
public void setPage(String page) {
this.page = page;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<Section> getSections() {
return sections;
}
public void setSections(List<Section> sections) {
this.sections = sections;
}
public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Section> {
private String id;
private int ordinal;
private boolean defaultVisibility;
private String page;
private String title;
private String description;
private String extendedDescription;
private List<Section> sections;
private List<FieldSet> fieldSets;
public List<FieldSet> getFieldSets() {
return fieldSets;
}
public String getId() {
return id;
}
public void setFieldSets(List<FieldSet> fieldSets) {
this.fieldSets = fieldSets;
}
public void setId(String id) {
this.id = id;
}
public int getOrdinal() {
return ordinal;
}
public void setOrdinal(int ordinal) {
this.ordinal = ordinal;
}
public boolean isDefaultVisibility() {
return defaultVisibility;
}
public void setDefaultVisibility(boolean defaultVisibility) {
this.defaultVisibility = defaultVisibility;
}
public String getPage() {
return page;
}
public void setPage(String page) {
this.page = page;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<Section> getSections() {
return sections;
}
public void setSections(List<Section> sections) {
this.sections = sections;
}
public List<FieldSet> getFieldSets() {
return fieldSets;
}
public void setFieldSets(List<FieldSet> fieldSets) {
this.fieldSets = fieldSets;
}
public String getExtendedDescription() {
return extendedDescription;
}
public void setExtendedDescription(String extendedDescription) {
this.extendedDescription = extendedDescription;
}
@Override
public Element toXml(Document doc) {
Element rootElement = doc.createElement("section");
rootElement.setAttribute("id", this.id);
rootElement.setAttribute("ordinal", "" + this.ordinal);
rootElement.setAttribute("defaultVisibility", "" + this.defaultVisibility);
rootElement.setAttribute("page", "" + this.page);
Element description = doc.createElement("description");
description.setTextContent(this.description);
Element extendedDescription = doc.createElement("extendedDescription");
extendedDescription.setTextContent(this.extendedDescription);
Element title = doc.createElement("title");
title.setTextContent(this.title);
if (sections != null) {
Element sections = doc.createElement("sections");
for (Section section : this.sections) {
sections.appendChild(section.toXml(doc));
}
rootElement.appendChild(sections);
}
if (this.fieldSets != null) {
Element formGroups = doc.createElement("fieldSets");
for (FieldSet fieldSet : this.fieldSets) {
formGroups.appendChild(fieldSet.toXml(doc));
}
rootElement.appendChild(formGroups);
}
rootElement.appendChild(title);
rootElement.appendChild(extendedDescription);
rootElement.appendChild(description);
return rootElement;
}
@Override
public Section fromXml(Element element) {
this.id = element.getAttribute("id");
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
this.defaultVisibility = Boolean.getBoolean(element.getAttribute("defaultVisibility"));
this.page = element.getAttribute("page");
Element description = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "description");
if (description != null) this.description = description.getTextContent();
Element extendedDescription = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "extendedDescription");
if (extendedDescription != null) this.extendedDescription = extendedDescription.getTextContent();
Element title = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "title");
if (title != null) this.title = title.getTextContent();
this.sections = new LinkedList<Section>();
Element sections = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "sections");
if (sections != null) {
NodeList sectionElements = sections.getChildNodes();
for (int temp = 0; temp < sectionElements.getLength(); temp++) {
Node sectionElement = sectionElements.item(temp);
if (sectionElement.getNodeType() == Node.ELEMENT_NODE) {
this.sections.add(new Section().fromXml((Element) sectionElement));
}
}
}
this.fieldSets = new LinkedList<FieldSet>();
Element fieldGroups = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fieldSets");
if (fieldGroups != null) {
NodeList fieldGroupElements = fieldGroups.getChildNodes();
for (int temp = 0; temp < fieldGroupElements.getLength(); temp++) {
Node fieldGroupElement = fieldGroupElements.item(temp);
if (fieldGroupElement.getNodeType() == Node.ELEMENT_NODE) {
this.fieldSets.add(new FieldSet().fromXml((Element) fieldGroupElement));
}
}
}
return this;
}
public String getExtendedDescription() {
return extendedDescription;
}
public void setExtendedDescription(String extendedDescription) {
this.extendedDescription = extendedDescription;
}
@Override
public Element toXml(Document doc) {
Element rootElement = doc.createElement("section");
rootElement.setAttribute("id", this.id);
rootElement.setAttribute("ordinal", ""+this.ordinal);
rootElement.setAttribute("defaultVisibility", ""+this.defaultVisibility);
rootElement.setAttribute("page", ""+this.page);
Element description = doc.createElement("description");
description.setTextContent(this.description);
Element extendedDescription = doc.createElement("extendedDescription");
extendedDescription.setTextContent(this.extendedDescription);
Element title = doc.createElement("title");
title.setTextContent(this.title);
if(sections!=null){
Element sections = doc.createElement("sections");
for(Section section : this.sections){
sections.appendChild(section.toXml(doc));
}
rootElement.appendChild(sections);
}
if(this.fieldSets!=null){
Element formGroups = doc.createElement("fieldSets");
for(FieldSet fieldSet : this.fieldSets){
formGroups.appendChild(fieldSet.toXml(doc));
}
rootElement.appendChild(formGroups);
}
rootElement.appendChild(title);
rootElement.appendChild(extendedDescription);
rootElement.appendChild(description);
return rootElement;
}
@Override
public Section fromXml(Element element) {
this.id = element.getAttribute("id");
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
this.defaultVisibility = Boolean.getBoolean(element.getAttribute("defaultVisibility"));
this.page = element.getAttribute("page");
Element description = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"description");
if(description!=null) this.description = description.getTextContent();
Element extendedDescription = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"extendedDescription");
if(extendedDescription != null) this.extendedDescription = extendedDescription.getTextContent();
Element title =XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"title");
if(title!=null) this.title = title.getTextContent();
this.sections = new LinkedList<Section>();
Element sections = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "sections");
if(sections!=null){
NodeList sectionElements = sections.getChildNodes();
for (int temp = 0; temp < sectionElements.getLength(); temp++) {
Node sectionElement = sectionElements.item(temp);
if (sectionElement.getNodeType() == Node.ELEMENT_NODE) {
this.sections.add(new Section().fromXml((Element)sectionElement));
}
}
}
this.fieldSets = new LinkedList<FieldSet>();
Element fieldGroups = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fieldSets");
if(fieldGroups!=null){
NodeList fieldGroupElements = fieldGroups.getChildNodes();
for (int temp = 0; temp < fieldGroupElements.getLength(); temp++) {
Node fieldGroupElement = fieldGroupElements.item(temp);
if (fieldGroupElement.getNodeType() == Node.ELEMENT_NODE) {
this.fieldSets.add(new FieldSet().fromXml((Element)fieldGroupElement));
}
}
}
return this;
}
}

View File

@ -1,14 +1,14 @@
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
import java.util.LinkedList;
import java.util.List;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.builders.XmlBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import eu.eudat.utilities.XmlSerializable;
import eu.eudat.utilities.builders.XmlBuilder;
import java.util.LinkedList;
import java.util.List;
public class ViewStyleModel implements XmlSerializable<ViewStyleModel> {
private List<Section> sections;
@ -40,7 +40,7 @@ public class ViewStyleModel implements XmlSerializable<ViewStyleModel> {
}
for (Page page : this.pages) {
pages.appendChild(page.toXml(doc));
pages.appendChild(page.toXml(doc));
}
root.appendChild(pages);
@ -63,8 +63,8 @@ public class ViewStyleModel implements XmlSerializable<ViewStyleModel> {
}
}
this.pages = new LinkedList<>();
Element pages = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"pages");
if(pages!=null){
Element pages = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "pages");
if (pages != null) {
NodeList pagesElements = pages.getChildNodes();
for (int temp = 0; temp < pagesElements.getLength(); temp++) {
Node pageElement = pagesElements.item(temp);

View File

@ -2,6 +2,6 @@ package eu.eudat.entities.xmlmodels.modeldefinition;
import eu.eudat.utilities.DatabaseDefinition;
public interface DatabaseModelDefinition extends DatabaseDefinition{
public interface DatabaseModelDefinition extends DatabaseDefinition {
}

View File

@ -2,10 +2,10 @@ package eu.eudat.exceptions.security;
public class NonValidTokenException extends Exception {
private static final long serialVersionUID = -2834659827755141154L;
public NonValidTokenException(String msg) {
super(msg);
}
private static final long serialVersionUID = -2834659827755141154L;
public NonValidTokenException(String msg) {
super(msg);
}
}

View File

@ -5,16 +5,19 @@ import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.UNAUTHORIZED)
public class UnauthorisedException extends RuntimeException{
public class UnauthorisedException extends RuntimeException {
public UnauthorisedException() {
super();
}
public UnauthorisedException(String message, Throwable cause) {
super(message, cause);
}
public UnauthorisedException(String message) {
super(message);
}
public UnauthorisedException(Throwable cause) {
super(cause);
}

View File

@ -12,7 +12,10 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
import java.lang.annotation.Annotation;
import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
public final class PrincipalArgumentResolver implements HandlerMethodArgumentResolver {
@ -39,7 +42,8 @@ public final class PrincipalArgumentResolver implements HandlerMethodArgumentRes
Principal principal = this.authenticationService.Touch(authToken);
if (principal == null) throw new UnauthorisedException("Authentication Information Missing");
if (!principal.isAuthorized(claimList)) throw new UnauthorisedException("You are not Authorized For this Action");
if (!principal.isAuthorized(claimList))
throw new UnauthorisedException("You are not Authorized For this Action");
return principal;
}

View File

@ -1,27 +1,18 @@
package eu.eudat.managers;
import java.util.Date;
import java.util.List;
import eu.eudat.builders.entity.DatasetProfileBuilder;
import eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel;
import eu.eudat.models.admin.composite.DatasetProfile;
import eu.eudat.services.ApiContext;
import eu.eudat.utilities.builders.ModelBuilder;
import eu.eudat.utilities.builders.XmlBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import eu.eudat.entities.DatasetProfileViewstyle;
import eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel;
import eu.eudat.models.admin.components.datasetprofile.FieldSet;
import eu.eudat.models.admin.composite.DatasetProfile;
import eu.eudat.utilities.builders.ModelBuilder;
import eu.eudat.utilities.builders.XmlBuilder;
import eu.eudat.utilities.helpers.ModelBuilderCollector;
import java.util.Date;
public class AdminManager {
public static eu.eudat.entities.DatasetProfile generateViewStyleDefinition(DatasetProfile profile, ApiContext apiContext) {
ViewStyleModel viewStyleModel = new ViewStyleModel();
viewStyleModel.setSections(new ModelBuilder().toViewStyleDefinition(profile.getSections(), eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section.class));
@ -40,12 +31,11 @@ public class AdminManager {
public static eu.eudat.models.admin.composite.DatasetProfile generateDatasetProfileModel(eu.eudat.entities.DatasetProfile profile) {
Document viewStyleDoc = XmlBuilder.fromXml(profile.getDefinition());
Element root = (Element) viewStyleDoc.getDocumentElement();
Element root = viewStyleDoc.getDocumentElement();
eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewstyle = new eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel().fromXml(root);
eu.eudat.models.admin.composite.DatasetProfile datasetprofile = new eu.eudat.models.admin.composite.DatasetProfile();
datasetprofile.buildProfile(viewstyle);
return datasetprofile;
}
}

View File

@ -3,16 +3,10 @@ package eu.eudat.managers;
import eu.eudat.dao.entities.DMPDao;
import eu.eudat.dao.entities.DatasetDao;
import eu.eudat.dao.entities.ProjectDao;
import eu.eudat.entities.DMP;
import eu.eudat.entities.Dataset;
import eu.eudat.entities.Project;
import eu.eudat.entities.UserInfo;
import eu.eudat.models.dashboard.DashBoardStatistics;
import eu.eudat.models.security.Principal;
import java.lang.reflect.Array;
import java.util.Arrays;
public class DashBoardManager {
public DashBoardStatistics getStatistics(DatasetDao datasetRepository, DMPDao dataManagementPlanRepository, ProjectDao projectRepository) {

View File

@ -1,9 +1,5 @@
package eu.eudat.managers;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import eu.eudat.builders.entity.UserInfoBuilder;
import eu.eudat.dao.entities.*;
import eu.eudat.entities.*;
@ -25,6 +21,13 @@ import eu.eudat.queryable.QueryableList;
import eu.eudat.services.ApiContext;
import org.springframework.scheduling.annotation.Async;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
public class DataManagementPlanManager {
public DataTableData<DataManagementPlanListingModel> getPaged(ApiContext apiContext, DataManagementPlanTableRequest dataManagementPlanTableRequest, Principal principal) throws Exception {

Some files were not shown because too many files have changed in this diff Show More