@Test public void interpretBasisOfRecordRubbishTest() { Map<String, String> coreMap = new HashMap<>(); coreMap.put(DwcTerm.basisOfRecord.qualifiedName(), "adwadaw"); ExtendedRecord er = ExtendedRecord.newBuilder().setId(ID).setCoreTerms(coreMap).build(); BasicRecord br = BasicRecord.newBuilder().setId(ID).build(); BasicInterpreter.interpretBasisOfRecord(er, br); Assert.assertEquals("UNKNOWN", br.getBasisOfRecord()); assertIssueSize(br, 1); assertIssue(OccurrenceIssue.BASIS_OF_RECORD_INVALID, br); }
public static void interpretBasisOfRecord(ExtendedRecord er, BasicRecord br) { Function<ParseResult<BasisOfRecord>, BasicRecord> fn = parseResult -> { if (parseResult.isSuccessful()) { br.setBasisOfRecord(parseResult.getPayload().name()); } else { br.setBasisOfRecord(BasisOfRecord.UNKNOWN.name()); addIssue(br, BASIS_OF_RECORD_INVALID); } return br; }; VocabularyParser.basisOfRecordParser().map(er, fn); if (br.getBasisOfRecord() == null || br.getBasisOfRecord().isEmpty()) { br.setBasisOfRecord(BasisOfRecord.UNKNOWN.name()); addIssue(br, BASIS_OF_RECORD_INVALID); } }
BasicInterpreter { public static void interpretBasisOfRecord(ExtendedRecord er, BasicRecord br) { Function<ParseResult<BasisOfRecord>, BasicRecord> fn = parseResult -> { if (parseResult.isSuccessful()) { br.setBasisOfRecord(parseResult.getPayload().name()); } else { br.setBasisOfRecord(BasisOfRecord.UNKNOWN.name()); addIssue(br, BASIS_OF_RECORD_INVALID); } return br; }; VocabularyParser.basisOfRecordParser().map(er, fn); if (br.getBasisOfRecord() == null || br.getBasisOfRecord().isEmpty()) { br.setBasisOfRecord(BasisOfRecord.UNKNOWN.name()); addIssue(br, BASIS_OF_RECORD_INVALID); } } }
BasicInterpreter { public static void interpretBasisOfRecord(ExtendedRecord er, BasicRecord br) { Function<ParseResult<BasisOfRecord>, BasicRecord> fn = parseResult -> { if (parseResult.isSuccessful()) { br.setBasisOfRecord(parseResult.getPayload().name()); } else { br.setBasisOfRecord(BasisOfRecord.UNKNOWN.name()); addIssue(br, BASIS_OF_RECORD_INVALID); } return br; }; VocabularyParser.basisOfRecordParser().map(er, fn); if (br.getBasisOfRecord() == null || br.getBasisOfRecord().isEmpty()) { br.setBasisOfRecord(BasisOfRecord.UNKNOWN.name()); addIssue(br, BASIS_OF_RECORD_INVALID); } }  }
BasicInterpreter { public static void interpretBasisOfRecord(ExtendedRecord er, BasicRecord br) { Function<ParseResult<BasisOfRecord>, BasicRecord> fn = parseResult -> { if (parseResult.isSuccessful()) { br.setBasisOfRecord(parseResult.getPayload().name()); } else { br.setBasisOfRecord(BasisOfRecord.UNKNOWN.name()); addIssue(br, BASIS_OF_RECORD_INVALID); } return br; }; VocabularyParser.basisOfRecordParser().map(er, fn); if (br.getBasisOfRecord() == null || br.getBasisOfRecord().isEmpty()) { br.setBasisOfRecord(BasisOfRecord.UNKNOWN.name()); addIssue(br, BASIS_OF_RECORD_INVALID); } }  static BiConsumer<ExtendedRecord, BasicRecord> interpretGbifId(
      HBaseLockingKeyService keygenService,
      boolean isTripletValid,
      boolean isOccurrenceIdValid,
      boolean useExtendedRecordId,
      BiConsumer<ExtendedRecord, BasicRecord> gbifIdFn); static BiConsumer<ExtendedRecord, BasicRecord> interpretGbifId(
      HBaseLockingKeyService keygenService, boolean isTripletValid, boolean isOccurrenceIdValid); static BiConsumer<ExtendedRecord, BasicRecord> interpretCopyGbifId(); static void interpretIndividualCount(ExtendedRecord er, BasicRecord br); static void interpretTypeStatus(ExtendedRecord er, BasicRecord br); static void interpretLifeStage(ExtendedRecord er, BasicRecord br); static void interpretEstablishmentMeans(ExtendedRecord er, BasicRecord br); static void interpretSex(ExtendedRecord er, BasicRecord br); static void interpretBasisOfRecord(ExtendedRecord er, BasicRecord br); static void interpretReferences(ExtendedRecord er, BasicRecord br); static void interpretTypifiedName(ExtendedRecord er, BasicRecord br); static void interpretSampleSizeValue(ExtendedRecord er, BasicRecord br); static void interpretSampleSizeUnit(ExtendedRecord er, BasicRecord br); static void interpretOrganismQuantity(ExtendedRecord er, BasicRecord br); static void interpretOrganismQuantityType(ExtendedRecord er, BasicRecord br); static void interpretRelativeOrganismQuantity(BasicRecord br); static void interpretLicense(ExtendedRecord er, BasicRecord br); static void interpretIdentifiedByIds(ExtendedRecord er, BasicRecord br); static void interpretRecordedByIds(ExtendedRecord er, BasicRecord br); static BiConsumer<ExtendedRecord, BasicRecord> interpretOccurrenceStatus(
      KeyValueStore<String, OccurrenceStatus> occStatusKvStore); }
