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