no message
This commit is contained in:
parent
bd1bc36085
commit
62a7c1fad3
|
@ -100,7 +100,7 @@ public class DMPs {
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/createOrUpdate" }, consumes = "application/json", produces="application/json")
|
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/createOrUpdate" }, consumes = "application/json", produces="application/json")
|
||||||
public @ResponseBody ResponseItem<DMP> createOrUpdate(@RequestBody eu.eudat.models.dmp.DataManagementPlan dataManagementPlan, Principal principal) {
|
public @ResponseBody ResponseItem<DMP> createOrUpdate(@RequestBody eu.eudat.models.dmp.DataManagementPlan dataManagementPlan, Principal principal) {
|
||||||
try{
|
try{
|
||||||
DataManagementPlanManager.createOrUpdate(dMPDao,researcherDao,userInfoDao,organisationDao,dataManagementPlan,principal);
|
DataManagementPlanManager.createOrUpdate(dMPDao,projectDao,researcherDao,userInfoDao,organisationDao,dataManagementPlan,principal);
|
||||||
return new ResponseItem<DMP>().status(HttpStatus.CREATED);
|
return new ResponseItem<DMP>().status(HttpStatus.CREATED);
|
||||||
}catch (Exception ex){
|
}catch (Exception ex){
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.util.UUID;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
import eu.eudat.models.criteria.ProjectCriteria;
|
import eu.eudat.models.criteria.ProjectCriteria;
|
||||||
|
import eu.eudat.models.external.OrganisationsExternalSourcesModel;
|
||||||
import eu.eudat.models.external.ProjectsExternalSourcesModel;
|
import eu.eudat.models.external.ProjectsExternalSourcesModel;
|
||||||
import eu.eudat.models.external.RegistriesExternalSourcesModel;
|
import eu.eudat.models.external.RegistriesExternalSourcesModel;
|
||||||
import eu.eudat.models.helpers.responses.*;
|
import eu.eudat.models.helpers.responses.*;
|
||||||
|
@ -128,7 +129,7 @@ public class Projects {
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/projects/get" }, consumes = "application/json", produces="application/json")
|
@RequestMapping(method = RequestMethod.POST, value = { "/projects/get" }, consumes = "application/json", produces="application/json")
|
||||||
public @ResponseBody ResponseItem<List<eu.eudat.models.project.Project>> getPaged(@RequestBody ProjectCriteriaRequest projectCriteria) {
|
public @ResponseBody ResponseItem<List<eu.eudat.models.project.Project>> getPaged(@RequestBody ProjectCriteriaRequest projectCriteria) {
|
||||||
try {
|
try {
|
||||||
List<eu.eudat.models.project.Project> dataTable = new ProjectManager().getCriteria(projectDao, projectCriteria);
|
List<eu.eudat.models.project.Project> dataTable = new ProjectManager().getCriteria(projectDao, projectCriteria,remoteFetcher);
|
||||||
return new ResponseItem<List<eu.eudat.models.project.Project>>().payload(dataTable).status(HttpStatus.OK);
|
return new ResponseItem<List<eu.eudat.models.project.Project>>().payload(dataTable).status(HttpStatus.OK);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class DatasetProfileDaoImpl implements DatasetProfileDao {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatasetProfile createOrUpdate(DatasetProfile item) {
|
public DatasetProfile createOrUpdate(DatasetProfile item) {
|
||||||
return null;
|
return this.databaseService.createOrUpdate(item,DatasetProfile.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,13 +3,13 @@ package eu.eudat.managers;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import eu.eudat.dao.entities.DMPDao;
|
import eu.eudat.dao.entities.*;
|
||||||
import eu.eudat.dao.entities.OrganisationDao;
|
|
||||||
import eu.eudat.dao.entities.ResearcherDao;
|
|
||||||
import eu.eudat.dao.entities.UserInfoDao;
|
|
||||||
import eu.eudat.entities.DMP;
|
import eu.eudat.entities.DMP;
|
||||||
|
import eu.eudat.entities.Project;
|
||||||
|
import eu.eudat.entities.UserInfo;
|
||||||
import eu.eudat.models.criteria.DataManagementPlanCriteria;
|
import eu.eudat.models.criteria.DataManagementPlanCriteria;
|
||||||
import eu.eudat.models.criteria.OrganisationCriteria;
|
import eu.eudat.models.criteria.OrganisationCriteria;
|
||||||
|
import eu.eudat.models.criteria.ProjectCriteria;
|
||||||
import eu.eudat.models.criteria.ResearcherCriteria;
|
import eu.eudat.models.criteria.ResearcherCriteria;
|
||||||
import eu.eudat.models.dmp.DataManagementPlan;
|
import eu.eudat.models.dmp.DataManagementPlan;
|
||||||
import eu.eudat.models.dmp.DataManagementPlanCriteriaRequest;
|
import eu.eudat.models.dmp.DataManagementPlanCriteriaRequest;
|
||||||
|
@ -44,11 +44,13 @@ public class DataManagementPlanManager {
|
||||||
return datamanagementPlans;
|
return datamanagementPlans;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createOrUpdate(DMPDao dmpsRepository, ResearcherDao researcherRepository, UserInfoDao userInfoDao, OrganisationDao organisationRepository, DataManagementPlan dataManagementPlan, Principal principal){
|
public static void createOrUpdate(DMPDao dmpsRepository, ProjectDao projectDao,ResearcherDao researcherRepository, UserInfoDao userInfoDao, OrganisationDao organisationRepository, DataManagementPlan dataManagementPlan, Principal principal){
|
||||||
DMP newDmp = dataManagementPlan.toDataModel();
|
DMP newDmp = dataManagementPlan.toDataModel();
|
||||||
createOrganisationsIfTheyDontExist(newDmp,organisationRepository);
|
createOrganisationsIfTheyDontExist(newDmp,organisationRepository);
|
||||||
createResearchersIfTheyDontExist(newDmp,researcherRepository);
|
createResearchersIfTheyDontExist(newDmp,researcherRepository);
|
||||||
newDmp.setCreator(userInfoDao.read(principal.getId()));
|
UserInfo user = userInfoDao.read(principal.getId());
|
||||||
|
createProjectIfItDoesntExist(newDmp,projectDao,user);
|
||||||
|
newDmp.setCreator(user);
|
||||||
dmpsRepository.createOrUpdate(newDmp);
|
dmpsRepository.createOrUpdate(newDmp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -76,4 +78,18 @@ public class DataManagementPlanManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void createProjectIfItDoesntExist(DMP newDmp,ProjectDao projectDao,UserInfo userInfo){
|
||||||
|
if(newDmp.getProject()!=null){
|
||||||
|
Project project = newDmp.getProject();
|
||||||
|
ProjectCriteria criteria = new ProjectCriteria();
|
||||||
|
criteria.setLike(project.getReference());
|
||||||
|
List<eu.eudat.entities.Project> entries = projectDao.getWithCriteria(criteria).toList();
|
||||||
|
if(entries!=null&&!entries.isEmpty())project.setId(entries.get(0).getId());
|
||||||
|
else{
|
||||||
|
project.setCreationUser(userInfo);
|
||||||
|
projectDao.createOrUpdate(project);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,10 +36,10 @@ public class DatasetWizardManager {
|
||||||
|
|
||||||
public static List<AssociatedProfile> getAvailableProfiles(DMPDao dmpRepository, DatasetProfileWizardAutocompleteRequest datasetProfileWizardAutocompleteRequest) throws InstantiationException, IllegalAccessException {
|
public static List<AssociatedProfile> getAvailableProfiles(DMPDao dmpRepository, DatasetProfileWizardAutocompleteRequest datasetProfileWizardAutocompleteRequest) throws InstantiationException, IllegalAccessException {
|
||||||
DataManagementPlan dataManagementPlan = new DomainModelConverter<eu.eudat.entities.DMP,DataManagementPlan>().fromDataModel(new LinkedList<DMP>(Arrays.asList(dmpRepository.find(datasetProfileWizardAutocompleteRequest.getCriteria().getId()))),DataManagementPlan.class).get(0);
|
DataManagementPlan dataManagementPlan = new DomainModelConverter<eu.eudat.entities.DMP,DataManagementPlan>().fromDataModel(new LinkedList<DMP>(Arrays.asList(dmpRepository.find(datasetProfileWizardAutocompleteRequest.getCriteria().getId()))),DataManagementPlan.class).get(0);
|
||||||
if(dataManagementPlan.getAssociatedProfile()==null||dataManagementPlan.getAssociatedProfile().getAssociatedProfiles()==null||dataManagementPlan.getAssociatedProfile().getAssociatedProfiles().isEmpty()){
|
if(dataManagementPlan.getProfiles()==null||dataManagementPlan.getProfiles().isEmpty()){
|
||||||
return new LinkedList<>();
|
return new LinkedList<>();
|
||||||
}
|
}
|
||||||
List<AssociatedProfile> profiles = dataManagementPlan.getAssociatedProfile().getAssociatedProfiles();
|
List<AssociatedProfile> profiles = dataManagementPlan.getProfiles();
|
||||||
return profiles.stream().filter(item->item.getLabel().contains(datasetProfileWizardAutocompleteRequest.getCriteria().getLike())).collect(Collectors.toList());
|
return profiles.stream().filter(item->item.getLabel().contains(datasetProfileWizardAutocompleteRequest.getCriteria().getLike())).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,23 @@
|
||||||
package eu.eudat.managers;
|
package eu.eudat.managers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import eu.eudat.dao.entities.ProjectDao;
|
import eu.eudat.dao.entities.ProjectDao;
|
||||||
import eu.eudat.dao.entities.UserInfoDao;
|
import eu.eudat.dao.entities.UserInfoDao;
|
||||||
import eu.eudat.models.criteria.ProjectCriteria;
|
import eu.eudat.models.criteria.ProjectCriteria;
|
||||||
|
import eu.eudat.models.external.ExternalListingItem;
|
||||||
|
import eu.eudat.models.external.ExternalSourcesItemModel;
|
||||||
|
import eu.eudat.models.external.ProjectsExternalSourcesModel;
|
||||||
import eu.eudat.models.helpers.DataTableData;
|
import eu.eudat.models.helpers.DataTableData;
|
||||||
import eu.eudat.models.project.Project;
|
import eu.eudat.models.project.Project;
|
||||||
import eu.eudat.models.project.ProjectCriteriaRequest;
|
import eu.eudat.models.project.ProjectCriteriaRequest;
|
||||||
import eu.eudat.models.project.ProjectTableRequest;
|
import eu.eudat.models.project.ProjectTableRequest;
|
||||||
import eu.eudat.models.security.Principal;
|
import eu.eudat.models.security.Principal;
|
||||||
|
import eu.eudat.proxy.config.exceptions.HugeResultSet;
|
||||||
|
import eu.eudat.proxy.config.exceptions.NoURLFound;
|
||||||
|
import eu.eudat.proxy.fetching.RemoteFetcher;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
import eu.eudat.utilities.builders.DomainModelConverter;
|
import eu.eudat.utilities.builders.DomainModelConverter;
|
||||||
|
|
||||||
|
@ -39,9 +46,21 @@ public class ProjectManager {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<eu.eudat.models.project.Project> getCriteria(ProjectDao projectRepository, ProjectCriteriaRequest projectCriteria) throws IllegalAccessException, InstantiationException{
|
public List<eu.eudat.models.project.Project> getCriteria(ProjectDao projectRepository, ProjectCriteriaRequest projectCriteria,RemoteFetcher remoteFetcher) throws IllegalAccessException, InstantiationException, HugeResultSet, NoURLFound {
|
||||||
QueryableList<eu.eudat.entities.Project> items = projectRepository.getWithCriteria(projectCriteria.getCriteria());
|
QueryableList<eu.eudat.entities.Project> items = projectRepository.getWithCriteria(projectCriteria.getCriteria());
|
||||||
List<eu.eudat.models.project.Project> projects = new DomainModelConverter<eu.eudat.entities.Project, Project>().fromDataModel(items.toList(), eu.eudat.models.project.Project.class);
|
List<eu.eudat.models.project.Project> projects = new DomainModelConverter<eu.eudat.entities.Project, Project>().fromDataModel(items.toList(), eu.eudat.models.project.Project.class);
|
||||||
|
List<Map<String,String>> remoteRepos = remoteFetcher.getProjects(projectCriteria.getCriteria().getLike());
|
||||||
|
ProjectsExternalSourcesModel projectsExternalSourcesModel = new ProjectsExternalSourcesModel().fromExternalItem(remoteRepos);
|
||||||
|
for(ExternalSourcesItemModel externalListingItem:projectsExternalSourcesModel){
|
||||||
|
eu.eudat.models.project.Project project = new eu.eudat.models.project.Project();
|
||||||
|
project.setReference(externalListingItem.getRemoteId());
|
||||||
|
project.setLabel(externalListingItem.getName());
|
||||||
|
project.setDescription(externalListingItem.getDescription());
|
||||||
|
project.setUri(externalListingItem.getUri());
|
||||||
|
project.setAbbreviation(externalListingItem.getAbbreviation());
|
||||||
|
project.setStatus((short)0);
|
||||||
|
projects.add(project);
|
||||||
|
}
|
||||||
return projects;
|
return projects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package eu.eudat.models.dataset;
|
||||||
|
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.datasetprofile.DatasetProfileListingModel;
|
import eu.eudat.models.datasetprofile.DatasetProfileListingModel;
|
||||||
import eu.eudat.models.dmp.AssociatedProfiles;
|
|
||||||
import eu.eudat.models.dmp.DataManagementPlan;
|
import eu.eudat.models.dmp.DataManagementPlan;
|
||||||
import eu.eudat.utilities.builders.DomainModelConverter;
|
import eu.eudat.utilities.builders.DomainModelConverter;
|
||||||
|
|
||||||
|
|
|
@ -10,15 +10,15 @@ import java.util.UUID;
|
||||||
* Created by ikalyvas on 12/20/2017.
|
* Created by ikalyvas on 12/20/2017.
|
||||||
*/
|
*/
|
||||||
public class AssociatedProfile implements XmlSerializable<AssociatedProfile>{
|
public class AssociatedProfile implements XmlSerializable<AssociatedProfile>{
|
||||||
private UUID profileId;
|
private UUID id;
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
public UUID getProfileId() {
|
public UUID getId() {
|
||||||
return profileId;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProfileId(UUID profileId) {
|
public void setId(UUID id) {
|
||||||
this.profileId = profileId;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
|
@ -32,14 +32,14 @@ public class AssociatedProfile implements XmlSerializable<AssociatedProfile>{
|
||||||
@Override
|
@Override
|
||||||
public Element toXml(Document doc) {
|
public Element toXml(Document doc) {
|
||||||
Element profile = doc.createElement("profile");
|
Element profile = doc.createElement("profile");
|
||||||
profile.setAttribute("profileId",this.profileId.toString());
|
profile.setAttribute("profileId",this.id.toString());
|
||||||
profile.setAttribute("label",this.label);
|
profile.setAttribute("label",this.label);
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AssociatedProfile fromXml(Element item) {
|
public AssociatedProfile fromXml(Element item) {
|
||||||
this.profileId = UUID.fromString(item.getAttribute("profileId"));
|
this.id = UUID.fromString(item.getAttribute("profileId"));
|
||||||
this.label = item.getAttribute("label");
|
this.label = item.getAttribute("label");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
package eu.eudat.models.dmp;
|
|
||||||
|
|
||||||
import eu.eudat.utilities.XmlSerializable;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
import org.w3c.dom.Node;
|
|
||||||
import org.w3c.dom.NodeList;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by ikalyvas on 12/20/2017.
|
|
||||||
*/
|
|
||||||
public class AssociatedProfiles implements XmlSerializable<AssociatedProfiles>{
|
|
||||||
List<AssociatedProfile> associatedProfiles;
|
|
||||||
|
|
||||||
public List<AssociatedProfile> getAssociatedProfiles() {
|
|
||||||
return associatedProfiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAssociatedProfiles(List<AssociatedProfile> associatedProfiles) {
|
|
||||||
this.associatedProfiles = associatedProfiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Element toXml(Document doc) {
|
|
||||||
Element associatedProfilesElement = doc.createElement("profiles");
|
|
||||||
for(AssociatedProfile associatedProfile:associatedProfiles){
|
|
||||||
associatedProfilesElement.appendChild(associatedProfile.toXml(doc));
|
|
||||||
}
|
|
||||||
return associatedProfilesElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AssociatedProfiles fromXml(Element item) {
|
|
||||||
this.associatedProfiles = new LinkedList<>();
|
|
||||||
if(item!=null){
|
|
||||||
NodeList associatedProfilesElement = item.getChildNodes();
|
|
||||||
for (int temp = 0; temp < associatedProfilesElement.getLength(); temp++) {
|
|
||||||
Node associatedProfileElement = associatedProfilesElement.item(temp);
|
|
||||||
if (associatedProfileElement.getNodeType() == Node.ELEMENT_NODE) {
|
|
||||||
this.associatedProfiles.add(new AssociatedProfile().fromXml((Element)associatedProfileElement));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,10 +2,14 @@ package eu.eudat.models.dmp;
|
||||||
|
|
||||||
import eu.eudat.entities.*;
|
import eu.eudat.entities.*;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
|
import eu.eudat.models.project.*;
|
||||||
|
import eu.eudat.models.project.Project;
|
||||||
import eu.eudat.utilities.builders.DomainModelConverter;
|
import eu.eudat.utilities.builders.DomainModelConverter;
|
||||||
import eu.eudat.utilities.builders.XmlBuilder;
|
import eu.eudat.utilities.builders.XmlBuilder;
|
||||||
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.NodeList;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collector;
|
import java.util.stream.Collector;
|
||||||
|
@ -18,8 +22,8 @@ public class DataManagementPlan implements DataModel<DMP>{
|
||||||
private int version;
|
private int version;
|
||||||
private int status;
|
private int status;
|
||||||
private String description;
|
private String description;
|
||||||
private AssociatedProfiles associatedProfile;
|
private List<AssociatedProfile> profiles;
|
||||||
private eu.eudat.models.dmp.Project project;
|
private eu.eudat.models.project.Project project;
|
||||||
private List<Organisation> organisations;
|
private List<Organisation> organisations;
|
||||||
private List<Researcher> researchers;
|
private List<Researcher> researchers;
|
||||||
private UserInfo creator;
|
private UserInfo creator;
|
||||||
|
@ -80,11 +84,11 @@ public class DataManagementPlan implements DataModel<DMP>{
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public eu.eudat.models.dmp.Project getProject() {
|
public Project getProject() {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProject(eu.eudat.models.dmp.Project project) {
|
public void setProject(Project project) {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,12 +100,12 @@ public class DataManagementPlan implements DataModel<DMP>{
|
||||||
this.creator = creator;
|
this.creator = creator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssociatedProfiles getAssociatedProfile() {
|
public List<AssociatedProfile> getProfiles() {
|
||||||
return associatedProfile;
|
return profiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAssociatedProfile(AssociatedProfiles associatedProfile) {
|
public void setProfiles(List<AssociatedProfile> profiles) {
|
||||||
this.associatedProfile = associatedProfile;
|
this.profiles = profiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreated() {
|
public Date getCreated() {
|
||||||
|
@ -128,15 +132,24 @@ public class DataManagementPlan implements DataModel<DMP>{
|
||||||
this.version = entity.getVersion();
|
this.version = entity.getVersion();
|
||||||
this.previous = entity.getPrevious();
|
this.previous = entity.getPrevious();
|
||||||
this.label = entity.getLabel();
|
this.label = entity.getLabel();
|
||||||
this.project = new eu.eudat.models.dmp.Project();
|
this.project = new Project();
|
||||||
this.project.fromDataModel(entity.getProject());
|
this.project.fromDataModel(entity.getProject());
|
||||||
this.creator = new eu.eudat.models.dmp.UserInfo();
|
this.creator = new eu.eudat.models.dmp.UserInfo();
|
||||||
if(entity.getCreator()!=null)this.creator.fromDataModel(entity.getCreator());
|
if(entity.getCreator()!=null)this.creator.fromDataModel(entity.getCreator());
|
||||||
|
|
||||||
if(entity.getAssociatedDmps()!=null&&!entity.getAssociatedDmps().isEmpty()){
|
if(entity.getAssociatedDmps()!=null&&!entity.getAssociatedDmps().isEmpty()){
|
||||||
Document viewStyleDoc = XmlBuilder.fromXml(entity.getAssociatedDmps());
|
Document viewStyleDoc = XmlBuilder.fromXml(entity.getAssociatedDmps());
|
||||||
Element root = (Element)viewStyleDoc.getDocumentElement();
|
Element item = (Element) viewStyleDoc.getElementsByTagName("profiles").item(0);
|
||||||
this.associatedProfile = new AssociatedProfiles().fromXml(root);
|
this.profiles = new LinkedList<>();
|
||||||
|
if(item!=null){
|
||||||
|
NodeList associatedProfilesElement = item.getChildNodes();
|
||||||
|
for (int temp = 0; temp < associatedProfilesElement.getLength(); temp++) {
|
||||||
|
Node associatedProfileElement = associatedProfilesElement.item(temp);
|
||||||
|
if (associatedProfileElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
|
this.profiles.add(new AssociatedProfile().fromXml((Element)associatedProfileElement));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.created = entity.getCreated();
|
this.created = entity.getCreated();
|
||||||
this.description = entity.getDescription();
|
this.description = entity.getDescription();
|
||||||
|
@ -154,10 +167,13 @@ public class DataManagementPlan implements DataModel<DMP>{
|
||||||
dataManagementPlanEntity.setProject(this.project.toDataModel());
|
dataManagementPlanEntity.setProject(this.project.toDataModel());
|
||||||
dataManagementPlanEntity.setStatus((short)this.status);
|
dataManagementPlanEntity.setStatus((short)this.status);
|
||||||
dataManagementPlanEntity.setDescription(this.description);
|
dataManagementPlanEntity.setDescription(this.description);
|
||||||
if(this.associatedProfile!=null) {
|
if(this.profiles!=null) {
|
||||||
Document associatedProfileDoc = XmlBuilder.getDocument();
|
Document associatedProfileDoc = XmlBuilder.getDocument();
|
||||||
Element associatedProfileElement = this.associatedProfile.toXml(associatedProfileDoc);
|
Element associatedProfilesElement = associatedProfileDoc.createElement("profiles");
|
||||||
associatedProfileDoc.appendChild(associatedProfileElement);
|
for(AssociatedProfile associatedProfile:this.profiles){
|
||||||
|
associatedProfilesElement.appendChild(associatedProfile.toXml(associatedProfileDoc));
|
||||||
|
}
|
||||||
|
associatedProfileDoc.appendChild(associatedProfilesElement);
|
||||||
dataManagementPlanEntity.setAssociatedDmps(XmlBuilder.generateXml(associatedProfileDoc));
|
dataManagementPlanEntity.setAssociatedDmps(XmlBuilder.generateXml(associatedProfileDoc));
|
||||||
}
|
}
|
||||||
dataManagementPlanEntity.setCreated(this.created!=null?this.created:new Date());
|
dataManagementPlanEntity.setCreated(this.created!=null?this.created:new Date());
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
package eu.eudat.models.dmp;
|
|
||||||
|
|
||||||
import eu.eudat.models.DataModel;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class Project implements DataModel<eu.eudat.entities.Project>{
|
|
||||||
private UUID id;
|
|
||||||
private String label;
|
|
||||||
public UUID getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(UUID id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLabel(String label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fromDataModel(eu.eudat.entities.Project entity) {
|
|
||||||
this.id = entity.getId();
|
|
||||||
this.label = entity.getLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public eu.eudat.entities.Project toDataModel() {
|
|
||||||
eu.eudat.entities.Project project = new eu.eudat.entities.Project();
|
|
||||||
project.setId(this.id);
|
|
||||||
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,8 +6,10 @@ package eu.eudat.models.external;
|
||||||
public class ExternalSourcesItemModel{
|
public class ExternalSourcesItemModel{
|
||||||
private String id;
|
private String id;
|
||||||
private String name;
|
private String name;
|
||||||
private String label;
|
private String description;
|
||||||
|
private String uri;
|
||||||
|
private String remoteId;
|
||||||
|
private String abbreviation;
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -24,11 +26,35 @@ public class ExternalSourcesItemModel{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLabel() {
|
public String getDescription() {
|
||||||
return label;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLabel(String label) {
|
public void setDescription(String description) {
|
||||||
this.label = label;
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUri(String uri) {
|
||||||
|
this.uri = uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemoteId() {
|
||||||
|
return remoteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemoteId(String remoteId) {
|
||||||
|
this.remoteId = remoteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAbbreviation() {
|
||||||
|
return abbreviation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAbbreviation(String abbreviation) {
|
||||||
|
this.abbreviation = abbreviation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class OrganisationsExternalSourcesModel extends ExternalListingItem<Organ
|
||||||
for(Map<String,String> item : values){
|
for(Map<String,String> item : values){
|
||||||
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
||||||
model.setId(item.get("pid"));
|
model.setId(item.get("pid"));
|
||||||
model.setLabel(item.get("uri"));
|
model.setUri(item.get("uri"));
|
||||||
model.setName(item.get("name"));
|
model.setName(item.get("name"));
|
||||||
this.add(model);
|
this.add(model);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,10 @@ public class ProjectsExternalSourcesModel extends ExternalListingItem<ProjectsEx
|
||||||
public ProjectsExternalSourcesModel fromExternalItem(List<Map<String,String>> values) {
|
public ProjectsExternalSourcesModel fromExternalItem(List<Map<String,String>> values) {
|
||||||
for(Map<String,String> item : values){
|
for(Map<String,String> item : values){
|
||||||
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
||||||
model.setId(item.get("pid"));
|
model.setRemoteId(item.get("pid"));
|
||||||
model.setLabel(item.get("uri"));
|
model.setUri(item.get("uri"));
|
||||||
model.setName(item.get("name"));
|
model.setName(item.get("name"));
|
||||||
|
model.setDescription(item.get("description"));
|
||||||
this.add(model);
|
this.add(model);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class RegistriesExternalSourcesModel extends ExternalListingItem<Registri
|
||||||
for(Map<String,String> item : values){
|
for(Map<String,String> item : values){
|
||||||
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
||||||
model.setId(item.get("pid"));
|
model.setId(item.get("pid"));
|
||||||
model.setLabel(item.get("uri"));
|
model.setUri(item.get("uri"));
|
||||||
model.setName(item.get("name"));
|
model.setName(item.get("name"));
|
||||||
this.add(model);
|
this.add(model);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class ResearchersExternalSourcesModel extends ExternalListingItem<Researc
|
||||||
for(Map<String,String> item : values){
|
for(Map<String,String> item : values){
|
||||||
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
||||||
model.setId(item.get("pid"));
|
model.setId(item.get("pid"));
|
||||||
model.setLabel(item.get("uri"));
|
model.setUri(item.get("uri"));
|
||||||
model.setName(item.get("name"));
|
model.setName(item.get("name"));
|
||||||
this.add(model);
|
this.add(model);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class ServiceExternalSourcesModel extends ExternalListingItem<ServiceExte
|
||||||
for(Map<String,String> item : values){
|
for(Map<String,String> item : values){
|
||||||
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
||||||
model.setId(item.get("pid"));
|
model.setId(item.get("pid"));
|
||||||
model.setLabel(item.get("label"));
|
model.setUri(item.get("label"));
|
||||||
model.setName(item.get("name"));
|
model.setName(item.get("name"));
|
||||||
this.add(model);
|
this.add(model);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,13 @@ import { Serializable } from "../Serializable";
|
||||||
|
|
||||||
export class ProfileModel implements Serializable<ProfileModel> {
|
export class ProfileModel implements Serializable<ProfileModel> {
|
||||||
public id: String;
|
public id: String;
|
||||||
public name: String;
|
public label: String;
|
||||||
public description: String;
|
public description: String;
|
||||||
public reference: String;
|
public reference: String;
|
||||||
|
|
||||||
fromJSONObject(item: any): ProfileModel {
|
fromJSONObject(item: any): ProfileModel {
|
||||||
this.id = item.id;
|
this.id = item.id;
|
||||||
this.name = item.name;
|
this.label = item.label;
|
||||||
this.description = item.abbreviation;
|
this.description = item.abbreviation;
|
||||||
this.reference = item.reference;
|
this.reference = item.reference;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue