Revision f1a25720
Added by Katja Luther over 6 years ago
- ID f1a25720755daa96e8838a617a660dfced7b9f31
- Parent 23e50194
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/out/DwcaEmlExport.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
import java.io.FileNotFoundException; |
13 | 13 |
import java.io.IOException; |
14 |
import java.time.ZonedDateTime; |
|
15 |
import java.time.format.DateTimeFormatter; |
|
16 |
import java.time.temporal.Temporal; |
|
14 | 17 |
import java.util.List; |
15 | 18 |
|
16 | 19 |
import javax.xml.stream.XMLStreamException; |
17 | 20 |
import javax.xml.stream.XMLStreamWriter; |
18 | 21 |
|
19 | 22 |
import org.apache.log4j.Logger; |
20 |
import org.joda.time.DateTime; |
|
21 |
import org.joda.time.Partial; |
|
22 |
import org.joda.time.format.DateTimeFormat; |
|
23 |
import org.joda.time.format.DateTimeFormatter; |
|
24 | 23 |
import org.springframework.stereotype.Component; |
25 | 24 |
|
26 | 25 |
import eu.etaxonomy.cdm.model.agent.Address; |
... | ... | |
143 | 142 |
String text; |
144 | 143 |
|
145 | 144 |
elementName = "dateStamp"; |
146 |
text = new DateTime().toString();
|
|
145 |
text = ZonedDateTime.now().toString();
|
|
147 | 146 |
writeTextElement(writer, elementName, text); |
148 | 147 |
|
149 | 148 |
elementName = "citation"; |
... | ... | |
202 | 201 |
|
203 | 202 |
} |
204 | 203 |
|
205 |
DateTimeFormatter dateFormatter = DateTimeFormat.forPattern("YYYY-MM-dd");
|
|
204 |
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("YYYY-MM-dd");
|
|
206 | 205 |
elementName = "pubDate"; |
207 |
text = emlRecord.getPublicationDate().toString(dateFormatter);
|
|
206 |
text = emlRecord.getPublicationDate().format(dateFormatter);
|
|
208 | 207 |
writeTextElement(writer, elementName, text); |
209 | 208 |
|
210 | 209 |
elementName = "language"; |
... | ... | |
400 | 399 |
} |
401 | 400 |
|
402 | 401 |
|
403 |
private void writeCalendarDate(XMLStreamWriter writer, Partial partial) throws XMLStreamException {
|
|
402 |
private void writeCalendarDate(XMLStreamWriter writer, Temporal partial) throws XMLStreamException {
|
|
404 | 403 |
//calendarDate |
405 | 404 |
String elementName = "calendarDate"; |
406 | 405 |
//FIXME must be something like 37723 |
407 |
String text = partial.toDateTime(new DateTime()).toString();
|
|
406 |
String text = partial.toString(); |
|
408 | 407 |
writeTextElement(writer, elementName, text); |
409 | 408 |
|
410 | 409 |
} |
Also available in: Unified diff
first implementation for change from joda time to java8 time