[Lada-commits] [PATCH 06 of 10] Added interface and annotation for importer

Wald Commits scm-commit at wald.intevation.org
Thu Apr 16 15:49:21 CEST 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1429192050 -7200
# Node ID e35f047f019fb4a8de58b00d0870f940d3010e64
# Parent  9a4ec6fb53a7f34a191fd0e86a7fa80d9689b0bc
Added interface and annotation for importer.

diff -r 9a4ec6fb53a7 -r e35f047f019f src/main/java/de/intevation/lada/importer/ImportConfig.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/importer/ImportConfig.java	Thu Apr 16 15:47:30 2015 +0200
@@ -0,0 +1,19 @@
+package de.intevation.lada.importer;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({
+    ElementType.TYPE,
+    ElementType.FIELD,
+    ElementType.METHOD,
+    ElementType.PARAMETER})
+public @interface ImportConfig {
+    ImportFormat format() default ImportFormat.LAF;
+}
diff -r 9a4ec6fb53a7 -r e35f047f019f src/main/java/de/intevation/lada/importer/ImportFormat.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/importer/ImportFormat.java	Thu Apr 16 15:47:30 2015 +0200
@@ -0,0 +1,5 @@
+package de.intevation.lada.importer;
+
+public enum ImportFormat {
+    LAF
+}
diff -r 9a4ec6fb53a7 -r e35f047f019f src/main/java/de/intevation/lada/importer/Importer.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/importer/Importer.java	Thu Apr 16 15:47:30 2015 +0200
@@ -0,0 +1,13 @@
+package de.intevation.lada.importer;
+
+import java.util.List;
+import java.util.Map;
+
+import de.intevation.lada.util.auth.UserInfo;
+
+public interface Importer {
+    void reset();
+    Map<String, List<ReportItem>> getWarnings();
+    Map<String, List<ReportItem>> getErrors();
+    void doImport(String content, UserInfo userInfo);
+}
diff -r 9a4ec6fb53a7 -r e35f047f019f src/main/java/de/intevation/lada/importer/ReportItem.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/importer/ReportItem.java	Thu Apr 16 15:47:30 2015 +0200
@@ -0,0 +1,82 @@
+package de.intevation.lada.importer;
+
+/**
+ * Container for error or warning messages send to the client.
+ *
+ * Errors and warnings are specified by the key-value pair that caused the problem and a code.
+ * The code can be
+ * 670: Parser error
+ * 671: existing
+ * 672: duplicated entry
+ * 673: missing
+ * 674: date error
+ * or any validation code.
+ *
+ * @author <a href="mailto:rrenkert at intevation.de">Raimund Renkert</a>
+ */
+public class ReportItem
+{
+    private String key;
+    private String value;
+    private Integer code;
+
+    /**
+     * Default constructor.
+     */
+    public ReportItem() {
+    }
+
+    /**
+     * Constructor to create a {@link ReportItem} object with data.
+     * @param key   The key caused the error/warning.
+     * @param value The value caused the error/warning.
+     * @param code  The code specifying the error/warning.
+     */
+    public ReportItem(String key, String value, Integer code) {
+        this.key = key;
+        this.value = value;
+        this.code = code;
+    }
+
+    /**
+     * @return the key
+     */
+    public String getKey() {
+        return key;
+    }
+
+    /**
+     * @param key the key to set
+     */
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    /**
+     * @return the value
+     */
+    public String getValue() {
+        return value;
+    }
+
+    /**
+     * @param value the value to set
+     */
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    /**
+     * @return the code
+     */
+    public Integer getCode() {
+        return code;
+    }
+
+    /**
+     * @param code the code to set
+     */
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+}


More information about the Lada-commits mailing list