@Test public void imageTest() { Map<String, String> ext1 = new HashMap<>(); ext1.put(DcTerm.identifier.qualifiedName(), "http: ext1.put(DcTerm.references.qualifiedName(), "http: ext1.put(DcTerm.created.qualifiedName(), "2010"); ext1.put(DcTerm.title.qualifiedName(), "Tt1"); ext1.put(DcTerm.description.qualifiedName(), "Desc1"); ext1.put(DcTerm.spatial.qualifiedName(), "Sp1"); ext1.put(DcTerm.format.qualifiedName(), "jpeg"); ext1.put(DcTerm.creator.qualifiedName(), "Cr1"); ext1.put(DcTerm.contributor.qualifiedName(), "Cont1"); ext1.put(DcTerm.publisher.qualifiedName(), "Pub1"); ext1.put(DcTerm.audience.qualifiedName(), "Aud1"); ext1.put(DcTerm.license.qualifiedName(), "Lic1"); ext1.put(DcTerm.rightsHolder.qualifiedName(), "Rh1"); ext1.put(DwcTerm.datasetID.qualifiedName(), "1"); ext1.put("http: ext1.put("http: Map<String, String> ext2 = new HashMap<>(); ext2.put(DcTerm.identifier.qualifiedName(), "http: ext2.put(DcTerm.references.qualifiedName(), "http: ext2.put(DcTerm.created.qualifiedName(), "2010/12/12"); ext2.put(DcTerm.title.qualifiedName(), "Tt2"); ext2.put(DcTerm.description.qualifiedName(), "Desc2"); ext2.put(DcTerm.spatial.qualifiedName(), "Sp2"); ext2.put(DcTerm.format.qualifiedName(), "jpeg"); ext2.put(DcTerm.creator.qualifiedName(), "Cr2"); ext2.put(DcTerm.contributor.qualifiedName(), "Cont2"); ext2.put(DcTerm.publisher.qualifiedName(), "Pub2"); ext2.put(DcTerm.audience.qualifiedName(), "Aud2"); ext2.put(DcTerm.license.qualifiedName(), "Lic2"); ext2.put(DcTerm.rightsHolder.qualifiedName(), "Rh2"); ext2.put(DwcTerm.datasetID.qualifiedName(), "1"); ext2.put("http: ext2.put("http: Map<String, String> ext3 = new HashMap<>(); ext3.put(DcTerm.created.qualifiedName(), "not a date"); Map<String, List<Map<String, String>>> ext = new HashMap<>(); ext.put(Extension.IMAGE.getRowType(), Arrays.asList(ext1, ext2, ext3)); ExtendedRecord record = ExtendedRecord.newBuilder().setId("id").setExtensions(ext).build(); String result = "{\"id\": \"id\", \"created\": 0, \"imageItems\": [{\"identifier\": \"http: + "\"http: + "\"latitude\": 60.4, \"longitude\": -131.3, \"format\": \"jpeg\", \"created\": \"2010\", \"creator\": " + "\"Cr1\", \"contributor\": \"Cont1\", \"publisher\": \"Pub1\", \"audience\": \"Aud1\", \"license\": " + "\"Lic1\", \"rightsHolder\": \"Rh1\", \"datasetId\": \"1\"}, {\"identifier\": \"http: + "\"references\": \"http: + "\"Sp2\", \"latitude\": -131.3, \"longitude\": 360.4, \"format\": \"jpeg\", \"created\": \"2010-12-12\", " + "\"creator\": \"Cr2\", \"contributor\": \"Cont2\", \"publisher\": \"Pub2\", \"audience\": \"Aud2\", \"license\": " + "\"Lic2\", \"rightsHolder\": \"Rh2\", \"datasetId\": \"1\"}], \"issues\": {\"issueList\": [" + "\"MULTIMEDIA_DATE_INVALID\", \"MULTIMEDIA_URI_INVALID\"]}}"; ImageRecord ir = ImageRecord.newBuilder().setId(record.getId()).setCreated(0L).build(); ImageInterpreter.builder().create().interpret(record, ir); Assert.assertEquals(result, ir.toString()); }
public void interpret(ExtendedRecord er, ImageRecord mr) { Objects.requireNonNull(er); Objects.requireNonNull(mr); Result<Image> result = handler.convert(er); mr.setImageItems(result.getList()); mr.getIssues().setIssueList(result.getIssuesAsList()); }
ImageInterpreter { public void interpret(ExtendedRecord er, ImageRecord mr) { Objects.requireNonNull(er); Objects.requireNonNull(mr); Result<Image> result = handler.convert(er); mr.setImageItems(result.getList()); mr.getIssues().setIssueList(result.getIssuesAsList()); } }
ImageInterpreter { public void interpret(ExtendedRecord er, ImageRecord mr) { Objects.requireNonNull(er); Objects.requireNonNull(mr); Result<Image> result = handler.convert(er); mr.setImageItems(result.getList()); mr.getIssues().setIssueList(result.getIssuesAsList()); } @Builder(buildMethodName = "create") private  ImageInterpreter(
      List<DateComponentOrdering> orderings,
      SerializableFunction<String, String> preprocessDateFn); }
ImageInterpreter { public void interpret(ExtendedRecord er, ImageRecord mr) { Objects.requireNonNull(er); Objects.requireNonNull(mr); Result<Image> result = handler.convert(er); mr.setImageItems(result.getList()); mr.getIssues().setIssueList(result.getIssuesAsList()); } @Builder(buildMethodName = "create") private  ImageInterpreter(
      List<DateComponentOrdering> orderings,
      SerializableFunction<String, String> preprocessDateFn); void interpret(ExtendedRecord er, ImageRecord mr); }
ImageInterpreter { public void interpret(ExtendedRecord er, ImageRecord mr) { Objects.requireNonNull(er); Objects.requireNonNull(mr); Result<Image> result = handler.convert(er); mr.setImageItems(result.getList()); mr.getIssues().setIssueList(result.getIssuesAsList()); } @Builder(buildMethodName = "create") private  ImageInterpreter(
      List<DateComponentOrdering> orderings,
      SerializableFunction<String, String> preprocessDateFn); void interpret(ExtendedRecord er, ImageRecord mr);  }