BasicInterpreter { public static void interpretBasisOfRecord(ExtendedRecord er, BasicRecord br) { Function<ParseResult<BasisOfRecord>, BasicRecord> fn = parseResult -> { if (parseResult.isSuccessful()) { br.setBasisOfRecord(parseResult.getPayload().name()); } else { br.setBasisOfRecord(BasisOfRecord.UNKNOWN.name()); addIssue(br, BASIS_OF_RECORD_INVALID); } return br; }; VocabularyParser.basisOfRecordParser().map(er, fn); if (br.getBasisOfRecord() == null || br.getBasisOfRecord().isEmpty()) { br.setBasisOfRecord(BasisOfRecord.UNKNOWN.name()); addIssue(br, BASIS_OF_RECORD_INVALID); } }  static BiConsumer<ExtendedRecord, BasicRecord> interpretGbifId(
      HBaseLockingKeyService keygenService,
      boolean isTripletValid,
      boolean isOccurrenceIdValid,
      boolean useExtendedRecordId,
      BiConsumer<ExtendedRecord, BasicRecord> gbifIdFn); static BiConsumer<ExtendedRecord, BasicRecord> interpretGbifId(
      HBaseLockingKeyService keygenService, boolean isTripletValid, boolean isOccurrenceIdValid); static BiConsumer<ExtendedRecord, BasicRecord> interpretCopyGbifId(); static void interpretIndividualCount(ExtendedRecord er, BasicRecord br); static void interpretTypeStatus(ExtendedRecord er, BasicRecord br); static void interpretLifeStage(ExtendedRecord er, BasicRecord br); static void interpretEstablishmentMeans(ExtendedRecord er, BasicRecord br); static void interpretSex(ExtendedRecord er, BasicRecord br); static void interpretBasisOfRecord(ExtendedRecord er, BasicRecord br); static void interpretReferences(ExtendedRecord er, BasicRecord br); static void interpretTypifiedName(ExtendedRecord er, BasicRecord br); static void interpretSampleSizeValue(ExtendedRecord er, BasicRecord br); static void interpretSampleSizeUnit(ExtendedRecord er, BasicRecord br); static void interpretOrganismQuantity(ExtendedRecord er, BasicRecord br); static void interpretOrganismQuantityType(ExtendedRecord er, BasicRecord br); static void interpretRelativeOrganismQuantity(BasicRecord br); static void interpretLicense(ExtendedRecord er, BasicRecord br); static void interpretIdentifiedByIds(ExtendedRecord er, BasicRecord br); static void interpretRecordedByIds(ExtendedRecord er, BasicRecord br); static BiConsumer<ExtendedRecord, BasicRecord> interpretOccurrenceStatus(
      KeyValueStore<String, OccurrenceStatus> occStatusKvStore); static final String GBIF_ID_INVALID; }