migration fix

This commit is contained in:
Efstratios Giannopoulos 2024-07-12 13:57:11 +03:00
parent c2343defab
commit 7982953de7
1 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,8 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Service @Service
public class ResearcherMigrationService { public class ResearcherMigrationService {
@ -75,6 +77,11 @@ public class ResearcherMigrationService {
data.setSource(isInternal? "Internal" : referenceParts[0]); data.setSource(isInternal? "Internal" : referenceParts[0]);
data.setSourceType(isInternal? ReferenceSourceType.Internal : ReferenceSourceType.External); data.setSourceType(isInternal? ReferenceSourceType.Internal : ReferenceSourceType.External);
Pattern pattern = Pattern.compile("\\(orcid:(.*?)\\)");
if (data.getSource().equalsIgnoreCase("orcid") && !pattern.matcher(data.getLabel()).find()){
data.setLabel(data.getLabel() + " (orcid:" + data.getReference() + ")");
}
DefinitionEntity definitionEntity = new DefinitionEntity(); DefinitionEntity definitionEntity = new DefinitionEntity();
definitionEntity.setFields(new ArrayList<>()); definitionEntity.setFields(new ArrayList<>());
if (!this.conventionService.isNullOrEmpty(item.getUri())){ if (!this.conventionService.isNullOrEmpty(item.getUri())){