changeset 12:fa0aad20af53

Adjusted interfaces used for the ArtifactDescription and added default implementations. flys-client/trunk@1321 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 17 Feb 2011 08:31:33 +0000
parents 6aeb4072eeb4
children 8d9075c07667
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/shared/model/ArtifactDescription.java flys-client/src/main/java/de/intevation/flys/client/shared/model/Data.java flys-client/src/main/java/de/intevation/flys/client/shared/model/DataItem.java flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultArtifactDescription.java flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultData.java flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultDataItem.java
diffstat 7 files changed, 212 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Wed Feb 16 15:40:17 2011 +0000
+++ b/flys-client/ChangeLog	Thu Feb 17 08:31:33 2011 +0000
@@ -1,3 +1,17 @@
+2011-02-16  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/shared/model/ArtifactDescription.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DataItem.java,
+	  src/main/java/de/intevation/flys/client/shared/model/Data.java: The
+	  interfaces implement the Serializable interface now.
+
+	* src/main/java/de/intevation/flys/client/shared/model/DefaultArtifactDescription.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DefaultDataItem.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DefaultData.java:
+	  New. Default implementions of the interfaces above. These classes
+	  implements constructors and the necessary methods of the interface
+	  descriptions only!
+
 2011-02-16  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/ArtifactDescription.java	Wed Feb 16 15:40:17 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/ArtifactDescription.java	Thu Feb 17 08:31:33 2011 +0000
@@ -1,5 +1,8 @@
 package de.intevation.flys.client.shared.model;
 
+import java.io.Serializable;
+
+
 /**
  * The artifact description describes a state of an artifact. There are
  * operations defined that return former inserted data, possible input values
@@ -7,7 +10,7 @@
  *
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
-public interface ArtifactDescription {
+public interface ArtifactDescription extends Serializable {
 
     /**
      * Returns the data that have been inserted in former states of the
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/Data.java	Wed Feb 16 15:40:17 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/Data.java	Thu Feb 17 08:31:33 2011 +0000
@@ -1,5 +1,7 @@
 package de.intevation.flys.client.shared.model;
 
+import java.io.Serializable;
+
 
 /**
  * A Data object represents the necessary data of a single state of the
@@ -8,7 +10,7 @@
  *
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
-public interface Data {
+public interface Data extends Serializable {
 
     /**
      * Returns the label of the item.
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DataItem.java	Wed Feb 16 15:40:17 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DataItem.java	Thu Feb 17 08:31:33 2011 +0000
@@ -1,5 +1,7 @@
 package de.intevation.flys.client.shared.model;
 
+import java.io.Serializable;
+
 
 /**
  * A DataItem represents a concrete item that might be selected, chosen or
@@ -7,7 +9,7 @@
  *
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
-public interface DataItem {
+public interface DataItem extends Serializable {
 
     /**
      * Returns the label of the item.
@@ -30,6 +32,6 @@
      *
      * @return the value.
      */
-    public Object getValue();
+    public String getStringValue();
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultArtifactDescription.java	Thu Feb 17 08:31:33 2011 +0000
@@ -0,0 +1,67 @@
+package de.intevation.flys.client.shared.model;
+
+
+/**
+ * The default implementation of an {@link ArtifactDescription}. This class just
+ * implements constructors to create new instances and the necessary methods of
+ * the interface.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class DefaultArtifactDescription implements ArtifactDescription {
+
+    /** Data that have been inserted in former states.*/
+    protected Data[]   oldData;
+
+    /** The Data that is allowed to be inserted in the current state.*/
+    protected Data     currentData;
+
+    /** The current state name.*/
+    protected String   currentState;
+
+    /** The names of reachable states.*/
+    protected String[] reachableStates;
+
+
+    public DefaultArtifactDescription() {
+    }
+
+
+    /**
+     * The default constructor.
+     *
+     * @param old The data that have been inserted in former states.
+     * @param current The data that might be inserted in the current state.
+     * @param state The name of the current state.
+     * @param reachableStates The names of the reachable states.
+     */
+    public DefaultArtifactDescription(
+        Data[] old, Data current, String state, String[] reachableStates)
+    {
+        this.oldData         = old;
+        this.currentData     = current;
+        this.currentState    = state;
+        this.reachableStates = reachableStates;
+    }
+
+
+    public Data[] getOldData() {
+        return oldData;
+    }
+
+
+    public Data getCurrentData() {
+        return currentData;
+    }
+
+
+    public String getCurrentState() {
+        return currentState;
+    }
+
+
+    public String[] getReachableStates() {
+        return reachableStates;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultData.java	Thu Feb 17 08:31:33 2011 +0000
@@ -0,0 +1,66 @@
+package de.intevation.flys.client.shared.model;
+
+
+/**
+ * The default implementation of a {@link Data} item. This class just implements
+ * constructors to create instances and the necessary methods of the interface.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class DefaultData implements Data {
+
+    /** The label of this Data object.*/
+    protected String label;
+
+    /** The description.*/
+    protected String description;
+
+    /** The type.*/
+    protected String type;
+
+    /** The DataItems.*/
+    protected DataItem[] items;
+
+
+    public DefaultData() {
+    }
+
+
+    /**
+     * The default constructor to create new DefaultData objects.
+     *
+     * @param label The label.
+     * @param description The description.
+     * @param type The type.
+     * @param items The DataItems.
+     */
+    public DefaultData(
+        String label, String description, String type, DataItem[] items)
+    {
+        this.label       = label;
+        this.description = description;
+        this.type        = type;
+        this.items       = items;
+    }
+
+
+    public String getLabel() {
+        return label;
+    }
+
+
+    public String getDescription() {
+        return description;
+    }
+
+
+    public String getType() {
+        return type;
+    }
+
+
+    public DataItem[] getItems() {
+        return items;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultDataItem.java	Thu Feb 17 08:31:33 2011 +0000
@@ -0,0 +1,54 @@
+package de.intevation.flys.client.shared.model;
+
+
+/**
+ * The default implementation of a {@link DataItem}. This class just implements
+ * constructors to create instances and the necessary methods of the interface.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class DefaultDataItem implements DataItem {
+
+    /** The label.*/
+    protected String label;
+
+    /** The description.*/
+    protected String description;
+
+    /** The value.*/
+    protected String value;
+
+
+    public DefaultDataItem() {
+    }
+
+
+    /**
+     * The default constructor to create new instances.
+     *
+     * @param label The label.
+     * @param description The description.
+     * @param value The value.
+     */
+    public DefaultDataItem(String label, String description, String value) {
+        this.label       = label;
+        this.description = description;
+        this.value       = value;
+    }
+
+
+    public String getLabel() {
+        return label;
+    }
+
+
+    public String getDescription() {
+        return description;
+    }
+
+
+    public String getStringValue() {
+        return value;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org