Mercurial > hg > openmind
changeset 125:0a0de5ec3219
change date type "date" to "day".
author | Robert Casties <casties@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 10 Feb 2023 10:10:07 +0100 |
parents | c816b417db0e |
children | 7d1e61a6d91b |
files | src/main/java/org/mpi/openmind/repository/utils/OM4StreamWriter.java |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/org/mpi/openmind/repository/utils/OM4StreamWriter.java Fri Feb 10 09:00:41 2023 +0100 +++ b/src/main/java/org/mpi/openmind/repository/utils/OM4StreamWriter.java Fri Feb 10 10:10:07 2023 +0100 @@ -509,6 +509,7 @@ ISMICalendar date = new ISMICalendar(json); String state = date.getState(); if (state.equals(ISMICalendar.STATE_NOT_CHECKED)) { + // state="not checked" -> unspecified type writer.writeStartElement(XMLUtil.ISMIDATE); writer.writeAttribute(XMLUtil.TYPE, "unspecified"); writer.writeCharacters(date.getDateInText()); @@ -516,21 +517,28 @@ return true; } if (state.equals(ISMICalendar.STATE_KNOWN)) { + // state="known" writer.writeStartElement(XMLUtil.ISMIDATE); - String type = date.getInputForm().toLowerCase(); - writer.writeAttribute(XMLUtil.TYPE, type); + // calendar String calendar = date.getCalendarType().toLowerCase(); writer.writeAttribute("calendar", calendar); + // notes String notes = date.getAdditionalInfo(); if (notes != null && !notes.isEmpty()) { writer.writeAttribute("notes", notes); } + // type = inputForm + String type = date.getInputForm().toLowerCase(); if (type.equals("year") || type.equals("range")) { + writer.writeAttribute(XMLUtil.TYPE, type); writer.writeAttribute("from", date.getFromGregorian().getDateTime().toString(isodateFormatter)); writer.writeAttribute("until", date.getUntilGregorian().getDateTime().toString(isodateFormatter)); } else if (type.equals("date")) { + // date type is called "day" + writer.writeAttribute(XMLUtil.TYPE, "day"); writer.writeAttribute("date", date.getFromGregorian().getDateTime().toString(isodateFormatter)); } + // textual date as content writer.writeCharacters(date.toShortString()); writer.writeEndElement(); return true;