#17 implementation objectmapper writeFile
This commit is contained in:
parent
bd2aa60128
commit
51e8f27a20
|
@ -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
|
||||||
|
}
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue