Merge remote-tracking branch 'origin/semantics' into Development
This commit is contained in:
commit
89922eaecc
|
@ -34,7 +34,7 @@
|
|||
<dependency>
|
||||
<groupId>gr.cite.opendmp</groupId>
|
||||
<artifactId>repositorydepositbase</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
|
|
@ -190,8 +190,10 @@ public class Admin extends BaseController {
|
|||
.status(ApiMessageCode.SUCCESS_MESSAGE).message(""));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getRDACommonStandards"}, produces = "application/json")
|
||||
public ResponseEntity getRDACommonStandards(@ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<String>>().status(ApiMessageCode.SUCCESS_MESSAGE).payload(configLoader.getRdaProperties()));
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getSchematics"}, produces = "application/json")
|
||||
public ResponseEntity<ResponseItem<List<String>>> getSchematics(@RequestParam(value = "query", required = false) String query, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) {
|
||||
List<String> schematics = this.datasetProfileManager.getSchematics(query);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<String>>().status(ApiMessageCode.SUCCESS_MESSAGE).payload(schematics));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,10 @@ import eu.eudat.data.entities.DMP;
|
|||
import eu.eudat.data.entities.Dataset;
|
||||
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
|
||||
import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest;
|
||||
import eu.eudat.data.query.items.table.dmp.DataManagmentPlanPublicTableRequest;
|
||||
import eu.eudat.exceptions.datamanagementplan.DMPNewVersionException;
|
||||
import eu.eudat.exceptions.datamanagementplan.DMPWithDatasetsDeleteException;
|
||||
import eu.eudat.exceptions.security.UnauthorisedException;
|
||||
import eu.eudat.logic.managers.DataManagementPlanManager;
|
||||
import eu.eudat.logic.managers.DatasetManager;
|
||||
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
|
||||
import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
|
@ -152,7 +150,7 @@ public class DMPs extends BaseController {
|
|||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/publicOverview/{id}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity getOverviewSinglePublic(@PathVariable String id, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws Exception {
|
||||
ResponseEntity<ResponseItem<DataManagementPlanOverviewModel>> getOverviewSinglePublic(@PathVariable String id, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws Exception {
|
||||
// try {
|
||||
DataManagementPlanOverviewModel dataManagementPlan = this.dataManagementPlanManager.getOverviewSingle(id, principal, true);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlanOverviewModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlan));
|
||||
|
@ -184,7 +182,21 @@ public class DMPs extends BaseController {
|
|||
public @ResponseBody
|
||||
ResponseEntity getRDAJsonDocument(@PathVariable String id, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) {
|
||||
try {
|
||||
return this.dataManagementPlanManager.getRDAJsonDocument(id, principal);
|
||||
FileEnvelope rdaJsonDocument = this.dataManagementPlanManager.getRDAJsonDocument(id, principal);
|
||||
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
responseHeaders.setContentLength(rdaJsonDocument.getFile().length());
|
||||
responseHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
responseHeaders.set("Content-Disposition", "attachment;filename=" + rdaJsonDocument.getFilename());
|
||||
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
|
||||
|
||||
InputStream resource = new FileInputStream(rdaJsonDocument.getFile());
|
||||
byte[] content = org.apache.poi.util.IOUtils.toByteArray(resource);
|
||||
resource.close();
|
||||
Files.deleteIfExists(rdaJsonDocument.getFile().toPath());
|
||||
|
||||
return new ResponseEntity<>(content, responseHeaders, HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.status(HttpStatus.EXPECTATION_FAILED).body(new ResponseItem<>().message(e.getMessage()).status(ApiMessageCode.ERROR_MESSAGE));
|
||||
}
|
||||
|
@ -321,21 +333,6 @@ public class DMPs extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* DOI Generation
|
||||
* */
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/createZenodoDoi/{id}"})
|
||||
public ResponseEntity<ResponseItem<String>> createZenodoDoi(@PathVariable String id, Principal principal) {
|
||||
try {
|
||||
String zenodoDOI = this.dataManagementPlanManager.createZenodoDoi(UUID.fromString(id), principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<String>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully created DOI for Data Datamanagement Plan in question.").payload(zenodoDOI));
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<String>().status(ApiMessageCode.ERROR_MESSAGE).message("Failed to create DOI for the Data Management Plan: " + e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Data Index
|
||||
* */
|
||||
|
|
|
@ -117,7 +117,7 @@ public class Datasets extends BaseController {
|
|||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/publicOverview/{id}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity getOverviewSinglePublic(@PathVariable String id, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws Exception {
|
||||
ResponseEntity<ResponseItem<DatasetOverviewModel>> getOverviewSinglePublic(@PathVariable String id, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws Exception {
|
||||
// try {
|
||||
DatasetOverviewModel dataset = this.datasetManager.getOverviewSingle(id, principal, true);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetOverviewModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataset));
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.exceptions.datasetprofile.DatasetProfileNewVersionException;
|
||||
import eu.eudat.logic.managers.DatasetProfileManager;
|
||||
import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.admin.composite.DatasetProfile;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import static eu.eudat.types.Authorities.ADMIN;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/management/"})
|
||||
public class ManagementController extends BaseController {
|
||||
|
||||
private DatasetProfileManager datasetProfileManager;
|
||||
|
||||
@Autowired
|
||||
public ManagementController(ApiContext apiContext, DatasetProfileManager datasetProfileManager){
|
||||
super(apiContext);
|
||||
this.datasetProfileManager = datasetProfileManager;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/addSchematics"})
|
||||
public ResponseEntity addSchematicsInDatasetProfiles(@ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
|
||||
try {
|
||||
this.datasetProfileManager.addSchematicsInDatasetProfiles();
|
||||
return ResponseEntity.status(HttpStatus.OK).body(null);
|
||||
} catch (Exception exception) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<Void>().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -88,16 +88,6 @@ public class Users extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<UserListingModel>>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/hasDOIToken"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Boolean>> hasDOIToken(Principal principal) throws NullEmailException {
|
||||
try {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Boolean>().payload(this.userManager.isDOITokenValid(principal)).status(ApiMessageCode.NO_MESSAGE));
|
||||
} catch (NonValidTokenException | ExpiredTokenException | IOException e) {
|
||||
return ResponseEntity.status(460).body(new ResponseItem<Boolean>().payload(false).status(ApiMessageCode.ERROR_MESSAGE).message(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/registerDOIToken"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
|
|
|
@ -481,6 +481,7 @@ public class DataManagementPlanManager {
|
|||
checkDmpValidationRules(newDmp);
|
||||
}
|
||||
UserInfo user = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());
|
||||
newDmp.setCreator(user);
|
||||
|
||||
createOrganisationsIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getOrganisationDao());
|
||||
createResearchersIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao(), user);
|
||||
|
@ -645,6 +646,7 @@ public class DataManagementPlanManager {
|
|||
if (latestVersionDMP.get(0).getVersion().equals(oldDmp.getVersion())) {
|
||||
DMP newDmp = dataManagementPlan.toDataModel();
|
||||
UserInfo user = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(principal.getId()).build();
|
||||
newDmp.setCreator(user);
|
||||
createOrganisationsIfTheyDontExist(newDmp, databaseRepository.getOrganisationDao());
|
||||
createResearchersIfTheyDontExist(newDmp, databaseRepository.getResearcherDao(), user);
|
||||
|
||||
|
@ -705,6 +707,7 @@ public class DataManagementPlanManager {
|
|||
DMP newDmp = dataManagementPlan.toDataModel();
|
||||
|
||||
UserInfo user = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(principal.getId()).build();
|
||||
newDmp.setCreator(user);
|
||||
createOrganisationsIfTheyDontExist(newDmp, databaseRepository.getOrganisationDao());
|
||||
createResearchersIfTheyDontExist(newDmp, databaseRepository.getResearcherDao(), user);
|
||||
|
||||
|
@ -1064,9 +1067,6 @@ public class DataManagementPlanManager {
|
|||
});
|
||||
UserInfo user = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());
|
||||
sendNotification(dmp, user, NotificationType.DMP_PUBLISH);
|
||||
// if (dmp.getDois() != null && !dmp.getDois().isEmpty()) {
|
||||
// this.createZenodoDoi(dmp.getId(), principal, true);
|
||||
// }
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
@ -1456,6 +1456,40 @@ public class DataManagementPlanManager {
|
|||
}
|
||||
dmpElement.appendChild(dmpProfileElement);
|
||||
|
||||
Element dmpContactElement = xmlDoc.createElement("contact");
|
||||
Element dmpContactName = xmlDoc.createElement("name");
|
||||
Element dmpContactEmail = xmlDoc.createElement("email");
|
||||
if(dmp.getCreator() != null){
|
||||
dmpContactName.setTextContent(dmp.getCreator().getName());
|
||||
dmpContactEmail.setTextContent(dmp.getCreator().getEmail());
|
||||
}
|
||||
else{
|
||||
Iterator<UserDMP> users = dmp.getUsers().iterator();
|
||||
if(users.hasNext()){
|
||||
UserDMP creator = users.next();
|
||||
dmpContactName.setTextContent(creator.getUser().getName());
|
||||
dmpContactEmail.setTextContent(creator.getUser().getEmail());
|
||||
}
|
||||
}
|
||||
dmpContactElement.appendChild(dmpContactName);
|
||||
dmpContactElement.appendChild(dmpContactEmail);
|
||||
dmpElement.appendChild(dmpContactElement);
|
||||
|
||||
Element dmpContributorsElement = xmlDoc.createElement("contributors");
|
||||
Iterator<UserDMP> users = dmp.getUsers().iterator();
|
||||
while(users.hasNext()){
|
||||
Element dmpContributorElement = xmlDoc.createElement("contributor");
|
||||
Element dmpContributorName = xmlDoc.createElement("name");
|
||||
Element dmpContributorEmail= xmlDoc.createElement("email");
|
||||
UserDMP contributor = users.next();
|
||||
dmpContributorName.setTextContent(contributor.getUser().getName());
|
||||
dmpContributorEmail.setTextContent(contributor.getUser().getEmail());
|
||||
dmpContributorElement.appendChild(dmpContributorName);
|
||||
dmpContributorElement.appendChild(dmpContributorEmail);
|
||||
dmpContributorsElement.appendChild(dmpContributorElement);
|
||||
}
|
||||
dmpElement.appendChild(dmpContributorsElement);
|
||||
|
||||
// Funder.
|
||||
Element funder = xmlDoc.createElement("funder");
|
||||
Element funderLabel = xmlDoc.createElement("label");
|
||||
|
@ -1464,6 +1498,13 @@ public class DataManagementPlanManager {
|
|||
funderId.setTextContent(dmp.getGrant().getFunder().getId().toString());
|
||||
funder.appendChild(funderLabel);
|
||||
funder.appendChild(funderId);
|
||||
if(dmp.getGrant().getFunder().getReference() != null){
|
||||
String referencePrefix = dmp.getGrant().getFunder().getReference().split(":")[0];
|
||||
String shortReference = dmp.getGrant().getFunder().getReference().substring(referencePrefix.length() + 1);
|
||||
Element funderReference = xmlDoc.createElement("reference");
|
||||
funderReference.setTextContent(shortReference);
|
||||
funder.appendChild(funderReference);
|
||||
}
|
||||
dmpElement.appendChild(funder);
|
||||
// Grant.
|
||||
Element grant = xmlDoc.createElement("grant");
|
||||
|
@ -1473,15 +1514,31 @@ public class DataManagementPlanManager {
|
|||
grantId.setTextContent(dmp.getGrant().getId().toString());
|
||||
grant.appendChild(grantLabel);
|
||||
grant.appendChild(grantId);
|
||||
if(dmp.getGrant().getReference() != null) {
|
||||
String referencePrefix = dmp.getGrant().getReference().split(":")[0];
|
||||
String shortReference = dmp.getGrant().getReference().substring(referencePrefix.length() + 1);
|
||||
Element grantReference = xmlDoc.createElement("reference");
|
||||
grantReference.setTextContent(shortReference);
|
||||
grant.appendChild(grantReference);
|
||||
}
|
||||
dmpElement.appendChild(grant);
|
||||
// Project.
|
||||
Element project = xmlDoc.createElement("project");
|
||||
Element projectLabel = xmlDoc.createElement("label");
|
||||
Element projectId = xmlDoc.createElement("id");
|
||||
projectLabel.setTextContent(dmp.getProject().getLabel());
|
||||
Element projectLabel = xmlDoc.createElement("label");
|
||||
Element projectDescription = xmlDoc.createElement("description");
|
||||
Element projectStartDate = xmlDoc.createElement("start");
|
||||
Element projectEndDate = xmlDoc.createElement("end");
|
||||
projectId.setTextContent(dmp.getProject().getId().toString());
|
||||
project.appendChild(projectLabel);
|
||||
projectLabel.setTextContent(dmp.getProject().getLabel());
|
||||
projectDescription.setTextContent(dmp.getProject().getDescription());
|
||||
projectStartDate.setTextContent(dmp.getProject().getStartdate().toString());
|
||||
projectEndDate.setTextContent(dmp.getProject().getEnddate().toString());
|
||||
project.appendChild(projectId);
|
||||
project.appendChild(projectLabel);
|
||||
project.appendChild(projectDescription);
|
||||
project.appendChild(projectStartDate);
|
||||
project.appendChild(projectEndDate);
|
||||
dmpElement.appendChild(project);
|
||||
|
||||
Element organisationsElement = xmlDoc.createElement("organisations");
|
||||
|
@ -1513,11 +1570,20 @@ public class DataManagementPlanManager {
|
|||
|
||||
for (Dataset dataset : datasets) {
|
||||
Element datasetElement = xmlDoc.createElement("dataset");
|
||||
Element datsetProfileElement = xmlDoc.createElement("profile");
|
||||
datasetElement.setAttribute("name", dataset.getLabel());
|
||||
|
||||
Element datasetDescriptionElement = xmlDoc.createElement("description");
|
||||
datasetElement.appendChild(datasetDescriptionElement);
|
||||
datasetDescriptionElement.setTextContent(dataset.getDescription());
|
||||
|
||||
Element datsetProfileElement = xmlDoc.createElement("profile-id");
|
||||
datasetElement.appendChild(datsetProfileElement);
|
||||
datsetProfileElement.setTextContent(dataset.getProfile().getId().toString());
|
||||
|
||||
Element datsetProfileLabelElement = xmlDoc.createElement("profile-label");
|
||||
datasetElement.appendChild(datsetProfileLabelElement);
|
||||
datsetProfileLabelElement.setTextContent(dataset.getProfile().getLabel());
|
||||
|
||||
DatasetWizardModel datasetWizardModel = new DatasetWizardModel();
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
if (dataset.getProperties() != null) {
|
||||
|
@ -1535,12 +1601,18 @@ public class DataManagementPlanManager {
|
|||
// Get DatasetProfiles from DMP to add to XML.
|
||||
for (DatasetProfile datasetProfile : dmp.getAssociatedDmps()) {
|
||||
Element profile = xmlDoc.createElement("profile");
|
||||
Element profileLabel = xmlDoc.createElement("profilelabel");
|
||||
profileLabel.setTextContent(datasetProfile.getLabel());
|
||||
profile.appendChild(profileLabel);
|
||||
Element profileId = xmlDoc.createElement("profileId");
|
||||
profileId.setTextContent(datasetProfile.getId().toString());
|
||||
profile.appendChild(profileId);
|
||||
Element profileGroupId = xmlDoc.createElement("profileGroupId");
|
||||
profileGroupId.setTextContent(datasetProfile.getGroupId().toString());
|
||||
profile.appendChild(profileGroupId);
|
||||
Element profileLabel = xmlDoc.createElement("profileLabel");
|
||||
profileLabel.setTextContent(datasetProfile.getLabel());
|
||||
profile.appendChild(profileLabel);
|
||||
Element profileVersion = xmlDoc.createElement("profileVersion");
|
||||
profileVersion.setTextContent(String.valueOf(datasetProfile.getVersion()));
|
||||
profile.appendChild(profileVersion);
|
||||
profiles.appendChild(profile);
|
||||
}
|
||||
dmpElement.appendChild(profiles);
|
||||
|
@ -1556,13 +1628,12 @@ public class DataManagementPlanManager {
|
|||
return fileEnvelope;
|
||||
}
|
||||
|
||||
public ResponseEntity<byte[]> getRDAJsonDocument(String id, Principal principal) throws Exception {
|
||||
public FileEnvelope getRDAJsonDocument(String id, Principal principal) throws Exception {
|
||||
eu.eudat.data.entities.DMP dmp = databaseRepository.getDmpDao().find(UUID.fromString(id));
|
||||
if (!dmp.isPublic() && dmp.getUsers().stream().noneMatch(userInfo -> userInfo.getUser().getId() == principal.getId()))
|
||||
throw new UnauthorisedException();
|
||||
// RDAExportModel rdaExportModel = new RDAExportModel().fromDataModel(dmp, datasetManager, principal);
|
||||
final Boolean isFinalized = dmp.getStatus() == DMP.DMPStatus.FINALISED.getValue();
|
||||
final Boolean isPublic = dmp.isPublic();
|
||||
final boolean isFinalized = dmp.getStatus() == DMP.DMPStatus.FINALISED.getValue();
|
||||
final boolean isPublic = dmp.isPublic();
|
||||
dmp.setDataset(dmp.getDataset().stream()
|
||||
.filter(dataset -> dataset.getStatus() != Dataset.Status.DELETED.getValue() &&
|
||||
dataset.getStatus() != Dataset.Status.CANCELED.getValue())
|
||||
|
@ -1570,15 +1641,12 @@ public class DataManagementPlanManager {
|
|||
.collect(Collectors.toSet()));
|
||||
String result = rdaManager.convertToRDA(dmp);
|
||||
|
||||
/*ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);*/
|
||||
String fileName = "DMP_" + dmp.getGrant().getLabel() + "_" + dmp.getVersion();//dmp.getLabel();
|
||||
String fileName = "DMP_" + dmp.getGrant().getLabel() + "_" + dmp.getVersion();
|
||||
fileName = fileName.replaceAll("[^a-zA-Z0-9+ ]", "").replace(" ", "_").replace(",", "_");
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
File file = new File(this.environment.getProperty("temp.temp") + uuid + ".json");
|
||||
OutputStream output = new FileOutputStream(file);
|
||||
try {
|
||||
// mapper.writeValue(file, rdaExportModel);
|
||||
output.write(result.getBytes());
|
||||
output.flush();
|
||||
output.close();
|
||||
|
@ -1586,18 +1654,10 @@ public class DataManagementPlanManager {
|
|||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
InputStream resource = new FileInputStream(file);
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
responseHeaders.setContentLength(file.length());
|
||||
responseHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
responseHeaders.set("Content-Disposition", "attachment;filename=" + fileName + ".json");
|
||||
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
|
||||
|
||||
byte[] content = org.apache.poi.util.IOUtils.toByteArray(resource);
|
||||
resource.close();
|
||||
Files.deleteIfExists(file.toPath());
|
||||
return new ResponseEntity<>(content, responseHeaders, HttpStatus.OK);
|
||||
FileEnvelope rdaJsonDocument = new FileEnvelope();
|
||||
rdaJsonDocument.setFilename(fileName + ".json");
|
||||
rdaJsonDocument.setFile(file);
|
||||
return rdaJsonDocument;
|
||||
}
|
||||
|
||||
public ResponseEntity<byte[]> getDocument(String id, String contentType, Principal principal, ConfigLoader configLoader) throws InstantiationException, IllegalAccessException, IOException {
|
||||
|
@ -2041,100 +2101,6 @@ public class DataManagementPlanManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
private String getUnpublishedDOI(String DOI, String token, Integer version) {
|
||||
try {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
Map createResponse = null;
|
||||
LinkedHashMap<String, String> links = null;
|
||||
LinkedHashMap<String, String> metadata = null;
|
||||
String listUrl = this.environment.getProperty("zenodo.url") + "deposit/depositions" + "?q=conceptdoi:\"" + DOI + "\"&access_token=" + token;
|
||||
ResponseEntity<Map[]> listResponses = restTemplate.getForEntity(listUrl, Map[].class);
|
||||
createResponse = listResponses.getBody()[0];
|
||||
metadata = (LinkedHashMap<String, String>) createResponse.get("metadata");
|
||||
links = (LinkedHashMap<String, String>) createResponse.get("links");
|
||||
|
||||
if (metadata.get("version").equals(version.toString())) {
|
||||
return links.get("publish");
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}catch (Exception e) {
|
||||
logger.warn(e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String createZenodoDoi(UUID id, Principal principal) throws Exception {
|
||||
return this.createZenodoDoi(id, principal, false);
|
||||
}
|
||||
|
||||
public String createZenodoDoi(UUID id, Principal principal, boolean update) throws Exception {
|
||||
DMP dmp = this.apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(id);
|
||||
if (!isUserOwnerOfDmp(dmp, principal))
|
||||
throw new Exception("User is not authorized to invoke this action");
|
||||
if (!dmp.getStatus().equals(DMP.DMPStatus.FINALISED.getValue()))
|
||||
throw new Exception("DMP is not finalized");
|
||||
/*if (dmp.getDoi() != null)
|
||||
throw new Exception("DMP already has a DOI");*/
|
||||
|
||||
FileEnvelope file = getWordDocument(id.toString(), principal, configLoader);
|
||||
String name = file.getFilename().substring(0, file.getFilename().length() - 5);
|
||||
File pdfFile = PDFUtils.convertToPDF(file, environment);
|
||||
String fileName = name + ".pdf";
|
||||
ResponseEntity<byte[]> jsonFile;
|
||||
try {
|
||||
jsonFile = getRDAJsonDocument(id.toString(), principal);
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
String previousDOI = this.getPreviousDOI(dmp.getGroupId(), dmp.getId(), "Zenodo");
|
||||
|
||||
File supportingFilesZip = this.createSupportingFilesZip(dmp);
|
||||
|
||||
DMPDepositModel dmpDepositModel = DMPToDepositMapper.fromDMP(dmp, pdfFile, fileName, jsonFile, supportingFilesZip, previousDOI);
|
||||
|
||||
String zenodoToken = "";
|
||||
try {
|
||||
if (this.userManager.isDOITokenValid(principal)) {
|
||||
zenodoToken = principal.getZenodoToken();
|
||||
}
|
||||
} catch (NonValidTokenException e) {
|
||||
zenodoToken = this.environment.getProperty("zenodo.access_token");
|
||||
}
|
||||
|
||||
String finalDoi = null;
|
||||
for(RepositoryDeposit repo: this.repositoriesDeposit) { //temp
|
||||
if(repo.getConfiguration().getRepositoryId().equals("Zenodo")) {
|
||||
finalDoi = repo.deposit(dmpDepositModel, zenodoToken);
|
||||
if (finalDoi != null) {
|
||||
EntityDoi doiEntity = new EntityDoi();
|
||||
doiEntity.setId(UUID.randomUUID());
|
||||
doiEntity.setEntityType(EntityDoi.EntityType.DMP);
|
||||
doiEntity.setDoi(finalDoi);
|
||||
doiEntity.setRepositoryId("Zenodo");
|
||||
Date now = new Date();
|
||||
doiEntity.setCreatedAt(now);
|
||||
doiEntity.setUpdatedAt(now);
|
||||
doiEntity.setEntityId(dmp);
|
||||
apiContext.getOperationsContext().getDatabaseRepository().getEntityDoiDao().createOrUpdate(doiEntity);
|
||||
|
||||
dmp.getDois().add(doiEntity);
|
||||
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(dmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(supportingFilesZip != null) {
|
||||
Files.deleteIfExists(supportingFilesZip.toPath());
|
||||
}
|
||||
Files.deleteIfExists(pdfFile.toPath());
|
||||
Files.deleteIfExists(file.getFile().toPath());
|
||||
|
||||
return finalDoi;
|
||||
}
|
||||
|
||||
public Doi createDoi(DepositRequest depositRequest, Principal principal) throws Exception {
|
||||
DMP dmp = this.apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(UUID.fromString(depositRequest.getDmpId()));
|
||||
if (!isUserOwnerOfDmp(dmp, principal))
|
||||
|
@ -2147,18 +2113,22 @@ public class DataManagementPlanManager {
|
|||
FileEnvelope file = getWordDocument(depositRequest.getDmpId(), principal, configLoader);
|
||||
String name = file.getFilename().substring(0, file.getFilename().length() - 5).replaceAll("[^a-zA-Z0-9_+ ]", "").replace(" ", "_").replace(",", "_");
|
||||
File pdfFile = PDFUtils.convertToPDF(file, environment);
|
||||
String fileName = name + ".pdf";
|
||||
ResponseEntity<byte[]> jsonFile;
|
||||
eu.eudat.depositinterface.models.FileEnvelope pdfEnvelope = new eu.eudat.depositinterface.models.FileEnvelope();
|
||||
pdfEnvelope.setFile(pdfFile);
|
||||
pdfEnvelope.setFilename(name + ".pdf");
|
||||
eu.eudat.depositinterface.models.FileEnvelope rdaJsonFile = new eu.eudat.depositinterface.models.FileEnvelope();
|
||||
try {
|
||||
jsonFile = getRDAJsonDocument(depositRequest.getDmpId(), principal);
|
||||
FileEnvelope rdaJsonDocument = getRDAJsonDocument(depositRequest.getDmpId(), principal);
|
||||
rdaJsonFile.setFile(rdaJsonDocument.getFile());
|
||||
rdaJsonFile.setFilename(rdaJsonDocument.getFilename());
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
String previousDOI = this.getPreviousDOI(dmp.getGroupId(), dmp.getId(), depositRequest.getRepositoryId());
|
||||
|
||||
File supportingFilesZip = this.createSupportingFilesZip(dmp);
|
||||
|
||||
DMPDepositModel dmpDepositModel = DMPToDepositMapper.fromDMP(dmp, pdfFile, fileName, jsonFile, supportingFilesZip, previousDOI);
|
||||
DMPDepositModel dmpDepositModel = DMPToDepositMapper.fromDMP(dmp, pdfEnvelope, rdaJsonFile, supportingFilesZip, previousDOI);
|
||||
|
||||
Optional<RepositoryDeposit> repo = this.repositoriesDeposit.stream().filter(x -> x.getConfiguration().getRepositoryId().equals(depositRequest.getRepositoryId())).findFirst();
|
||||
String finalDoi = repo.map(r -> {
|
||||
|
@ -2192,10 +2162,12 @@ public class DataManagementPlanManager {
|
|||
if(supportingFilesZip != null) {
|
||||
Files.deleteIfExists(supportingFilesZip.toPath());
|
||||
}
|
||||
Files.deleteIfExists(rdaJsonFile.getFile().toPath());
|
||||
Files.deleteIfExists(pdfFile.toPath());
|
||||
Files.deleteIfExists(file.getFile().toPath());
|
||||
|
||||
return doiModel;
|
||||
|
||||
}
|
||||
|
||||
private File createSupportingFilesZip(DMP dmp) throws IOException {
|
||||
|
|
|
@ -1136,7 +1136,7 @@ public class DatasetManager {
|
|||
List<Tag> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(eu.eudat.elastic.entities.Dataset::getTags).flatMap(Collection::stream).filter(StreamDistinctBy.distinctByKey(Tag::getId)).collect(Collectors.toList());
|
||||
Set<JsonNode> tagNodes = new HashSet<>();
|
||||
tagNodes.addAll(JsonSearcher.findNodes(propertiesJson, "renderStyle", "tags", true));
|
||||
tagNodes.addAll(JsonSearcher.findNodes(propertiesJson, "rdaProperty", "dataset.keyword"));
|
||||
tagNodes.addAll(JsonSearcher.findNodes(propertiesJson, "schematics", "rda.dataset.keyword"));
|
||||
if(wizardModel.getTags() == null){
|
||||
wizardModel.setTags(new ArrayList<>());
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ import eu.eudat.data.query.items.item.datasetprofile.DatasetProfileAutocompleteR
|
|||
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
|
||||
import eu.eudat.exceptions.datasetprofile.DatasetProfileNewVersionException;
|
||||
import eu.eudat.logic.builders.model.models.DataTableDataBuilder;
|
||||
import eu.eudat.logic.proxy.config.Schematic;
|
||||
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.logic.services.operations.DatabaseRepository;
|
||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
||||
|
@ -43,9 +45,17 @@ import org.springframework.web.client.RestTemplate;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.activation.MimetypesFileTypeMap;
|
||||
import javax.transaction.Transactional;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.xpath.*;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
|
@ -62,14 +72,16 @@ public class DatasetProfileManager {
|
|||
private ApiContext apiContext;
|
||||
private DatabaseRepository databaseRepository;
|
||||
private Environment environment;
|
||||
private ConfigLoader configLoader;
|
||||
|
||||
private final MetricsManager metricsManager;
|
||||
|
||||
@Autowired
|
||||
public DatasetProfileManager(ApiContext apiContext, Environment environment, MetricsManager metricsManager) {
|
||||
public DatasetProfileManager(ApiContext apiContext, Environment environment, ConfigLoader configLoader, MetricsManager metricsManager) {
|
||||
this.apiContext = apiContext;
|
||||
this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository();
|
||||
this.environment = environment;
|
||||
this.configLoader = configLoader;
|
||||
this.metricsManager = metricsManager;
|
||||
}
|
||||
|
||||
|
@ -363,4 +375,55 @@ public class DatasetProfileManager {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public List<String> getSchematics(String query) {
|
||||
List<Schematic> schematics = configLoader.getSchematics();
|
||||
List<String> filteredSchematics = schematics.stream().map(Schematic::getName).collect(Collectors.toList());
|
||||
if(query != null && !query.isEmpty()){
|
||||
filteredSchematics = schematics.stream().filter(x -> x.getCategory().contains(query) || x.getName().contains(query)).map(Schematic::getName).collect(Collectors.toList());
|
||||
}
|
||||
return filteredSchematics;
|
||||
}
|
||||
|
||||
public void addSchematicsInDatasetProfiles() throws XPathExpressionException {
|
||||
List<DatasetProfile> datasetProfiles = this.databaseRepository.getDatasetProfileDao().getAll().toList();
|
||||
for(DatasetProfile datasetProfile: datasetProfiles){
|
||||
Document document = XmlBuilder.fromXml(datasetProfile.getDefinition());
|
||||
XPathFactory xpathFactory = XPathFactory.newInstance();
|
||||
XPath xpath = xpathFactory.newXPath();
|
||||
XPathExpression expr = xpath.compile("//rdaCommonStandard");
|
||||
NodeList rdaProperties = (NodeList) expr.evaluate(document, XPathConstants.NODESET);
|
||||
for(int i = 0; i < rdaProperties.getLength(); i++){
|
||||
Node rdaPropertyNode = rdaProperties.item(i);
|
||||
String rdaProperty = rdaPropertyNode.getTextContent();
|
||||
Element schematics = document.createElement("schematics");
|
||||
Node fieldParent = rdaPropertyNode.getParentNode();
|
||||
if(rdaProperty != null && !rdaProperty.isEmpty()){
|
||||
Element schematic = document.createElement("schematic");
|
||||
schematic.setTextContent(rdaProperty);
|
||||
schematics.appendChild(schematic);
|
||||
}
|
||||
fieldParent.insertBefore(schematics, rdaPropertyNode);
|
||||
fieldParent.removeChild(rdaPropertyNode);
|
||||
}
|
||||
try {
|
||||
DOMSource domSource = new DOMSource(document);
|
||||
StringWriter writer = new StringWriter();
|
||||
StreamResult result = new StreamResult(writer);
|
||||
TransformerFactory tf = TransformerFactory.newInstance();
|
||||
Transformer transformer = tf.newTransformer();
|
||||
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
transformer.transform(domSource, result);
|
||||
String newDefinition = writer.toString();
|
||||
if(newDefinition != null){
|
||||
|
||||
}
|
||||
datasetProfile.setDefinition(newDefinition);
|
||||
this.databaseRepository.getDatasetProfileDao().createOrUpdate(datasetProfile);
|
||||
}
|
||||
catch(TransformerException ex) {
|
||||
logger.error(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,31 +159,10 @@ public class UserManager {
|
|||
return dataTableData;
|
||||
}
|
||||
|
||||
public Boolean isDOITokenValid(Principal principal) throws NonValidTokenException, ExpiredTokenException, IOException {
|
||||
if (principal.getZenodoToken() != null && !principal.getZenodoToken().isEmpty()) {
|
||||
if (Instant.now().isBefore(principal.getZenodoDuration())) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
this.updateDOIToken(ZenodoAccessType.REFRESH_TOKEN, principal.getZenodoRefresh(), this.environment.getProperty("zenodo.login.redirect_uri"), principal);
|
||||
return true;
|
||||
}catch (Exception e) {
|
||||
this.deleteDOIToken(principal);
|
||||
throw new ExpiredTokenException("Zenodo Token is expired.");
|
||||
}
|
||||
}
|
||||
throw new NonValidTokenException("This account has no Zenodo Token");
|
||||
}
|
||||
|
||||
public void registerDOIToken(DOIRequest doiRequest, Principal principal) throws IOException {
|
||||
this.updateDOIToken(ZenodoAccessType.AUTHORIZATION_CODE, doiRequest.getZenodoRequest().getCode(), doiRequest.getRedirectUri(), principal);
|
||||
}
|
||||
|
||||
private void updateDOIToken(ZenodoAccessType accessType, String code, String redirectUri, Principal principal) throws IOException {
|
||||
ZenodoResponseToken responseToken = this.zenodoCustomProvider.getAccessToken(accessType, code
|
||||
, this.environment.getProperty("zenodo.login.client_id")
|
||||
, this.environment.getProperty("zenodo.login.client_secret")
|
||||
, redirectUri);
|
||||
ZenodoResponseToken responseToken = this.zenodoCustomProvider.getAccessToken(ZenodoAccessType.AUTHORIZATION_CODE,
|
||||
doiRequest.getZenodoRequest().getCode(), this.environment.getProperty("zenodo.login.client_id"),
|
||||
this.environment.getProperty("zenodo.login.client_secret"), doiRequest.getRedirectUri());
|
||||
Map<String, Object> settings = new HashMap<>();
|
||||
settings.put("zenodoEmail", responseToken.getEmail());
|
||||
settings.put("zenodoRefresh", responseToken.getRefreshToken());
|
||||
|
|
|
@ -112,17 +112,17 @@ public class PrefillingMapper {
|
|||
throw e;
|
||||
}
|
||||
} else {
|
||||
List<JsonNode> nodes = JsonSearcher.findNodes(parentNode, "rdaProperty", prefillingMapping.getMaDmpTarget());
|
||||
List<JsonNode> nodes = JsonSearcher.findNodes(parentNode, "schematics", "rda." + prefillingMapping.getMaDmpTarget());
|
||||
|
||||
// zenodo prefilling customizations
|
||||
if(type.equals("zenodo")){
|
||||
if(prefillingMapping.getMaDmpTarget().equals("dataset.distribution.data_access")){
|
||||
if(parsedValue != null && parsedValue.equals("open")){
|
||||
List<JsonNode> issuedNodes = JsonSearcher.findNodes(parentNode, "rdaProperty", "dataset.issued");
|
||||
List<JsonNode> issuedNodes = JsonSearcher.findNodes(parentNode, "schematics", "rda.dataset.issued");
|
||||
if(!issuedNodes.isEmpty()){
|
||||
String issuedIdNode = issuedNodes.get(0).get("id").asText();
|
||||
String issuedValue = (String) properties.get(issuedIdNode);
|
||||
List<JsonNode> licStartDateNodes = JsonSearcher.findNodes(parentNode, "rdaProperty", "dataset.distribution.license.start_date");
|
||||
List<JsonNode> licStartDateNodes = JsonSearcher.findNodes(parentNode, "schematics", "rda.dataset.distribution.license.start_date");
|
||||
for (JsonNode licStartDateNode : licStartDateNodes) {
|
||||
String licStartDateId = licStartDateNode.get(0) != null ? licStartDateNode.get(0).get("id").asText() : licStartDateNode.get("id").asText();
|
||||
properties.put(licStartDateId, issuedValue);
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package eu.eudat.logic.proxy.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class Schematic {
|
||||
|
||||
@JsonProperty("category")
|
||||
private String category;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package eu.eudat.logic.proxy.config.configloaders;
|
||||
|
||||
import eu.eudat.logic.proxy.config.ExternalUrls;
|
||||
import eu.eudat.logic.proxy.config.Schematic;
|
||||
import eu.eudat.logic.security.customproviders.ConfigurableProvider.entities.ConfigurableProviders;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
|
||||
|
@ -9,7 +10,7 @@ import java.util.Map;
|
|||
|
||||
public interface ConfigLoader {
|
||||
ExternalUrls getExternalUrls();
|
||||
List<String> getRdaProperties();
|
||||
List<Schematic> getSchematics();
|
||||
XWPFDocument getDocument();
|
||||
XWPFDocument getDatasetDocument();
|
||||
ConfigurableProviders getConfigurableProviders();
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package eu.eudat.logic.proxy.config.configloaders;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.logic.proxy.config.ExternalUrls;
|
||||
import eu.eudat.logic.proxy.config.Schematic;
|
||||
import eu.eudat.logic.security.customproviders.ConfigurableProvider.entities.ConfigurableProviders;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -35,7 +37,7 @@ public class DefaultConfigLoader implements ConfigLoader {
|
|||
private static final ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
private ExternalUrls externalUrls;
|
||||
private List<String> rdaProperties;
|
||||
private List<Schematic> schematics;
|
||||
private XWPFDocument document;
|
||||
private XWPFDocument datasetDocument;
|
||||
private ConfigurableProviders configurableProviders;
|
||||
|
@ -64,24 +66,17 @@ public class DefaultConfigLoader implements ConfigLoader {
|
|||
}
|
||||
}
|
||||
|
||||
private void setRdaProperties() {
|
||||
String filePath = environment.getProperty("configuration.rda");
|
||||
private void setSchematics() {
|
||||
String filePath = environment.getProperty("configuration.schematics");
|
||||
logger.info("Loaded also config file: " + filePath);
|
||||
BufferedReader reader;
|
||||
List<String> rdaList = new LinkedList<>();
|
||||
if (filePath != null) {
|
||||
try {
|
||||
reader = new BufferedReader(new InputStreamReader(getStreamFromPath(filePath)));
|
||||
String line = reader.readLine();
|
||||
while (line != null) {
|
||||
rdaList.add(line);
|
||||
line = reader.readLine();
|
||||
schematics = mapper.readValue(getStreamFromPath(filePath), new TypeReference<List<Schematic>>(){});
|
||||
}
|
||||
reader.close();
|
||||
} catch (IOException | NullPointerException e) {
|
||||
catch (IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
rdaProperties = rdaList;
|
||||
}
|
||||
}
|
||||
|
||||
private void setDocument() {
|
||||
|
@ -171,12 +166,12 @@ public class DefaultConfigLoader implements ConfigLoader {
|
|||
return externalUrls;
|
||||
}
|
||||
|
||||
public List<String> getRdaProperties() {
|
||||
if (rdaProperties == null) {
|
||||
rdaProperties = new ArrayList<>();
|
||||
this.setRdaProperties();
|
||||
public List<Schematic> getSchematics() {
|
||||
if (schematics == null) {
|
||||
schematics = new ArrayList<>();
|
||||
this.setSchematics();
|
||||
}
|
||||
return rdaProperties;
|
||||
return schematics;
|
||||
}
|
||||
|
||||
public XWPFDocument getDocument() {
|
||||
|
|
|
@ -1,29 +1,45 @@
|
|||
package eu.eudat.logic.security.repositorydeposit.mapper;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.data.entities.*;
|
||||
import eu.eudat.depositinterface.models.*;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.xml.xpath.*;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DMPToDepositMapper {
|
||||
|
||||
public static DMPDepositModel fromDMP(DMP entity, File pdfFile, String fileName, ResponseEntity<byte[]> jsonFile, File supportingFilesZip, String previousDOI) {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DMPToDepositMapper.class);
|
||||
private static final ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
public static DMPDepositModel fromDMP(DMP entity, FileEnvelope pdfFile, FileEnvelope jsonFile, File supportingFilesZip, String previousDOI) {
|
||||
DMPDepositModel deposit = new DMPDepositModel();
|
||||
deposit.setId(entity.getId());
|
||||
deposit.setVersion(entity.getVersion());
|
||||
deposit.setLabel(entity.getLabel());
|
||||
deposit.setDescription(entity.getDescription());
|
||||
deposit.setPublic(entity.isPublic());
|
||||
deposit.setDatasets(entity.getDataset().stream().map(DMPToDepositMapper::fromDataset).collect(Collectors.toList()));
|
||||
deposit.setUsers(entity.getUsers().stream().map(DMPToDepositMapper::fromUserDMP).collect(Collectors.toSet()));
|
||||
deposit.setOrganisations(entity.getOrganisations().stream().map(DMPToDepositMapper::fromOrganisation).collect(Collectors.toSet()));
|
||||
deposit.setResearchers(entity.getResearchers().stream().map(DMPToDepositMapper::fromResearcher).collect(Collectors.toSet()));
|
||||
deposit.setGrant(fromGrant(entity.getGrant()));
|
||||
|
||||
deposit.setPdfFile(pdfFile);
|
||||
deposit.setPdfFileName(fileName);
|
||||
deposit.setRdaJson(jsonFile);
|
||||
deposit.setRdaJsonFile(jsonFile);
|
||||
deposit.setSupportingFilesZip(supportingFilesZip);
|
||||
deposit.setPreviousDOI(previousDOI);
|
||||
|
||||
|
@ -31,6 +47,54 @@ public class DMPToDepositMapper {
|
|||
return deposit;
|
||||
}
|
||||
|
||||
private static DatasetDepositModel fromDataset(Dataset entity){
|
||||
DatasetDepositModel deposit = new DatasetDepositModel();
|
||||
deposit.setLabel(entity.getLabel());
|
||||
deposit.setDescription(entity.getDescription());
|
||||
deposit.setProfileDefinition(entity.getProfile().getDefinition());
|
||||
deposit.setProperties(entity.getProperties());
|
||||
deposit.setFields(fromDefinitionAndProperties(deposit.getProfileDefinition(), deposit.getProperties()));
|
||||
return deposit;
|
||||
}
|
||||
|
||||
private static List<DatasetFieldsDepositModel> fromDefinitionAndProperties(String definition, String properties){
|
||||
List<DatasetFieldsDepositModel> deposit = new ArrayList<>();
|
||||
try {
|
||||
|
||||
Map<String, Object> datasetAnswers = mapper.readValue(properties, HashMap.class);
|
||||
|
||||
Document document = XmlBuilder.fromXml(definition);
|
||||
XPathFactory xpathFactory = XPathFactory.newInstance();
|
||||
XPath xpath = xpathFactory.newXPath();
|
||||
XPathExpression expr = xpath.compile("//schematics");
|
||||
NodeList schematics = (NodeList) expr.evaluate(document, XPathConstants.NODESET);
|
||||
for (int i = 0; i < schematics.getLength(); i++) {
|
||||
Node schematicsNode = schematics.item(i);
|
||||
NodeList schematicsList = schematicsNode.getChildNodes();
|
||||
DatasetFieldsDepositModel fieldDeposit = new DatasetFieldsDepositModel();
|
||||
List<String> schematicsDeposit = new ArrayList<>();
|
||||
if(schematicsList != null){
|
||||
for(int j = 0; j < schematicsList.getLength(); j++){
|
||||
Node schematic = schematicsList.item(j);
|
||||
if(schematic.getTextContent().matches(".*\\w+.*")) {
|
||||
schematicsDeposit.add(schematic.getTextContent());
|
||||
}
|
||||
}
|
||||
}
|
||||
fieldDeposit.setSchematics(schematicsDeposit);
|
||||
String fieldId = schematicsNode.getParentNode().getAttributes().getNamedItem("id").getNodeValue();
|
||||
String value = (String) datasetAnswers.get(fieldId);
|
||||
fieldDeposit.setValue(value);
|
||||
deposit.add(fieldDeposit);
|
||||
}
|
||||
}
|
||||
catch (XPathExpressionException | JsonProcessingException ex){
|
||||
logger.error(ex.getMessage(), ex);
|
||||
return null;
|
||||
}
|
||||
return deposit;
|
||||
}
|
||||
|
||||
private static UserDMPDepositModel fromUserDMP(UserDMP entity){
|
||||
UserDMPDepositModel deposit = new UserDMPDepositModel();
|
||||
deposit.setUser(fromUserInfo(entity.getUser()));
|
||||
|
|
|
@ -86,6 +86,11 @@ public class ExportXmlBuilder {
|
|||
composite.appendChild(title);
|
||||
}
|
||||
composite.appendChild(createFields(compositeField.getFields(), visibilityRuleService, element));
|
||||
if(compositeField.getHasCommentField()){
|
||||
Element comment = element.createElement("comment");
|
||||
comment.setTextContent(compositeField.getCommentFieldValue());
|
||||
composite.appendChild(comment);
|
||||
}
|
||||
elementComposites.appendChild(composite);
|
||||
|
||||
}
|
||||
|
|
|
@ -164,10 +164,14 @@ public class ExportXmlBuilderDatasetProfile {
|
|||
numbering.setTextContent(field.getNumbering());
|
||||
elementField.appendChild(numbering);
|
||||
}
|
||||
if (field.getRdaProperty() != null) {
|
||||
Element rdaProperty = element.createElement("rdaProperty");
|
||||
rdaProperty.setTextContent(field.getRdaProperty());
|
||||
elementField.appendChild(rdaProperty);
|
||||
if (field.getSchematics() != null) {
|
||||
Element schematics = element.createElement("schematics");
|
||||
field.getSchematics().forEach(schematic -> {
|
||||
Element schematicChild = element.createElement("schematic");
|
||||
schematicChild.setTextContent(schematic);
|
||||
schematics.appendChild(schematicChild);
|
||||
});
|
||||
elementField.appendChild(schematics);
|
||||
}
|
||||
if (field.getValidations() != null) {
|
||||
Element validations = element.createElement("validations");
|
||||
|
|
|
@ -29,7 +29,7 @@ public class Field {
|
|||
|
||||
private Object data;
|
||||
|
||||
private String rdaProperty;
|
||||
private Schematics schematics;
|
||||
|
||||
@XmlAttribute(name = "id")
|
||||
public String getId() {
|
||||
|
@ -103,16 +103,15 @@ public class Field {
|
|||
this.data = data;
|
||||
}
|
||||
|
||||
@XmlElement(name = "rdaProperty")
|
||||
public String getRdaProperty() {
|
||||
return rdaProperty;
|
||||
@XmlElement(name = "schematics")
|
||||
public Schematics getSchematics() {
|
||||
return schematics;
|
||||
}
|
||||
|
||||
public void setRdaProperty(String rdaProperty) {
|
||||
this.rdaProperty = rdaProperty;
|
||||
public void setSchematics(Schematics schematics) {
|
||||
this.schematics = schematics;
|
||||
}
|
||||
|
||||
|
||||
public eu.eudat.models.data.admin.components.datasetprofile.Field toAdminCompositeModelSection() {
|
||||
eu.eudat.models.data.admin.components.datasetprofile.Field fieldEntity =new eu.eudat.models.data.admin.components.datasetprofile.Field();
|
||||
fieldEntity.setId(this.id);
|
||||
|
@ -131,7 +130,14 @@ public class Field {
|
|||
if (data != null) {
|
||||
fieldEntity.setData(data.toMap((Element) this.data));
|
||||
}
|
||||
fieldEntity.setRdaCommonStandard(this.rdaProperty);
|
||||
List<String> schematicsList = new LinkedList<>();
|
||||
if (this.schematics != null && this.schematics.getSchematics() != null) {
|
||||
for (Schematic schematic : this.schematics.getSchematics()) {
|
||||
if (schematic != null && schematic.getSchematic() != null && !schematic.getSchematic().isEmpty())
|
||||
schematicsList.add(schematic.getSchematic());
|
||||
}
|
||||
}
|
||||
fieldEntity.setSchematics(schematicsList);
|
||||
return fieldEntity;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlValue;
|
||||
|
||||
@XmlRootElement(name = "schematic")
|
||||
public class Schematic {
|
||||
|
||||
private String schematic;
|
||||
|
||||
@XmlValue
|
||||
public String getSchematic() {
|
||||
return schematic;
|
||||
}
|
||||
public void setSchematic(String schematic) {
|
||||
this.schematic = schematic;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = "schematics")
|
||||
public class Schematics {
|
||||
|
||||
private List<Schematic> schematics;
|
||||
|
||||
@XmlElement(name = "schematic")
|
||||
public List<Schematic> getSchematics() {
|
||||
return schematics;
|
||||
}
|
||||
|
||||
public void setSchematics(List<Schematic> schematics) {
|
||||
this.schematics = schematics;
|
||||
}
|
||||
}
|
|
@ -29,6 +29,18 @@ public class JsonSearcher {
|
|||
}
|
||||
found++;
|
||||
}
|
||||
else if(node.get(fieldName).isArray()){
|
||||
for(JsonNode item: node.get(fieldName)){
|
||||
if(item.asText().equals(value) || item.asText().startsWith(value)){
|
||||
if (parent) {
|
||||
nodes.add(root);
|
||||
} else {
|
||||
nodes.add(node);
|
||||
}
|
||||
found++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class Field implements ViewStyleDefinition<eu.eudat.models.data.entities.
|
|||
|
||||
private String id;
|
||||
private Integer ordinal;
|
||||
private String rdaCommonStandard;
|
||||
private List<String> schematics;
|
||||
private String value;
|
||||
private ViewStyle viewStyle;
|
||||
private String datatype;
|
||||
|
@ -70,11 +70,12 @@ public class Field implements ViewStyleDefinition<eu.eudat.models.data.entities.
|
|||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public String getRdaCommonStandard() {
|
||||
return rdaCommonStandard;
|
||||
|
||||
public List<String> getSchematics() {
|
||||
return schematics;
|
||||
}
|
||||
public void setRdaCommonStandard(String rdaCommonStandard) {
|
||||
this.rdaCommonStandard = rdaCommonStandard;
|
||||
public void setSchematics(List<String> schematics) {
|
||||
this.schematics = schematics;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
|
@ -152,7 +153,7 @@ public class Field implements ViewStyleDefinition<eu.eudat.models.data.entities.
|
|||
field.setVisible(this.visible);
|
||||
field.setDefaultValue(this.defaultValue);
|
||||
field.setValidations(this.validations);
|
||||
field.setRdaCommonStandard(this.rdaCommonStandard);
|
||||
field.setSchematics(this.schematics);
|
||||
field.setExport(this.export);
|
||||
return field;
|
||||
}
|
||||
|
@ -166,7 +167,7 @@ public class Field implements ViewStyleDefinition<eu.eudat.models.data.entities.
|
|||
this.visible = item.getVisible();
|
||||
this.defaultValue = item.getDefaultValue();
|
||||
this.validations = item.getValidations();
|
||||
this.rdaCommonStandard = item.getRdaCommonStandard();
|
||||
this.schematics = item.getSchematics();
|
||||
this.export = item.getExport();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import java.util.List;
|
|||
public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field> {
|
||||
private String id;
|
||||
private int ordinal;
|
||||
private String rdaCommonStandard;
|
||||
private List<String> schematics;
|
||||
private String numbering;
|
||||
private ViewStyle viewStyle;
|
||||
private DefaultValue defaultValue;
|
||||
|
@ -42,11 +42,11 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
|
|||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public String getRdaCommonStandard() {
|
||||
return rdaCommonStandard;
|
||||
public List<String> getSchematics() {
|
||||
return schematics;
|
||||
}
|
||||
public void setRdaCommonStandard(String rdaCommonStandard) {
|
||||
this.rdaCommonStandard = rdaCommonStandard;
|
||||
public void setSchematics(List<String> schematics) {
|
||||
this.schematics = schematics;
|
||||
}
|
||||
|
||||
public ViewStyle getViewStyle() {
|
||||
|
@ -105,8 +105,14 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
|
|||
rootElement.setAttribute("id", this.id);
|
||||
rootElement.setAttribute("ordinal", "" + this.ordinal);
|
||||
|
||||
Element rdaCommonStandard = doc.createElement("rdaCommonStandard");
|
||||
rdaCommonStandard.setTextContent(this.rdaCommonStandard);
|
||||
Element schematics = doc.createElement("schematics");
|
||||
if (this.schematics != null) {
|
||||
for (String s : this.schematics) {
|
||||
Element schematic = doc.createElement("schematic");
|
||||
schematic.setTextContent(s);
|
||||
schematics.appendChild(schematic);
|
||||
}
|
||||
}
|
||||
|
||||
Element viewStyle = doc.createElement("viewStyle");
|
||||
viewStyle.setAttribute("renderstyle", this.viewStyle.getRenderStyle());
|
||||
|
@ -128,7 +134,7 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
|
|||
Element numbering = doc.createElement("numbering");
|
||||
numbering.setTextContent(this.numbering);
|
||||
|
||||
rootElement.appendChild(rdaCommonStandard);
|
||||
rootElement.appendChild(schematics);
|
||||
rootElement.appendChild(numbering);
|
||||
rootElement.appendChild(validations);
|
||||
rootElement.appendChild(defaultValue);
|
||||
|
@ -158,8 +164,17 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
|
|||
Element numbering = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "numbering");
|
||||
if (numbering != null) this.numbering = numbering.getTextContent();
|
||||
|
||||
Element rdaCommonStandard = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "rdaCommonStandard");
|
||||
if (rdaCommonStandard != null) this.rdaCommonStandard = rdaCommonStandard.getTextContent();
|
||||
this.schematics = new LinkedList<>();
|
||||
Element schematics = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "schematics");
|
||||
if(schematics != null){
|
||||
NodeList schematicElements = schematics.getChildNodes();
|
||||
for (int temp = 0; temp < schematicElements.getLength(); temp++) {
|
||||
Node schematicElement = schematicElements.item(temp);
|
||||
if (schematicElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.schematics.add(schematicElement.getTextContent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Element dataElement = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "data");
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
|
|||
private List<Field> multiplicityItems;
|
||||
private List<eu.eudat.models.data.admin.components.datasetprofile.Field.ValidationType> validations;
|
||||
private Visibility visible;
|
||||
private String rdaProperty;
|
||||
private List<String> schematics;
|
||||
|
||||
private Boolean export;
|
||||
|
||||
|
@ -154,12 +154,12 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
|
|||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public String getRdaProperty() {
|
||||
return rdaProperty;
|
||||
public List<String> getSchematics() {
|
||||
return schematics;
|
||||
}
|
||||
|
||||
public void setRdaProperty(String rdaProperty) {
|
||||
this.rdaProperty = rdaProperty;
|
||||
public void setSchematics(List<String> schematics) {
|
||||
this.schematics = schematics;
|
||||
}
|
||||
|
||||
public Boolean getExport() {
|
||||
|
@ -181,7 +181,7 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
|
|||
newField.defaultValue = this.defaultValue;
|
||||
newField.data = this.data;
|
||||
newField.validations = this.validations;
|
||||
newField.rdaProperty = this.rdaProperty;
|
||||
newField.schematics = this.schematics;
|
||||
newField.numbering = "mult" + index + "_" + this.numbering;
|
||||
newField.export = this.export;
|
||||
return newField;
|
||||
|
@ -196,7 +196,7 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
|
|||
field.setDefaultValue(this.defaultValue);
|
||||
field.setVisible(this.visible);
|
||||
field.setValidations(this.validations);
|
||||
field.setRdaCommonStandard(this.rdaProperty);
|
||||
field.setSchematics(this.schematics);
|
||||
field.setExport(this.export);
|
||||
return field;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
|
|||
this.defaultValue = item.getDefaultValue();
|
||||
this.visible = item.getVisible();
|
||||
this.validations = item.getValidations();
|
||||
this.rdaProperty = item.getRdaCommonStandard();
|
||||
this.schematics = item.getSchematics();
|
||||
this.export = item.getExport();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,19 @@ public class CostRDAMapper {
|
|||
public static List<Cost> toRDAList(List<JsonNode> nodes) throws JsonProcessingException {
|
||||
Map<String, Cost> rdaMap = new HashMap<>();
|
||||
for(JsonNode node: nodes){
|
||||
String rdaProperty = node.get("rdaProperty").asText();
|
||||
String rdaProperty = "";
|
||||
JsonNode schematics = node.get("schematics");
|
||||
if(schematics.isArray()){
|
||||
for(JsonNode schematic: schematics){
|
||||
if(schematic.asText().startsWith("rda.dmp.cost")){
|
||||
rdaProperty = schematic.asText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
continue;
|
||||
}
|
||||
String rdaValue = node.get("value").asText();
|
||||
if(rdaValue == null || (rdaValue.isEmpty() && !node.get("value").isArray())){
|
||||
continue;
|
||||
|
|
|
@ -27,7 +27,19 @@ public class DatasetIdRDAMapper {
|
|||
public static DatasetId toRDA(List<JsonNode> nodes) {
|
||||
DatasetId data = new DatasetId();
|
||||
for (JsonNode node: nodes) {
|
||||
String rdaProperty = node.get("rdaProperty").asText();
|
||||
String rdaProperty = "";
|
||||
JsonNode schematics = node.get("schematics");
|
||||
if(schematics.isArray()){
|
||||
for(JsonNode schematic: schematics){
|
||||
if(schematic.asText().startsWith("rda.dataset.dataset_id")){
|
||||
rdaProperty = schematic.asText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
continue;
|
||||
}
|
||||
String rdaValue = node.get("value").asText();
|
||||
if(rdaValue == null || rdaValue.isEmpty()){
|
||||
continue;
|
||||
|
@ -77,11 +89,14 @@ public class DatasetIdRDAMapper {
|
|||
public static Map<String, String> toProperties(DatasetId rda, JsonNode node) {
|
||||
Map<String, String> properties = new HashMap<>();
|
||||
|
||||
List<JsonNode> idNodes = JsonSearcher.findNodes(node, "rdaProperty", "dataset.dataset_id");
|
||||
List<JsonNode> idNodes = JsonSearcher.findNodes(node, "schematics", "rda.dataset.dataset_id");
|
||||
|
||||
for (JsonNode idNode: idNodes) {
|
||||
for (DatasetIdProperties datasetIdProperties : DatasetIdProperties.values()) {
|
||||
if (idNode.get("rdaProperty").asText().endsWith(datasetIdProperties.getName())) {
|
||||
JsonNode schematics = idNode.get("schematics");
|
||||
if(schematics.isArray()){
|
||||
for(JsonNode schematic: schematics){
|
||||
if(schematic.asText().endsWith(datasetIdProperties.getName())){
|
||||
switch (datasetIdProperties) {
|
||||
case IDENTIFIER:
|
||||
properties.put(idNode.get("id").asText(), rda.getIdentifier());
|
||||
|
@ -90,7 +105,9 @@ public class DatasetIdRDAMapper {
|
|||
properties.put(idNode.get("id").asText(), rda.getType().value());
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,32 +59,32 @@ public class DatasetRDAMapper {
|
|||
ObjectMapper mapper = new ObjectMapper();
|
||||
String datasetDescriptionJson = mapper.writeValueAsString(datasetWizardModel.getDatasetProfileDefinition());
|
||||
JsonNode datasetDescriptionObj = mapper.readTree(datasetDescriptionJson);
|
||||
List<JsonNode> idNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.dataset_id");
|
||||
List<JsonNode> idNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.dataset_id");
|
||||
if (!idNodes.isEmpty()) {
|
||||
rda.setDatasetId(DatasetIdRDAMapper.toRDA(idNodes));
|
||||
}
|
||||
if (rda.getDatasetId() == null) {
|
||||
rda.setDatasetId(new DatasetId(dataset.getId().toString(), DatasetId.Type.OTHER));
|
||||
}
|
||||
List<JsonNode> typeNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.type");
|
||||
List<JsonNode> typeNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.type");
|
||||
if (!typeNodes.isEmpty() && !typeNodes.get(0).get("value").asText().isEmpty()) {
|
||||
rda.setType(typeNodes.get(0).get("value").asText());
|
||||
} else {
|
||||
rda.setType("DMP Dataset");
|
||||
}
|
||||
List<JsonNode> languageNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.language");
|
||||
List<JsonNode> languageNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.language");
|
||||
if (!languageNodes.isEmpty() && !languageNodes.get(0).get("value").asText().isEmpty()) {
|
||||
rda.setLanguage(Language.fromValue(languageNodes.get(0).get("value").asText()));
|
||||
} else {
|
||||
rda.setLanguage(LanguageRDAMapper.mapLanguageIsoToRDAIso(dataset.getProfile().getLanguage()));
|
||||
}
|
||||
List<JsonNode> metadataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.metadata");
|
||||
List<JsonNode> metadataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.metadata");
|
||||
if (!metadataNodes.isEmpty()) {
|
||||
rda.setMetadata(MetadataRDAMapper.toRDAList(metadataNodes));
|
||||
}else{
|
||||
rda.setMetadata(new ArrayList<>());
|
||||
}
|
||||
List<JsonNode> qaNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.data_quality_assurance");
|
||||
List<JsonNode> qaNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.data_quality_assurance");
|
||||
if (!qaNodes.isEmpty()) {
|
||||
/*rda.setDataQualityAssurance(qaNodes.stream().map(qaNode -> qaNode.get("value").asText()).collect(Collectors.toList()));
|
||||
for (int i = 0; i < qaNodes.size(); i++) {
|
||||
|
@ -115,17 +115,17 @@ public class DatasetRDAMapper {
|
|||
}else{
|
||||
rda.setDataQualityAssurance(new ArrayList<>());
|
||||
}
|
||||
List<JsonNode> preservationNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.preservation_statement");
|
||||
List<JsonNode> preservationNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.preservation_statement");
|
||||
if (!preservationNodes.isEmpty() && !preservationNodes.get(0).get("value").asText().isEmpty()) {
|
||||
rda.setPreservationStatement(preservationNodes.get(0).get("value").asText());
|
||||
}
|
||||
List<JsonNode> distributionNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.distribution");
|
||||
List<JsonNode> distributionNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.distribution");
|
||||
if (!distributionNodes.isEmpty()) {
|
||||
rda.setDistribution(DistributionRDAMapper.toRDAList(distributionNodes));
|
||||
}else{
|
||||
rda.setDistribution(new ArrayList<>());
|
||||
}
|
||||
List<JsonNode> keywordNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.keyword");
|
||||
List<JsonNode> keywordNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.keyword");
|
||||
if (!keywordNodes.isEmpty()) {
|
||||
rda.setKeyword(keywordNodes.stream().map(keywordNode -> {
|
||||
JsonNode value = keywordNode.get("value");
|
||||
|
@ -142,7 +142,7 @@ public class DatasetRDAMapper {
|
|||
List<String> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString()).getTags().stream().map(Tag::getName).collect(Collectors.toList());
|
||||
rda.setKeyword(tags);
|
||||
}
|
||||
List<JsonNode> personalDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.personal_data");
|
||||
List<JsonNode> personalDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.personal_data");
|
||||
if (!personalDataNodes.isEmpty()) {
|
||||
try{
|
||||
rda.setPersonalData(personalDataNodes.stream().map(personalDataNode -> Dataset.PersonalData.fromValue(personalDataNode.get("value").asText())).findFirst().get());
|
||||
|
@ -152,13 +152,13 @@ public class DatasetRDAMapper {
|
|||
} else {
|
||||
rda.setPersonalData(Dataset.PersonalData.UNKNOWN);
|
||||
}
|
||||
List<JsonNode> securityAndPrivacyNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.security_and_privacy");
|
||||
List<JsonNode> securityAndPrivacyNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.security_and_privacy");
|
||||
if (!securityAndPrivacyNodes.isEmpty()) {
|
||||
rda.setSecurityAndPrivacy(SecurityAndPrivacyRDAMapper.toRDAList(securityAndPrivacyNodes));
|
||||
}else{
|
||||
rda.setSecurityAndPrivacy(new ArrayList<>());
|
||||
}
|
||||
List<JsonNode> sensitiveDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.sensitive_data");
|
||||
List<JsonNode> sensitiveDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.sensitive_data");
|
||||
if (!sensitiveDataNodes.isEmpty()) {
|
||||
try{
|
||||
rda.setSensitiveData(sensitiveDataNodes.stream().map(sensitiveDataNode -> Dataset.SensitiveData.fromValue(sensitiveDataNode.get("value").asText())).findFirst().get());
|
||||
|
@ -168,35 +168,47 @@ public class DatasetRDAMapper {
|
|||
} else {
|
||||
rda.setSensitiveData(Dataset.SensitiveData.UNKNOWN);
|
||||
}
|
||||
List<JsonNode> technicalResourceNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.technical_resource");
|
||||
List<JsonNode> technicalResourceNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.technical_resource");
|
||||
if (!technicalResourceNodes.isEmpty()) {
|
||||
rda.setTechnicalResource(TechnicalResourceRDAMapper.toRDAList(technicalResourceNodes));
|
||||
}else{
|
||||
rda.setTechnicalResource(new ArrayList<>());
|
||||
}
|
||||
List<JsonNode> issuedNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.issued");
|
||||
List<JsonNode> issuedNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.issued");
|
||||
if (!issuedNodes.isEmpty() && !issuedNodes.get(0).get("value").asText().isEmpty()) {
|
||||
rda.setIssued(issuedNodes.get(0).get("value").asText());
|
||||
}
|
||||
List<JsonNode> contributorNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dmp.contributor");
|
||||
List<JsonNode> contributorNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dmp.contributor");
|
||||
if (!contributorNodes.isEmpty()) {
|
||||
dmp.getContributor().addAll(contributorNodes.stream().map(contributorNode -> {
|
||||
JsonNode value = contributorNode.get("value");
|
||||
if (value.isArray()) {
|
||||
return StreamSupport.stream(value.spliterator(), false).map(node -> ContributorRDAMapper.toRDA(node.asText())).collect(Collectors.toList());
|
||||
} else {
|
||||
return Collections.singletonList(new Contributor()); // return null kalutera
|
||||
return Collections.singletonList(new Contributor());
|
||||
}
|
||||
}).flatMap(Collection::stream).collect(Collectors.toList()));
|
||||
}
|
||||
List<JsonNode> costNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dmp.cost");
|
||||
List<JsonNode> costNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dmp.cost");
|
||||
if (!costNodes.isEmpty()) {
|
||||
dmp.getCost().addAll(CostRDAMapper.toRDAList(costNodes));
|
||||
}
|
||||
List<JsonNode> ethicsNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dmp.ethical_issues");
|
||||
List<JsonNode> ethicsNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dmp.ethical_issues");
|
||||
if (!ethicsNodes.isEmpty()) {
|
||||
for(JsonNode node: ethicsNodes){
|
||||
String rdaProperty = node.get("rdaProperty").asText();
|
||||
String rdaProperty = "";
|
||||
JsonNode schematics = node.get("schematics");
|
||||
if(schematics.isArray()){
|
||||
for(JsonNode schematic: schematics){
|
||||
if(schematic.asText().startsWith("rda.dmp.ethical_issues")){
|
||||
rdaProperty = schematic.asText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
continue;
|
||||
}
|
||||
String rdaValue = node.get("value").asText();
|
||||
if(rdaValue == null || rdaValue.isEmpty()){
|
||||
continue;
|
||||
|
@ -276,12 +288,12 @@ public class DatasetRDAMapper {
|
|||
String datasetDescriptionJson = mapper.writeValueAsString(datasetWizardModel.getDatasetProfileDefinition());
|
||||
JsonNode datasetDescriptionObj = mapper.readTree(datasetDescriptionJson);
|
||||
|
||||
List<JsonNode> typeNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.type");
|
||||
List<JsonNode> typeNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.type");
|
||||
if (!typeNodes.isEmpty()) {
|
||||
properties.put(typeNodes.get(0).get("id").asText(), rda.getType());
|
||||
}
|
||||
|
||||
List<JsonNode> languageNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.language");
|
||||
List<JsonNode> languageNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.language");
|
||||
if (!languageNodes.isEmpty() && rda.getLanguage() != null) {
|
||||
properties.put(languageNodes.get(0).get("id").asText(), rda.getLanguage().value());
|
||||
}
|
||||
|
@ -298,7 +310,7 @@ public class DatasetRDAMapper {
|
|||
for (int i = 0; i < qaIds.size(); i++) {
|
||||
properties.put(qaIds.get(i), rda.getDataQualityAssurance().get(i));
|
||||
}*/
|
||||
List<JsonNode> qaNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.data_quality_assurance");
|
||||
List<JsonNode> qaNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.data_quality_assurance");
|
||||
if (!qaNodes.isEmpty() && rda.getDataQualityAssurance() != null && !rda.getDataQualityAssurance().isEmpty()) {
|
||||
ObjectMapper m = new ObjectMapper();
|
||||
List<String> qas = new ArrayList<>(rda.getDataQualityAssurance());
|
||||
|
@ -310,12 +322,12 @@ public class DatasetRDAMapper {
|
|||
}
|
||||
}
|
||||
|
||||
List<JsonNode> preservationNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.preservation_statement");
|
||||
List<JsonNode> preservationNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.preservation_statement");
|
||||
if (!preservationNodes.isEmpty()) {
|
||||
properties.put(preservationNodes.get(0).get("id").asText(), rda.getPreservationStatement());
|
||||
}
|
||||
|
||||
List<JsonNode> issuedNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.issued");
|
||||
List<JsonNode> issuedNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.issued");
|
||||
if (!issuedNodes.isEmpty()) {
|
||||
properties.put(issuedNodes.get(0).get("id").asText(), rda.getIssued());
|
||||
}
|
||||
|
@ -351,7 +363,7 @@ public class DatasetRDAMapper {
|
|||
}
|
||||
}
|
||||
|
||||
List<JsonNode> personalDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.personal_data");
|
||||
List<JsonNode> personalDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.personal_data");
|
||||
if (!personalDataNodes.isEmpty()) {
|
||||
properties.put(personalDataNodes.get(0).get("id").asText(), rda.getPersonalData().value());
|
||||
}
|
||||
|
@ -360,7 +372,7 @@ public class DatasetRDAMapper {
|
|||
properties.putAll(SecurityAndPrivacyRDAMapper.toProperties(rda.getSecurityAndPrivacy()));
|
||||
}
|
||||
|
||||
List<JsonNode> sensitiveDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.sensitive_data");
|
||||
List<JsonNode> sensitiveDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.sensitive_data");
|
||||
if (!sensitiveDataNodes.isEmpty()) {
|
||||
properties.put(sensitiveDataNodes.get(0).get("id").asText(), rda.getSensitiveData().value());
|
||||
}
|
||||
|
|
|
@ -24,7 +24,10 @@ public class DistributionRDAMapper {
|
|||
Map<String, Distribution> rdaMap = new HashMap<>();
|
||||
|
||||
for (JsonNode node: nodes) {
|
||||
String rdaProperty = node.get("rdaProperty").asText();
|
||||
String rdaProperty = getRdaDistributionProperty(node);
|
||||
if(rdaProperty.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
String rdaValue = node.get("value").asText();
|
||||
//if(rdaValue == null || rdaValue.isEmpty()){
|
||||
if(rdaValue == null || (rdaValue.isEmpty() && !node.get("value").isArray())){
|
||||
|
@ -79,7 +82,16 @@ public class DistributionRDAMapper {
|
|||
rda.setAdditionalProperty(ImportPropertyName.BYTE_SIZE.getName(), node.get("id").asText());
|
||||
break;
|
||||
case LICENSE:
|
||||
List<JsonNode> licenseNodes = nodes.stream().filter(lnode -> lnode.get("rdaProperty").asText().toLowerCase().contains("license")).collect(Collectors.toList());
|
||||
List<JsonNode> licenseNodes = nodes.stream().filter(lnode -> {
|
||||
if(lnode.get("schematics").isArray()){
|
||||
for(JsonNode schematic: lnode.get("schematics")){
|
||||
if(schematic.asText().startsWith("rda.dataset.distribution.license")){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
License license = LicenseRDAMapper.toRDA(licenseNodes);
|
||||
rda.setLicense(license != null? Collections.singletonList(license): new ArrayList<>());
|
||||
break;
|
||||
|
@ -182,11 +194,14 @@ public class DistributionRDAMapper {
|
|||
public static Map<String, String> toProperties(Distribution rda, JsonNode root) {
|
||||
Map<String, String> properties = new HashMap<>();
|
||||
|
||||
List<JsonNode> distributionNodes = JsonSearcher.findNodes(root, "rdaProperty", "dataset.distribution");
|
||||
List<JsonNode> distributionNodes = JsonSearcher.findNodes(root, "schematics", "rda.dataset.distribution");
|
||||
|
||||
for (JsonNode distributionNode: distributionNodes) {
|
||||
for (ExportPropertyName exportPropertyName: ExportPropertyName.values()) {
|
||||
if (distributionNode.get("rdaProperty").asText().contains(exportPropertyName.getName())) {
|
||||
JsonNode schematics = distributionNode.get("schematics");
|
||||
if(schematics.isArray()){
|
||||
for(JsonNode schematic: schematics){
|
||||
if(schematic.asText().contains(exportPropertyName.getName())){
|
||||
switch (exportPropertyName) {
|
||||
case ACCESS_URL:
|
||||
properties.put(distributionNode.get("id").asText(), rda.getAccessUrl());
|
||||
|
@ -248,6 +263,9 @@ public class DistributionRDAMapper {
|
|||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +276,10 @@ public class DistributionRDAMapper {
|
|||
public static Distribution toRDA(List<JsonNode> nodes) {
|
||||
Distribution rda = new Distribution();
|
||||
for (JsonNode node: nodes) {
|
||||
String rdaProperty = node.get("rdaProperty").asText();
|
||||
String rdaProperty = getRdaDistributionProperty(node);
|
||||
if(rdaProperty.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
String rdaValue = node.get("value").asText();
|
||||
for (ExportPropertyName exportPropertyName: ExportPropertyName.values()) {
|
||||
if (rdaProperty.contains(exportPropertyName.getName())) {
|
||||
|
@ -288,11 +309,29 @@ public class DistributionRDAMapper {
|
|||
rda.setFormat(Collections.singletonList(rdaValue));
|
||||
break;
|
||||
case LICENSE:
|
||||
List<JsonNode> licenseNodes = nodes.stream().filter(lnode -> lnode.get("rdaProperty").asText().toLowerCase().contains("license")).collect(Collectors.toList());
|
||||
List<JsonNode> licenseNodes = nodes.stream().filter(lnode -> {
|
||||
if(lnode.get("schematics").isArray()){
|
||||
for(JsonNode schematic: lnode.get("schematics")){
|
||||
if(schematic.asText().startsWith("rda.dataset.distribution.license")){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
rda.setLicense(Collections.singletonList(LicenseRDAMapper.toRDA(licenseNodes)));
|
||||
break;
|
||||
case HOST:
|
||||
List<JsonNode> hostNodes = nodes.stream().filter(lnode -> lnode.get("rdaProperty").asText().toLowerCase().contains("host")).collect(Collectors.toList());
|
||||
List<JsonNode> hostNodes = nodes.stream().filter(lnode -> {
|
||||
if(lnode.get("schematics").isArray()){
|
||||
for(JsonNode schematic: lnode.get("schematics")){
|
||||
if(schematic.asText().startsWith("rda.dataset.distribution.host")){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
rda.setHost(HostRDAMapper.toRDA(hostNodes, "0"));
|
||||
break;
|
||||
}
|
||||
|
@ -333,6 +372,20 @@ public class DistributionRDAMapper {
|
|||
return rda;
|
||||
}
|
||||
|
||||
private static String getRdaDistributionProperty(JsonNode node) {
|
||||
String rdaProperty = "";
|
||||
JsonNode schematics = node.get("schematics");
|
||||
if(schematics.isArray()){
|
||||
for(JsonNode schematic: schematics){
|
||||
if(schematic.asText().startsWith("rda.dataset.distribution")){
|
||||
rdaProperty = schematic.asText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rdaProperty;
|
||||
}
|
||||
|
||||
private static Distribution getRelative( Map<String, Distribution> rdaMap, String numbering) {
|
||||
return rdaMap.entrySet().stream().filter(entry -> MyStringUtils.getFirstDifference(entry.getKey(), numbering) > 0)
|
||||
.max(Comparator.comparingInt(entry -> MyStringUtils.getFirstDifference(entry.getKey(), numbering))).map(Map.Entry::getValue).orElse(new Distribution());
|
||||
|
|
|
@ -19,7 +19,19 @@ public class HostRDAMapper {
|
|||
public static Host toRDA(List<JsonNode> nodes, String numbering) {
|
||||
Host rda = new Host();
|
||||
for (JsonNode node: nodes) {
|
||||
String rdaProperty = node.get("rdaProperty").asText();
|
||||
String rdaProperty = "";
|
||||
JsonNode schematics = node.get("schematics");
|
||||
if(schematics.isArray()){
|
||||
for(JsonNode schematic: schematics){
|
||||
if(schematic.asText().startsWith("rda.dataset.distribution.host")){
|
||||
rdaProperty = schematic.asText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
continue;
|
||||
}
|
||||
if (rdaProperty.contains("host")) {
|
||||
int firstDiff = MyStringUtils.getFirstDifference(numbering, node.get("numbering").asText());
|
||||
if (firstDiff == -1 || firstDiff >= 2) {
|
||||
|
|
|
@ -17,7 +17,19 @@ public class LicenseRDAMapper {
|
|||
public static License toRDA(List<JsonNode> nodes) {
|
||||
License rda = new License();
|
||||
for (JsonNode node: nodes) {
|
||||
String rdaProperty = node.get("rdaProperty").asText();
|
||||
String rdaProperty = "";
|
||||
JsonNode schematics = node.get("schematics");
|
||||
if(schematics.isArray()){
|
||||
for(JsonNode schematic: schematics){
|
||||
if(schematic.asText().startsWith("rda.dataset.distribution.license")){
|
||||
rdaProperty = schematic.asText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
continue;
|
||||
}
|
||||
String value = node.get("value").asText();
|
||||
if(value == null || value.isEmpty()){
|
||||
continue;
|
||||
|
@ -78,11 +90,14 @@ public class LicenseRDAMapper {
|
|||
public static Map<String, String> toProperties(License rda, JsonNode root) {
|
||||
Map<String, String> properties = new HashMap<>();
|
||||
|
||||
List<JsonNode> licenseNodes = JsonSearcher.findNodes(root, "rdaProperty", "dataset.distribution.license");
|
||||
List<JsonNode> licenseNodes = JsonSearcher.findNodes(root, "schematics", "rda.dataset.distribution.license");
|
||||
|
||||
for (JsonNode licenseNode: licenseNodes) {
|
||||
for (LicenceProperties licenceProperty: LicenceProperties.values()) {
|
||||
if (licenseNode.get("rdaProperty").asText().endsWith(licenceProperty.getName())) {
|
||||
JsonNode schematics = licenseNode.get("schematics");
|
||||
if(schematics.isArray()) {
|
||||
for (JsonNode schematic : schematics) {
|
||||
if (schematic.asText().endsWith(licenceProperty.getName())) {
|
||||
switch (licenceProperty) {
|
||||
case LICENSE_REF:
|
||||
if (rda.getLicenseRef() != null) {
|
||||
|
@ -94,6 +109,9 @@ public class LicenseRDAMapper {
|
|||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,19 @@ public class MetadataRDAMapper {
|
|||
Map<String, String> rdaMap = new HashMap<>();
|
||||
List<Metadatum> rdas = new ArrayList<>();
|
||||
for (JsonNode node: nodes) {
|
||||
String rdaProperty = node.get("rdaProperty").asText();
|
||||
String rdaProperty = "";
|
||||
JsonNode schematics = node.get("schematics");
|
||||
if(schematics.isArray()){
|
||||
for(JsonNode schematic: schematics){
|
||||
if(schematic.asText().startsWith("rda.dataset.metadata")){
|
||||
rdaProperty = schematic.asText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
continue;
|
||||
}
|
||||
JsonNode rdaValue = node.get("value");
|
||||
|
||||
for (PropertyName propertyName: PropertyName.values()) {
|
||||
|
@ -119,7 +131,16 @@ public class MetadataRDAMapper {
|
|||
|
||||
public static Metadatum toRDA(JsonNode node) {
|
||||
Metadatum rda = new Metadatum();
|
||||
String rdaProperty = node.get("rdaProperty").asText();
|
||||
String rdaProperty = "";
|
||||
JsonNode schematics = node.get("schematics");
|
||||
if(schematics.isArray()){
|
||||
for(JsonNode schematic: schematics){
|
||||
if(schematic.asText().startsWith("rda.dataset.metadata")){
|
||||
rdaProperty = schematic.asText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
JsonNode rdaValue = node.get("value");
|
||||
if (rdaProperty.contains("metadata_standard_id")) {
|
||||
if (rdaValue instanceof ArrayNode) {
|
||||
|
|
|
@ -16,7 +16,19 @@ public class SecurityAndPrivacyRDAMapper {
|
|||
Map<String, SecurityAndPrivacy> rdaMap = new HashMap<>();
|
||||
|
||||
for (JsonNode node: nodes) {
|
||||
String rdaProperty = node.get("rdaProperty").asText();
|
||||
String rdaProperty = "";
|
||||
JsonNode schematics = node.get("schematics");
|
||||
if(schematics.isArray()){
|
||||
for(JsonNode schematic: schematics){
|
||||
if(schematic.asText().startsWith("rda.dataset.security_and_privacy")){
|
||||
rdaProperty = schematic.asText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
continue;
|
||||
}
|
||||
String rdaValue = node.get("value").asText();
|
||||
if(rdaValue == null || rdaValue.isEmpty()){
|
||||
continue;
|
||||
|
@ -69,7 +81,16 @@ public class SecurityAndPrivacyRDAMapper {
|
|||
|
||||
public static SecurityAndPrivacy toRDA(JsonNode node) {
|
||||
SecurityAndPrivacy rda = new SecurityAndPrivacy();
|
||||
String rdaProperty = node.get("rdaProperty").asText();
|
||||
String rdaProperty = "";
|
||||
JsonNode schematics = node.get("schematics");
|
||||
if(schematics.isArray()){
|
||||
for(JsonNode schematic: schematics){
|
||||
if(schematic.asText().startsWith("rda.dataset.security_and_privacy")){
|
||||
rdaProperty = schematic.asText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
String value = node.get("value").asText();
|
||||
|
||||
if (rdaProperty.contains("description")) {
|
||||
|
|
|
@ -16,7 +16,19 @@ public class TechnicalResourceRDAMapper {
|
|||
Map<String, TechnicalResource> rdaMap = new HashMap<>();
|
||||
|
||||
for (JsonNode node: nodes) {
|
||||
String rdaProperty = node.get("rdaProperty").asText();
|
||||
String rdaProperty = "";
|
||||
JsonNode schematics = node.get("schematics");
|
||||
if(schematics.isArray()){
|
||||
for(JsonNode schematic: schematics){
|
||||
if(schematic.asText().startsWith("rda.dataset.technical_resource")){
|
||||
rdaProperty = schematic.asText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
continue;
|
||||
}
|
||||
String rdaValue = node.get("value").asText();
|
||||
if(rdaValue == null || rdaValue.isEmpty()){
|
||||
continue;
|
||||
|
@ -70,7 +82,16 @@ public class TechnicalResourceRDAMapper {
|
|||
|
||||
public static TechnicalResource toRDA(JsonNode node) {
|
||||
TechnicalResource rda = new TechnicalResource();
|
||||
String rdaProperty = node.get("rdaProperty").asText();
|
||||
String rdaProperty = "";
|
||||
JsonNode schematics = node.get("schematics");
|
||||
if(schematics.isArray()){
|
||||
for(JsonNode schematic: schematics){
|
||||
if(schematic.asText().startsWith("rda.dataset.technical_resource")){
|
||||
rdaProperty = schematic.asText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
String value = node.get("value").asText();
|
||||
|
||||
if (rdaProperty.contains("description")) {
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
[
|
||||
{
|
||||
"Funder": "Australian Research Council",
|
||||
"DOI": "10.13039/501100000923"
|
||||
},
|
||||
{
|
||||
"Funder": "Austrian Science Fund",
|
||||
"DOI": "10.13039/501100002428"
|
||||
},
|
||||
{
|
||||
"Funder": "European Commission",
|
||||
"DOI": "10.13039/501100000780"
|
||||
},
|
||||
{
|
||||
"Funder": "European Environment Agency",
|
||||
"DOI": "10.13039/501100000806"
|
||||
},
|
||||
{
|
||||
"Funder": "Academy of Finland",
|
||||
"DOI": "10.13039/501100002341"
|
||||
},
|
||||
{
|
||||
"Funder": "Hrvatska Zaklada za Znanost",
|
||||
"DOI": "10.13039/501100004488"
|
||||
},
|
||||
{
|
||||
"Funder": "Fundação para a Ciência e a Tecnologia",
|
||||
"DOI": "10.13039/501100001871"
|
||||
},
|
||||
{
|
||||
"Funder": "Ministarstvo Prosvete, Nauke i Tehnološkog Razvoja",
|
||||
"DOI": "10.13039/501100004564"
|
||||
},
|
||||
{
|
||||
"Funder": "Ministarstvo Znanosti, Obrazovanja i Sporta",
|
||||
"DOI": "10.13039/501100006588"
|
||||
},
|
||||
{
|
||||
"Funder": "National Health and Medical Research Council",
|
||||
"DOI": "10.13039/501100000925"
|
||||
},
|
||||
{
|
||||
"Funder": "National Institutes of Health",
|
||||
"DOI": "10.13039/100000002"
|
||||
},
|
||||
{
|
||||
"Funder": "National Science Foundation",
|
||||
"DOI": "10.13039/100000001"
|
||||
},
|
||||
{
|
||||
"Funder": "Nederlandse Organisatie voor Wetenschappelijk Onderzoek",
|
||||
"DOI": "10.13039/501100003246"
|
||||
},
|
||||
{
|
||||
"Funder": "Research Councils",
|
||||
"DOI": "10.13039/501100000690"
|
||||
},
|
||||
{
|
||||
"Funder": "Schweizerischer Nationalfonds zur Förderung der wissenschaftlichen Forschung",
|
||||
"DOI": "10.13039/501100001711"
|
||||
},
|
||||
{
|
||||
"Funder": "Science Foundation Ireland",
|
||||
"DOI": "10.13039/501100001602"
|
||||
},
|
||||
{
|
||||
"Funder": "Wellcome Trust",
|
||||
"DOI": "10.13039/100004440"
|
||||
}
|
||||
]
|
|
@ -0,0 +1,374 @@
|
|||
[
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.data_quality_assurance"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.access_url"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.available_until"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.byte_size"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.data_access"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.description"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.download_url"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.format"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.host.availability"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.host.backup_frequency"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.host.backup_type"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.host.certified_with"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.host.description"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.host.geo_location"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.host.pid_system"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.host.storage_type"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.host.supports_versioning"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.host.title"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.host.url"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.license.license_ref"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.license.start_date"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.title"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.keyword"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.language"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.metadata.description"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.metadata.language"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.metadata.metadata_standard_id"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.metadata.metadata_standard_id.identifier"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.metadata.metadata_standard_id.type"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.personal_data"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.preservation_statement"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.security_and_privacy"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.security_and_privacy.description"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.security_and_privacy.title"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.sensitive_data"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.technical_resource.description"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.technical_resource.name"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.title"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.type"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.issued"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.dataset_id"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.dataset_id.identifier"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.dataset_id.type"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.description"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.contact"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.contact.contact_id.identifier"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.contact.contact_id.type"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.contact.mbox"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.contact.name"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.contributor"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.contributor.contributor_id.identifier"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.contributor.contributor_id.type"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.contributor.mbox"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.contributor.name"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.contributor.role"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.cost"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.cost.currency_code"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.cost.description"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.cost.title"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.cost.value"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.created"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.description"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.dmp_id"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.dmp_id.identifier"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.dmp_id.type"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.ethical_issues_description"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.ethical_issues_exist"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.ethical_issues_report"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.language"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.modified"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.project"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.project.description"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.project.end"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.project.funding"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.project.funding.funder_id.identifier"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.project.funding.funder_id.type"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.project.funding.funding_status"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.project.funding.grant_id.identifier"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.project.funding.grant_id.type"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.project.start"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.dmp.project.title"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dmp.title"
|
||||
},
|
||||
{
|
||||
"category": "zenodo",
|
||||
"name": "zenodo.related_identifiers"
|
||||
},
|
||||
{
|
||||
"category": "zenodo",
|
||||
"name": "zenodo.related_identifiers.relation"
|
||||
},
|
||||
{
|
||||
"category": "zenodo",
|
||||
"name": "zenodo.related_identifiers.identifier"
|
||||
},
|
||||
{
|
||||
"category": "zenodo",
|
||||
"name": "zenodo.communities"
|
||||
},
|
||||
{
|
||||
"category": "zenodo",
|
||||
"name": "zenodo.grants"
|
||||
},
|
||||
{
|
||||
"category": "zenodo",
|
||||
"name": "zenodo.creators"
|
||||
},
|
||||
{
|
||||
"category": "zenodo",
|
||||
"name": "zenodo.contributors"
|
||||
},
|
||||
{
|
||||
"category": "zenodo",
|
||||
"name": "zenodo.keywords"
|
||||
},
|
||||
{
|
||||
"category": "zenodo",
|
||||
"name": "zenodo.references"
|
||||
},
|
||||
{
|
||||
"category": "zenodo",
|
||||
"name": "zenodo.notes"
|
||||
},
|
||||
{
|
||||
"category": "zenodo",
|
||||
"name": "zenodo.publication_date"
|
||||
}
|
||||
]
|
|
@ -23,11 +23,10 @@ pdf.converter.url=http://localhost:3000/
|
|||
|
||||
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
|
||||
configuration.externalUrls=externalUrls/ExternalUrls.xml
|
||||
configuration.rda=RDACommonStandards.txt
|
||||
configuration.schematics=Schematics.json
|
||||
configuration.h2020template=documents/h2020.docx
|
||||
configuration.h2020datasettemplate=documents/h2020_dataset.docx
|
||||
configuration.configurable_login_providers=configurableLoginProviders.json
|
||||
configuration.doi_funder=DOI_Funder.json
|
||||
|
||||
####################EMAIL FILE TEMPLATES OVERRIDES CONFIGURATIONS##########
|
||||
email.invite=classpath:templates/email/email.html
|
||||
|
@ -78,8 +77,6 @@ conf_email.expiration_time_seconds=14400
|
|||
conf_email.subject=OpenDMP email confirmation
|
||||
|
||||
#############ZENODO CONFIGURATIONS#########
|
||||
zenodo.url=https://sandbox.zenodo.org/api/
|
||||
zenodo.access_token=
|
||||
zenodo.login.access_token_url=https://sandbox.zenodo.org/oauth/token
|
||||
zenodo.login.client_id=
|
||||
zenodo.login.client_secret=
|
||||
|
|
|
@ -23,11 +23,9 @@ pdf.converter.url=http://opendmp-pdf:3000/
|
|||
|
||||
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
|
||||
configuration.externalUrls=externalUrls/ExternalUrls.xml
|
||||
configuration.rda=RDACommonStandards.txt
|
||||
configuration.h2020template=documents/h2020.docx
|
||||
configuration.h2020datasettemplate=documents/h2020_dataset.docx
|
||||
configuration.configurable_login_providers=configurableLoginProviders.json
|
||||
configuration.doi_funder=DOI_Funder.json
|
||||
|
||||
####################EMAIL FILE TEMPLATES OVERRIDES CONFIGURATIONS##########
|
||||
email.invite=classpath:templates/email/email.html
|
||||
|
@ -100,14 +98,11 @@ conf_email.expiration_time_seconds=14400
|
|||
conf_email.subject=OpenDMP email confirmation
|
||||
|
||||
#############ZENODO CONFIGURATIONS#########
|
||||
zenodo.url=https://sandbox.zenodo.org/api/
|
||||
zenodo.access_token=
|
||||
zenodo.login.access_token_url=https://sandbox.zenodo.org/oauth/token
|
||||
zenodo.login.client_id=
|
||||
zenodo.login.client_secret=
|
||||
zenodo.login.redirect_uri=http://localhost:8080/login/external/zenodo
|
||||
|
||||
|
||||
#############CONTACT EMAIL CONFIGURATIONS#########
|
||||
contact_email.mail=
|
||||
logging.config=classpath:logging/logback-${spring.profiles.active}.xml
|
||||
|
|
|
@ -17,7 +17,6 @@ pdf.converter.url=http://docsbox-web/
|
|||
|
||||
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
|
||||
configuration.externalUrls=externalUrls/ExternalUrls.xml
|
||||
configuration.rda=RDACommonStandards.txt
|
||||
configuration.h2020template=documents/h2020.docx
|
||||
configuration.h2020datasettemplate=documents/h2020_dataset.docx
|
||||
configuration.configurable_login_providers=ConfigurableLoginProviders.json
|
||||
|
|
|
@ -49,11 +49,10 @@ elasticsearch.certKey=
|
|||
|
||||
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
|
||||
configuration.externalUrls=externalUrls/ExternalUrls.xml
|
||||
configuration.rda=RDACommonStandards.txt
|
||||
configuration.schematics=Schematics.json
|
||||
configuration.h2020template=documents/h2020.docx
|
||||
configuration.h2020datasettemplate=documents/h2020_dataset.docx
|
||||
configuration.configurable_login_providers=configurableLoginProviders.json
|
||||
configuration.doi_funder=DOI_Funder.json
|
||||
|
||||
####################EMAIL FILE TEMPLATES OVERRIDES CONFIGURATIONS##########
|
||||
email.invite=file:templates/email/email.html
|
||||
|
|
|
@ -224,6 +224,13 @@ const appRoutes: Routes = [
|
|||
title: 'GENERAL.TITLES.INDEX-MANAGMENT'
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'maintenance-tasks',
|
||||
loadChildren: () => import('./ui/admin/maintenance-tasks/maintenance-tasks.module').then(m => m.MaintenanceTasksModule),
|
||||
data: {
|
||||
breadcrumb: true
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'login/admin',
|
||||
loadChildren: () => import('./ui/auth/admin-login/admin-login.module').then(m => m.AdminLoginModule),
|
||||
|
|
|
@ -59,7 +59,7 @@ export interface Field {
|
|||
data: any;
|
||||
visible: Visibility;
|
||||
validations: ValidationType[];
|
||||
rdaCommonStandard: string;
|
||||
schematics: string[];
|
||||
export: boolean;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,9 +19,6 @@ import { ConfigurationService } from '../configuration/configuration.service';
|
|||
@Injectable()
|
||||
export class DatasetProfileService extends BaseService {
|
||||
|
||||
private rdaCommonStandards: String[];
|
||||
private rdaCommonStandardsLoading: boolean;
|
||||
|
||||
private actionUrl: string;
|
||||
private headers = new HttpHeaders();
|
||||
|
||||
|
@ -68,26 +65,20 @@ export class DatasetProfileService extends BaseService {
|
|||
return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response', headers: headerXml });
|
||||
}
|
||||
|
||||
uploadFile(file: FileList, labelSent: string): Observable<DataTableData<DatasetListingModel>> {
|
||||
uploadFile(file: FileList, labelSent: string, datasetProfileId?: string): Observable<DataTableData<DatasetListingModel>> {
|
||||
const params = new BaseHttpParams();
|
||||
params.interceptorContext = {
|
||||
excludedInterceptors: [InterceptorType.JSONContentType]
|
||||
};
|
||||
const formData = new FormData();
|
||||
formData.append('file', file[0], labelSent);
|
||||
return this.http.post(this.actionUrl + "upload", formData, { params: params });
|
||||
return (datasetProfileId === undefined || datasetProfileId == null)
|
||||
? this.http.post(this.actionUrl + "upload", formData, { params: params })
|
||||
: this.http.post(this.actionUrl + "upload/" + datasetProfileId, formData, { params: params });
|
||||
|
||||
}
|
||||
|
||||
getRDACommonStandards(): String[] {
|
||||
if (!this.rdaCommonStandards && !this.rdaCommonStandardsLoading) { this.getRDACommonStandardsInternal(); }
|
||||
return this.rdaCommonStandards;
|
||||
}
|
||||
|
||||
private getRDACommonStandardsInternal() {
|
||||
this.rdaCommonStandardsLoading = true;
|
||||
return this.http.get<String[]>(this.actionUrl + "getRDACommonStandards").pipe(takeUntil(this._destroyed)).subscribe(x => {
|
||||
this.rdaCommonStandards = x;
|
||||
this.rdaCommonStandardsLoading = false;
|
||||
});
|
||||
searchSchematics(like: string): Observable<String[]> {
|
||||
return this.http.get<String[]>(this.actionUrl + "getSchematics?query=" + like);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,10 +114,6 @@ export class DmpService {
|
|||
return this.http.post<DmpModel>(`${this.actionUrl}updateusers/${id}`, users, { headers: this.headers });
|
||||
}
|
||||
|
||||
getDoi(id: string): Observable<string> {
|
||||
return this.http.post<string>(this.actionUrl + 'createZenodoDoi/' + id, { headers: this.headers });
|
||||
}
|
||||
|
||||
getDynamicField(requestItem: RequestItem<DynamicFieldGrantCriteria>): any {
|
||||
return this.http.post<any>(this.actionUrl + 'dynamic', requestItem, { headers: this.headers });
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
import { Injectable } from "@angular/core";
|
||||
import { BaseService } from "@common/base/base.service";
|
||||
import { Observable } from "rxjs";
|
||||
import { ConfigurationService } from "../configuration/configuration.service";
|
||||
import { BaseHttpService } from "../http/base-http.service";
|
||||
|
||||
@Injectable()
|
||||
export class MaintenanceTasksService extends BaseService {
|
||||
|
||||
private actionUrl: string;
|
||||
|
||||
constructor(private http: BaseHttpService, configurationService: ConfigurationService) {
|
||||
super();
|
||||
this.actionUrl = configurationService.server + 'management/';
|
||||
}
|
||||
|
||||
migrateSchematics(): Observable<void> {
|
||||
return this.http.post<null>(this.actionUrl + 'addSchematics/', null);
|
||||
}
|
||||
}
|
|
@ -57,11 +57,6 @@ export class UserService {
|
|||
return this.http.post<UserListingModel>(this.actionUrl + 'find', email, {headers: this.headers});
|
||||
}
|
||||
|
||||
public hasDOIToken(): Observable<any> {
|
||||
const url = this.actionUrl + 'hasDOIToken';
|
||||
return this.http.get(url, { headers: this.headers });
|
||||
}
|
||||
|
||||
public registerDOIToken(code: string, redirectUri: string): Observable<any> {
|
||||
const url = this.actionUrl + 'registerDOIToken';
|
||||
return this.http.post(url, {zenodoRequest: {code: code}, redirectUri: redirectUri}, { headers: this.headers });
|
||||
|
|
|
@ -47,7 +47,7 @@ export class FieldEditorModel extends BaseFormModel {
|
|||
public visible: VisibilityEditorModel = new VisibilityEditorModel();
|
||||
public data: FieldDataEditorModel<any>;
|
||||
public validations: ValidationType[] = [];
|
||||
public rdaCommonStandard: string;
|
||||
public schematics: string[];
|
||||
public export: boolean = true;
|
||||
|
||||
fromModel(item: Field): FieldEditorModel {
|
||||
|
@ -58,7 +58,7 @@ export class FieldEditorModel extends BaseFormModel {
|
|||
this.validations = item.validations;
|
||||
this.viewStyle = new ViewStyleEditorModel().fromModel(item.viewStyle);
|
||||
this.visible = new VisibilityEditorModel().fromModel(item.visible);
|
||||
this.rdaCommonStandard = item.rdaCommonStandard;
|
||||
this.schematics = item.schematics;
|
||||
this.export = item.export;
|
||||
|
||||
if (item.data) {
|
||||
|
@ -105,7 +105,7 @@ export class FieldEditorModel extends BaseFormModel {
|
|||
page: [{ value: this.page, disabled: (disabled && !skipDisable.includes('FieldEditorModel.page')) }],
|
||||
ordinal: [{ value: this.ordinal, disabled: (disabled && !skipDisable.includes('FieldEditorModel.ordinal')) }],
|
||||
validations: [{ value: this.validations, disabled: (disabled && !skipDisable.includes('FieldEditorModel.validations')) }],
|
||||
rdaCommonStandard: [{value: this.rdaCommonStandard, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.rdaCommonStandard')) }],
|
||||
schematics: [{ value: this.schematics, disabled: (disabled && !skipDisable.includes('FieldEditorModel.schematics')) }],
|
||||
export: [{value: this.export, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.export'))}]
|
||||
});
|
||||
|
||||
|
|
|
@ -227,13 +227,9 @@
|
|||
</mat-form-field> -->
|
||||
|
||||
<mat-form-field class="col-6">
|
||||
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.RDA-COMMON-STANDARDS' | translate}}</mat-label>
|
||||
<mat-select [formControl]="this.form.get('rdaCommonStandard')">
|
||||
<mat-option>--</mat-option>
|
||||
<mat-option *ngFor="let property of datasetProfileService.getRDACommonStandards()" [value]="property">
|
||||
{{property}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-label>Schematics</mat-label>
|
||||
<app-multiple-auto-complete placeholder="Schematics" [hidePlaceholder]="true" required='false' [formControl]="this.form.get('schematics')" [configuration]="schematicsAutoCompleteConfiguration">
|
||||
</app-multiple-auto-complete>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-checkbox [formControl]="this.form.get('export')" class="col-6" [disabled]="viewOnly">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXPORT' | translate}}</mat-checkbox>
|
||||
|
|
|
@ -6,7 +6,7 @@ import {DatasetProfileService} from '@app/core/services/dataset-profile/dataset-
|
|||
import {EnumUtils} from '@app/core/services/utilities/enum-utils.service';
|
||||
import {RuleEditorModel} from '@app/ui/admin/dataset-profile/admin/rule-editor-model';
|
||||
import {BaseComponent} from '@common/base/base.component';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {Observable, Subscription} from 'rxjs';
|
||||
import {ViewStyleType} from './view-style-enum';
|
||||
import {DatasetProfileComboBoxType} from '@app/core/common/enum/dataset-profile-combo-box-type';
|
||||
import {ErrorStateMatcher} from '@angular/material/core';
|
||||
|
@ -44,6 +44,8 @@ import {
|
|||
WordListFieldData
|
||||
} from '@app/core/model/dataset-profile-definition/field-data/field-data';
|
||||
import {ConfigurationService} from "@app/core/services/configuration/configuration.service";
|
||||
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dataset-profile-editor-field-component',
|
||||
|
@ -70,8 +72,16 @@ export class DatasetProfileEditorFieldComponent extends BaseComponent implements
|
|||
|
||||
@Output() delete = new EventEmitter<void>();
|
||||
|
||||
schematicsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
|
||||
filterFn: this.filterSchematics.bind(this),
|
||||
initialItems: (excludedItems: any[]) => this.filterSchematics('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x !== resultItem)))),
|
||||
displayFn: (item) => item,
|
||||
titleFn: (item) => item
|
||||
}
|
||||
|
||||
//rdaCommonStandards = this.datasetProfileService.getRDACommonStandards(); //GK: Don't do that again. The service has a weird async behaviour.
|
||||
filterSchematics(value: string): Observable<String[]> {
|
||||
return this.datasetProfileService.searchSchematics(value);
|
||||
}
|
||||
|
||||
constructor(
|
||||
public enumUtils: EnumUtils,
|
||||
|
|
|
@ -60,6 +60,9 @@
|
|||
<button mat-menu-item (click)="newVersion(row.id, row.label)">
|
||||
<mat-icon>queue</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.NEW-VERSION' | translate}}
|
||||
</button>
|
||||
<button mat-menu-item (click)="newVersionFromFile(row.id, row.label)">
|
||||
<mat-icon>file_copy</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.NEW-VERSION-FROM-FILE' | translate}}
|
||||
</button>
|
||||
<button mat-menu-item (click)="clone(row.id)">
|
||||
<mat-icon>filter_none</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.CLONE' | translate}}
|
||||
</button>
|
||||
|
|
|
@ -123,6 +123,35 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
|
|||
this.router.navigate(['dataset-profiles/newversion/' + id]);
|
||||
}
|
||||
|
||||
newVersionFromFile(id: string, label: string): void {
|
||||
const dialogRef = this.dialog.open(DialogConfirmationUploadDatasetProfiles, {
|
||||
width: '500px',
|
||||
restoreFocus: false,
|
||||
data: {
|
||||
message: this.language.instant('DATASET-WIZARD.NEW-VERSION-FROM-FILE.NEW-VERSION-XML-FILE-TITLE', {datasetName: label}),
|
||||
confirmButton: this.language.instant('DATASET-WIZARD.NEW-VERSION-FROM-FILE.NEW-VERSION-XML'),
|
||||
cancelButton: this.language.instant('DATASET-WIZARD.NEW-VERSION-FROM-FILE.NEW-VERSION-XML-FILE-CANCEL'),
|
||||
name: "",
|
||||
file: FileList,
|
||||
sucsess: false
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(data => {
|
||||
if (data && data.sucsess && data.name != null && data.file != null) {
|
||||
this.datasetService.uploadFile(data.file, data.name, id)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(_=>{
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-WIZARD.NEW-VERSION-FROM-FILE.NEW-VERSION-XML-SUCCESSFUL'), SnackBarNotificationLevel.Success);
|
||||
this.refresh();
|
||||
},
|
||||
error=>{
|
||||
this.uiNotificationService.snackBarNotification(error.message, SnackBarNotificationLevel.Error);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
viewVersions(rowId, rowLabel) {
|
||||
this.router.navigate(['/dataset-profiles/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<div class="row root">
|
||||
<mat-card class="col-md-3 offset-md-4">
|
||||
<div>
|
||||
<div style="color: red;">Warning: Danger zone. Irreversible action!</div>
|
||||
<button mat-raised-button color="primary" (click)="migrateSchematics($event)" class="lightblue-btn button">Migrate schematics</button>
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
|
@ -0,0 +1,7 @@
|
|||
.root {
|
||||
padding-bottom: 2em;
|
||||
|
||||
.button {
|
||||
margin: 5px;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { MaintenanceTasksService } from '@app/core/services/maintenance-tasks/maintenance-tasks.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-maintenance-tasks',
|
||||
templateUrl: './maintenance-tasks.component.html',
|
||||
styleUrls: ['./maintenance-tasks.component.scss']
|
||||
})
|
||||
export class MaintenanceTasksComponent extends BaseComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private maintenanceTasksService: MaintenanceTasksService,
|
||||
private uiNotificationService: UiNotificationService,
|
||||
private translate: TranslateService,
|
||||
private router: Router,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
migrateSchematics(ev: Event) {
|
||||
(ev.srcElement as HTMLButtonElement).disabled = true;
|
||||
this.maintenanceTasksService.migrateSchematics().pipe(takeUntil(this._destroyed)).subscribe(
|
||||
response => {
|
||||
(ev.srcElement as HTMLButtonElement).disabled = false;
|
||||
this.onCallbackSuccess();
|
||||
},
|
||||
error => {
|
||||
(ev.srcElement as HTMLButtonElement).disabled = false;
|
||||
this.onCallbackError(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onCallbackSuccess(): void {
|
||||
this.uiNotificationService.snackBarNotification( this.translate.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||
this.router.navigate(['/reload']).then(() => this.router.navigate(['/maintenance-tasks']));
|
||||
}
|
||||
|
||||
onCallbackError(error: any) {
|
||||
this.uiNotificationService.snackBarNotification( error, SnackBarNotificationLevel.Error);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { MaintenanceTasksRoutingModule } from './maintenance-tasks.routing';
|
||||
import { MaintenanceTasksComponent } from './maintenance-tasks.component';
|
||||
import { CommonUiModule } from '@common/ui/common-ui.module';
|
||||
import { CommonFormsModule } from '@common/forms/common-forms.module';
|
||||
import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module';
|
||||
import { MaintenanceTasksService } from '@app/core/services/maintenance-tasks/maintenance-tasks.service';
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [MaintenanceTasksComponent],
|
||||
imports: [
|
||||
CommonUiModule,
|
||||
CommonFormsModule,
|
||||
ConfirmationDialogModule,
|
||||
MaintenanceTasksRoutingModule
|
||||
],
|
||||
providers: [
|
||||
MaintenanceTasksService
|
||||
]
|
||||
})
|
||||
export class MaintenanceTasksModule { }
|
|
@ -0,0 +1,15 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { MaintenanceTasksComponent } from './maintenance-tasks.component';
|
||||
import { AdminAuthGuard } from '@app/core/admin-auth-guard.service';
|
||||
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', component: MaintenanceTasksComponent, canActivate: [AdminAuthGuard] },
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class MaintenanceTasksRoutingModule { }
|
|
@ -53,7 +53,6 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
|
|||
breadCrumbs: Observable<BreadcrumbItem[]> = observableOf();
|
||||
isUserOwner: boolean;
|
||||
expand = false;
|
||||
hasDOIToken = false;
|
||||
researchers: ResearcherModel[];
|
||||
users: UserInfoListingModel[];
|
||||
lockStatus: Boolean;
|
||||
|
|
|
@ -64,7 +64,6 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
breadCrumbs: Observable<BreadcrumbItem[]> = observableOf();
|
||||
isUserOwner: boolean;
|
||||
expand = false;
|
||||
hasDOIToken = false;
|
||||
lockStatus: Boolean;
|
||||
textMessage: any;
|
||||
versions: VersionListingModel[];
|
||||
|
@ -510,7 +509,6 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
if (result.length > 0) {
|
||||
this.dmp.dois = result;
|
||||
this.selectedModel = this.dmp.dois[this.dmp.dois.length - 1];
|
||||
this.hasDOIToken = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -838,90 +836,4 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
// return url;
|
||||
// }
|
||||
|
||||
// getDoi(dmp: DmpOverviewModel) {
|
||||
// this.userService.hasDOIToken().subscribe(response => {
|
||||
// this.hasDOIToken = true;
|
||||
// this.showConfirmationDOIDialog(dmp);
|
||||
// }, error => {
|
||||
// this.hasDOIToken = false;
|
||||
// this.showErrorConfirmationDOIDialog(error.error.message, dmp);
|
||||
// });
|
||||
// }
|
||||
|
||||
// showConfirmationDOIDialog(dmp: DmpOverviewModel) {
|
||||
// const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
// maxWidth: '600px',
|
||||
// restoreFocus: false,
|
||||
// data: {
|
||||
// message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ZENODO-DOI', { 'username': this.hasDOIToken ? this.authentication.current().zenodoEmail : 'default' }),
|
||||
// confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
||||
// cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
|
||||
// }
|
||||
// });
|
||||
// dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
// if (result) {
|
||||
// this.dmpService.getDoi(dmp.id)
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe(
|
||||
// complete => {
|
||||
// this.onDOICallbackSuccess();
|
||||
// this.dmp.doi = complete;
|
||||
// },
|
||||
// error => this.onDeleteCallbackError(error)
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// showErrorConfirmationDOIDialog(message: string, dmp: DmpOverviewModel) {
|
||||
// const dialogRef = this.dialog.open(MultipleChoiceDialogComponent, {
|
||||
// maxWidth: '600px',
|
||||
// restoreFocus: false,
|
||||
// data: {
|
||||
// message: message ? this.language.instant(message) : this.language.instant('GENERAL.ERRORS.HTTP-REQUEST-ERROR'),
|
||||
// titles: [this.language.instant('DMP-OVERVIEW.MULTIPLE-DIALOG.ZENODO-LOGIN'), this.language.instant('DMP-OVERVIEW.MULTIPLE-DIALOG.USE-DEFAULT')]
|
||||
// }
|
||||
// });
|
||||
// dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
// switch (result) {
|
||||
// case 0:
|
||||
// // this.authentication.logout();
|
||||
// // this.router.navigate(['/login/external/zenodo']);
|
||||
// this.showOauth2Dialog(this.getAccessUrl(), dmp);
|
||||
// break;
|
||||
// case 1:
|
||||
// this.showConfirmationDOIDialog(dmp);
|
||||
// break;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// showOauth2Dialog(url: string, dmp: DmpOverviewModel) {
|
||||
// this.oauth2DialogService.login(url)
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe(result => {
|
||||
// if (result !== undefined) {
|
||||
// if (result.oauthCode !== undefined && result.oauthCode !== null && !this.oauthLock) {
|
||||
// this.userService.registerDOIToken(result.oauthCode, this.configurationService.app + 'oauth2')
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe(() => {
|
||||
// this.hasDOIToken = true;
|
||||
// this.showConfirmationDOIDialog(dmp);
|
||||
// });
|
||||
// this.oauthLock = true;
|
||||
// }
|
||||
// } else {
|
||||
// this.oauthLock = false;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// onDOICallbackSuccess(): void {
|
||||
// this.uiNotificationService.snackBarNotification(this.language.instant('DMP-EDITOR.SNACK-BAR.SUCCESSFUL-DOI'), SnackBarNotificationLevel.Success);
|
||||
// }
|
||||
|
||||
// onDOICallbackError(error) {
|
||||
// this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('DMP-EDITOR.SNACK-BAR.UNSUCCESSFUL-DOI'), SnackBarNotificationLevel.Error);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -765,6 +765,12 @@
|
|||
"UPLOAD-XML-IMPORT": "File",
|
||||
"UPLOAD-XML-FILE-CANCEL": "Cancel"
|
||||
},
|
||||
"NEW-VERSION-FROM-FILE": {
|
||||
"NEW-VERSION-XML": "Import",
|
||||
"NEW-VERSION-XML-FILE-TITLE": "New Version from File for {{datasetName}}",
|
||||
"NEW-VERSION-XML-FILE-CANCEL": "Cancel",
|
||||
"NEW-VERSION-XML-SUCCESSFUL": "New Version successfully uploaded"
|
||||
},
|
||||
"DIALOGUE": {
|
||||
"TITLE": "Copy Dataset to DMP",
|
||||
"DMP-SEARCH": {
|
||||
|
@ -930,6 +936,7 @@
|
|||
"VIEW": "View",
|
||||
"CLONE": "Clone",
|
||||
"NEW-VERSION": "New Version",
|
||||
"NEW-VERSION-FROM-FILE": "New Version from File",
|
||||
"VIEW-VERSIONS": "All Dataset Template Versions",
|
||||
"DELETE": "Delete",
|
||||
"CREATE-DATASET-TEMPLATE": "Create Dataset Template"
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
"FreeTextFieldDataEditorModel.label",
|
||||
"WordListFieldDataEditorModel.label",
|
||||
"FieldDataOptionEditorModel.label",
|
||||
"FieldSetEditorModel.rdaCommonStandard",
|
||||
"FieldSetEditorModel.schematics",
|
||||
"FieldSetEditorModel.export"
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue