@Test public void test_calculate_01() { EntityObject entity = new EntityObject(specimen); VerbatimEventDateCalculator calculator = new VerbatimEventDateCalculator(); String date = calculator.calculateValue(entity); assertEquals("01", "", date); }
@Override public String calculateValue(EntityObject entity) { Specimen specimen = (Specimen) entity.getDocument(); if (specimen.getGatheringEvent() == null) { return EMPTY_STRING; } OffsetDateTime beginDate = specimen.getGatheringEvent().getDateTimeBegin(); if (beginDate == null) { return EMPTY_STRING; } OffsetDateTime endDate = specimen.getGatheringEvent().getDateTimeEnd(); if (endDate == null || isSameDay(beginDate, endDate)) { return formatISO8601ShortDate(beginDate); } return formatISO8601ShortDate(beginDate) + "/" + formatISO8601ShortDate(endDate); }
VerbatimEventDateCalculator implements ICalculator { @Override public String calculateValue(EntityObject entity) { Specimen specimen = (Specimen) entity.getDocument(); if (specimen.getGatheringEvent() == null) { return EMPTY_STRING; } OffsetDateTime beginDate = specimen.getGatheringEvent().getDateTimeBegin(); if (beginDate == null) { return EMPTY_STRING; } OffsetDateTime endDate = specimen.getGatheringEvent().getDateTimeEnd(); if (endDate == null || isSameDay(beginDate, endDate)) { return formatISO8601ShortDate(beginDate); } return formatISO8601ShortDate(beginDate) + "/" + formatISO8601ShortDate(endDate); } }
VerbatimEventDateCalculator implements ICalculator { @Override public String calculateValue(EntityObject entity) { Specimen specimen = (Specimen) entity.getDocument(); if (specimen.getGatheringEvent() == null) { return EMPTY_STRING; } OffsetDateTime beginDate = specimen.getGatheringEvent().getDateTimeBegin(); if (beginDate == null) { return EMPTY_STRING; } OffsetDateTime endDate = specimen.getGatheringEvent().getDateTimeEnd(); if (endDate == null || isSameDay(beginDate, endDate)) { return formatISO8601ShortDate(beginDate); } return formatISO8601ShortDate(beginDate) + "/" + formatISO8601ShortDate(endDate); }  }
VerbatimEventDateCalculator implements ICalculator { @Override public String calculateValue(EntityObject entity) { Specimen specimen = (Specimen) entity.getDocument(); if (specimen.getGatheringEvent() == null) { return EMPTY_STRING; } OffsetDateTime beginDate = specimen.getGatheringEvent().getDateTimeBegin(); if (beginDate == null) { return EMPTY_STRING; } OffsetDateTime endDate = specimen.getGatheringEvent().getDateTimeEnd(); if (endDate == null || isSameDay(beginDate, endDate)) { return formatISO8601ShortDate(beginDate); } return formatISO8601ShortDate(beginDate) + "/" + formatISO8601ShortDate(endDate); }  @Override void initialize(Class<? extends IDocumentObject> docType, Map<String, String> args); @Override String calculateValue(EntityObject entity); }
VerbatimEventDateCalculator implements ICalculator { @Override public String calculateValue(EntityObject entity) { Specimen specimen = (Specimen) entity.getDocument(); if (specimen.getGatheringEvent() == null) { return EMPTY_STRING; } OffsetDateTime beginDate = specimen.getGatheringEvent().getDateTimeBegin(); if (beginDate == null) { return EMPTY_STRING; } OffsetDateTime endDate = specimen.getGatheringEvent().getDateTimeEnd(); if (endDate == null || isSameDay(beginDate, endDate)) { return formatISO8601ShortDate(beginDate); } return formatISO8601ShortDate(beginDate) + "/" + formatISO8601ShortDate(endDate); }  @Override void initialize(Class<? extends IDocumentObject> docType, Map<String, String> args); @Override String calculateValue(EntityObject entity);  }