Merge branch 'Development' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot into Development
This commit is contained in:
commit
67aa17324c
|
@ -32,11 +32,7 @@ public class Admin {
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/admin/addDmp" },consumes = "application/json", produces="application/json")
|
@RequestMapping(method = RequestMethod.POST, value = { "/admin/addDmp" },consumes = "application/json", produces="application/json")
|
||||||
public ResponseEntity<Object> addDmp(@RequestBody DatasetProfile profile){
|
public ResponseEntity<Object> addDmp(@RequestBody DatasetProfile profile){
|
||||||
try{
|
try{
|
||||||
eu.eudat.entities.DatasetProfile modelDefinition = AdminManager.generateModelDefinition(profile);
|
eu.eudat.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile);
|
||||||
eu.eudat.entities.DatasetProfileViewstyle viewStyleDefinition = AdminManager.generateViewStyleDefinition(profile);
|
|
||||||
|
|
||||||
viewStyleDefinition = datasetProfileViewstyleDao.create(viewStyleDefinition);
|
|
||||||
modelDefinition.setViewstyle(viewStyleDefinition);
|
|
||||||
datasetProfileDao.createOrUpdate(modelDefinition);
|
datasetProfileDao.createOrUpdate(modelDefinition);
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(modelDefinition.getId());
|
return ResponseEntity.status(HttpStatus.OK).body(modelDefinition.getId());
|
||||||
|
@ -50,20 +46,9 @@ public class Admin {
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/admin/addDmp/{id}" },consumes = "application/json", produces="application/json")
|
@RequestMapping(method = RequestMethod.POST, value = { "/admin/addDmp/{id}" },consumes = "application/json", produces="application/json")
|
||||||
public ResponseEntity<Object> updateDmp(@PathVariable String id,@RequestBody DatasetProfile profile){
|
public ResponseEntity<Object> updateDmp(@PathVariable String id,@RequestBody DatasetProfile profile){
|
||||||
try{
|
try{
|
||||||
eu.eudat.entities.DatasetProfile modelDefinition = AdminManager.generateModelDefinition(profile);
|
eu.eudat.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile);
|
||||||
eu.eudat.entities.DatasetProfileViewstyle viewStyleDefinition = AdminManager.generateViewStyleDefinition(profile);
|
|
||||||
|
|
||||||
|
|
||||||
eu.eudat.entities.DatasetProfile datasetprofile = datasetProfileDao.find(UUID.fromString(id));
|
eu.eudat.entities.DatasetProfile datasetprofile = datasetProfileDao.find(UUID.fromString(id));
|
||||||
|
|
||||||
eu.eudat.entities.DatasetProfileViewstyle oldviewStyle = datasetProfileViewstyleDao.read((datasetprofile.getViewstyle().getId()));
|
|
||||||
oldviewStyle.setDefinition(viewStyleDefinition.getDefinition());
|
|
||||||
datasetProfileViewstyleDao.update(oldviewStyle);
|
|
||||||
|
|
||||||
|
|
||||||
//if(!datasetprofile.getDataset().isEmpty())throw new Exception ("Cannot edit a Profile that has Datasets assigned");
|
|
||||||
|
|
||||||
datasetprofile.setViewstyle(oldviewStyle);
|
|
||||||
datasetprofile.setDefinition(modelDefinition.getDefinition());
|
datasetprofile.setDefinition(modelDefinition.getDefinition());
|
||||||
datasetProfileDao.createOrUpdate(datasetprofile);
|
datasetProfileDao.createOrUpdate(datasetprofile);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package eu.eudat.controllers;
|
||||||
|
|
||||||
|
import eu.eudat.validators.DataManagementPlanTableRequestValidator;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by ikalyvas on 1/2/2018.
|
||||||
|
*/
|
||||||
|
public abstract class BaseController {
|
||||||
|
|
||||||
|
private ApplicationContext springContext;
|
||||||
|
|
||||||
|
public BaseController(ApplicationContext springContext){
|
||||||
|
this.springContext = springContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@InitBinder()
|
||||||
|
protected void initBinder(WebDataBinder binder) {
|
||||||
|
if (binder.getTarget() != null && DataManagementPlanTableRequestValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.springContext.getBean("dataManagementPlanTableRequestValidator",DataManagementPlanTableRequestValidator.class));
|
||||||
|
if (binder.getTarget() != null && ProjectTableRequestValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.springContext.getBean("projectTableRequestValidator",ProjectTableRequestValidator.class));
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ import eu.eudat.models.listingmodels.DataManagementPlanListingModel;
|
||||||
import eu.eudat.models.security.Principal;
|
import eu.eudat.models.security.Principal;
|
||||||
import eu.eudat.validators.DataManagementPlanTableRequestValidator;
|
import eu.eudat.validators.DataManagementPlanTableRequestValidator;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.WebDataBinder;
|
import org.springframework.web.bind.WebDataBinder;
|
||||||
|
@ -39,8 +40,11 @@ import eu.eudat.managers.DataManagementPlanManager;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@CrossOrigin
|
@CrossOrigin
|
||||||
public class DMPs {
|
public class DMPs extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
public DMPs(ApplicationContext applicationContext){
|
||||||
|
super(applicationContext);
|
||||||
|
}
|
||||||
@Autowired private DataRepositoryDao dataRepositoryDao;
|
@Autowired private DataRepositoryDao dataRepositoryDao;
|
||||||
@Autowired private DatasetDao datasetDao;
|
@Autowired private DatasetDao datasetDao;
|
||||||
@Autowired private DatasetProfileDao datasetProfileDao;
|
@Autowired private DatasetProfileDao datasetProfileDao;
|
||||||
|
@ -55,10 +59,6 @@ public class DMPs {
|
||||||
@Autowired private ServiceDao serviceDao;
|
@Autowired private ServiceDao serviceDao;
|
||||||
@Autowired private UserInfoDao userInfoDao;
|
@Autowired private UserInfoDao userInfoDao;
|
||||||
|
|
||||||
@InitBinder
|
|
||||||
protected void initBinder(WebDataBinder binder){
|
|
||||||
binder.setValidator(new DataManagementPlanTableRequestValidator());
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/getPaged" }, consumes = "application/json", produces="application/json")
|
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/getPaged" }, consumes = "application/json", produces="application/json")
|
||||||
public @ResponseBody ResponseItem<DataTableData<DataManagementPlanListingModel>> getPaged(@Valid @RequestBody DataManagementPlanTableRequest dataManagementPlanTableRequest) {
|
public @ResponseBody ResponseItem<DataTableData<DataManagementPlanListingModel>> getPaged(@Valid @RequestBody DataManagementPlanTableRequest dataManagementPlanTableRequest) {
|
||||||
|
@ -73,7 +73,7 @@ public class DMPs {
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = { "/dmps/getSingle/{id}" }, produces="application/json")
|
@RequestMapping(method = RequestMethod.GET, value = { "/dmps/getSingle/{id}" }, produces="application/json")
|
||||||
public @ResponseBody ResponseItem<DataManagementPlan> getPaged(@PathVariable String id) {
|
public @ResponseBody ResponseItem<DataManagementPlan> getSingle(@PathVariable String id) {
|
||||||
try {
|
try {
|
||||||
eu.eudat.models.dmp.DataManagementPlan project = new DataManagementPlanManager().getSingle(dMPDao, id);
|
eu.eudat.models.dmp.DataManagementPlan project = new DataManagementPlanManager().getSingle(dMPDao, id);
|
||||||
return new ResponseItem<DataManagementPlan>().status(HttpStatus.OK).payload(project);
|
return new ResponseItem<DataManagementPlan>().status(HttpStatus.OK).payload(project);
|
||||||
|
|
|
@ -67,83 +67,9 @@ public class DataRepositories {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
||||||
}
|
}
|
||||||
catch(HugeResultSet ex) {
|
catch(HugeResultSet ex) {
|
||||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(null); //the ex.getMessage has the appropriate text description
|
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// MANAGE DATAREPOSITORy(IES)
|
|
||||||
|
|
||||||
// @RequestMapping(method = RequestMethod.GET, value = { "/datarepos" })
|
|
||||||
// public @ResponseBody ResponseEntity<List<UUID>> listDataRepositories(){
|
|
||||||
// try {
|
|
||||||
// List<UUID> allIDs = dataRepositoryDao.listAllIDs();
|
|
||||||
// return ResponseEntity.status(HttpStatus.OK).body(allIDs);
|
|
||||||
// }
|
|
||||||
// catch(Exception ex) {
|
|
||||||
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// @RequestMapping(method = RequestMethod.GET, value = { "/datarepos/{id}" })
|
|
||||||
// public @ResponseBody ResponseEntity<DataRepository> getDataRepository(@PathVariable("id") String id) {
|
|
||||||
// try {
|
|
||||||
// DataRepository dataRepository = dataRepositoryDao.read(UUID.fromString(id));
|
|
||||||
// return ResponseEntity.status(HttpStatus.OK).body(dataRepository);
|
|
||||||
// }
|
|
||||||
// catch(Exception ex) {
|
|
||||||
// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// @RequestMapping(method = RequestMethod.GET, value = { "/datarepo/getAll" }, produces="application/json")
|
|
||||||
// public @ResponseBody ResponseEntity<List<DataRepository>> getAllDataRepositories(){
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// List<DataRepository> allDataRepositories = dataRepositoryDao.getAll();
|
|
||||||
//
|
|
||||||
// return ResponseEntity.status(HttpStatus.OK).body(allDataRepositories);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// catch(Exception ex) {
|
|
||||||
// ex.printStackTrace();
|
|
||||||
// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// @Transactional
|
|
||||||
// @RequestMapping(method = RequestMethod.POST, value = { "/datarepo/create" }, consumes = "application/json", produces="application/json")
|
|
||||||
// public @ResponseBody ResponseEntity<DataRepository> setOrganisation(@RequestBody DataRepository dataRepository) {
|
|
||||||
// try {
|
|
||||||
// DataRepository createdDataRepository = dataRepositoryDao.update(dataRepository);
|
|
||||||
// return ResponseEntity.status(HttpStatus.CREATED).body(createdDataRepository);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// @RequestMapping(method = RequestMethod.POST, value = { "/datarepo/delete" }, consumes = "application/json", produces="text/plain")
|
|
||||||
// public @ResponseBody ResponseEntity<Object> delete(@RequestBody DataRepository dataRepository) {
|
|
||||||
//
|
|
||||||
// DataRepository dr = new DataRepository();
|
|
||||||
// dr.setId(dataRepository.getId());
|
|
||||||
// try {
|
|
||||||
// dataRepositoryDao.delete(dr);
|
|
||||||
// return ResponseEntity.status(HttpStatus.CREATED).body("{\"msg\":\"Deleted data repository!\"}");
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not delete data repository!\"}");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package eu.eudat.controllers;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -81,10 +80,10 @@ public class DatasetProfileController {
|
||||||
public ResponseEntity<Object> getDataForAutocomplete(@RequestBody AutoCompleteLookupItem lookupItem){
|
public ResponseEntity<Object> getDataForAutocomplete(@RequestBody AutoCompleteLookupItem lookupItem){
|
||||||
try {
|
try {
|
||||||
eu.eudat.entities.Dataset dataset = datasetDao.find(UUID.fromString(lookupItem.getProfileID()));
|
eu.eudat.entities.Dataset dataset = datasetDao.find(UUID.fromString(lookupItem.getProfileID()));
|
||||||
Document viewStyleDoc = XmlBuilder.fromXml(dataset.getProfile().getViewstyle().getDefinition());
|
//Document viewStyleDoc = XmlBuilder.fromXml(dataset.getProfile().getViewstyle().getDefinition());
|
||||||
Element field = viewStyleDoc.getElementById(lookupItem.getFieldID());
|
//Element field = viewStyleDoc.getElementById(lookupItem.getFieldID());
|
||||||
eu.eudat.entities.xmlmodels.viewstyledefinition.Field modelfield = new eu.eudat.entities.xmlmodels.viewstyledefinition.Field();
|
eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field modelfield = new eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field();
|
||||||
modelfield.fromXml(field);
|
//modelfield.fromXml(field);
|
||||||
AutoCompleteData data = new AutoCompleteData().fromData(modelfield.getData());
|
AutoCompleteData data = new AutoCompleteData().fromData(modelfield.getData());
|
||||||
|
|
||||||
URL url = new URL(data.getUrl()+lookupItem.getSearchTerm());
|
URL url = new URL(data.getUrl()+lookupItem.getSearchTerm());
|
||||||
|
|
|
@ -12,6 +12,9 @@ import eu.eudat.entities.DatasetProfileViewstyle;
|
||||||
import eu.eudat.managers.DatasetProfileManager;
|
import eu.eudat.managers.DatasetProfileManager;
|
||||||
import eu.eudat.models.datasetprofile.DatasetProfileAutocompleteItem;
|
import eu.eudat.models.datasetprofile.DatasetProfileAutocompleteItem;
|
||||||
import eu.eudat.models.datasetprofile.DatasetProfileAutocompleteRequest;
|
import eu.eudat.models.datasetprofile.DatasetProfileAutocompleteRequest;
|
||||||
|
import eu.eudat.models.datasetprofile.DatasetProfileListingModel;
|
||||||
|
import eu.eudat.models.datasetprofile.DatasetProfileTableRequestItem;
|
||||||
|
import eu.eudat.models.helpers.DataTableData;
|
||||||
import eu.eudat.models.helpers.responses.ResponseItem;
|
import eu.eudat.models.helpers.responses.ResponseItem;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
@ -40,7 +43,6 @@ import eu.eudat.dao.entities.ServiceDao;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@CrossOrigin
|
@CrossOrigin
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/dmps" })
|
|
||||||
public class DatasetProfiles {
|
public class DatasetProfiles {
|
||||||
|
|
||||||
@Autowired private DataRepositoryDao dataRepositoryDao;
|
@Autowired private DataRepositoryDao dataRepositoryDao;
|
||||||
|
@ -57,7 +59,7 @@ public class DatasetProfiles {
|
||||||
@Autowired private ServiceDao serviceDao;
|
@Autowired private ServiceDao serviceDao;
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/datasetprofiles/get" }, produces="application/json")
|
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/datasetprofiles/get" }, produces="application/json")
|
||||||
public @ResponseBody ResponseItem<List<DatasetProfileAutocompleteItem>> get(@RequestBody DatasetProfileAutocompleteRequest datasetProfileAutocompleteRequest) {
|
public @ResponseBody ResponseItem<List<DatasetProfileAutocompleteItem>> get(@RequestBody DatasetProfileAutocompleteRequest datasetProfileAutocompleteRequest) {
|
||||||
try {
|
try {
|
||||||
List<DatasetProfileAutocompleteItem> datasetProfileAutocompleteItems = DatasetProfileManager.getWithCriteria(datasetProfileDao,datasetProfileAutocompleteRequest);
|
List<DatasetProfileAutocompleteItem> datasetProfileAutocompleteItems = DatasetProfileManager.getWithCriteria(datasetProfileDao,datasetProfileAutocompleteRequest);
|
||||||
|
@ -67,5 +69,27 @@ public class DatasetProfiles {
|
||||||
return new ResponseItem<List<DatasetProfileAutocompleteItem>>().status(HttpStatus.BAD_REQUEST);
|
return new ResponseItem<List<DatasetProfileAutocompleteItem>>().status(HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/datasetprofiles/getPaged" }, produces="application/json")
|
||||||
|
public @ResponseBody ResponseItem<DataTableData<DatasetProfileListingModel>> getPaged(@RequestBody DatasetProfileTableRequestItem datasetProfileTableRequestItem) {
|
||||||
|
try {
|
||||||
|
DataTableData<DatasetProfileListingModel> datasetProfileTableData = DatasetProfileManager.getPaged(datasetProfileDao,datasetProfileTableRequestItem);
|
||||||
|
return new ResponseItem<DataTableData<DatasetProfileListingModel>>().status(HttpStatus.OK).payload(datasetProfileTableData );
|
||||||
|
}
|
||||||
|
catch(Exception ex) {
|
||||||
|
return new ResponseItem<DataTableData<DatasetProfileListingModel>>().status(HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET, value = { "/datasetprofiles/getAll" }, produces="application/json")
|
||||||
|
public @ResponseBody ResponseItem<List<DatasetProfileListingModel>> getAll() {
|
||||||
|
try {
|
||||||
|
List<DatasetProfileListingModel> datasetProfileTableData = DatasetProfileManager.getAll(datasetProfileDao);
|
||||||
|
return new ResponseItem<List<DatasetProfileListingModel>>().status(HttpStatus.OK).payload(datasetProfileTableData );
|
||||||
|
}
|
||||||
|
catch(Exception ex) {
|
||||||
|
return new ResponseItem<List<DatasetProfileListingModel>>().status(HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import eu.eudat.models.criteria.ProjectCriteria;
|
import eu.eudat.models.criteria.ProjectCriteria;
|
||||||
import eu.eudat.models.external.OrganisationsExternalSourcesModel;
|
import eu.eudat.models.external.OrganisationsExternalSourcesModel;
|
||||||
|
@ -16,6 +17,7 @@ import eu.eudat.models.helpers.responses.*;
|
||||||
import eu.eudat.models.project.ProjectCriteriaRequest;
|
import eu.eudat.models.project.ProjectCriteriaRequest;
|
||||||
import eu.eudat.models.security.Principal;
|
import eu.eudat.models.security.Principal;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
@ -56,8 +58,12 @@ import eu.eudat.proxy.fetching.RemoteFetcher;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@CrossOrigin
|
@CrossOrigin
|
||||||
public class Projects {
|
public class Projects extends BaseController{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public Projects(ApplicationContext applicationContext){
|
||||||
|
super(applicationContext);
|
||||||
|
}
|
||||||
@Autowired private DataRepositoryDao dataRepositoryDao;
|
@Autowired private DataRepositoryDao dataRepositoryDao;
|
||||||
@Autowired private DatasetDao datasetDao;
|
@Autowired private DatasetDao datasetDao;
|
||||||
@Autowired private DatasetProfileDao datasetProfileDao;
|
@Autowired private DatasetProfileDao datasetProfileDao;
|
||||||
|
@ -79,7 +85,7 @@ public class Projects {
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/projects/getPaged" }, consumes = "application/json", produces="application/json")
|
@RequestMapping(method = RequestMethod.POST, value = { "/projects/getPaged" }, consumes = "application/json", produces="application/json")
|
||||||
public @ResponseBody ResponseItem<DataTableData<eu.eudat.models.project.Project>> getPaged(@RequestBody ProjectTableRequest projectTableRequest) {
|
public @ResponseBody ResponseItem<DataTableData<eu.eudat.models.project.Project>> getPaged(@Valid @RequestBody ProjectTableRequest projectTableRequest) {
|
||||||
try {
|
try {
|
||||||
DataTableData<eu.eudat.models.project.Project> dataTable = new ProjectManager().getPaged(projectDao, projectTableRequest);
|
DataTableData<eu.eudat.models.project.Project> dataTable = new ProjectManager().getPaged(projectDao, projectTableRequest);
|
||||||
return new ResponseItem<DataTableData<eu.eudat.models.project.Project>>().payload(dataTable).status(HttpStatus.OK);
|
return new ResponseItem<DataTableData<eu.eudat.models.project.Project>>().payload(dataTable).status(HttpStatus.OK);
|
||||||
|
@ -118,7 +124,7 @@ public class Projects {
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = { "/projects/inactivate/{id}" }, consumes = "application/json", produces="application/json")
|
@RequestMapping(method = RequestMethod.DELETE, value = { "/projects/inactivate/{id}" }, consumes = "application/json", produces="application/json")
|
||||||
public @ResponseBody ResponseItem<eu.eudat.entities.Project> inactivate(@PathVariable String id) {
|
public @ResponseBody ResponseItem<eu.eudat.entities.Project> inactivate(@PathVariable String id) {
|
||||||
try {
|
try {
|
||||||
Project inactivate = new ProjectManager().inactivate(projectDao,id);
|
Project project = new ProjectManager().inactivate(projectDao,id);
|
||||||
return new ResponseItem<eu.eudat.entities.Project>().status(HttpStatus.OK);
|
return new ResponseItem<eu.eudat.entities.Project>().status(HttpStatus.OK);
|
||||||
}catch (Exception ex){
|
}catch (Exception ex){
|
||||||
return new ResponseItem<eu.eudat.entities.Project>().status(HttpStatus.BAD_REQUEST).message(ex.getMessage());
|
return new ResponseItem<eu.eudat.entities.Project>().status(HttpStatus.BAD_REQUEST).message(ex.getMessage());
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
|
||||||
public interface DatasetProfileDao {
|
public interface DatasetProfileDao {
|
||||||
|
|
||||||
QueryableList<DatasetProfile> getWithCriteria(DatasetProfileCriteria criteria);
|
QueryableList<DatasetProfile> getWithCriteria(DatasetProfileCriteria criteria);
|
||||||
|
QueryableList<DatasetProfile> getAll();
|
||||||
|
|
||||||
DatasetProfile createOrUpdate(DatasetProfile item);
|
DatasetProfile createOrUpdate(DatasetProfile item);
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class DatasetProfileDaoImpl implements DatasetProfileDao {
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatasetProfile createOrUpdate(DatasetProfile item) {
|
public DatasetProfile createOrUpdate(DatasetProfile item) {
|
||||||
return this.databaseService.createOrUpdate(item,DatasetProfile.class);
|
return this.databaseService.createOrUpdate(item,DatasetProfile.class);
|
||||||
|
@ -38,11 +39,16 @@ public class DatasetProfileDaoImpl implements DatasetProfileDao {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatasetProfile find(UUID id) {
|
public DatasetProfile find(UUID id) {
|
||||||
return null;
|
return databaseService.getQueryable(DatasetProfile.class).where((builder, root) -> builder.equal(root.get("id"),id)).toList().get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long count() {
|
public Long count() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryableList<DatasetProfile> getAll() {
|
||||||
|
return databaseService.getQueryable(DatasetProfile.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,19 +46,6 @@ public class DatasetProfile implements Serializable,DataEntity<DatasetProfile> {
|
||||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "profile")
|
@OneToMany(fetch = FetchType.LAZY, mappedBy = "profile")
|
||||||
private Set<Dataset> dataset;
|
private Set<Dataset> dataset;
|
||||||
|
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.LAZY)
|
|
||||||
// @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
|
||||||
@JoinColumn(name = "\"Ruleset\"", nullable = true)
|
|
||||||
private DatasetProfileRuleset ruleset;
|
|
||||||
|
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.LAZY)
|
|
||||||
// @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
|
||||||
@JoinColumn(name = "\"Viewstyle\"", nullable = true)
|
|
||||||
private DatasetProfileViewstyle viewstyle;
|
|
||||||
|
|
||||||
|
|
||||||
@Type(type="eu.eudat.typedefinition.XMLType")
|
@Type(type="eu.eudat.typedefinition.XMLType")
|
||||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
|
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
|
||||||
private String definition;
|
private String definition;
|
||||||
|
@ -136,22 +123,6 @@ public class DatasetProfile implements Serializable,DataEntity<DatasetProfile> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public DatasetProfileRuleset getRuleset() {
|
|
||||||
return ruleset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRuleset(DatasetProfileRuleset ruleset) {
|
|
||||||
this.ruleset = ruleset;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public DatasetProfileViewstyle getViewstyle() {
|
|
||||||
return viewstyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setViewstyle(DatasetProfileViewstyle viewstyle) {
|
|
||||||
this.viewstyle = viewstyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDefinition() {
|
public String getDefinition() {
|
||||||
return definition;
|
return definition;
|
||||||
|
@ -173,8 +144,7 @@ public class DatasetProfile implements Serializable,DataEntity<DatasetProfile> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", ruleset=" + ruleset
|
return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + "]";
|
||||||
+ ", viewstyle=" + viewstyle + ", definition=" + definition + "]";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,10 +36,6 @@ public class DatasetProfileRuleset implements Serializable {
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.LAZY, mappedBy = "ruleset")
|
|
||||||
private DatasetProfile datasetProfile;
|
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "\"Label\"")
|
@Column(name = "\"Label\"")
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
|
@ -73,14 +69,6 @@ public class DatasetProfileRuleset implements Serializable {
|
||||||
this.definition = definition;
|
this.definition = definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DatasetProfile getDatasetProfile() {
|
|
||||||
return datasetProfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDatasetProfile(DatasetProfile datasetProfile) {
|
|
||||||
this.datasetProfile = datasetProfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,9 +36,6 @@ public class DatasetProfileViewstyle implements Serializable {
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.LAZY, mappedBy = "viewstyle")
|
|
||||||
private DatasetProfile datasetProfile;
|
|
||||||
|
|
||||||
@Column(name = "\"Label\"")
|
@Column(name = "\"Label\"")
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
|
@ -72,14 +69,5 @@ public class DatasetProfileViewstyle implements Serializable {
|
||||||
this.definition = definition;
|
this.definition = definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DatasetProfile getDatasetProfile() {
|
|
||||||
return datasetProfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDatasetProfile(DatasetProfile datasetProfile) {
|
|
||||||
this.datasetProfile = datasetProfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.entities.xmlmodels.viewstyledefinition;
|
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
|
||||||
|
|
||||||
import eu.eudat.utilities.DatabaseDefinition;
|
import eu.eudat.utilities.DatabaseDefinition;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package eu.eudat.entities.xmlmodels.viewstyledefinition;
|
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
|
||||||
|
|
||||||
|
import eu.eudat.models.components.commons.DefaultValue;
|
||||||
|
import eu.eudat.models.components.commons.Multiplicity;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import eu.eudat.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
|
||||||
import eu.eudat.models.components.commons.ViewStyle;
|
import eu.eudat.models.components.commons.ViewStyle;
|
||||||
import eu.eudat.models.components.commons.Visibility;
|
import eu.eudat.models.components.commons.Visibility;
|
||||||
import eu.eudat.models.components.commons.datafield.FieldData;
|
import eu.eudat.models.components.commons.datafield.FieldData;
|
||||||
|
@ -14,11 +14,8 @@ import eu.eudat.utilities.builders.XmlBuilder;
|
||||||
public class Field implements DatabaseViewStyleDefinition,XmlSerializable<Field>{
|
public class Field implements DatabaseViewStyleDefinition,XmlSerializable<Field>{
|
||||||
private String id;
|
private String id;
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
private boolean defaultVisibility;
|
|
||||||
private String title;
|
|
||||||
private String description;
|
|
||||||
private String extendedDescription;
|
|
||||||
private ViewStyle viewStyle;
|
private ViewStyle viewStyle;
|
||||||
|
private DefaultValue defaultValue;
|
||||||
private Visibility visible;
|
private Visibility visible;
|
||||||
private FieldData data;
|
private FieldData data;
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -33,30 +30,6 @@ public class Field implements DatabaseViewStyleDefinition,XmlSerializable<Field>
|
||||||
public void setOrdinal(int ordinal) {
|
public void setOrdinal(int ordinal) {
|
||||||
this.ordinal = ordinal;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
public boolean getDefaultVisibility() {
|
|
||||||
return defaultVisibility;
|
|
||||||
}
|
|
||||||
public void setDefaultVisibility(boolean defaultVisibility) {
|
|
||||||
this.defaultVisibility = defaultVisibility;
|
|
||||||
}
|
|
||||||
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 String getExtendedDescription() {
|
|
||||||
return extendedDescription;
|
|
||||||
}
|
|
||||||
public void setExtendedDescription(String extendedDescription) {
|
|
||||||
this.extendedDescription = extendedDescription;
|
|
||||||
}
|
|
||||||
public ViewStyle getViewStyle() {
|
public ViewStyle getViewStyle() {
|
||||||
return viewStyle;
|
return viewStyle;
|
||||||
}
|
}
|
||||||
|
@ -71,6 +44,14 @@ public class Field implements DatabaseViewStyleDefinition,XmlSerializable<Field>
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DefaultValue getDefaultValue() {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultValue(DefaultValue defaultValue) {
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
public Visibility getVisible() {
|
public Visibility getVisible() {
|
||||||
return visible;
|
return visible;
|
||||||
}
|
}
|
||||||
|
@ -82,16 +63,6 @@ public class Field implements DatabaseViewStyleDefinition,XmlSerializable<Field>
|
||||||
Element rootElement = doc.createElement("field");
|
Element rootElement = doc.createElement("field");
|
||||||
rootElement.setAttribute("id", this.id);
|
rootElement.setAttribute("id", this.id);
|
||||||
rootElement.setAttribute("ordinal", ""+this.ordinal);
|
rootElement.setAttribute("ordinal", ""+this.ordinal);
|
||||||
rootElement.setAttribute("defaultVisibility",""+this.defaultVisibility);
|
|
||||||
|
|
||||||
Element extendedDescription = doc.createElement("extendedDescription");
|
|
||||||
extendedDescription.setTextContent(this.extendedDescription);
|
|
||||||
|
|
||||||
Element description = doc.createElement("description");
|
|
||||||
description.setTextContent(this.description);
|
|
||||||
|
|
||||||
Element title = doc.createElement("title");
|
|
||||||
title.setTextContent(this.title);
|
|
||||||
|
|
||||||
Element viewStyle = doc.createElement("viewStyle");
|
Element viewStyle = doc.createElement("viewStyle");
|
||||||
viewStyle.setAttribute("renderstyle", this.viewStyle.getRenderStyle());
|
viewStyle.setAttribute("renderstyle", this.viewStyle.getRenderStyle());
|
||||||
|
@ -99,11 +70,13 @@ public class Field implements DatabaseViewStyleDefinition,XmlSerializable<Field>
|
||||||
|
|
||||||
Element visibility = this.visible.toXml(doc);
|
Element visibility = this.visible.toXml(doc);
|
||||||
|
|
||||||
rootElement.appendChild(title);
|
Element defaultValue = doc.createElement("defaultValue");
|
||||||
|
defaultValue.setAttribute("type",this.defaultValue.getType());
|
||||||
|
defaultValue.setAttribute("value",this.defaultValue.getValue());
|
||||||
|
|
||||||
|
rootElement.appendChild(defaultValue);
|
||||||
rootElement.appendChild(visibility);
|
rootElement.appendChild(visibility);
|
||||||
rootElement.appendChild(extendedDescription);
|
|
||||||
rootElement.appendChild(viewStyle);
|
rootElement.appendChild(viewStyle);
|
||||||
rootElement.appendChild(description);
|
|
||||||
if(this.data!=null)rootElement.appendChild(this.data.toXml(doc));
|
if(this.data!=null)rootElement.appendChild(this.data.toXml(doc));
|
||||||
return rootElement;
|
return rootElement;
|
||||||
}
|
}
|
||||||
|
@ -111,19 +84,6 @@ public class Field implements DatabaseViewStyleDefinition,XmlSerializable<Field>
|
||||||
public Field fromXml(Element element) {
|
public Field fromXml(Element element) {
|
||||||
this.id = element.getAttribute("id");
|
this.id = element.getAttribute("id");
|
||||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
||||||
this.defaultVisibility = Boolean.valueOf(element.getAttribute("defaultVisibility")).booleanValue();
|
|
||||||
|
|
||||||
Element extendedDescription = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "extendedDescription");
|
|
||||||
|
|
||||||
this.extendedDescription = extendedDescription.getTextContent();
|
|
||||||
|
|
||||||
Element description = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "description");
|
|
||||||
|
|
||||||
this.description = description.getTextContent();
|
|
||||||
|
|
||||||
Element title = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "title");
|
|
||||||
|
|
||||||
this.title = title.getTextContent();
|
|
||||||
|
|
||||||
this.viewStyle = new ViewStyle();
|
this.viewStyle = new ViewStyle();
|
||||||
Element viewStyle = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "viewStyle");
|
Element viewStyle = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "viewStyle");
|
||||||
|
@ -137,8 +97,14 @@ public class Field implements DatabaseViewStyleDefinition,XmlSerializable<Field>
|
||||||
|
|
||||||
Element dataElement = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "data");
|
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);
|
this.data = new ModelBuilder().toFieldData(null, this.viewStyle.getRenderStyle(),dataElement);
|
||||||
if(this.data!=null)this.data.fromXml(dataElement);
|
if(this.data!=null)this.data.fromXml(dataElement);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,76 +1,126 @@
|
||||||
package eu.eudat.entities.xmlmodels.modeldefinition;
|
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import eu.eudat.models.components.commons.Multiplicity;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
import eu.eudat.models.components.commons.Multiplicity;
|
|
||||||
import eu.eudat.utilities.XmlSerializable;
|
import eu.eudat.utilities.XmlSerializable;
|
||||||
import eu.eudat.utilities.builders.XmlBuilder;
|
import eu.eudat.utilities.builders.XmlBuilder;
|
||||||
|
|
||||||
public class FieldSet implements DatabaseModelDefinition,XmlSerializable<FieldSet>{
|
public class FieldSet implements DatabaseViewStyleDefinition,XmlSerializable<FieldSet>{
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
private Multiplicity multiplicity;
|
|
||||||
|
|
||||||
private List<Field> fields;
|
private List<Field> fields;
|
||||||
|
private String title;
|
||||||
|
private String description;
|
||||||
|
private String extendedDescription;
|
||||||
|
private Multiplicity multiplicity;
|
||||||
|
public List<Field> getFields() {
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFields(List<Field> fields) {
|
||||||
|
this.fields = fields;
|
||||||
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getOrdinal() {
|
public int getOrdinal() {
|
||||||
return ordinal;
|
return ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOrdinal(int ordinal) {
|
public void setOrdinal(int ordinal) {
|
||||||
this.ordinal = ordinal;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
public List<Field> getFields() {
|
|
||||||
return fields;
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
}
|
}
|
||||||
public void setFields(List<Field> fields) {
|
|
||||||
this.fields = fields;
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExtendedDescription() {
|
||||||
|
return extendedDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtendedDescription(String extendedDescription) {
|
||||||
|
this.extendedDescription = extendedDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Multiplicity getMultiplicity() {
|
public Multiplicity getMultiplicity() {
|
||||||
return multiplicity;
|
return multiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMultiplicity(Multiplicity multiplicity) {
|
public void setMultiplicity(Multiplicity multiplicity) {
|
||||||
this.multiplicity = multiplicity;
|
this.multiplicity = multiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Element toXml(Document doc) {
|
public Element toXml(Document doc) {
|
||||||
|
Element fieldSet = doc.createElement("fieldSet");
|
||||||
|
fieldSet.setAttribute("id", this.id);
|
||||||
|
fieldSet.setAttribute("ordinal", ""+this.ordinal);
|
||||||
|
|
||||||
Element rootElement = doc.createElement("fieldset");
|
Element title = doc.createElement("title");
|
||||||
rootElement.setAttribute("id", this.id);
|
title.setTextContent(this.title);
|
||||||
rootElement.setAttribute("ordinal",""+this.ordinal);
|
|
||||||
|
Element description = doc.createElement("description");
|
||||||
|
description.setTextContent(this.description);
|
||||||
|
|
||||||
|
Element extendedDescription = doc.createElement("extendedDescription");
|
||||||
|
extendedDescription.setTextContent(this.extendedDescription);
|
||||||
|
|
||||||
Element fieldsElement = doc.createElement("fields");
|
|
||||||
for(Field field:this.fields){
|
|
||||||
fieldsElement.appendChild(field.toXml(doc));
|
|
||||||
}
|
|
||||||
rootElement.appendChild(fieldsElement);
|
|
||||||
Element multiplicity = doc.createElement("multiplicity");
|
Element multiplicity = doc.createElement("multiplicity");
|
||||||
multiplicity.setAttribute("min", ""+this.multiplicity.getMin());
|
multiplicity.setAttribute("min", ""+this.multiplicity.getMin());
|
||||||
multiplicity.setAttribute("max", ""+this.multiplicity.getMax());
|
multiplicity.setAttribute("max", ""+this.multiplicity.getMax());
|
||||||
rootElement.appendChild(multiplicity);
|
|
||||||
rootElement.appendChild(multiplicity);
|
|
||||||
return rootElement;
|
|
||||||
|
Element fieldsElement = doc.createElement("fields");
|
||||||
|
for(Field field : fields){
|
||||||
|
fieldsElement.appendChild(field.toXml(doc));
|
||||||
}
|
}
|
||||||
|
fieldSet.appendChild(fieldsElement);
|
||||||
|
fieldSet.appendChild(multiplicity);
|
||||||
|
fieldSet.appendChild(title);
|
||||||
|
fieldSet.appendChild(description);
|
||||||
|
fieldSet.appendChild(extendedDescription);
|
||||||
|
return fieldSet;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldSet fromXml(Element element) {
|
public FieldSet fromXml(Element element) {
|
||||||
this.id = element.getAttribute("id");
|
this.id = element.getAttribute("id");
|
||||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
||||||
|
|
||||||
this.fields = new LinkedList();
|
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 fields = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fields");
|
Element fields = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fields");
|
||||||
|
|
||||||
if(fields!=null){
|
if(fields!=null){
|
||||||
|
@ -82,6 +132,7 @@ public class FieldSet implements DatabaseModelDefinition,XmlSerializable<FieldSe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.multiplicity = new Multiplicity();
|
this.multiplicity = new Multiplicity();
|
||||||
Element multiplicity = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "multiplicity");
|
Element multiplicity = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "multiplicity");
|
||||||
|
|
||||||
|
@ -91,5 +142,4 @@ public class FieldSet implements DatabaseModelDefinition,XmlSerializable<FieldSe
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.entities.xmlmodels.viewstyledefinition;
|
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -20,7 +20,7 @@ public class Section implements DatabaseViewStyleDefinition,XmlSerializable<Sect
|
||||||
private String description;
|
private String description;
|
||||||
private String extendedDescription;
|
private String extendedDescription;
|
||||||
private List<Section> sections;
|
private List<Section> sections;
|
||||||
private List<FieldGroup> fieldGroups;
|
private List<FieldSet> fieldSets;
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -63,11 +63,13 @@ public class Section implements DatabaseViewStyleDefinition,XmlSerializable<Sect
|
||||||
public void setSections(List<Section> sections) {
|
public void setSections(List<Section> sections) {
|
||||||
this.sections = sections;
|
this.sections = sections;
|
||||||
}
|
}
|
||||||
public List<FieldGroup> getFieldGroups() {
|
|
||||||
return fieldGroups;
|
public List<FieldSet> getFieldSets() {
|
||||||
|
return fieldSets;
|
||||||
}
|
}
|
||||||
public void setFieldGroups(List<FieldGroup> fieldGroups) {
|
|
||||||
this.fieldGroups = fieldGroups;
|
public void setFieldSets(List<FieldSet> fieldSets) {
|
||||||
|
this.fieldSets = fieldSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExtendedDescription() {
|
public String getExtendedDescription() {
|
||||||
|
@ -102,10 +104,10 @@ public class Section implements DatabaseViewStyleDefinition,XmlSerializable<Sect
|
||||||
rootElement.appendChild(sections);
|
rootElement.appendChild(sections);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.fieldGroups!=null){
|
if(this.fieldSets!=null){
|
||||||
Element formGroups = doc.createElement("fieldGroups");
|
Element formGroups = doc.createElement("fieldSets");
|
||||||
for(FieldGroup fieldGroup : this.fieldGroups){
|
for(FieldSet fieldSet : this.fieldSets){
|
||||||
formGroups.appendChild(fieldGroup.toXml(doc));
|
formGroups.appendChild(fieldSet.toXml(doc));
|
||||||
}
|
}
|
||||||
rootElement.appendChild(formGroups);
|
rootElement.appendChild(formGroups);
|
||||||
}
|
}
|
||||||
|
@ -145,15 +147,15 @@ public class Section implements DatabaseViewStyleDefinition,XmlSerializable<Sect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fieldGroups = new LinkedList<FieldGroup>();
|
this.fieldSets = new LinkedList<FieldSet>();
|
||||||
Element fieldGroups = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fieldGroups");
|
Element fieldGroups = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fieldSets");
|
||||||
|
|
||||||
if(fieldGroups!=null){
|
if(fieldGroups!=null){
|
||||||
NodeList fieldGroupElements = fieldGroups.getChildNodes();
|
NodeList fieldGroupElements = fieldGroups.getChildNodes();
|
||||||
for (int temp = 0; temp < fieldGroupElements.getLength(); temp++) {
|
for (int temp = 0; temp < fieldGroupElements.getLength(); temp++) {
|
||||||
Node fieldGroupElement = fieldGroupElements.item(temp);
|
Node fieldGroupElement = fieldGroupElements.item(temp);
|
||||||
if (fieldGroupElement.getNodeType() == Node.ELEMENT_NODE) {
|
if (fieldGroupElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
this.fieldGroups.add(new FieldGroup().fromXml((Element)fieldGroupElement));
|
this.fieldSets.add(new FieldSet().fromXml((Element)fieldGroupElement));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.entities.xmlmodels.viewstyledefinition;
|
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -1,92 +0,0 @@
|
||||||
package eu.eudat.entities.xmlmodels.modeldefinition;
|
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
|
|
||||||
import eu.eudat.models.components.commons.DefaultValue;
|
|
||||||
import eu.eudat.models.components.commons.Multiplicity;
|
|
||||||
import eu.eudat.utilities.XmlSerializable;
|
|
||||||
import eu.eudat.utilities.builders.XmlBuilder;
|
|
||||||
|
|
||||||
public class Field implements DatabaseModelDefinition,XmlSerializable<Field>{
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
private String datatype;
|
|
||||||
private int ordinal;
|
|
||||||
private DefaultValue defaultValue;
|
|
||||||
private Multiplicity multiplicity;
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getDatatype() {
|
|
||||||
return datatype;
|
|
||||||
}
|
|
||||||
public void setDatatype(String datatype) {
|
|
||||||
this.datatype = datatype;
|
|
||||||
}
|
|
||||||
public int getOrdinal() {
|
|
||||||
return ordinal;
|
|
||||||
}
|
|
||||||
public void setOrdinal(int ordinal) {
|
|
||||||
this.ordinal = ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DefaultValue getDefaultValue() {
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
public void setDefaultValue(DefaultValue defaultValue) {
|
|
||||||
this.defaultValue = defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Multiplicity getMultiplicity() {
|
|
||||||
return multiplicity;
|
|
||||||
}
|
|
||||||
public void setMultiplicity(Multiplicity multiplicity) {
|
|
||||||
this.multiplicity = multiplicity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Element toXml(Document doc) {
|
|
||||||
Element element = doc.createElement("field");
|
|
||||||
element.setAttribute("id", this.id);
|
|
||||||
element.setAttribute("ordinal",""+this.ordinal);
|
|
||||||
element.setAttribute("datatype", this.datatype);
|
|
||||||
|
|
||||||
Element defaultValue = doc.createElement("defaultValue");
|
|
||||||
defaultValue.setAttribute("type", this.defaultValue.getType());
|
|
||||||
defaultValue.setAttribute("value",this.defaultValue.getValue());
|
|
||||||
|
|
||||||
Element multiplicity = doc.createElement("multiplicity");
|
|
||||||
multiplicity.setAttribute("min", ""+this.multiplicity.getMin());
|
|
||||||
multiplicity.setAttribute("max", ""+this.multiplicity.getMax());
|
|
||||||
|
|
||||||
element.appendChild(defaultValue);
|
|
||||||
element.appendChild(multiplicity);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public Field fromXml(Element item) {
|
|
||||||
this.id = item.getAttribute("id");
|
|
||||||
this.ordinal = Integer.parseInt(item.getAttribute("ordinal"));
|
|
||||||
this.datatype = item.getAttribute("datatype");
|
|
||||||
|
|
||||||
this.defaultValue = new DefaultValue();
|
|
||||||
Element defaultValue = (Element)XmlBuilder.getNodeFromListByTagName(item.getChildNodes(), "defaultValue");
|
|
||||||
|
|
||||||
this.defaultValue.setType(defaultValue.getAttribute("type"));
|
|
||||||
this.defaultValue.setValue(defaultValue.getAttribute("value"));
|
|
||||||
|
|
||||||
this.multiplicity = new Multiplicity();
|
|
||||||
Element multiplicity = (Element)XmlBuilder.getNodeFromListByTagName(item.getChildNodes(), "multiplicity");
|
|
||||||
|
|
||||||
this.multiplicity.setMin(Integer.parseInt(multiplicity.getAttribute("min")));
|
|
||||||
this.multiplicity.setMax(Integer.parseInt(multiplicity.getAttribute("max")));
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
package eu.eudat.entities.xmlmodels.modeldefinition;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
public class FieldGroup implements DatabaseModelDefinition,XmlSerializable<FieldGroup>{
|
|
||||||
private List<FieldSet> fieldSets;
|
|
||||||
|
|
||||||
public List<FieldSet> getFieldSets() {
|
|
||||||
return fieldSets;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFieldSets(List<FieldSet> fieldSets) {
|
|
||||||
this.fieldSets = fieldSets;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Element toXml(Document doc) {
|
|
||||||
Element rootElement = doc.createElement("root");
|
|
||||||
Element fieldSetsElement = doc.createElement("fieldSets");
|
|
||||||
for(FieldSet fieldSet : fieldSets){
|
|
||||||
fieldSetsElement.appendChild(fieldSet.toXml(doc));
|
|
||||||
}
|
|
||||||
rootElement.appendChild(fieldSetsElement);
|
|
||||||
doc.appendChild(rootElement);
|
|
||||||
return rootElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FieldGroup fromXml(Element element) {
|
|
||||||
this.fieldSets = new LinkedList();
|
|
||||||
Element fieldSets = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fieldSets");
|
|
||||||
|
|
||||||
if(fieldSets!=null){
|
|
||||||
NodeList fieldSetElements = fieldSets.getChildNodes();
|
|
||||||
for (int temp = 0; temp < fieldSetElements.getLength(); temp++) {
|
|
||||||
Node fieldSetElement = fieldSetElements.item(temp);
|
|
||||||
if (fieldSetElement.getNodeType() == Node.ELEMENT_NODE) {
|
|
||||||
this.fieldSets.add(new FieldSet().fromXml((Element)fieldSetElement));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,135 +0,0 @@
|
||||||
package eu.eudat.entities.xmlmodels.viewstyledefinition;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
public class FieldGroup implements DatabaseViewStyleDefinition,XmlSerializable<FieldGroup>{
|
|
||||||
private String id;
|
|
||||||
private int ordinal;
|
|
||||||
private boolean defaultVisibility;
|
|
||||||
private int page;
|
|
||||||
private String description;
|
|
||||||
private String title;
|
|
||||||
private String extendedDescription;
|
|
||||||
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 int getPage() {
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
public void setPage(int page) {
|
|
||||||
this.page = page;
|
|
||||||
}
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
public String getExtendedDescription() {
|
|
||||||
return extendedDescription;
|
|
||||||
}
|
|
||||||
public void setExtendedDescription(String extendedDescription) {
|
|
||||||
this.extendedDescription = extendedDescription;
|
|
||||||
}
|
|
||||||
public List<FieldSet> getFieldSets() {
|
|
||||||
return fieldSets;
|
|
||||||
}
|
|
||||||
public void setFieldSets(List<FieldSet> fieldSets) {
|
|
||||||
this.fieldSets = fieldSets;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public Element toXml(Document doc) {
|
|
||||||
Element root = doc.createElement("fieldGroup");
|
|
||||||
root.setAttribute("id", this.id);
|
|
||||||
root.setAttribute("ordinal", ""+this.ordinal);
|
|
||||||
root.setAttribute("defaultVisibility", ""+this.defaultVisibility);
|
|
||||||
root.setAttribute("page", ""+this.page);
|
|
||||||
|
|
||||||
Element title = doc.createElement("title");
|
|
||||||
title.setTextContent(this.title);
|
|
||||||
|
|
||||||
Element description = doc.createElement("description");
|
|
||||||
description.setTextContent(this.description);
|
|
||||||
|
|
||||||
Element extendedDescription = doc.createElement("extendedDescription");
|
|
||||||
extendedDescription.setTextContent(this.extendedDescription);
|
|
||||||
|
|
||||||
Element fieldSets = doc.createElement("fieldsets");
|
|
||||||
for(FieldSet fieldSet : this.fieldSets){
|
|
||||||
fieldSets.appendChild(fieldSet.toXml(doc));
|
|
||||||
}
|
|
||||||
|
|
||||||
root.appendChild(fieldSets);
|
|
||||||
root.appendChild(title);
|
|
||||||
root.appendChild(description);
|
|
||||||
root.appendChild(extendedDescription);
|
|
||||||
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FieldGroup fromXml(Element element) {
|
|
||||||
this.id = element.getAttribute("id");
|
|
||||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
|
||||||
this.defaultVisibility = Boolean.getBoolean(element.getAttribute("defaultVisibility"));
|
|
||||||
this.page = Integer.parseInt(element.getAttribute("page"));
|
|
||||||
|
|
||||||
Element title = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"title");
|
|
||||||
this.title = title.getTextContent();
|
|
||||||
|
|
||||||
Element extendedDescription = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"extendedDescription");
|
|
||||||
this.extendedDescription = extendedDescription.getTextContent();
|
|
||||||
|
|
||||||
Element description = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"description");
|
|
||||||
this.description = description .getTextContent();
|
|
||||||
|
|
||||||
this.fieldSets = new LinkedList();
|
|
||||||
Element fieldSets = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fieldsets");
|
|
||||||
|
|
||||||
if(fieldSets!=null){
|
|
||||||
NodeList fieldSetElements = fieldSets.getChildNodes();
|
|
||||||
for (int temp = 0; temp < fieldSetElements.getLength(); temp++) {
|
|
||||||
Node fieldSetElement = fieldSetElements.item(temp);
|
|
||||||
if (fieldSetElement.getNodeType() == Node.ELEMENT_NODE) {
|
|
||||||
this.fieldSets.add(new FieldSet().fromXml((Element)fieldSetElement));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,75 +0,0 @@
|
||||||
package eu.eudat.entities.xmlmodels.viewstyledefinition;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
public class FieldSet implements DatabaseViewStyleDefinition,XmlSerializable<FieldSet>{
|
|
||||||
private String id;
|
|
||||||
private int ordinal;
|
|
||||||
private List<Field> fields;
|
|
||||||
|
|
||||||
public List<Field> getFields() {
|
|
||||||
return fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFields(List<Field> fields) {
|
|
||||||
this.fields = fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Element toXml(Document doc) {
|
|
||||||
Element fieldSet = doc.createElement("fieldSet");
|
|
||||||
fieldSet.setAttribute("id", this.id);
|
|
||||||
fieldSet.setAttribute("ordinal", ""+this.ordinal);
|
|
||||||
Element fieldsElement = doc.createElement("fields");
|
|
||||||
for(Field field : fields){
|
|
||||||
fieldsElement.appendChild(field.toXml(doc));
|
|
||||||
}
|
|
||||||
fieldSet.appendChild(fieldsElement);
|
|
||||||
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 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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -34,8 +34,6 @@ public class Transformers {
|
||||||
DatasetProfile dp = new DatasetProfile();
|
DatasetProfile dp = new DatasetProfile();
|
||||||
dp.setLabel(formData.getFirst("DatasetProfileListingModel.label"));
|
dp.setLabel(formData.getFirst("DatasetProfileListingModel.label"));
|
||||||
dp.setDefinition(formData.getFirst("DatasetProfileListingModel.definition"));
|
dp.setDefinition(formData.getFirst("DatasetProfileListingModel.definition"));
|
||||||
dp.setRuleset(dpr);
|
|
||||||
dp.setViewstyle(dpv);
|
|
||||||
|
|
||||||
|
|
||||||
Project project = new Project();
|
Project project = new Project();
|
||||||
|
|
|
@ -10,9 +10,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||||
|
|
||||||
import eu.eudat.entities.DatasetProfileViewstyle;
|
import eu.eudat.entities.DatasetProfileViewstyle;
|
||||||
import eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup;
|
import eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel;
|
||||||
import eu.eudat.entities.xmlmodels.viewstyledefinition.Section;
|
|
||||||
import eu.eudat.entities.xmlmodels.viewstyledefinition.ViewStyleModel;
|
|
||||||
import eu.eudat.models.admin.components.datasetprofile.FieldSet;
|
import eu.eudat.models.admin.components.datasetprofile.FieldSet;
|
||||||
import eu.eudat.models.admin.composite.DatasetProfile;
|
import eu.eudat.models.admin.composite.DatasetProfile;
|
||||||
import eu.eudat.utilities.builders.ModelBuilder;
|
import eu.eudat.utilities.builders.ModelBuilder;
|
||||||
|
@ -20,49 +18,34 @@ import eu.eudat.utilities.builders.XmlBuilder;
|
||||||
import eu.eudat.utilities.helpers.ModelBuilderCollector;
|
import eu.eudat.utilities.helpers.ModelBuilderCollector;
|
||||||
|
|
||||||
public class AdminManager {
|
public class AdminManager {
|
||||||
public static eu.eudat.entities.DatasetProfile generateModelDefinition(DatasetProfile profile){
|
|
||||||
ObjectMapper xmlMapper = new XmlMapper();
|
|
||||||
List<FieldSet> fieldSets = ModelBuilderCollector.collectCompositeFields(profile.getSections());
|
|
||||||
FieldGroup fieldGroup = new FieldGroup();
|
|
||||||
List<eu.eudat.entities.xmlmodels.modeldefinition.FieldSet> fieldset = new ModelBuilder().toModelDefinition(fieldSets, eu.eudat.entities.xmlmodels.modeldefinition.FieldSet.class);
|
|
||||||
fieldGroup.setFieldSets(fieldset);
|
|
||||||
Document modelDoc = XmlBuilder.getDocument();
|
|
||||||
fieldGroup.toXml(modelDoc);
|
|
||||||
String xml = XmlBuilder.generateXml(modelDoc);
|
|
||||||
|
|
||||||
eu.eudat.entities.DatasetProfile datasetProfile = new eu.eudat.entities.DatasetProfile();
|
|
||||||
datasetProfile.setDefinition(xml);
|
|
||||||
datasetProfile.setStatus((short)1);
|
|
||||||
datasetProfile.setLabel(profile.getLabel());
|
|
||||||
datasetProfile.setCreated(new Date());
|
|
||||||
return datasetProfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DatasetProfileViewstyle generateViewStyleDefinition(DatasetProfile profile){
|
public static eu.eudat.entities.DatasetProfile generateViewStyleDefinition(DatasetProfile profile){
|
||||||
ViewStyleModel viewStyleModel = new ViewStyleModel();
|
ViewStyleModel viewStyleModel = new ViewStyleModel();
|
||||||
viewStyleModel.setSections(new ModelBuilder().toViewStyleDefinition(profile.getSections(), eu.eudat.entities.xmlmodels.viewstyledefinition.Section.class));
|
viewStyleModel.setSections(new ModelBuilder().toViewStyleDefinition(profile.getSections(), eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section.class));
|
||||||
Document viewStyleDoc = XmlBuilder.getDocument();
|
Document viewStyleDoc = XmlBuilder.getDocument();
|
||||||
Element elementViewStyle = viewStyleModel.toXml(viewStyleDoc);
|
Element elementViewStyle = viewStyleModel.toXml(viewStyleDoc);
|
||||||
viewStyleDoc.appendChild(elementViewStyle);
|
viewStyleDoc.appendChild(elementViewStyle);
|
||||||
String xml = XmlBuilder.generateXml(viewStyleDoc);
|
String xml = XmlBuilder.generateXml(viewStyleDoc);
|
||||||
|
|
||||||
DatasetProfileViewstyle datasetProfileViewstyle = new DatasetProfileViewstyle();
|
eu.eudat.entities.DatasetProfile datasetProfile = new eu.eudat.entities.DatasetProfile();
|
||||||
datasetProfileViewstyle.setDefinition(xml);
|
datasetProfile.setDefinition(xml);
|
||||||
datasetProfileViewstyle.setLabel(profile.getLabel());
|
datasetProfile.setLabel(profile.getLabel());
|
||||||
return datasetProfileViewstyle;
|
datasetProfile.setStatus((short)1);
|
||||||
|
datasetProfile.setCreated(new Date());
|
||||||
|
return datasetProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static eu.eudat.models.admin.composite.DatasetProfile generateDatasetProfileModel(eu.eudat.entities.DatasetProfile profile){
|
public static eu.eudat.models.admin.composite.DatasetProfile generateDatasetProfileModel(eu.eudat.entities.DatasetProfile profile){
|
||||||
Document viewStyleDoc = XmlBuilder.fromXml(profile.getViewstyle().getDefinition());
|
Document viewStyleDoc = XmlBuilder.fromXml(profile.getDefinition());
|
||||||
Element root = (Element)viewStyleDoc.getDocumentElement();
|
Element root = (Element)viewStyleDoc.getDocumentElement();
|
||||||
eu.eudat.entities.xmlmodels.viewstyledefinition.ViewStyleModel viewstyle= new eu.eudat.entities.xmlmodels.viewstyledefinition.ViewStyleModel().fromXml(root);
|
eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewstyle= new eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel().fromXml(root);
|
||||||
|
|
||||||
Document profileDoc = XmlBuilder.fromXml(profile.getDefinition());
|
Document profileDoc = XmlBuilder.fromXml(profile.getDefinition());
|
||||||
root = (Element)profileDoc.getDocumentElement();
|
root = (Element)profileDoc.getDocumentElement();
|
||||||
eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup fieldGroup = new eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup().fromXml(root);
|
|
||||||
|
|
||||||
eu.eudat.models.admin.composite.DatasetProfile datasetprofile = new eu.eudat.models.admin.composite.DatasetProfile();
|
eu.eudat.models.admin.composite.DatasetProfile datasetprofile = new eu.eudat.models.admin.composite.DatasetProfile();
|
||||||
datasetprofile.buildProfile(fieldGroup, viewstyle);
|
datasetprofile.buildProfile(viewstyle);
|
||||||
|
|
||||||
return datasetprofile;
|
return datasetprofile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,12 @@ import eu.eudat.entities.DMP;
|
||||||
import eu.eudat.entities.DatasetProfile;
|
import eu.eudat.entities.DatasetProfile;
|
||||||
import eu.eudat.models.datasetprofile.DatasetProfileAutocompleteItem;
|
import eu.eudat.models.datasetprofile.DatasetProfileAutocompleteItem;
|
||||||
import eu.eudat.models.datasetprofile.DatasetProfileAutocompleteRequest;
|
import eu.eudat.models.datasetprofile.DatasetProfileAutocompleteRequest;
|
||||||
|
import eu.eudat.models.datasetprofile.DatasetProfileListingModel;
|
||||||
|
import eu.eudat.models.datasetprofile.DatasetProfileTableRequestItem;
|
||||||
import eu.eudat.models.dmp.DataManagementPlan;
|
import eu.eudat.models.dmp.DataManagementPlan;
|
||||||
import eu.eudat.models.dmp.DataManagementPlanCriteriaRequest;
|
import eu.eudat.models.dmp.DataManagementPlanCriteriaRequest;
|
||||||
|
import eu.eudat.models.helpers.DataTableData;
|
||||||
|
import eu.eudat.models.listingmodels.DatasetListingModel;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
import eu.eudat.utilities.builders.DomainModelConverter;
|
import eu.eudat.utilities.builders.DomainModelConverter;
|
||||||
|
|
||||||
|
@ -24,4 +28,20 @@ public class DatasetProfileManager {
|
||||||
List<DatasetProfileAutocompleteItem> datasetProfiles = new DomainModelConverter<DatasetProfile, DatasetProfileAutocompleteItem>().fromDataModel( items.toList(), DatasetProfileAutocompleteItem.class);
|
List<DatasetProfileAutocompleteItem> datasetProfiles = new DomainModelConverter<DatasetProfile, DatasetProfileAutocompleteItem>().fromDataModel( items.toList(), DatasetProfileAutocompleteItem.class);
|
||||||
return datasetProfiles;
|
return datasetProfiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DataTableData<DatasetProfileListingModel> getPaged(DatasetProfileDao datasetProfileRepository, DatasetProfileTableRequestItem datasetProfileTableRequestItem) throws IllegalAccessException, InstantiationException{
|
||||||
|
QueryableList<DatasetProfile> items = datasetProfileRepository.getWithCriteria(datasetProfileTableRequestItem.getCriteria());
|
||||||
|
QueryableList<DatasetProfile> pagedItems = PaginationManager.applyPaging(items,datasetProfileTableRequestItem);
|
||||||
|
List<DatasetProfileListingModel> datasetProfiles = new DomainModelConverter<DatasetProfile, DatasetProfileListingModel>().fromDataModel( pagedItems.toList(), DatasetProfileListingModel.class);
|
||||||
|
DataTableData<DatasetProfileListingModel> dataTable = new DataTableData<>();
|
||||||
|
dataTable.setData(datasetProfiles);
|
||||||
|
dataTable.setTotalCount(items.count());
|
||||||
|
return dataTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<DatasetProfileListingModel> getAll(DatasetProfileDao datasetProfileRepository) throws IllegalAccessException, InstantiationException{
|
||||||
|
QueryableList<DatasetProfile> items = datasetProfileRepository.getAll();
|
||||||
|
List<DatasetProfileListingModel> datasetProfiles = new DomainModelConverter<DatasetProfile, DatasetProfileListingModel>().fromDataModel( items.toList(), DatasetProfileListingModel.class);
|
||||||
|
return datasetProfiles;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,16 +7,12 @@ import eu.eudat.utilities.builders.XmlBuilder;
|
||||||
|
|
||||||
public class UserManager {
|
public class UserManager {
|
||||||
public static eu.eudat.models.user.composite.DatasetProfile generateDatasetProfileModel(eu.eudat.entities.DatasetProfile profile){
|
public static eu.eudat.models.user.composite.DatasetProfile generateDatasetProfileModel(eu.eudat.entities.DatasetProfile profile){
|
||||||
Document viewStyleDoc = XmlBuilder.fromXml(profile.getViewstyle().getDefinition());
|
Document viewStyleDoc = XmlBuilder.fromXml(profile.getDefinition());
|
||||||
Element root = (Element)viewStyleDoc.getDocumentElement();
|
Element root = (Element)viewStyleDoc.getDocumentElement();
|
||||||
eu.eudat.entities.xmlmodels.viewstyledefinition.ViewStyleModel viewstyle= new eu.eudat.entities.xmlmodels.viewstyledefinition.ViewStyleModel().fromXml(root);
|
eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewstyle= new eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel().fromXml(root);
|
||||||
|
|
||||||
Document profileDoc = XmlBuilder.fromXml(profile.getDefinition());
|
|
||||||
root = (Element)profileDoc.getDocumentElement();
|
|
||||||
eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup fieldGroup = new eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup().fromXml(root);
|
|
||||||
|
|
||||||
eu.eudat.models.user.composite.DatasetProfile datasetprofile = new eu.eudat.models.user.composite.DatasetProfile();
|
eu.eudat.models.user.composite.DatasetProfile datasetprofile = new eu.eudat.models.user.composite.DatasetProfile();
|
||||||
datasetprofile.buildProfile(fieldGroup, viewstyle);
|
datasetprofile.buildProfile(viewstyle);
|
||||||
|
|
||||||
return datasetprofile;
|
return datasetprofile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,19 +11,14 @@ import eu.eudat.models.components.commons.Visibility;
|
||||||
import eu.eudat.utilities.ViewStyleDefinition;
|
import eu.eudat.utilities.ViewStyleDefinition;
|
||||||
import eu.eudat.utilities.builders.ModelBuilder;
|
import eu.eudat.utilities.builders.ModelBuilder;
|
||||||
|
|
||||||
public class Field implements ViewStyleDefinition<eu.eudat.entities.xmlmodels.viewstyledefinition.Field>,ModelDefinition<eu.eudat.entities.xmlmodels.modeldefinition.Field>,Comparable{
|
public class Field implements ViewStyleDefinition<eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field>,Comparable{
|
||||||
private String id;
|
private String id;
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
private String title;
|
|
||||||
private String value;
|
private String value;
|
||||||
private String description;
|
|
||||||
private String extendedDescription;
|
|
||||||
private ViewStyle viewStyle;
|
private ViewStyle viewStyle;
|
||||||
private String datatype;
|
private String datatype;
|
||||||
private boolean defaultVisibility;
|
|
||||||
private int page;
|
private int page;
|
||||||
private DefaultValue defaultValue;
|
private DefaultValue defaultValue;
|
||||||
private Multiplicity multiplicity;
|
|
||||||
private Object data;
|
private Object data;
|
||||||
private Visibility visible;
|
private Visibility visible;
|
||||||
|
|
||||||
|
@ -41,42 +36,18 @@ public class Field implements ViewStyleDefinition<eu.eudat.entities.xmlmodels.vi
|
||||||
public void setOrdinal(int ordinal){
|
public void setOrdinal(int ordinal){
|
||||||
this.ordinal = ordinal;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
public void setValue(String value) {
|
public void setValue(String value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
public String getExtendedDescription() {
|
|
||||||
return extendedDescription;
|
|
||||||
}
|
|
||||||
public void setExtendedDescription(String extendedDescription) {
|
|
||||||
this.extendedDescription = extendedDescription;
|
|
||||||
}
|
|
||||||
public ViewStyle getViewStyle() {
|
public ViewStyle getViewStyle() {
|
||||||
return viewStyle;
|
return viewStyle;
|
||||||
}
|
}
|
||||||
public void setViewStyle(ViewStyle viewStyle) {
|
public void setViewStyle(ViewStyle viewStyle) {
|
||||||
this.viewStyle = viewStyle;
|
this.viewStyle = viewStyle;
|
||||||
}
|
}
|
||||||
public boolean getDefaultVisibility() {
|
|
||||||
return defaultVisibility;
|
|
||||||
}
|
|
||||||
public void setDefaultVisibility(boolean defaultVisibility) {
|
|
||||||
this.defaultVisibility = defaultVisibility;
|
|
||||||
}
|
|
||||||
public int getPage() {
|
public int getPage() {
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
@ -97,12 +68,6 @@ public class Field implements ViewStyleDefinition<eu.eudat.entities.xmlmodels.vi
|
||||||
this.datatype = datatype;
|
this.datatype = datatype;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Multiplicity getMultiplicity() {
|
|
||||||
return multiplicity;
|
|
||||||
}
|
|
||||||
public void setMultiplicity(Multiplicity multiplicity) {
|
|
||||||
this.multiplicity = multiplicity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getData() {
|
public Object getData() {
|
||||||
return data;
|
return data;
|
||||||
|
@ -118,49 +83,27 @@ public class Field implements ViewStyleDefinition<eu.eudat.entities.xmlmodels.vi
|
||||||
public void setVisible(Visibility visible) {
|
public void setVisible(Visibility visible) {
|
||||||
this.visible = visible;
|
this.visible = visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public eu.eudat.entities.xmlmodels.modeldefinition.Field toDatabaseDefinition(eu.eudat.entities.xmlmodels.modeldefinition.Field field) {
|
public eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field toDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field field) {
|
||||||
if(this.id == null||this.id.isEmpty())this.id = "field_"+RandomStringUtils.random(5, true, true);
|
if(this.id == null||this.id.isEmpty())this.id = "field_"+RandomStringUtils.random(5, true, true);
|
||||||
|
|
||||||
field.setDatatype(this.datatype);
|
|
||||||
field.setDefaultValue(this.defaultValue);
|
|
||||||
field.setId(this.id);
|
|
||||||
field.setMultiplicity(this.multiplicity);
|
|
||||||
field.setOrdinal(this.ordinal);
|
|
||||||
return field;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.modeldefinition.Field item) {
|
|
||||||
this.datatype = item.getDatatype();
|
|
||||||
this.defaultValue = item.getDefaultValue();
|
|
||||||
this.multiplicity = item.getMultiplicity();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public eu.eudat.entities.xmlmodels.viewstyledefinition.Field toDatabaseDefinition(eu.eudat.entities.xmlmodels.viewstyledefinition.Field field) {
|
|
||||||
if(this.id == null||this.id.isEmpty())this.id = "field_"+RandomStringUtils.random(5, true, true);
|
|
||||||
|
|
||||||
field.setDefaultVisibility(this.defaultVisibility);
|
|
||||||
field.setDescription(this.description);
|
|
||||||
field.setExtendedDescription(this.extendedDescription);
|
|
||||||
field.setId(this.id);
|
field.setId(this.id);
|
||||||
field.setOrdinal(this.ordinal);
|
field.setOrdinal(this.ordinal);
|
||||||
field.setTitle(this.title);
|
|
||||||
field.setViewStyle(this.viewStyle);
|
field.setViewStyle(this.viewStyle);
|
||||||
field.setData(new ModelBuilder().toFieldData(data, this.viewStyle.getRenderStyle()));
|
field.setData(new ModelBuilder().toFieldData(data, this.viewStyle.getRenderStyle()));
|
||||||
field.setVisible(this.visible);
|
field.setVisible(this.visible);
|
||||||
|
field.setDefaultValue(this.defaultValue);
|
||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.viewstyledefinition.Field item) {
|
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field item) {
|
||||||
this.defaultVisibility = item.getDefaultVisibility();
|
|
||||||
this.description = item.getDescription();
|
|
||||||
this.extendedDescription = item.getExtendedDescription();
|
|
||||||
this.id = item.getId();
|
this.id = item.getId();
|
||||||
this.ordinal = item.getOrdinal();
|
this.ordinal = item.getOrdinal();
|
||||||
this.title = item.getTitle();
|
|
||||||
this.viewStyle = item.getViewStyle();
|
this.viewStyle = item.getViewStyle();
|
||||||
this.data = item.getData();
|
this.data = item.getData();
|
||||||
this.visible = item.getVisible();
|
this.visible = item.getVisible();
|
||||||
|
this.defaultValue = item.getDefaultValue();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Object o) {
|
public int compareTo(Object o) {
|
||||||
|
|
|
@ -9,10 +9,14 @@ import eu.eudat.models.components.commons.Multiplicity;
|
||||||
import eu.eudat.utilities.ViewStyleDefinition;
|
import eu.eudat.utilities.ViewStyleDefinition;
|
||||||
import eu.eudat.utilities.builders.ModelBuilder;
|
import eu.eudat.utilities.builders.ModelBuilder;
|
||||||
|
|
||||||
public class FieldSet implements Comparable,ModelDefinition<eu.eudat.entities.xmlmodels.modeldefinition.FieldSet>, ViewStyleDefinition<eu.eudat.entities.xmlmodels.viewstyledefinition.FieldSet>{
|
public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet>{
|
||||||
private String id;
|
private String id;
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
private Multiplicity multiplicity;
|
private Multiplicity multiplicity;
|
||||||
|
private String title;
|
||||||
|
private String description;
|
||||||
|
private String extendedDescription;
|
||||||
|
|
||||||
private List<Field> fields;
|
private List<Field> fields;
|
||||||
|
|
||||||
public List<Field> getFields() {
|
public List<Field> getFields() {
|
||||||
|
@ -47,41 +51,58 @@ public class FieldSet implements Comparable,ModelDefinition<eu.eudat.entities.xm
|
||||||
this.multiplicity = multiplicity;
|
this.multiplicity = multiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void setOrdinal(Integer ordinal) {
|
||||||
public eu.eudat.entities.xmlmodels.modeldefinition.FieldSet toDatabaseDefinition(eu.eudat.entities.xmlmodels.modeldefinition.FieldSet fieldSet) {
|
this.ordinal = ordinal;
|
||||||
if(this.id == null||this.id.isEmpty())this.id = "fieldSet_"+RandomStringUtils.random(5, true, true);
|
}
|
||||||
|
|
||||||
fieldSet.setId(this.id);
|
public String getTitle() {
|
||||||
fieldSet.setOrdinal(this.ordinal);
|
return title;
|
||||||
List<eu.eudat.entities.xmlmodels.modeldefinition.Field> modelfields = new ModelBuilder().toModelDefinition(this.fields, eu.eudat.entities.xmlmodels.modeldefinition.Field.class);
|
}
|
||||||
fieldSet.setFields(modelfields);
|
|
||||||
fieldSet.setMultiplicity(this.multiplicity);
|
public void setTitle(String title) {
|
||||||
return fieldSet;
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExtendedDescription() {
|
||||||
|
return extendedDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtendedDescription(String extendedDescription) {
|
||||||
|
this.extendedDescription = extendedDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.modeldefinition.FieldSet item) {
|
public eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet toDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet item) {
|
||||||
this.id = item.getId();
|
|
||||||
this.ordinal = item.getOrdinal();
|
|
||||||
this.multiplicity = item.getMultiplicity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public eu.eudat.entities.xmlmodels.viewstyledefinition.FieldSet toDatabaseDefinition(eu.eudat.entities.xmlmodels.viewstyledefinition.FieldSet item) {
|
|
||||||
if(this.id == null||this.id.isEmpty())this.id = "fieldSet_"+RandomStringUtils.random(5, true, true);
|
if(this.id == null||this.id.isEmpty())this.id = "fieldSet_"+RandomStringUtils.random(5, true, true);
|
||||||
|
|
||||||
List<eu.eudat.entities.xmlmodels.viewstyledefinition.Field> viewStylefields = new ModelBuilder().toViewStyleDefinition(this.fields, eu.eudat.entities.xmlmodels.viewstyledefinition.Field.class);
|
List<eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field> viewStylefields = new ModelBuilder().toViewStyleDefinition(this.fields, eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field.class);
|
||||||
item.setFields(viewStylefields);
|
item.setFields(viewStylefields);
|
||||||
item.setId(this.id);
|
item.setId(this.id);
|
||||||
|
item.setDescription(this.description);
|
||||||
|
item.setTitle(this.title);
|
||||||
|
item.setExtendedDescription(this.extendedDescription);
|
||||||
item.setOrdinal(this.ordinal);
|
item.setOrdinal(this.ordinal);
|
||||||
|
item.setMultiplicity(this.multiplicity);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.viewstyledefinition.FieldSet item) {
|
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet item) {
|
||||||
this.fields = new ModelBuilder().fromViewStyleDefinition(item.getFields(), Field.class);
|
this.fields = new ModelBuilder().fromViewStyleDefinition(item.getFields(), Field.class);
|
||||||
this.id = item.getId();
|
this.id = item.getId();
|
||||||
this.ordinal = item.getOrdinal();
|
this.ordinal = item.getOrdinal();
|
||||||
|
this.description = item.getDescription();
|
||||||
|
this.extendedDescription = item.getExtendedDescription();
|
||||||
|
this.title = item.getTitle();
|
||||||
|
this.multiplicity = item.getMultiplicity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,121 +0,0 @@
|
||||||
package eu.eudat.models.admin.components.datasetprofile;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import eu.eudat.utilities.ModelDefinition;
|
|
||||||
import org.apache.commons.lang3.RandomStringUtils;
|
|
||||||
|
|
||||||
import eu.eudat.entities.xmlmodels.viewstyledefinition.FieldGroup;
|
|
||||||
import eu.eudat.utilities.ViewStyleDefinition;
|
|
||||||
import eu.eudat.utilities.builders.ModelBuilder;
|
|
||||||
|
|
||||||
public class Group implements ModelDefinition<eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup>,ViewStyleDefinition<eu.eudat.entities.xmlmodels.viewstyledefinition.FieldGroup>{
|
|
||||||
private String id;
|
|
||||||
private String title;
|
|
||||||
private String section;
|
|
||||||
private String value;
|
|
||||||
private int ordinal;
|
|
||||||
private String description;
|
|
||||||
private String extendedDescription;
|
|
||||||
private boolean defaultVisibility;
|
|
||||||
private int page;
|
|
||||||
private List<FieldSet> compositeFields;
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
public String getSection() {
|
|
||||||
return section;
|
|
||||||
}
|
|
||||||
public void setSection(String section) {
|
|
||||||
this.section = section;
|
|
||||||
}
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
public String getExtendedDescription() {
|
|
||||||
return extendedDescription;
|
|
||||||
}
|
|
||||||
public void setExtendedDescription(String extendedDescription) {
|
|
||||||
this.extendedDescription = extendedDescription;
|
|
||||||
}
|
|
||||||
public boolean isDefaultVisibility() {
|
|
||||||
return defaultVisibility;
|
|
||||||
}
|
|
||||||
public void setDefaultVisibility(boolean defaultVisibility) {
|
|
||||||
this.defaultVisibility = defaultVisibility;
|
|
||||||
}
|
|
||||||
public int getPage() {
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
public void setPage(int page) {
|
|
||||||
this.page = page;
|
|
||||||
}
|
|
||||||
public List<FieldSet> getCompositeFields() {
|
|
||||||
return compositeFields;
|
|
||||||
}
|
|
||||||
public void setCompositeFields(List<FieldSet> compositeFields) {
|
|
||||||
this.compositeFields = compositeFields;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOrdinal() {
|
|
||||||
return ordinal;
|
|
||||||
}
|
|
||||||
public void setOrdinal(int ordinal) {
|
|
||||||
this.ordinal = ordinal;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public eu.eudat.entities.xmlmodels.viewstyledefinition.FieldGroup toDatabaseDefinition(FieldGroup item) {
|
|
||||||
if(this.id == null||this.id.isEmpty())this.id = "group_"+RandomStringUtils.random(5, true, true);
|
|
||||||
|
|
||||||
item.setDefaultVisibility(this.defaultVisibility);
|
|
||||||
item.setDescription(this.description);
|
|
||||||
item.setExtendedDescription(this.extendedDescription);
|
|
||||||
item.setFieldSets(new ModelBuilder().toViewStyleDefinition(this.compositeFields, eu.eudat.entities.xmlmodels.viewstyledefinition.FieldSet.class));
|
|
||||||
item.setId(this.id);
|
|
||||||
item.setOrdinal(this.ordinal);
|
|
||||||
item.setPage(this.page);
|
|
||||||
item.setTitle(this.title);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void fromDatabaseDefinition(FieldGroup item) {
|
|
||||||
|
|
||||||
this.defaultVisibility = item.isDefaultVisibility();
|
|
||||||
this.description = item.getDescription();
|
|
||||||
this.extendedDescription = item.getExtendedDescription();
|
|
||||||
this.compositeFields = new ModelBuilder().fromViewStyleDefinition(item.getFieldSets(), FieldSet.class);
|
|
||||||
this.id = item.getId();
|
|
||||||
this.ordinal = item.getOrdinal();
|
|
||||||
this.page = item.getPage();
|
|
||||||
this.title = item.getTitle();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup toDatabaseDefinition(eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup item) {
|
|
||||||
item.setFieldSets(new ModelBuilder().toModelDefinition(this.compositeFields, eu.eudat.entities.xmlmodels.modeldefinition.FieldSet.class));
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup item) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,9 +7,9 @@ import org.apache.commons.lang3.RandomStringUtils;
|
||||||
import eu.eudat.utilities.ViewStyleDefinition;
|
import eu.eudat.utilities.ViewStyleDefinition;
|
||||||
import eu.eudat.utilities.builders.ModelBuilder;
|
import eu.eudat.utilities.builders.ModelBuilder;
|
||||||
|
|
||||||
public class Section implements Comparable,ViewStyleDefinition<eu.eudat.entities.xmlmodels.viewstyledefinition.Section>{
|
public class Section implements Comparable,ViewStyleDefinition<eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section>{
|
||||||
private List<Section> sections;
|
private List<Section> sections;
|
||||||
private List<Group> fieldGroups;
|
private List<FieldSet> fieldSets;
|
||||||
private Boolean defaultVisibility;
|
private Boolean defaultVisibility;
|
||||||
private int page;
|
private int page;
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
|
@ -22,12 +22,15 @@ public class Section implements Comparable,ViewStyleDefinition<eu.eudat.entities
|
||||||
public void setSections(List<Section> sections) {
|
public void setSections(List<Section> sections) {
|
||||||
this.sections = sections;
|
this.sections = sections;
|
||||||
}
|
}
|
||||||
public List<Group> getFieldGroups() {
|
|
||||||
return fieldGroups;
|
public List<FieldSet> getFieldSets() {
|
||||||
|
return fieldSets;
|
||||||
}
|
}
|
||||||
public void setFieldGroups(List<Group> fieldGroups) {
|
|
||||||
this.fieldGroups = fieldGroups;
|
public void setFieldSets(List<FieldSet> fieldSets) {
|
||||||
|
this.fieldSets = fieldSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getDefaultVisibility() {
|
public Boolean getDefaultVisibility() {
|
||||||
return defaultVisibility;
|
return defaultVisibility;
|
||||||
}
|
}
|
||||||
|
@ -66,24 +69,24 @@ public class Section implements Comparable,ViewStyleDefinition<eu.eudat.entities
|
||||||
this.ordinal = ordinal;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public eu.eudat.entities.xmlmodels.viewstyledefinition.Section toDatabaseDefinition(eu.eudat.entities.xmlmodels.viewstyledefinition.Section item) {
|
public eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section toDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section item) {
|
||||||
if(this.id == null||this.id.isEmpty())this.id = "section_"+RandomStringUtils.random(5, true, true);
|
if(this.id == null||this.id.isEmpty())this.id = "section_"+RandomStringUtils.random(5, true, true);
|
||||||
item.setDefaultVisibility(this.defaultVisibility);
|
item.setDefaultVisibility(this.defaultVisibility);
|
||||||
item.setDescription(this.description);
|
item.setDescription(this.description);
|
||||||
if(this.fieldGroups!=null)item.setFieldGroups(new ModelBuilder().toViewStyleDefinition(this.fieldGroups, eu.eudat.entities.xmlmodels.viewstyledefinition.FieldGroup.class));
|
if(this.fieldSets!=null)item.setFieldSets(new ModelBuilder().toViewStyleDefinition(this.fieldSets, eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet.class));
|
||||||
item.setId(this.id);
|
item.setId(this.id);
|
||||||
item.setOrdinal(this.ordinal);
|
item.setOrdinal(this.ordinal);
|
||||||
item.setPage(this.page);
|
item.setPage(this.page);
|
||||||
if(this.sections!=null)item.setSections(new ModelBuilder().toViewStyleDefinition(this.sections, eu.eudat.entities.xmlmodels.viewstyledefinition.Section.class));
|
if(this.sections!=null)item.setSections(new ModelBuilder().toViewStyleDefinition(this.sections, eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section.class));
|
||||||
item.setTitle(this.title);
|
item.setTitle(this.title);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.viewstyledefinition.Section item) {
|
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section item) {
|
||||||
|
|
||||||
this.defaultVisibility = item.isDefaultVisibility();
|
this.defaultVisibility = item.isDefaultVisibility();
|
||||||
this.description = item.getDescription();
|
this.description = item.getDescription();
|
||||||
this.fieldGroups = new ModelBuilder().fromViewStyleDefinition(item.getFieldGroups(),Group.class);
|
this.fieldSets = new ModelBuilder().fromViewStyleDefinition(item.getFieldSets(),FieldSet.class);
|
||||||
this.id = item.getId();
|
this.id = item.getId();
|
||||||
this.ordinal = item.getOrdinal();
|
this.ordinal = item.getOrdinal();
|
||||||
this.page = item.getPage();
|
this.page = item.getPage();
|
||||||
|
|
|
@ -27,13 +27,9 @@ public class DatasetProfile {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildProfile(eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup fieldGroup, eu.eudat.entities.xmlmodels.viewstyledefinition.ViewStyleModel viewStyle){
|
public void buildProfile(eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewStyle){
|
||||||
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
|
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
|
||||||
updateProfile(fieldGroup,viewStyle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateProfile(eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup fieldGroup, eu.eudat.entities.xmlmodels.viewstyledefinition.ViewStyleModel viewStyle){
|
|
||||||
ModelBuilderCollector.mapSections(sections, fieldGroup.getFieldSets());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package eu.eudat.models.components.commons;
|
package eu.eudat.models.components.commons;
|
||||||
|
|
||||||
|
import eu.eudat.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import eu.eudat.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
|
||||||
import eu.eudat.utilities.XmlSerializable;
|
import eu.eudat.utilities.XmlSerializable;
|
||||||
|
|
||||||
public class Rule implements XmlSerializable<Rule>,DatabaseModelDefinition{
|
public class Rule implements XmlSerializable<Rule>,DatabaseModelDefinition {
|
||||||
private String ruleType;
|
private String ruleType;
|
||||||
private String target;
|
private String target;
|
||||||
private String ruleStyle;
|
private String ruleStyle;
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package eu.eudat.models.datasetprofile;
|
||||||
|
|
||||||
|
import eu.eudat.models.criteria.DatasetProfileCriteria;
|
||||||
|
import eu.eudat.models.helpers.requests.TableRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by ikalyvas on 1/2/2018.
|
||||||
|
*/
|
||||||
|
public class DatasetProfileTableRequestItem extends TableRequest<DatasetProfileCriteria> {
|
||||||
|
}
|
|
@ -1,31 +0,0 @@
|
||||||
package eu.eudat.models.errormodels;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by ikalyvas on 12/22/2017.
|
|
||||||
*/
|
|
||||||
public class FieldError {
|
|
||||||
private String field;
|
|
||||||
|
|
||||||
private String message;
|
|
||||||
|
|
||||||
public String getField() {
|
|
||||||
return field;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setField(String field) {
|
|
||||||
this.field = field;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FieldError(String field, String message) {
|
|
||||||
this.field = field;
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +1,22 @@
|
||||||
package eu.eudat.models.errormodels;
|
package eu.eudat.models.errormodels;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by ikalyvas on 12/22/2017.
|
* Created by ikalyvas on 12/22/2017.
|
||||||
*/
|
*/
|
||||||
public class ValidationErrorContext {
|
public class ValidationErrorContext {
|
||||||
private List<FieldError> fieldErrors = new ArrayList<>();
|
private Map<String,String> error = new HashMap<>();
|
||||||
|
|
||||||
public List<FieldError> getFieldErrors() {
|
public Map<String, String> getError() {
|
||||||
return fieldErrors;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFieldErrors(List<FieldError> fieldErrors) {
|
public void setError(Map<String, String> error) {
|
||||||
this.fieldErrors = fieldErrors;
|
this.error = error;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValidationErrorContext() {
|
public ValidationErrorContext() {
|
||||||
|
@ -22,7 +24,6 @@ public class ValidationErrorContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFieldError(String path, String message) {
|
public void addFieldError(String path, String message) {
|
||||||
FieldError error = new FieldError(path, message);
|
error.put(path,message);
|
||||||
fieldErrors.add(error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,27 +9,24 @@ import eu.eudat.entities.xmlmodels.modeldefinition.*;
|
||||||
import eu.eudat.models.components.commons.DefaultValue;
|
import eu.eudat.models.components.commons.DefaultValue;
|
||||||
import eu.eudat.models.components.commons.Multiplicity;
|
import eu.eudat.models.components.commons.Multiplicity;
|
||||||
import eu.eudat.models.components.commons.ViewStyle;
|
import eu.eudat.models.components.commons.ViewStyle;
|
||||||
|
import eu.eudat.models.components.commons.Visibility;
|
||||||
import eu.eudat.models.user.composite.PropertiesModelBuilder;
|
import eu.eudat.models.user.composite.PropertiesModelBuilder;
|
||||||
import eu.eudat.utilities.ModelDefinition;
|
import eu.eudat.utilities.ModelDefinition;
|
||||||
import eu.eudat.utilities.ViewStyleDefinition;
|
import eu.eudat.utilities.ViewStyleDefinition;
|
||||||
import eu.eudat.utilities.builders.ModelBuilder;
|
import eu.eudat.utilities.builders.ModelBuilder;
|
||||||
|
|
||||||
public class Field implements Comparable,PropertiesModelBuilder,ModelDefinition<eu.eudat.entities.xmlmodels.modeldefinition.Field>, ViewStyleDefinition<eu.eudat.entities.xmlmodels.viewstyledefinition.Field>{
|
public class Field implements Comparable,PropertiesModelBuilder,ViewStyleDefinition<eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field>{
|
||||||
private String id;
|
private String id;
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
private String title;
|
|
||||||
private String value;
|
private String value;
|
||||||
private String description;
|
|
||||||
private String extendedDescription;
|
|
||||||
private ViewStyle viewStyle;
|
private ViewStyle viewStyle;
|
||||||
private String datatype;
|
private String datatype;
|
||||||
private boolean defaultVisibility;
|
|
||||||
private int page;
|
private int page;
|
||||||
private DefaultValue defaultValue;
|
private DefaultValue defaultValue;
|
||||||
private Multiplicity multiplicity;
|
private Multiplicity multiplicity;
|
||||||
private Object data;
|
private Object data;
|
||||||
private List<Field> multiplicityItems;
|
private List<Field> multiplicityItems;
|
||||||
|
private Visibility visible;
|
||||||
public List<Field> getMultiplicityItems() {
|
public List<Field> getMultiplicityItems() {
|
||||||
return multiplicityItems;
|
return multiplicityItems;
|
||||||
}
|
}
|
||||||
|
@ -53,42 +50,18 @@ public class Field implements Comparable,PropertiesModelBuilder,ModelDefinition<
|
||||||
public void setOrdinal(int ordinal){
|
public void setOrdinal(int ordinal){
|
||||||
this.ordinal = ordinal;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
public void setValue(String value) {
|
public void setValue(String value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
public String getExtendedDescription() {
|
|
||||||
return extendedDescription;
|
|
||||||
}
|
|
||||||
public void setExtendedDescription(String extendedDescription) {
|
|
||||||
this.extendedDescription = extendedDescription;
|
|
||||||
}
|
|
||||||
public ViewStyle getViewStyle() {
|
public ViewStyle getViewStyle() {
|
||||||
return viewStyle;
|
return viewStyle;
|
||||||
}
|
}
|
||||||
public void setViewStyle(ViewStyle viewStyle) {
|
public void setViewStyle(ViewStyle viewStyle) {
|
||||||
this.viewStyle = viewStyle;
|
this.viewStyle = viewStyle;
|
||||||
}
|
}
|
||||||
public boolean getDefaultVisibility() {
|
|
||||||
return defaultVisibility;
|
|
||||||
}
|
|
||||||
public void setDefaultVisibility(boolean defaultVisibility) {
|
|
||||||
this.defaultVisibility = defaultVisibility;
|
|
||||||
}
|
|
||||||
public int getPage() {
|
public int getPage() {
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
@ -123,17 +96,21 @@ public class Field implements Comparable,PropertiesModelBuilder,ModelDefinition<
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Visibility getVisible() {
|
||||||
|
return visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVisible(Visibility visible) {
|
||||||
|
this.visible = visible;
|
||||||
|
}
|
||||||
|
|
||||||
public Field cloneForMultiplicity(String key, Map<String, Object> properties){
|
public Field cloneForMultiplicity(String key, Map<String, Object> properties){
|
||||||
Field newField = new Field();
|
Field newField = new Field();
|
||||||
newField.id = key;
|
newField.id = key;
|
||||||
newField.ordinal = this.ordinal;
|
newField.ordinal = this.ordinal;
|
||||||
newField.title = this.title;
|
|
||||||
newField.value = (String)properties.get(key);
|
newField.value = (String)properties.get(key);
|
||||||
newField.description = this.description;
|
|
||||||
newField.extendedDescription = this.extendedDescription;
|
|
||||||
newField.viewStyle = this.viewStyle;
|
newField.viewStyle = this.viewStyle;
|
||||||
newField.datatype = this.datatype;
|
newField.datatype = this.datatype;
|
||||||
newField.defaultVisibility = this.defaultVisibility;
|
|
||||||
newField.page = this.page;
|
newField.page = this.page;
|
||||||
newField.defaultValue = this.defaultValue;
|
newField.defaultValue = this.defaultValue;
|
||||||
newField.data = this.data;
|
newField.data = this.data;
|
||||||
|
@ -142,42 +119,23 @@ public class Field implements Comparable,PropertiesModelBuilder,ModelDefinition<
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public eu.eudat.entities.xmlmodels.modeldefinition.Field toDatabaseDefinition(eu.eudat.entities.xmlmodels.modeldefinition.Field field) {
|
public eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field toDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field field) {
|
||||||
field.setDatatype(this.datatype);
|
|
||||||
field.setDefaultValue(this.defaultValue);
|
|
||||||
field.setId(this.id);
|
|
||||||
field.setMultiplicity(this.multiplicity);
|
|
||||||
field.setOrdinal(this.ordinal);
|
|
||||||
return field;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.modeldefinition.Field item) {
|
|
||||||
this.datatype = item.getDatatype();
|
|
||||||
this.defaultValue = item.getDefaultValue();
|
|
||||||
this.multiplicity = item.getMultiplicity();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public eu.eudat.entities.xmlmodels.viewstyledefinition.Field toDatabaseDefinition(eu.eudat.entities.xmlmodels.viewstyledefinition.Field field) {
|
|
||||||
field.setDefaultVisibility(this.defaultVisibility);
|
|
||||||
field.setDescription(this.description);
|
|
||||||
field.setExtendedDescription(this.extendedDescription);
|
|
||||||
field.setId(this.id);
|
field.setId(this.id);
|
||||||
field.setOrdinal(this.ordinal);
|
field.setOrdinal(this.ordinal);
|
||||||
field.setTitle(this.title);
|
|
||||||
field.setViewStyle(this.viewStyle);
|
field.setViewStyle(this.viewStyle);
|
||||||
field.setData(new ModelBuilder().toFieldData(data, this.viewStyle.getRenderStyle()));
|
field.setData(new ModelBuilder().toFieldData(data, this.viewStyle.getRenderStyle()));
|
||||||
|
field.setDefaultValue(this.defaultValue);
|
||||||
|
field.setVisible(this.visible);
|
||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.viewstyledefinition.Field item) {
|
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field item) {
|
||||||
this.defaultVisibility = item.getDefaultVisibility();
|
|
||||||
this.description = item.getDescription();
|
|
||||||
this.extendedDescription = item.getExtendedDescription();
|
|
||||||
this.id = item.getId();
|
this.id = item.getId();
|
||||||
this.ordinal = item.getOrdinal();
|
this.ordinal = item.getOrdinal();
|
||||||
this.title = item.getTitle();
|
|
||||||
this.viewStyle = item.getViewStyle();
|
this.viewStyle = item.getViewStyle();
|
||||||
this.data = item.getData();
|
this.data = item.getData();
|
||||||
|
this.defaultValue = item.getDefaultValue();
|
||||||
|
this.visible= item.getVisible();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void fromJsonObject(Map<String, Object> properties) {
|
public void fromJsonObject(Map<String, Object> properties) {
|
||||||
|
|
|
@ -12,9 +12,12 @@ import eu.eudat.utilities.ModelDefinition;
|
||||||
import eu.eudat.utilities.ViewStyleDefinition;
|
import eu.eudat.utilities.ViewStyleDefinition;
|
||||||
import eu.eudat.utilities.builders.ModelBuilder;
|
import eu.eudat.utilities.builders.ModelBuilder;
|
||||||
|
|
||||||
public class FieldSet implements Comparable,PropertiesModelBuilder,ModelDefinition<eu.eudat.entities.xmlmodels.modeldefinition.FieldSet>, ViewStyleDefinition<eu.eudat.entities.xmlmodels.viewstyledefinition.FieldSet>{
|
public class FieldSet implements Comparable,PropertiesModelBuilder, ViewStyleDefinition<eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet>{
|
||||||
private String id;
|
private String id;
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
|
private String title;
|
||||||
|
private String description;
|
||||||
|
private String extendedDescription;
|
||||||
private Multiplicity multiplicity;
|
private Multiplicity multiplicity;
|
||||||
private List<Field> fields;
|
private List<Field> fields;
|
||||||
private List<FieldSet> multiplicityItems;
|
private List<FieldSet> multiplicityItems;
|
||||||
|
@ -23,6 +26,30 @@ public class FieldSet implements Comparable,PropertiesModelBuilder,ModelDefiniti
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 String getExtendedDescription() {
|
||||||
|
return extendedDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtendedDescription(String extendedDescription) {
|
||||||
|
this.extendedDescription = extendedDescription;
|
||||||
|
}
|
||||||
|
|
||||||
public void setFields(List<Field> fields) {
|
public void setFields(List<Field> fields) {
|
||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
}
|
}
|
||||||
|
@ -65,26 +92,10 @@ public class FieldSet implements Comparable,PropertiesModelBuilder,ModelDefiniti
|
||||||
this.ordinal = ordinal;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public eu.eudat.entities.xmlmodels.modeldefinition.FieldSet toDatabaseDefinition(eu.eudat.entities.xmlmodels.modeldefinition.FieldSet fieldSet) {
|
|
||||||
fieldSet.setId(this.id);
|
|
||||||
fieldSet.setOrdinal(this.ordinal);
|
|
||||||
List<eu.eudat.entities.xmlmodels.modeldefinition.Field> modelfields = new ModelBuilder().toModelDefinition(this.fields, eu.eudat.entities.xmlmodels.modeldefinition.Field.class);
|
|
||||||
fieldSet.setFields(modelfields);
|
|
||||||
fieldSet.setMultiplicity(this.multiplicity);
|
|
||||||
return fieldSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.modeldefinition.FieldSet item) {
|
public eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet toDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet item) {
|
||||||
this.id = item.getId();
|
List<eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field> viewStylefields = new ModelBuilder().toViewStyleDefinition(this.fields, eu.eudat.entities.xmlmodels.datasetprofiledefinition.Field.class);
|
||||||
this.ordinal = item.getOrdinal();
|
|
||||||
this.multiplicity = item.getMultiplicity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public eu.eudat.entities.xmlmodels.viewstyledefinition.FieldSet toDatabaseDefinition(eu.eudat.entities.xmlmodels.viewstyledefinition.FieldSet item) {
|
|
||||||
List<eu.eudat.entities.xmlmodels.viewstyledefinition.Field> viewStylefields = new ModelBuilder().toViewStyleDefinition(this.fields, eu.eudat.entities.xmlmodels.viewstyledefinition.Field.class);
|
|
||||||
item.setFields(viewStylefields);
|
item.setFields(viewStylefields);
|
||||||
item.setId(this.id);
|
item.setId(this.id);
|
||||||
item.setOrdinal(this.ordinal);
|
item.setOrdinal(this.ordinal);
|
||||||
|
@ -92,10 +103,13 @@ public class FieldSet implements Comparable,PropertiesModelBuilder,ModelDefiniti
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.viewstyledefinition.FieldSet item) {
|
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet item) {
|
||||||
this.fields = new ModelBuilder().fromViewStyleDefinition(item.getFields(), Field.class);
|
this.fields = new ModelBuilder().fromViewStyleDefinition(item.getFields(), Field.class);
|
||||||
this.id = item.getId();
|
this.id = item.getId();
|
||||||
this.ordinal = item.getOrdinal();
|
this.ordinal = item.getOrdinal();
|
||||||
|
this.title = item.getTitle();
|
||||||
|
this.description = item.getDescription();
|
||||||
|
this.extendedDescription = item.getExtendedDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -114,6 +128,9 @@ public class FieldSet implements Comparable,PropertiesModelBuilder,ModelDefiniti
|
||||||
private FieldSet cloneForMultiplicity(String key, int index,Map<String, Object> properties){
|
private FieldSet cloneForMultiplicity(String key, int index,Map<String, Object> properties){
|
||||||
FieldSet newFieldSet = new FieldSet();
|
FieldSet newFieldSet = new FieldSet();
|
||||||
newFieldSet.id = key;
|
newFieldSet.id = key;
|
||||||
|
newFieldSet.description = this.description;
|
||||||
|
newFieldSet.extendedDescription = this.extendedDescription;
|
||||||
|
newFieldSet.title = this.title;
|
||||||
|
|
||||||
newFieldSet.ordinal = this.ordinal;
|
newFieldSet.ordinal = this.ordinal;
|
||||||
newFieldSet.fields = new LinkedList();
|
newFieldSet.fields = new LinkedList();
|
||||||
|
|
|
@ -1,130 +0,0 @@
|
||||||
package eu.eudat.models.user.components.datasetprofile;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import eu.eudat.entities.xmlmodels.viewstyledefinition.FieldGroup;
|
|
||||||
import eu.eudat.models.user.composite.PropertiesModelBuilder;
|
|
||||||
import eu.eudat.utilities.ModelDefinition;
|
|
||||||
import eu.eudat.utilities.ViewStyleDefinition;
|
|
||||||
import eu.eudat.utilities.builders.ModelBuilder;
|
|
||||||
|
|
||||||
public class Group implements PropertiesModelBuilder,ModelDefinition<eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup>, ViewStyleDefinition<eu.eudat.entities.xmlmodels.viewstyledefinition.FieldGroup>{
|
|
||||||
private String id;
|
|
||||||
private String title;
|
|
||||||
private String section;
|
|
||||||
private String value;
|
|
||||||
private int ordinal;
|
|
||||||
private String description;
|
|
||||||
private String extendedDescription;
|
|
||||||
private boolean defaultVisibility;
|
|
||||||
private int page;
|
|
||||||
private List<FieldSet> compositeFields;
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
public String getSection() {
|
|
||||||
return section;
|
|
||||||
}
|
|
||||||
public void setSection(String section) {
|
|
||||||
this.section = section;
|
|
||||||
}
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
public String getExtendedDescription() {
|
|
||||||
return extendedDescription;
|
|
||||||
}
|
|
||||||
public void setExtendedDescription(String extendedDescription) {
|
|
||||||
this.extendedDescription = extendedDescription;
|
|
||||||
}
|
|
||||||
public boolean getDefaultVisibility() {
|
|
||||||
return defaultVisibility;
|
|
||||||
}
|
|
||||||
public void setDefaultVisibility(boolean defaultVisibility) {
|
|
||||||
this.defaultVisibility = defaultVisibility;
|
|
||||||
}
|
|
||||||
public int getPage() {
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
public void setPage(int page) {
|
|
||||||
this.page = page;
|
|
||||||
}
|
|
||||||
public List<FieldSet> getCompositeFields() {
|
|
||||||
Collections.sort(this.compositeFields);
|
|
||||||
return compositeFields;
|
|
||||||
}
|
|
||||||
public void setCompositeFields(List<FieldSet> compositeFields) {
|
|
||||||
this.compositeFields = compositeFields;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOrdinal() {
|
|
||||||
return ordinal;
|
|
||||||
}
|
|
||||||
public void setOrdinal(int ordinal) {
|
|
||||||
this.ordinal = ordinal;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public eu.eudat.entities.xmlmodels.viewstyledefinition.FieldGroup toDatabaseDefinition(FieldGroup item) {
|
|
||||||
item.setDefaultVisibility(this.defaultVisibility);
|
|
||||||
item.setDescription(this.description);
|
|
||||||
item.setExtendedDescription(this.extendedDescription);
|
|
||||||
item.setFieldSets(new ModelBuilder().toViewStyleDefinition(this.compositeFields, eu.eudat.entities.xmlmodels.viewstyledefinition.FieldSet.class));
|
|
||||||
item.setId(this.id);
|
|
||||||
item.setOrdinal(this.ordinal);
|
|
||||||
item.setPage(this.page);
|
|
||||||
item.setTitle(this.title);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void fromDatabaseDefinition(FieldGroup item) {
|
|
||||||
this.defaultVisibility = item.isDefaultVisibility();
|
|
||||||
this.description = item.getDescription();
|
|
||||||
this.extendedDescription = item.getExtendedDescription();
|
|
||||||
this.compositeFields = new ModelBuilder().fromViewStyleDefinition(item.getFieldSets(), FieldSet.class);
|
|
||||||
this.id = item.getId();
|
|
||||||
this.ordinal = item.getOrdinal();
|
|
||||||
this.page = item.getPage();
|
|
||||||
this.title = item.getTitle();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup toDatabaseDefinition(eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup item) {
|
|
||||||
item.setFieldSets(new ModelBuilder().toModelDefinition(this.compositeFields, eu.eudat.entities.xmlmodels.modeldefinition.FieldSet.class));
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup item) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void fromJsonObject(Map<String, Object> properties) {
|
|
||||||
this.compositeFields.forEach(item->item.fromJsonObject(properties));
|
|
||||||
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void fromJsonObject(Map<String, Object> properties, String index) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,9 +8,9 @@ import eu.eudat.models.user.composite.PropertiesModelBuilder;
|
||||||
import eu.eudat.utilities.ViewStyleDefinition;
|
import eu.eudat.utilities.ViewStyleDefinition;
|
||||||
import eu.eudat.utilities.builders.ModelBuilder;
|
import eu.eudat.utilities.builders.ModelBuilder;
|
||||||
|
|
||||||
public class Section implements Comparable,ViewStyleDefinition<eu.eudat.entities.xmlmodels.viewstyledefinition.Section>,PropertiesModelBuilder{
|
public class Section implements Comparable,ViewStyleDefinition<eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section>,PropertiesModelBuilder{
|
||||||
private List<Section> sections;
|
private List<Section> sections;
|
||||||
private List<Group> fieldGroups;
|
private List<FieldSet> fieldSets;
|
||||||
private Boolean defaultVisibility;
|
private Boolean defaultVisibility;
|
||||||
private int page;
|
private int page;
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
|
@ -24,12 +24,15 @@ public class Section implements Comparable,ViewStyleDefinition<eu.eudat.entities
|
||||||
public void setSections(List<Section> sections) {
|
public void setSections(List<Section> sections) {
|
||||||
this.sections = sections;
|
this.sections = sections;
|
||||||
}
|
}
|
||||||
public List<Group> getFieldGroups() {
|
|
||||||
return fieldGroups;
|
public List<FieldSet> getFieldSets() {
|
||||||
|
return fieldSets;
|
||||||
}
|
}
|
||||||
public void setFieldGroups(List<Group> fieldGroups) {
|
|
||||||
this.fieldGroups = fieldGroups;
|
public void setFieldSets(List<FieldSet> fieldSets) {
|
||||||
|
this.fieldSets = fieldSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getDefaultVisibility() {
|
public Boolean getDefaultVisibility() {
|
||||||
return defaultVisibility;
|
return defaultVisibility;
|
||||||
}
|
}
|
||||||
|
@ -68,22 +71,22 @@ public class Section implements Comparable,ViewStyleDefinition<eu.eudat.entities
|
||||||
this.ordinal = ordinal;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public eu.eudat.entities.xmlmodels.viewstyledefinition.Section toDatabaseDefinition(eu.eudat.entities.xmlmodels.viewstyledefinition.Section item) {
|
public eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section toDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section item) {
|
||||||
item.setDefaultVisibility(this.defaultVisibility);
|
item.setDefaultVisibility(this.defaultVisibility);
|
||||||
item.setDescription(this.description);
|
item.setDescription(this.description);
|
||||||
if(this.fieldGroups!=null)item.setFieldGroups(new ModelBuilder().toViewStyleDefinition(this.fieldGroups, eu.eudat.entities.xmlmodels.viewstyledefinition.FieldGroup.class));
|
if(this.fieldSets!=null)item.setFieldSets(new ModelBuilder().toViewStyleDefinition(this.fieldSets, eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet.class));
|
||||||
item.setId(this.id);
|
item.setId(this.id);
|
||||||
item.setOrdinal(this.ordinal);
|
item.setOrdinal(this.ordinal);
|
||||||
item.setPage(this.page);
|
item.setPage(this.page);
|
||||||
if(this.sections!=null)item.setSections(new ModelBuilder().toViewStyleDefinition(this.sections, eu.eudat.entities.xmlmodels.viewstyledefinition.Section.class));
|
if(this.sections!=null)item.setSections(new ModelBuilder().toViewStyleDefinition(this.sections, eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section.class));
|
||||||
item.setTitle(this.title);
|
item.setTitle(this.title);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.viewstyledefinition.Section item) {
|
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section item) {
|
||||||
this.defaultVisibility = item.isDefaultVisibility();
|
this.defaultVisibility = item.isDefaultVisibility();
|
||||||
this.description = item.getDescription();
|
this.description = item.getDescription();
|
||||||
this.fieldGroups = new ModelBuilder().fromViewStyleDefinition(item.getFieldGroups(),Group.class);
|
this.fieldSets = new ModelBuilder().fromViewStyleDefinition(item.getFieldSets(),FieldSet.class);
|
||||||
this.id = item.getId();
|
this.id = item.getId();
|
||||||
this.ordinal = item.getOrdinal();
|
this.ordinal = item.getOrdinal();
|
||||||
this.page = item.getPage();
|
this.page = item.getPage();
|
||||||
|
@ -93,7 +96,7 @@ public class Section implements Comparable,ViewStyleDefinition<eu.eudat.entities
|
||||||
@Override
|
@Override
|
||||||
public void fromJsonObject(Map<String, Object> properties) {
|
public void fromJsonObject(Map<String, Object> properties) {
|
||||||
this.sections.forEach(item->item.fromJsonObject(properties));
|
this.sections.forEach(item->item.fromJsonObject(properties));
|
||||||
this.fieldGroups.forEach(item->item.fromJsonObject(properties));
|
this.fieldSets.forEach(item->item.fromJsonObject(properties));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Object o) {
|
public int compareTo(Object o) {
|
||||||
|
|
|
@ -38,15 +38,9 @@ public class DatasetProfile implements PropertiesModelBuilder{
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildProfile(eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup fieldGroup, eu.eudat.entities.xmlmodels.viewstyledefinition.ViewStyleModel viewStyle){
|
public void buildProfile( eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewStyle){
|
||||||
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
|
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
|
||||||
updateProfile(fieldGroup,viewStyle);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateProfile(eu.eudat.entities.xmlmodels.modeldefinition.FieldGroup fieldGroup, eu.eudat.entities.xmlmodels.viewstyledefinition.ViewStyleModel viewStyle){
|
|
||||||
ModelBuilderCollector.mapUserSections(sections, fieldGroup.getFieldSets());
|
|
||||||
this.rules = ModelBuilderCollector.collectRules(viewStyle.getSections());
|
this.rules = ModelBuilderCollector.collectRules(viewStyle.getSections());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,8 +5,7 @@ package eu.eudat.utilities;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import eu.eudat.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
import eu.eudat.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||||
import eu.eudat.entities.xmlmodels.modeldefinition.Field;
|
import eu.eudat.entities.xmlmodels.datasetprofiledefinition.DatabaseViewStyleDefinition;
|
||||||
import eu.eudat.entities.xmlmodels.viewstyledefinition.DatabaseViewStyleDefinition;
|
|
||||||
|
|
||||||
public interface ModelSerializer<T extends DatabaseViewStyleDefinition,U extends DatabaseModelDefinition> {
|
public interface ModelSerializer<T extends DatabaseViewStyleDefinition,U extends DatabaseModelDefinition> {
|
||||||
void fromDatabaseDefinition(T viewStyle,U model);
|
void fromDatabaseDefinition(T viewStyle,U model);
|
||||||
|
|
|
@ -4,8 +4,7 @@ package eu.eudat.utilities;
|
||||||
* Created by ikalyvas on 12/15/2017.
|
* Created by ikalyvas on 12/15/2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import eu.eudat.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
import eu.eudat.entities.xmlmodels.datasetprofiledefinition.DatabaseViewStyleDefinition;
|
||||||
import eu.eudat.entities.xmlmodels.viewstyledefinition.DatabaseViewStyleDefinition;
|
|
||||||
|
|
||||||
public interface ViewStyleDefinition<T extends DatabaseViewStyleDefinition>{
|
public interface ViewStyleDefinition<T extends DatabaseViewStyleDefinition>{
|
||||||
T toDatabaseDefinition(T item);
|
T toDatabaseDefinition(T item);
|
||||||
|
|
|
@ -7,10 +7,9 @@ import java.util.Map;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import eu.eudat.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
import eu.eudat.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||||
import eu.eudat.entities.xmlmodels.viewstyledefinition.DatabaseViewStyleDefinition;
|
import eu.eudat.entities.xmlmodels.datasetprofiledefinition.DatabaseViewStyleDefinition;
|
||||||
import eu.eudat.models.components.commons.datafield.AutoCompleteData;
|
import eu.eudat.models.components.commons.datafield.AutoCompleteData;
|
||||||
import eu.eudat.models.components.commons.datafield.CheckBoxData;
|
import eu.eudat.models.components.commons.datafield.CheckBoxData;
|
||||||
import eu.eudat.models.components.commons.datafield.ComboBoxData;
|
|
||||||
import eu.eudat.models.components.commons.datafield.FieldData;
|
import eu.eudat.models.components.commons.datafield.FieldData;
|
||||||
import eu.eudat.models.components.commons.datafield.RadioBoxData;
|
import eu.eudat.models.components.commons.datafield.RadioBoxData;
|
||||||
import eu.eudat.models.components.commons.datafield.WordListData;
|
import eu.eudat.models.components.commons.datafield.WordListData;
|
||||||
|
@ -84,17 +83,17 @@ public class ModelBuilder {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public <U extends FieldData<U>> U toFieldData(Object data,String type){
|
public <U > FieldData<U> toFieldData(Object data,String type){
|
||||||
if(type.equals("combobox")){
|
if(type.equals("combobox")){
|
||||||
String comboboxType = (String)((Map<String,Object>)data).get("type");
|
String comboboxType = (String)((Map<String,Object>)data).get("type");
|
||||||
if(comboboxType.equals("autocomplete")){
|
if(comboboxType.equals("autocomplete")){
|
||||||
return (U) new AutoCompleteData().fromData(data);
|
return (FieldData<U>) new AutoCompleteData().fromData(data);
|
||||||
}else if(comboboxType.equals("wordlist"))
|
}else if(comboboxType.equals("wordlist"))
|
||||||
return (U) new WordListData().fromData(data);
|
return (FieldData<U>) new WordListData().fromData(data);
|
||||||
}
|
}
|
||||||
if(type.equals("booleanDecision"))return null;
|
if(type.equals("booleanDecision"))return null;
|
||||||
if(type.equals("radiobox"))return (U) new RadioBoxData().fromData(data);
|
if(type.equals("radiobox"))return (FieldData<U>) new RadioBoxData().fromData(data);
|
||||||
if(type.equals("checkBox"))return (U) new CheckBoxData().fromData(data);
|
if(type.equals("checkBox"))return (FieldData<U>) new CheckBoxData().fromData(data);
|
||||||
if(type.equals("freetext"))return null;
|
if(type.equals("freetext"))return null;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.transform.Transformer;
|
import javax.xml.transform.Transformer;
|
||||||
import javax.xml.transform.TransformerConfigurationException;
|
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
import javax.xml.transform.TransformerFactory;
|
import javax.xml.transform.TransformerFactory;
|
||||||
import javax.xml.transform.dom.DOMSource;
|
import javax.xml.transform.dom.DOMSource;
|
||||||
|
@ -21,8 +20,6 @@ import org.w3c.dom.NodeList;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
import eu.eudat.entities.xmlmodels.viewstyledefinition.FieldSet;
|
|
||||||
|
|
||||||
|
|
||||||
public class XmlBuilder {
|
public class XmlBuilder {
|
||||||
|
|
||||||
|
|
|
@ -1,134 +1,28 @@
|
||||||
package eu.eudat.utilities.helpers;
|
package eu.eudat.utilities.helpers;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import eu.eudat.models.admin.components.datasetprofile.FieldSet;
|
import eu.eudat.models.admin.components.datasetprofile.FieldSet;
|
||||||
import eu.eudat.models.admin.components.datasetprofile.Group;
|
|
||||||
import eu.eudat.models.admin.components.datasetprofile.Section;
|
import eu.eudat.models.admin.components.datasetprofile.Section;
|
||||||
import eu.eudat.models.user.components.commons.Rule;
|
import eu.eudat.models.user.components.commons.Rule;
|
||||||
|
|
||||||
public class ModelBuilderCollector {
|
public class ModelBuilderCollector {
|
||||||
|
|
||||||
public static List<FieldSet> collectCompositeFields(List<Section> sections){
|
|
||||||
List<FieldSet> fieldGroups = new LinkedList();
|
|
||||||
for(Section section: sections){
|
|
||||||
if(!section.getSections().isEmpty()){
|
|
||||||
fieldGroups.addAll(collectCompositeFields(section.getSections()));
|
|
||||||
}
|
|
||||||
fieldGroups.addAll(
|
|
||||||
section.getFieldGroups().stream()
|
|
||||||
.map(group->group.getCompositeFields())
|
|
||||||
.flatMap(List::stream)
|
|
||||||
.collect(Collectors.toList())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return fieldGroups;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void mapSections(List<eu.eudat.models.admin.components.datasetprofile.Section> sections, List<eu.eudat.entities.xmlmodels.modeldefinition.FieldSet> fieldGroups){
|
|
||||||
for(Section section: sections){
|
|
||||||
if(!section.getSections().isEmpty()){
|
|
||||||
mapSections(section.getSections(),fieldGroups);
|
|
||||||
}
|
|
||||||
for(Group group: section.getFieldGroups()){
|
|
||||||
if(!group.getCompositeFields().isEmpty()){
|
|
||||||
mapCompositeFields(group.getCompositeFields(),fieldGroups);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void mapCompositeFields(List<eu.eudat.models.admin.components.datasetprofile.FieldSet> fieldSets, List<eu.eudat.entities.xmlmodels.modeldefinition.FieldSet> fieldGroups){
|
|
||||||
for(FieldSet fieldSet: fieldSets){
|
|
||||||
if(!fieldSet.getFields().isEmpty()){
|
|
||||||
mapFields(fieldSet.getFields(),fieldGroups);
|
|
||||||
}
|
|
||||||
for(eu.eudat.entities.xmlmodels.modeldefinition.FieldSet fieldModelSet :fieldGroups){
|
|
||||||
if(fieldSet.getId()!=null&&fieldSet.getId().equals(fieldModelSet.getId())){
|
|
||||||
fieldSet.fromDatabaseDefinition(fieldModelSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void mapFields(List<eu.eudat.models.admin.components.datasetprofile.Field> fields, List<eu.eudat.entities.xmlmodels.modeldefinition.FieldSet> fieldGroups){
|
|
||||||
|
|
||||||
for(eu.eudat.models.admin.components.datasetprofile.Field fielditem: fields){
|
|
||||||
for(eu.eudat.entities.xmlmodels.modeldefinition.FieldSet fieldSet:fieldGroups){
|
|
||||||
for(eu.eudat.entities.xmlmodels.modeldefinition.Field fieldmodelitem : fieldSet.getFields()){
|
|
||||||
if(fielditem.getId()!=null&&fielditem.getId().equals(fieldmodelitem.getId())){
|
|
||||||
fielditem.fromDatabaseDefinition(fieldmodelitem);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void mapUserSections(List<eu.eudat.models.user.components.datasetprofile.Section> sections, List<eu.eudat.entities.xmlmodels.modeldefinition.FieldSet> fieldGroups){
|
|
||||||
for(eu.eudat.models.user.components.datasetprofile.Section section: sections){
|
|
||||||
if(!section.getSections().isEmpty()){
|
|
||||||
mapUserSections(section.getSections(),fieldGroups);
|
|
||||||
}
|
|
||||||
for(eu.eudat.models.user.components.datasetprofile.Group group: section.getFieldGroups()){
|
|
||||||
if(!group.getCompositeFields().isEmpty()){
|
|
||||||
mapUserCompositeFields(group.getCompositeFields(),fieldGroups);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void mapUserCompositeFields(List<eu.eudat.models.user.components.datasetprofile.FieldSet> fieldSets, List<eu.eudat.entities.xmlmodels.modeldefinition.FieldSet> fieldGroups){
|
|
||||||
for(eu.eudat.models.user.components.datasetprofile.FieldSet fieldSet: fieldSets){
|
|
||||||
if(!fieldSet.getFields().isEmpty()){
|
|
||||||
mapUserFields(fieldSet.getFields(),fieldGroups);
|
|
||||||
}
|
|
||||||
for(eu.eudat.entities.xmlmodels.modeldefinition.FieldSet fieldModelSet :fieldGroups){
|
|
||||||
if(fieldSet.getId()!=null&&fieldSet.getId().equals(fieldModelSet.getId())){
|
|
||||||
fieldSet.fromDatabaseDefinition(fieldModelSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void mapUserFields(List<eu.eudat.models.user.components.datasetprofile.Field> fields, List<eu.eudat.entities.xmlmodels.modeldefinition.FieldSet> fieldGroups){
|
|
||||||
|
|
||||||
for(eu.eudat.models.user.components.datasetprofile.Field fielditem: fields){
|
|
||||||
for(eu.eudat.entities.xmlmodels.modeldefinition.FieldSet fieldSet:fieldGroups){
|
|
||||||
for(eu.eudat.entities.xmlmodels.modeldefinition.Field fieldmodelitem : fieldSet.getFields()){
|
|
||||||
if(fielditem.getId()!=null&&fielditem.getId().equals(fieldmodelitem.getId())){
|
|
||||||
fielditem.fromDatabaseDefinition(fieldmodelitem);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sections
|
* @param sections
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static List<Rule> collectRules(List<eu.eudat.entities.xmlmodels.viewstyledefinition.Section> sections){
|
public static List<Rule> collectRules(List<eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section> sections){
|
||||||
List<Rule> rules = new LinkedList();
|
List<Rule> rules = new LinkedList();
|
||||||
for(eu.eudat.entities.xmlmodels.viewstyledefinition.Section section: sections){
|
for(eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section section: sections){
|
||||||
if(!section.getSections().isEmpty()){
|
if(!section.getSections().isEmpty()){
|
||||||
rules.addAll(collectRules(section.getSections()));
|
rules.addAll(collectRules(section.getSections()));
|
||||||
}
|
}
|
||||||
rules.addAll(
|
rules.addAll(
|
||||||
section.getFieldGroups().stream()
|
section.getFieldSets().stream()
|
||||||
.map(group->group.getFieldSets())
|
|
||||||
.flatMap(List::stream)
|
|
||||||
.map(fieldset->fieldset.getFields())
|
.map(fieldset->fieldset.getFields())
|
||||||
.flatMap(List::stream)
|
.flatMap(List::stream)
|
||||||
.map(field->getRulesFromField(field.getId(),field.getVisible()
|
.map(field->getRulesFromField(field.getId(),field.getVisible()
|
||||||
|
|
|
@ -5,8 +5,7 @@ package eu.eudat.utilities.helpers;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import eu.eudat.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
import eu.eudat.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||||
import eu.eudat.entities.xmlmodels.modeldefinition.Field;
|
import eu.eudat.entities.xmlmodels.datasetprofiledefinition.DatabaseViewStyleDefinition;
|
||||||
import eu.eudat.entities.xmlmodels.viewstyledefinition.DatabaseViewStyleDefinition;
|
|
||||||
|
|
||||||
public interface ModelSerializer<T extends DatabaseViewStyleDefinition,U extends DatabaseModelDefinition> {
|
public interface ModelSerializer<T extends DatabaseViewStyleDefinition,U extends DatabaseModelDefinition> {
|
||||||
void fromDatabaseDefinition(T viewStyle,U model);
|
void fromDatabaseDefinition(T viewStyle,U model);
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package eu.eudat.validators;
|
||||||
|
|
||||||
|
import org.springframework.validation.Validator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by ikalyvas on 1/2/2018.
|
||||||
|
*/
|
||||||
|
public abstract class ApiValidator implements Validator {
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import org.springframework.validation.Validator;
|
||||||
/**
|
/**
|
||||||
* Created by ikalyvas on 12/22/2017.
|
* Created by ikalyvas on 12/22/2017.
|
||||||
*/
|
*/
|
||||||
|
@Component("dataManagementPlanTableRequestValidator")
|
||||||
public class DataManagementPlanTableRequestValidator implements Validator {
|
public class DataManagementPlanTableRequestValidator implements Validator {
|
||||||
@Override
|
@Override
|
||||||
public boolean supports(Class<?> aClass) {
|
public boolean supports(Class<?> aClass) {
|
||||||
|
@ -16,12 +17,16 @@ public class DataManagementPlanTableRequestValidator implements Validator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate(Object obj, Errors errors) {
|
public void validate(Object obj, Errors errors) {
|
||||||
DataManagementPlanTableRequest user = (DataManagementPlanTableRequest) obj;
|
DataManagementPlanTableRequest dataManagementPlanTableRequest = (DataManagementPlanTableRequest) obj;
|
||||||
if(user.getOffset()<0){
|
if(dataManagementPlanTableRequest.getOffset()<0){
|
||||||
errors.rejectValue("offset", "datamanagementplanrequest.offset.negative");
|
errors.rejectValue("offset", "datamanagementplanrequest.offset.negative");
|
||||||
}
|
}
|
||||||
if(user.getLength()<0){
|
if(dataManagementPlanTableRequest.getLength()<0){
|
||||||
errors.rejectValue("length", "datamanagementplanrequest.length.negative");
|
errors.rejectValue("length", "datamanagementplanrequest.length.negative");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean supportsType(Class<?> clazz) {
|
||||||
|
return DataManagementPlanTableRequest.class.equals(clazz);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package eu.eudat.validators;
|
||||||
|
|
||||||
|
import eu.eudat.models.dmp.DataManagementPlanTableRequest;
|
||||||
|
import eu.eudat.models.project.ProjectTableRequest;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.validation.Errors;
|
||||||
|
import org.springframework.validation.Validator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by ikalyvas on 1/2/2018.
|
||||||
|
*/
|
||||||
|
@Component("projectTableRequestValidator")
|
||||||
|
public class ProjectTableRequestValidator implements Validator {
|
||||||
|
@Override
|
||||||
|
public boolean supports(Class<?> aClass) {
|
||||||
|
return ProjectTableRequest.class.equals(aClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validate(Object obj, Errors errors) {
|
||||||
|
ProjectTableRequest projectTableRequest = (ProjectTableRequest) obj;
|
||||||
|
if(projectTableRequest.getCriteria().getPeriodEnd()!=null&&projectTableRequest.getCriteria().getPeriodEnd()!=null&&projectTableRequest.getCriteria().getPeriodEnd().before(projectTableRequest.getCriteria().getPeriodStart())){
|
||||||
|
errors.rejectValue("criteria.periodStart", "projectTableRequest.periodStart.overlapping");
|
||||||
|
}
|
||||||
|
if(projectTableRequest.getOffset()<0){
|
||||||
|
errors.rejectValue("offset", "projectTableRequest.offset.negative");
|
||||||
|
}
|
||||||
|
if(projectTableRequest.getLength()<0){
|
||||||
|
errors.rejectValue("length", "projectTableRequest.length.negative");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean supportsType(Class<?> clazz) {
|
||||||
|
return ProjectTableRequest.class.equals(clazz);
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,9 +5,9 @@
|
||||||
|
|
||||||
##########################Persistence##########################################
|
##########################Persistence##########################################
|
||||||
database.driver-class-name=org.postgresql.Driver
|
database.driver-class-name=org.postgresql.Driver
|
||||||
database.url = jdbc:postgresql://localhost:5432/dmptool
|
database.url = jdbc:postgresql://develdb1.madgik.di.uoa.gr:5432/dmptool
|
||||||
database.username = postgres
|
database.username = dmptool
|
||||||
database.password = zxcvbnm
|
database.password = dmpt00lu$r
|
||||||
##########################/Persistence##########################################
|
##########################/Persistence##########################################
|
||||||
|
|
||||||
###################Allowed Proxy Service Host ############################
|
###################Allowed Proxy Service Host ############################
|
||||||
|
|
|
@ -1,2 +1,5 @@
|
||||||
datamanagementplanrequest.length.negative=table length cannot be negative
|
datamanagementplanrequest.length.negative=table length cannot be negative
|
||||||
datamanagementplanrequest.offset.negative=table offset cannot be negative
|
datamanagementplanrequest.offset.negative=table offset cannot be negative
|
||||||
|
projectTableRequest.periodStart.overlapping = Period Start cannot overlap Period End
|
||||||
|
projectTableRequest.offset.negative=table offset cannot be negative
|
||||||
|
projectTableRequest.length.negative=table length cannot be negative
|
|
@ -104,7 +104,7 @@ export class ProjectDataSource extends DataSource<ProjectListingModel> {
|
||||||
duration: 3000,
|
duration: 3000,
|
||||||
extraClasses: ['snackbar-warning']
|
extraClasses: ['snackbar-warning']
|
||||||
});
|
});
|
||||||
this._criteria.onCallbackError(error);
|
this._criteria.onCallbackError(error.error);
|
||||||
return Observable.of(null);
|
return Observable.of(null);
|
||||||
})
|
})
|
||||||
.map(result => {
|
.map(result => {
|
||||||
|
|
|
@ -13,10 +13,10 @@ import { BaseCriteriaErrorModel } from '../../../../models/criteria/BaseCriteria
|
||||||
export class BaseCriteriaComponent implements OnInit {
|
export class BaseCriteriaComponent implements OnInit {
|
||||||
|
|
||||||
public refreshCallback: Function = null;
|
public refreshCallback: Function = null;
|
||||||
public errorModel: BaseCriteriaErrorModel = new BaseCriteriaErrorModel();
|
public baseErrorModel: BaseCriteriaErrorModel = new BaseCriteriaErrorModel();
|
||||||
|
|
||||||
constructor(errorModel: BaseCriteriaErrorModel) {
|
constructor(baseErrorModel: BaseCriteriaErrorModel) {
|
||||||
this.errorModel = errorModel;
|
this.baseErrorModel = baseErrorModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -28,13 +28,13 @@ export class BaseCriteriaComponent implements OnInit {
|
||||||
|
|
||||||
public setErrorModel(errorModel: BaseCriteriaErrorModel) {
|
public setErrorModel(errorModel: BaseCriteriaErrorModel) {
|
||||||
Object.keys(errorModel).forEach(item => {
|
Object.keys(errorModel).forEach(item => {
|
||||||
(<any>this.errorModel)[item] = (<any>errorModel)[item];
|
(<any>this.baseErrorModel)[item] = (<any>errorModel)[item];
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public clearErrorModel() {
|
public clearErrorModel() {
|
||||||
Object.keys(this.errorModel).forEach(item => {
|
Object.keys(this.baseErrorModel).forEach(item => {
|
||||||
(<any>this.errorModel)[item] = '';
|
(<any>this.baseErrorModel)[item] = '';
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,23 +5,24 @@
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input matInput placeholder=" {{'CRITERIA.PROJECTS.LIKE'| translate}}" name="projectCriteriaLike" [(ngModel)]="criteria.like"
|
<input matInput placeholder=" {{'CRITERIA.PROJECTS.LIKE'| translate}}" name="projectCriteriaLike" [(ngModel)]="criteria.like"
|
||||||
(ngModelChange)="controlModified()">
|
(ngModelChange)="controlModified()">
|
||||||
<mat-error *ngIf="baseErrorModel?.like">{{baseErrorModel['Criteria.like']}}</mat-error>
|
<mat-error *ngIf="baseErrorModel?.like">{{baseErrorModel['criteria.like']}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input matInput (focus)="periodStartPicker.open()" (click)="periodStartPicker.open()" placeholder=" {{'CRITERIA.PROJECTS.PERIOD-FROM'| translate}}"
|
<input matInput (focus)="periodStartPicker.open()" (click)="periodStartPicker.open()" placeholder=" {{'CRITERIA.PROJECTS.PERIOD-FROM'| translate}}"
|
||||||
[matDatepicker]="periodStartPicker" name="projectCriteriaPeriodStart" [(ngModel)]="criteria.periodStart" (ngModelChange)="controlModified()">
|
[matDatepicker]="periodStartPicker" name="projectCriteriaPeriodStart" [(ngModel)]="criteria.periodStart" (ngModelChange)="controlModified()">
|
||||||
<mat-error *ngIf="baseErrorModel?.periodStart">{{baseErrorModel['Criteria.periodStart']}}</mat-error>
|
|
||||||
<mat-datepicker-toggle matSuffix [for]="periodStartPicker"></mat-datepicker-toggle>
|
<mat-datepicker-toggle matSuffix [for]="periodStartPicker"></mat-datepicker-toggle>
|
||||||
<mat-datepicker #periodStartPicker></mat-datepicker>
|
<mat-datepicker #periodStartPicker></mat-datepicker>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-error *ngIf="baseErrorModel['criteria.periodStart']">{{baseErrorModel['criteria.periodStart']}}</mat-error>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input matInput (focus)="periodEndPicker.open()" (click)="periodEndPicker.open()" name="projectCriteriaPeriodEnd" placeholder=" {{'CRITERIA.PROJECTS.PERIOD-TO'| translate}}"
|
<input matInput (focus)="periodEndPicker.open()" (click)="periodEndPicker.open()" name="projectCriteriaPeriodEnd" placeholder=" {{'CRITERIA.PROJECTS.PERIOD-TO'| translate}}"
|
||||||
[matDatepicker]="periodEndPicker" [(ngModel)]="criteria.periodEnd" (ngModelChange)="controlModified()">
|
[matDatepicker]="periodEndPicker" [(ngModel)]="criteria.periodEnd" (ngModelChange)="controlModified()">
|
||||||
<mat-error *ngIf="baseErrorModel?.periodEnd">{{baseErrorModel['Criteria.periodEnd']}}</mat-error>
|
<mat-error *ngIf="baseErrorModel?.criteria?.periodEnd">{{baseErrorModel['criteria.periodEnd']}}</mat-error>
|
||||||
<mat-datepicker-toggle matSuffix [for]="periodEndPicker"></mat-datepicker-toggle>
|
<mat-datepicker-toggle matSuffix [for]="periodEndPicker"></mat-datepicker-toggle>
|
||||||
<mat-datepicker #periodEndPicker></mat-datepicker>
|
<mat-datepicker #periodEndPicker></mat-datepicker>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
Loading…
Reference in New Issue