Revision 48991
Added by Claudio Atzori over 6 years ago
OafEntityMerger.java | ||
---|---|---|
18 | 18 |
import eu.dnetlib.data.proto.KindProtos.Kind; |
19 | 19 |
import eu.dnetlib.data.proto.OafProtos.Oaf; |
20 | 20 |
import eu.dnetlib.data.proto.OafProtos.OafEntity; |
21 |
import eu.dnetlib.data.proto.PersonProtos.Person; |
|
22 |
import eu.dnetlib.data.proto.PersonProtos.Person.CoAuthor; |
|
23 |
import eu.dnetlib.data.proto.PersonProtos.Person.MergedPerson; |
|
24 |
import eu.dnetlib.data.proto.PersonProtos.Person.Metadata; |
|
25 | 21 |
import eu.dnetlib.data.proto.ResultProtos.Result; |
26 | 22 |
import eu.dnetlib.data.proto.ResultProtos.Result.Instance; |
27 | 23 |
import eu.dnetlib.data.proto.SpecialTrustProtos.SpecialTrust; |
... | ... | |
108 | 104 |
break; |
109 | 105 |
case organization: |
110 | 106 |
break; |
111 |
case person: |
|
112 |
final Person.Builder person = builder.getEntityBuilder().getPersonBuilder().setAnchor(true); |
|
113 |
|
|
114 |
for (final String field : OafUtils.getFieldNames(Person.Metadata.getDescriptor(), Metadata.SECONDNAMES_FIELD_NUMBER)) { |
|
115 |
setSingleString(person.getMetadataBuilder(), field); |
|
116 |
} |
|
117 |
|
|
118 |
final Map<String, MergedPerson> mergedMap = Maps.newHashMap(); |
|
119 |
for(MergedPerson merged : person.getMergedpersonList()) { |
|
120 |
mergedMap.put(merged.getId(), merged); |
|
121 |
} |
|
122 |
person.clearMergedperson().addAllMergedperson(mergedMap.values()); |
|
123 |
|
|
124 |
final Map<String, CoAuthor> coAuthorMap = Maps.newHashMap(); |
|
125 |
for(CoAuthor coAuthor : person.getCoauthorList()) { |
|
126 |
coAuthorMap.put(coAuthor.getId(), coAuthor); |
|
127 |
} |
|
128 |
person.clearCoauthor().addAllCoauthor(coAuthorMap.values()); |
|
129 |
|
|
130 |
break; |
|
131 | 107 |
case project: |
132 | 108 |
break; |
133 | 109 |
case result: |
Also available in: Unified diff
depending on protobuf specific version, getting rid of person entities, updated solrj version