Skip to content

Commit

Permalink
make has_accepted_name default; #148
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorrit Poelen committed Jun 18, 2024
1 parent 805a8b2 commit 8e95b5a
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@

public class WorldRegisterOfMarineSpeciesTaxonService extends CommonTaxonService<Long> {
private static final Logger LOG = LoggerFactory.getLogger(WorldRegisterOfMarineSpeciesTaxonService.class);


private static final List<String> acceptedStatus = Arrays.asList(
"accepted"
);


private static final List<String> uncheckedStatus = Arrays.asList(
"unassessed",
"nomen dubium",
Expand Down Expand Up @@ -170,11 +165,15 @@ protected void lazyInit() throws PropertyEnricherException {
@Override
protected NameType getNameTypeFor(Taxon taxon) {
return taxon.getStatus() == null
? NameType.NONE
? defaultRelation()
: getNameType(taxon.getStatus().getName()
);
}

private NameType defaultRelation() {
return NameType.HAS_ACCEPTED_NAME;
}


private InputStream getClassificationStream() throws PropertyEnricherException {
InputStream resource;
Expand Down Expand Up @@ -249,11 +248,9 @@ private void parseLine(NameUsageListener<Long> nameUsageListener, JsonNode jsonN
}

private NameType getNameType(String statusValue) {
NameType nameType = NameType.TRANSLATES_TO;
NameType nameType = defaultRelation();
if (synonymStatus.contains(statusValue)) {
nameType = NameType.SYNONYM_OF;
} else if (acceptedStatus.contains(statusValue)) {
nameType = NameType.HAS_ACCEPTED_NAME;
} else if (uncheckedStatus.contains(statusValue)) {
nameType = NameType.HAS_UNCHECKED_NAME;
}
Expand Down

0 comments on commit 8e95b5a

Please sign in to comment.