1
0
Fork 0

identifier factory doesn't depend on pre-existing entity.id

This commit is contained in:
Claudio Atzori 2021-03-17 15:14:53 +01:00
parent a3dac32f16
commit 734232d3b9
1 changed files with 2 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import eu.dnetlib.dhp.schema.common.ModelSupport;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.google.common.collect.HashBiMap; import com.google.common.collect.HashBiMap;
@ -176,7 +177,7 @@ public class IdentifierFactory implements Serializable {
private static <T extends OafEntity> String idFromPid(T entity, StructuredProperty s, boolean md5) { private static <T extends OafEntity> String idFromPid(T entity, StructuredProperty s, boolean md5) {
return new StringBuilder() return new StringBuilder()
.append(StringUtils.substringBefore(entity.getId(), ID_PREFIX_SEPARATOR)) .append(ModelSupport.getIdPrefix(entity.getClass()))
.append(ID_PREFIX_SEPARATOR) .append(ID_PREFIX_SEPARATOR)
.append(createPrefix(s.getQualifier().getClassid())) .append(createPrefix(s.getQualifier().getClassid()))
.append(ID_SEPARATOR) .append(ID_SEPARATOR)