From 734232d3b94a640321f675f2f72af4a9728a49ec Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Wed, 17 Mar 2021 15:14:53 +0100 Subject: [PATCH] identifier factory doesn't depend on pre-existing entity.id --- .../eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactory.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactory.java b/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactory.java index 4682b7aed..0371a2879 100644 --- a/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactory.java +++ b/dhp-common/src/main/java/eu/dnetlib/dhp/schema/oaf/utils/IdentifierFactory.java @@ -10,6 +10,7 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; +import eu.dnetlib.dhp.schema.common.ModelSupport; import org.apache.commons.lang3.StringUtils; import com.google.common.collect.HashBiMap; @@ -176,7 +177,7 @@ public class IdentifierFactory implements Serializable { private static String idFromPid(T entity, StructuredProperty s, boolean md5) { return new StringBuilder() - .append(StringUtils.substringBefore(entity.getId(), ID_PREFIX_SEPARATOR)) + .append(ModelSupport.getIdPrefix(entity.getClass())) .append(ID_PREFIX_SEPARATOR) .append(createPrefix(s.getQualifier().getClassid())) .append(ID_SEPARATOR)