Revision 45965
Added by Sandro La Bruzzo about 7 years ago
DliToHbaseXsltFunctions.java | ||
---|---|---|
69 | 69 |
FieldTypeProtos.StructuredProperty.Builder identifier = FieldTypeProtos.StructuredProperty.newBuilder(); |
70 | 70 |
identifier.setQualifier(getSimpleQualifier(pidType, "dnet:pid_types")); |
71 | 71 |
identifier.setValue(pid.trim()); |
72 |
entity.addExtension(DliProtos.typedIdentifier, identifier.build());
|
|
72 |
entity.addExtension(DliProtos.typedIdentifier, fixPid(identifier.build()));
|
|
73 | 73 |
entity.setId(entityId); |
74 | 74 |
entity.setType(TypeProtos.Type.valueOf(type)); |
75 | 75 |
final DNGFProtos.DNGF oaf = DNGFProtos.DNGF.newBuilder().setEntity(entity).setKind(KindProtos.Kind.entity).build(); |
... | ... | |
78 | 78 |
} catch (Throwable e) { |
79 | 79 |
throw new RuntimeException(e); |
80 | 80 |
} |
81 |
|
|
82 | 81 |
} |
83 | 82 |
|
84 | 83 |
public static String createEntity( |
... | ... | |
188 | 187 |
} |
189 | 188 |
return null; |
190 | 189 |
} |
190 |
|
|
191 |
|
|
192 |
public static FieldTypeProtos.StructuredProperty fixPid(final FieldTypeProtos.StructuredProperty inputPid) { |
|
193 |
if (inputPid == null) { |
|
194 |
return null; |
|
195 |
} |
|
196 |
String pid = inputPid.getValue(); |
|
197 |
String pidType = inputPid.getQualifier().getClassid(); |
|
198 |
|
|
199 |
if (StringUtils.isBlank(pid) || StringUtils.isBlank(pidType)) { |
|
200 |
return null; |
|
201 |
} |
|
202 |
pidType = pidType.trim().toLowerCase(); |
|
203 |
pid = pid.trim().toLowerCase(); |
|
204 |
|
|
205 |
if ("doi".equals(pidType)) { |
|
206 |
pid = pid.replace("http://dx.doi.org/", "").replace("http://doi.org/", ""); |
|
207 |
} |
|
208 |
return getStructuredProperty(pid, pidType, pidType, inputPid.getQualifier().getSchemeid(), inputPid.getQualifier().getSchemename()); |
|
209 |
} |
|
191 | 210 |
} |
Also available in: Unified diff
Added fix of pid