#17 implementation objectmapper writeFile

This commit is contained in:
Gian-Andrea Hutter 2022-10-28 12:24:55 +02:00
parent bd2aa60128
commit 51e8f27a20
2 changed files with 11 additions and 1 deletions

View File

@ -0,0 +1,8 @@
package ch.zhaw.gartenverwaltung.gardenplan;
public class Gardenplanmodel {
// private JasonGardenplan gardenplan;
// liste von crops
//task generieren
//plant holen, task template mit tasktemplateklasse tasks erstellen
}

View File

@ -2,6 +2,7 @@ package ch.zhaw.gartenverwaltung.io;
import ch.zhaw.gartenverwaltung.types.Task; import ch.zhaw.gartenverwaltung.types.Task;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
@ -95,7 +96,8 @@ public class JsonTaskDatabase implements TaskDatabase{
*/ */
private void writeTaskListToFile() throws IOException { private void writeTaskListToFile() throws IOException {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(timeModule); mapper.registerModule(timeModule)
.registerModule(new Jdk8Module());
if(dataSource != null) { if(dataSource != null) {
mapper.writeValue(new File(dataSource.getFile()), taskMap); mapper.writeValue(new File(dataSource.getFile()), taskMap);