Revision 49332
Added by Sandro La Bruzzo over 6 years ago
DMFResolverParser.java | ||
---|---|---|
12 | 12 |
import eu.dnetlib.pid.resolver.model.ObjectType; |
13 | 13 |
import eu.dnetlib.pid.resolver.model.PID; |
14 | 14 |
import eu.dnetlib.pid.resolver.model.SubjectType; |
15 |
import eu.dnetlib.pid.resolver.parser.AbstractResolverParser; |
|
15 | 16 |
import org.apache.commons.lang3.StringUtils; |
16 | 17 |
import org.apache.commons.logging.Log; |
17 | 18 |
import org.apache.commons.logging.LogFactory; |
... | ... | |
64 | 65 |
final List<Node> identifierType = |
65 | 66 |
VtdUtilityParser.getTextValuesWithAttributes(ap, vn, "//*[local-name()='resource']/*[local-name()='identifier']", Lists.newArrayList("identifierType")); |
66 | 67 |
|
67 |
if (identifierType != null && identifierType.size() > 0) {
|
|
68 |
if (extractIdentifier(parsedObject, identifierType)) return null;
|
|
68 | 69 |
|
69 |
final Node result = identifierType.get(0); |
|
70 |
parsedObject.setPid(result.getTextValue()); |
|
71 |
parsedObject.setPidType(result.getAttributes().get("identifierType")); |
|
72 |
} else { |
|
73 |
log.debug("Error on parsing record the identifier should not null "); |
|
74 |
return null; |
|
75 |
} |
|
76 |
|
|
77 | 70 |
final List<Node> relations = |
78 | 71 |
VtdUtilityParser.getTextValuesWithAttributes(ap, vn, "//*[local-name()='resource']//*[local-name()='relatedIdentifier']", Arrays.asList("relatedIdentifierType", "relationType", "inverseRelationType")); |
79 | 72 |
|
... | ... | |
96 | 89 |
|
97 | 90 |
final List<Node> subjects = VtdUtilityParser.getTextValuesWithAttributes(ap, vn, "//*[local-name()='resource']//*[local-name()='subject']", Arrays.asList("subjectScheme")); |
98 | 91 |
|
99 |
if (subjects != null && subjects.size() > 0) { |
|
100 |
final List<SubjectType> subjectResult = new ArrayList<>(); |
|
101 |
subjects.forEach(subjectMap -> { |
|
102 |
final SubjectType subject = new SubjectType(subjectMap.getAttributes().get("subjectScheme"), subjectMap.getTextValue()); |
|
103 |
subjectResult.add(subject); |
|
104 |
}); |
|
105 |
parsedObject.setSubjects(subjectResult); |
|
106 |
} |
|
92 |
extractSubject(parsedObject, subjects); |
|
107 | 93 |
|
108 | 94 |
parsedObject.setCompletionStatus(completionStatus); |
109 | 95 |
|
... | ... | |
129 | 115 |
final String type = VtdUtilityParser.getSingleValue(ap, vn, "//*[local-name()='resource']/*[local-name()='resourceType']"); |
130 | 116 |
setType(parsedObject, type); |
131 | 117 |
} |
118 |
final List<String> dates = VtdUtilityParser.getTextValue(ap, vn, "//*[local-name()='resource']/*[local-name()='dates']/*[local-name()='date']"); |
|
132 | 119 |
|
133 | 120 |
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
final List<String> dates = VtdUtilityParser.getTextValue(ap, vn, "//*[local-name()='resource']/*[local-name()='dates']/*[local-name()='date']"); |
|
139 |
|
|
140 |
if (dates != null && dates.size() > 0) { |
|
121 |
if (dates != null && dates.size() > 0) { |
|
141 | 122 |
parsedObject.setDate(dates.get(0)); |
142 | 123 |
} |
143 | 124 |
return parsedObject; |
... | ... | |
148 | 129 |
} |
149 | 130 |
|
150 | 131 |
|
151 |
|
|
152 | 132 |
} |
153 | 133 |
|
Also available in: Unified diff
minor