From 304cb333987e47579537f4d7f74576c3df5ee8ec Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt <code@dgerhardt.net> Date: Thu, 7 Sep 2017 14:58:35 +0200 Subject: [PATCH] Introduce migration service for API v2 --- src/main/java/de/thm/arsnova/config/AppConfig.java | 6 ++++++ .../de/thm/arsnova/entities/migration/V2Migrator.java | 10 ++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/main/java/de/thm/arsnova/entities/migration/V2Migrator.java diff --git a/src/main/java/de/thm/arsnova/config/AppConfig.java b/src/main/java/de/thm/arsnova/config/AppConfig.java index 38b968c39..7fba9014a 100644 --- a/src/main/java/de/thm/arsnova/config/AppConfig.java +++ b/src/main/java/de/thm/arsnova/config/AppConfig.java @@ -20,6 +20,7 @@ package de.thm.arsnova.config; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import de.thm.arsnova.entities.migration.V2Migrator; import de.thm.arsnova.util.ImageUtils; import de.thm.arsnova.connector.client.ConnectorClient; import de.thm.arsnova.connector.client.ConnectorClientImpl; @@ -284,4 +285,9 @@ public class AppConfig extends WebMvcConfigurerAdapter { public ImageUtils imageUtils() { return new ImageUtils(); } + + @Bean + public V2Migrator v2Migrator() { + return new V2Migrator(); + } } diff --git a/src/main/java/de/thm/arsnova/entities/migration/V2Migrator.java b/src/main/java/de/thm/arsnova/entities/migration/V2Migrator.java new file mode 100644 index 000000000..6c007027c --- /dev/null +++ b/src/main/java/de/thm/arsnova/entities/migration/V2Migrator.java @@ -0,0 +1,10 @@ +package de.thm.arsnova.entities.migration; + +import de.thm.arsnova.entities.Entity; + +public class V2Migrator { + private void copyCommonProperties(final Entity from, final Entity to) { + to.setId(from.getId()); + to.setRevision(from.getRevision()); + } +} -- GitLab