migration changes
This commit is contained in:
parent
b8c5edf4fb
commit
656afc2045
|
@ -21,7 +21,7 @@ BEGIN
|
||||||
CREATE TABLE public."Reference"
|
CREATE TABLE public."Reference"
|
||||||
(
|
(
|
||||||
id uuid NOT NULL,
|
id uuid NOT NULL,
|
||||||
label character varying(250) COLLATE pg_catalog."default" NOT NULL,
|
label character varying(500) COLLATE pg_catalog."default" NOT NULL,
|
||||||
description text COLLATE pg_catalog."default",
|
description text COLLATE pg_catalog."default",
|
||||||
abbreviation character varying(50) COLLATE pg_catalog."default",
|
abbreviation character varying(50) COLLATE pg_catalog."default",
|
||||||
source character varying(1024) COLLATE pg_catalog."default",
|
source character varying(1024) COLLATE pg_catalog."default",
|
||||||
|
|
|
@ -970,6 +970,7 @@ public class DatasetMigrationService {
|
||||||
if (this.conventionService.isNullOrEmpty(data.getReference())) {
|
if (this.conventionService.isNullOrEmpty(data.getReference())) {
|
||||||
data.setReference(data.getId().toString().replace("-", "").toLowerCase(Locale.ROOT));
|
data.setReference(data.getId().toString().replace("-", "").toLowerCase(Locale.ROOT));
|
||||||
data.setSourceType(ReferenceSourceType.Internal);
|
data.setSourceType(ReferenceSourceType.Internal);
|
||||||
|
data.setSource("Internal");
|
||||||
if (dataset.getCreator() != null) data.setCreatedById(dataset.getCreator().getId());
|
if (dataset.getCreator() != null) data.setCreatedById(dataset.getCreator().getId());
|
||||||
logger.warn("Migrate Dataset " + dataset.getId() + " " + dataset.getLabel() + " reference auto created as internal " + referenceTypeDataEntity.getReferenceTypeId() + " for value " + this.jsonHandlingService.toJsonSafe(item));
|
logger.warn("Migrate Dataset " + dataset.getId() + " " + dataset.getLabel() + " reference auto created as internal " + referenceTypeDataEntity.getReferenceTypeId() + " for value " + this.jsonHandlingService.toJsonSafe(item));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,9 @@ package eu.old.eudat.migration;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.data.DescriptionReferenceEntity;
|
import eu.eudat.data.DescriptionReferenceEntity;
|
||||||
import eu.eudat.data.DmpReferenceEntity;
|
|
||||||
import eu.old.eudat.data.dao.entities.*;
|
import eu.old.eudat.data.dao.entities.*;
|
||||||
import eu.old.eudat.data.entities.*;
|
import eu.old.eudat.data.entities.*;
|
||||||
import eu.old.eudat.logic.services.operations.DatabaseRepository;
|
import eu.old.eudat.logic.services.operations.DatabaseRepository;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -17,15 +15,14 @@ import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ReferenceMigrationService {
|
public class DatasetReferenceMigrationService {
|
||||||
|
|
||||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpDatasetProfileMigrationService.class));
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpDatasetProfileMigrationService.class));
|
||||||
private final DatabaseRepository databaseRepository;
|
private final DatabaseRepository databaseRepository;
|
||||||
private static final int PageSize = 500;
|
private static final int PageSize = 500;
|
||||||
private static final boolean TestMode = false;
|
|
||||||
private final EntityManager entityManager;
|
private final EntityManager entityManager;
|
||||||
|
|
||||||
public ReferenceMigrationService(DatabaseRepository databaseRepository, EntityManager entityManager) {
|
public DatasetReferenceMigrationService(DatabaseRepository databaseRepository, EntityManager entityManager) {
|
||||||
this.databaseRepository = databaseRepository;
|
this.databaseRepository = databaseRepository;
|
||||||
this.entityManager = entityManager;
|
this.entityManager = entityManager;
|
||||||
}
|
}
|
|
@ -93,7 +93,6 @@ public class StorageFileMigrationService {
|
||||||
page++;
|
page++;
|
||||||
}
|
}
|
||||||
} while (items != null && !items.isEmpty());
|
} while (items != null && !items.isEmpty());
|
||||||
throw new MyApplicationException("");
|
|
||||||
// for (File file : filesToDelete){
|
// for (File file : filesToDelete){
|
||||||
// try{
|
// try{
|
||||||
// file.delete();
|
// file.delete();
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package eu.old.eudat.publicapi.migration;
|
package eu.old.eudat.publicapi.migration;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import eu.old.eudat.migration.*;
|
import eu.old.eudat.migration.*;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import jakarta.xml.bind.JAXBException;
|
import jakarta.xml.bind.JAXBException;
|
||||||
|
@ -36,7 +35,7 @@ public class MigrationController {
|
||||||
private final TagMigrationService tagMigrationService;
|
private final TagMigrationService tagMigrationService;
|
||||||
private final DmpDatasetProfileMigrationService dmpDatasetProfileMigrationService;
|
private final DmpDatasetProfileMigrationService dmpDatasetProfileMigrationService;
|
||||||
private final OrganizationMigrationService organizationMigrationService;
|
private final OrganizationMigrationService organizationMigrationService;
|
||||||
private final ReferenceMigrationService referenceMigrationService;
|
private final DatasetReferenceMigrationService datasetReferenceMigrationService;
|
||||||
private final UserContactInfoMigrationService userContactInfoMigrationService;
|
private final UserContactInfoMigrationService userContactInfoMigrationService;
|
||||||
private final DmpUserMigrationService dmpUserMigrationService;
|
private final DmpUserMigrationService dmpUserMigrationService;
|
||||||
private final UserMigrationService userMigrationService;
|
private final UserMigrationService userMigrationService;
|
||||||
|
@ -58,7 +57,7 @@ public class MigrationController {
|
||||||
ResearcherMigrationService researcherMigrationService,
|
ResearcherMigrationService researcherMigrationService,
|
||||||
ServiceMigrationService serviceMigrationService, TagMigrationService tagMigrationService,
|
ServiceMigrationService serviceMigrationService, TagMigrationService tagMigrationService,
|
||||||
OrganizationMigrationService organizationMigrationService,
|
OrganizationMigrationService organizationMigrationService,
|
||||||
ReferenceMigrationService referenceMigrationService,
|
DatasetReferenceMigrationService datasetReferenceMigrationService,
|
||||||
UserContactInfoMigrationService userContactInfoMigrationService,
|
UserContactInfoMigrationService userContactInfoMigrationService,
|
||||||
DmpUserMigrationService dmpUserMigrationService,
|
DmpUserMigrationService dmpUserMigrationService,
|
||||||
UserMigrationService userMigrationService,
|
UserMigrationService userMigrationService,
|
||||||
|
@ -77,7 +76,7 @@ public class MigrationController {
|
||||||
this.serviceMigrationService = serviceMigrationService;
|
this.serviceMigrationService = serviceMigrationService;
|
||||||
this.tagMigrationService = tagMigrationService;
|
this.tagMigrationService = tagMigrationService;
|
||||||
this.organizationMigrationService = organizationMigrationService;
|
this.organizationMigrationService = organizationMigrationService;
|
||||||
this.referenceMigrationService = referenceMigrationService;
|
this.datasetReferenceMigrationService = datasetReferenceMigrationService;
|
||||||
this.userContactInfoMigrationService = userContactInfoMigrationService;
|
this.userContactInfoMigrationService = userContactInfoMigrationService;
|
||||||
this.dmpUserMigrationService = dmpUserMigrationService;
|
this.dmpUserMigrationService = dmpUserMigrationService;
|
||||||
this.userMigrationService = userMigrationService;
|
this.userMigrationService = userMigrationService;
|
||||||
|
@ -90,39 +89,39 @@ public class MigrationController {
|
||||||
@GetMapping("all")
|
@GetMapping("all")
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean migrateAll() throws IOException, JAXBException, ParserConfigurationException, InstantiationException, IllegalAccessException, SAXException, NoSuchFieldException, InvalidApplicationException, TransformerException, URISyntaxException {
|
public boolean migrateAll() throws IOException, JAXBException, ParserConfigurationException, InstantiationException, IllegalAccessException, SAXException, NoSuchFieldException, InvalidApplicationException, TransformerException, URISyntaxException {
|
||||||
// //Reference
|
//Reference
|
||||||
// this.dataRepositoryMigrationService.migrate();
|
this.dataRepositoryMigrationService.migrate();
|
||||||
// this.externalDatasetMigrationService.migrate();
|
this.externalDatasetMigrationService.migrate();
|
||||||
// this.funderMigrationService.migrate();
|
this.funderMigrationService.migrate();
|
||||||
// this.grantMigrationService.migrate();
|
this.grantMigrationService.migrate();
|
||||||
// this.organizationMigrationService.migrate();
|
this.organizationMigrationService.migrate();
|
||||||
// this.projectMigrationService.migrate();
|
this.projectMigrationService.migrate();
|
||||||
// this.registryMigrationService.migrate();
|
this.registryMigrationService.migrate();
|
||||||
// this.researcherMigrationService.migrate();
|
this.researcherMigrationService.migrate();
|
||||||
// this.serviceMigrationService.migrate();
|
this.serviceMigrationService.migrate();
|
||||||
//
|
|
||||||
// //User
|
//User
|
||||||
// this.userContactInfoMigrationService.migrate();
|
this.userContactInfoMigrationService.migrate();
|
||||||
// this.userMigrationService.migrate();
|
this.userMigrationService.migrate();
|
||||||
//
|
|
||||||
// //XML recreate
|
//XML recreate
|
||||||
// this.dmpBlueprintXmlMigrationService.migrate();
|
this.dmpBlueprintXmlMigrationService.migrate();
|
||||||
// this.descriptionTemplateXmlMigrationService.migrate();
|
this.descriptionTemplateXmlMigrationService.migrate();
|
||||||
//
|
|
||||||
// //Dmp
|
//Dmp
|
||||||
// this.dmpMigrationService.migrate();
|
this.dmpMigrationService.migrate();
|
||||||
// this.dmpDatasetProfileMigrationService.migrate();
|
this.dmpDatasetProfileMigrationService.migrate();
|
||||||
// this.dmpUserMigrationService.migrate();
|
this.dmpUserMigrationService.migrate();
|
||||||
|
|
||||||
//Description
|
//Description
|
||||||
this.datasetMigrationService.migrate(); //TODO
|
this.datasetMigrationService.migrate();
|
||||||
// this.referenceMigrationService.migrateDatasetReferences();
|
this.datasetReferenceMigrationService.migrateDatasetReferences();
|
||||||
// this.tagMigrationService.migrate();
|
this.tagMigrationService.migrate();
|
||||||
|
|
||||||
// this.storageFileMigrationService.migrate();
|
this.storageFileMigrationService.migrate();
|
||||||
|
|
||||||
throw new RuntimeException("");
|
//throw new RuntimeException("");
|
||||||
//return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @GetMapping("dmp-blueprints-xml")
|
// @GetMapping("dmp-blueprints-xml")
|
||||||
|
|
Loading…
Reference in New Issue