[Tynstep-svn] r175 - in trunk/step-web-shared: . src/main/java/com/tyndalehouse/step/web/shared/command src/main/java/com/tyndalehouse/step/web/shared/common src/main/java/com/tyndalehouse/step/web/shared/common/timeline src/main/java/com/tyndalehouse/step/web/shared/result src/main/java/com/tyndalehouse/step/web/shared/scripture src/test/java/com/tyndalehouse/step/web/shared src/test/java/com/tyndalehouse/step/web/shared/scripture

ChrisBurrell at crosswire.org ChrisBurrell at crosswire.org
Fri Aug 27 05:34:50 MST 2010


Author: ChrisBurrell
Date: 2010-08-27 05:34:50 -0700 (Fri, 27 Aug 2010)
New Revision: 175

Removed:
   trunk/step-web-shared/src/test/java/com/tyndalehouse/step/web/shared/GettersAndSettersTest.java
Modified:
   trunk/step-web-shared/pom.xml
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetAvailableBibleVersionsCommand.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetDictionaryDefinitionCommand.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetEventsForDateRangeCommand.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineUISetupCommand.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/InstallJswordModuleCommand.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/ScriptureDisplayOptions.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineBean.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineEventBean.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/InstallJswordModuleResult.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/OsisElementType.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Passage.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/PassageElement.java
   trunk/step-web-shared/src/test/java/com/tyndalehouse/step/web/shared/scripture/PassageElementTest.java
Log:
major refactor

Modified: trunk/step-web-shared/pom.xml
===================================================================
--- trunk/step-web-shared/pom.xml	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/pom.xml	2010-08-27 12:34:50 UTC (rev 175)
@@ -4,14 +4,14 @@
 		<groupId>com.tyndalehouse</groupId>
 		<artifactId>step-parent</artifactId>
 		<version>0.1-SNAPSHOT</version>
-		<relativePath>..</relativePath>
+		<relativePath>../step-parent</relativePath>
 	</parent>
 
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>com.tyndalehouse</groupId>
 	<artifactId>step-web-shared</artifactId>
 	<packaging>jar</packaging>
-	<name>step-web-shared</name>
+	<name>STEP :: Web Application - Commands and Handlers</name>
 
 	<dependencies>
 		<dependency>

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetAvailableBibleVersionsCommand.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetAvailableBibleVersionsCommand.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetAvailableBibleVersionsCommand.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -16,29 +16,20 @@
      */
     private static final long serialVersionUID = 5781027650600417430L;
 
-    // TODO: later change that to list modules, bibles, etc.
     /**
      * Describes which types of modules are required to be returned.
      */
     private BooksRequiredType booksRequired = BooksRequiredType.BIBLE;
 
     /**
-     * Default constructor needs to be available for GWT it seems.
-     */
-    public GetAvailableBibleVersionsCommand() {
-
-    }
-
-    /**
      * @return the booksRequired
      */
     public BooksRequiredType getBooksRequired() {
-        return booksRequired;
+        return this.booksRequired;
     }
 
     /**
-     * @param booksRequired
-     *            the booksRequired to set
+     * @param booksRequired the booksRequired to set
      */
     public void setBooksRequired(final BooksRequiredType booksRequired) {
         this.booksRequired = booksRequired;

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -8,17 +8,16 @@
 import com.tyndalehouse.step.web.shared.result.GetCurrentBibleTextResult;
 
 /**
- * Contains the details of a request for biblical text. Such details include
- * whether to use a plain text, a standard XSLT, or a logical form
+ * Contains the details of a request for biblical text. Such details include whether to use a plain text, a standard
+ * XSLT, or a logical form
  * <p>
- * For logical form (represented in Bean form) we allow the use of interlinears
- * as well.
+ * For logical form (represented in Bean form) we allow the use of interlinears as well.
  * <p>
- * A classic interlinear is where the original text is the master copy of the
- * text, and the translated (English, French, etc.) text is lined up underneath
+ * A classic interlinear is where the original text is the master copy of the text, and the translated (English, French,
+ * etc.) text is lined up underneath
  * <p>
- * A reverse interlinear is where the the English/French text is on top, and the
- * original (Hebrew or Greek) is lined up underneath.
+ * A reverse interlinear is where the the English/French text is on top, and the original (Hebrew or Greek) is lined up
+ * underneath.
  * 
  * @author cjburrell
  * 
@@ -26,8 +25,6 @@
 public class GetCurrentBibleTextCommand implements Action<GetCurrentBibleTextResult> {
     private static final long serialVersionUID = -6828956918275592036L;
 
-    // TODO: add validation to the handler/client to ensure that
-    // version/interlinear matches correctly
     /**
      * the biblical reference, for e.g. Gen 1:1
      */
@@ -41,19 +38,17 @@
     private Map<String, ScriptureDisplayOptions> displayOptions;
 
     /**
-     * default constructor TODO: can this be made private? I think so
+     * exposing for serialisation
      */
     public GetCurrentBibleTextCommand() {
-
+        // exposing for serialisation
     }
 
     /**
      * constructor for a version,reference combo
      * 
-     * @param version
-     *            version to be used in the lookup (intials)
-     * @param reference
-     *            reference to be used in the lookup (for e.g. Gen 1:1)
+     * @param version version to be used in the lookup (intials)
+     * @param reference reference to be used in the lookup (for e.g. Gen 1:1)
      */
     public GetCurrentBibleTextCommand(final String version, final String reference) {
         this.version = version;
@@ -64,27 +59,25 @@
      * @return the biblical reference (Gen 1:1-5 for example)
      */
     public String getReference() {
-        return reference;
+        return this.reference;
     }
 
     /**
      * @return the initials of the version to be used in the lookup
      */
     public String getVersion() {
-        return version;
+        return this.version;
     }
 
     /**
-     * @param reference
-     *            the reference to set
+     * @param reference the reference to set
      */
     public void setReference(final String reference) {
         this.reference = reference;
     }
 
     /**
-     * @param version
-     *            the version to set
+     * @param version the version to set
      */
     public void setVersion(final String version) {
         this.version = version;
@@ -94,12 +87,11 @@
      * @return the displayOptions
      */
     public Map<String, ScriptureDisplayOptions> getDisplayOptions() {
-        return displayOptions;
+        return this.displayOptions;
     }
 
     /**
-     * @param displayOptions
-     *            the displayOptions to set
+     * @param displayOptions the displayOptions to set
      */
     public void setDisplayOptions(final Map<String, ScriptureDisplayOptions> displayOptions) {
         this.displayOptions = displayOptions;

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetDictionaryDefinitionCommand.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetDictionaryDefinitionCommand.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetDictionaryDefinitionCommand.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -24,22 +24,14 @@
     private List<String> lookupReferencce;
 
     /**
-     * the public constructor
-     */
-    public GetDictionaryDefinitionCommand() {
-
-    }
-
-    /**
      * @return the lookupReferencce
      */
     public List<String> getLookupReferencce() {
-        return lookupReferencce;
+        return this.lookupReferencce;
     }
 
     /**
-     * @param lookupReferences
-     *            the list lookupReferencce to set
+     * @param lookupReferences the list lookupReferencce to set
      */
     public void setLookupReference(final List<String> lookupReferences) {
         this.lookupReferencce = lookupReferences;

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetEventsForDateRangeCommand.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetEventsForDateRangeCommand.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetEventsForDateRangeCommand.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -8,9 +8,8 @@
 import com.tyndalehouse.step.web.shared.result.GetEventsForDateRangeResult;
 
 /**
- * Contains the details of a request for events within a particular date range.
- * This contains a list of @see {@link TimeBandVisibleDate}, which records the
- * portion of time to be requested from the server
+ * Contains the details of a request for events within a particular date range. This contains a list of @see
+ * {@link TimeBandVisibleDate}, which records the portion of time to be requested from the server
  * 
  * @author cjburrell
  * 
@@ -29,18 +28,9 @@
     private List<TimeBandVisibleDate> visbleDates;
 
     /**
-     * Used for serialization
-     */
-    public GetEventsForDateRangeCommand() {
-
-    }
-
-    /**
      * default constructor that should be used
      * 
-     * @param visbleDates
-     *            list of date ranges encapsulated in a TimeBandVisibleDate
-     *            object
+     * @param visbleDates list of date ranges encapsulated in a TimeBandVisibleDate object
      */
     public GetEventsForDateRangeCommand(final List<TimeBandVisibleDate> visbleDates) {
         this.visbleDates = visbleDates;
@@ -50,27 +40,25 @@
      * @return the visbleDates
      */
     public List<TimeBandVisibleDate> getVisbleDates() {
-        return visbleDates;
+        return this.visbleDates;
     }
 
     /**
      * @return the showDuration
      */
     public boolean isShowDuration() {
-        return showDuration;
+        return this.showDuration;
     }
 
     /**
-     * @param showDuration
-     *            the showDuration to set
+     * @param showDuration the showDuration to set
      */
     public void setShowDuration(final boolean showDuration) {
         this.showDuration = showDuration;
     }
 
     /**
-     * @param visbleDates
-     *            the visbleDates to set
+     * @param visbleDates the visbleDates to set
      */
     public void setVisbleDates(final List<TimeBandVisibleDate> visbleDates) {
         this.visbleDates = visbleDates;

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineUISetupCommand.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineUISetupCommand.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineUISetupCommand.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -5,23 +5,12 @@
 import com.tyndalehouse.step.web.shared.result.GetTimelineUISetupResult;
 
 /**
- * command to request all the initial information useful to set up a timeline
- * component, including the list of timebands, their recommended units, etc.
+ * command to request all the initial information useful to set up a timeline component, including the list of
+ * timebands, their recommended units, etc.
  * 
  * @author CJBurrell
  * 
  */
 public class GetTimelineUISetupCommand implements Action<GetTimelineUISetupResult> {
-
-    /**
-     * serial id
-     */
     private static final long serialVersionUID = 7813083800240239846L;
-
-    /**
-     * public constructor
-     */
-    public GetTimelineUISetupCommand() {
-
-    }
 }

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/InstallJswordModuleCommand.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/InstallJswordModuleCommand.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/InstallJswordModuleCommand.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -11,34 +11,20 @@
  * 
  */
 public class InstallJswordModuleCommand implements Action<InstallJswordModuleResult> {
-
-    /**
-     * serial id
-     */
     private static final long serialVersionUID = 3416377875572322721L;
 
-    /**
-     * the initials to be used to check/install the book
-     */
+    /** the initials to be used to check/install the book */
     private String initials;
 
     /**
-     * the install jsword module command constructor
-     */
-    public InstallJswordModuleCommand() {
-
-    }
-
-    /**
      * @return the initials of module to be installed
      */
     public String getInitials() {
-        return initials;
+        return this.initials;
     }
 
     /**
-     * @param initials
-     *            the initials of the module to set
+     * @param initials the initials of the module to set
      */
     public void setInitials(final String initials) {
         this.initials = initials;

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/ScriptureDisplayOptions.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/ScriptureDisplayOptions.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/ScriptureDisplayOptions.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -7,20 +7,25 @@
 import java.util.HashMap;
 import java.util.Map;
 
+/**
+ * represents the options displayable in the options button on the scripture display view
+ * 
+ * @author CJBurrell
+ * 
+ */
 public enum ScriptureDisplayOptions implements Comparable<ScriptureDisplayOptions> {
     /**
-     * selects a standard passage and displays without any extra languages such
-     * as greek or hebrew
+     * selects a standard passage and displays without any extra languages such as greek or hebrew
      */
     NO_INTERLINEAR("Interlinear - None", INTERLINEAR, true),
     /**
-     * displays a classic interlienar, that is the hebrew/greek version of the
-     * text with the associated English/contemporary language below
+     * displays a classic interlienar, that is the hebrew/greek version of the text with the associated
+     * English/contemporary language below
      */
     CLASSIC_INTERLINEAR("Interlinear - Classic", INTERLINEAR),
     /**
-     * displays a reverse interlinear, that is the english/contemporary language
-     * as the main language, with the words from the greek or hebrew below
+     * displays a reverse interlinear, that is the english/contemporary language as the main language, with the words
+     * from the greek or hebrew below
      */
     REVERSE_INTERLINEAR("Interlinear - Reverse", INTERLINEAR),
     /** displays verse numbers */
@@ -34,37 +39,53 @@
     /** displays cross references */
     CROSS_REFERENCES("Cross References");
 
-    private static final ScriptureDisplayOptions[] cachedOrderedOptions = initOrderedOptions();
-    private static final Map<String, ScriptureDisplayOptions> cachedKeyedOptions = initKeyedOptions();
+    private static final ScriptureDisplayOptions[] ORDERED_OPTIONS_CACHE = initOrderedOptions();
+    private static final Map<String, ScriptureDisplayOptions> KEYED_OPTIONS_CACHE = initKeyedOptions();
 
+    /** comparator for sorting elements on the UI */
     private static Comparator<ScriptureDisplayOptions> sdoComparator = new Comparator<ScriptureDisplayOptions>() {
         public int compare(final ScriptureDisplayOptions sdo1, final ScriptureDisplayOptions sdo2) {
             return sdo1.getDisplayValue().compareTo(sdo2.getDisplayValue());
         }
     };
 
-    /**
-     * group identifying options that cannot be selected together
-     */
+    /** group identifying options that cannot be selected together */
     private final ScriptureDisplayOptionGroups group;
 
     /** value to be displayed on the screen */
     private final String displayValue;
 
+    /** indicates whether the option should be selected by default */
     private final boolean defaultOption;
 
+    /**
+     * @param displayValue the value to be displayed on the screen
+     */
     ScriptureDisplayOptions(final String displayValue) {
         this(displayValue, null);
     }
 
+    /**
+     * @param displayValue the value to be displayed on the screen
+     * @param defaultOption true if it is a default option
+     */
     ScriptureDisplayOptions(final String displayValue, final boolean defaultOption) {
         this(displayValue, null, defaultOption);
     }
 
-    private ScriptureDisplayOptions(final String displayValue, final ScriptureDisplayOptionGroups group) {
+    /**
+     * @param displayValue the value to be displayed on the screen
+     * @param group the group it is part of, if applicable
+     */
+    ScriptureDisplayOptions(final String displayValue, final ScriptureDisplayOptionGroups group) {
         this(displayValue, group, false);
     }
 
+    /**
+     * @param displayValue the value to be displayed on the screen
+     * @param group the group it is part of, if applicable
+     * @param defaultOption true if it is a default option
+     */
     ScriptureDisplayOptions(final String displayValue, final ScriptureDisplayOptionGroups group,
             final boolean defaultOption) {
         this.displayValue = displayValue;
@@ -72,12 +93,18 @@
         this.defaultOption = defaultOption;
     }
 
+    /**
+     * @return an ordered list of options for display on the UI
+     */
     private static ScriptureDisplayOptions[] initOrderedOptions() {
         final ScriptureDisplayOptions[] values = ScriptureDisplayOptions.values();
         Arrays.sort(values, sdoComparator);
         return values;
     }
 
+    /**
+     * @return the options keyed by their group/individual keys
+     */
     private static Map<String, ScriptureDisplayOptions> initKeyedOptions() {
         final ScriptureDisplayOptions[] values = ScriptureDisplayOptions.values();
         final Map<String, ScriptureDisplayOptions> keyedOptions = new HashMap<String, ScriptureDisplayOptions>();
@@ -91,29 +118,43 @@
      * @return the displayValue
      */
     public String getDisplayValue() {
-        return displayValue;
+        return this.displayValue;
     }
 
+    /**
+     * @return the list of options, ordered for the UI
+     */
     public static ScriptureDisplayOptions[] getScriptureDisplayOptions() {
-        return cachedOrderedOptions;
+        return ORDERED_OPTIONS_CACHE;
     }
 
+    /**
+     * @return the group of the option (for e.g. interlinear, may be null
+     */
     public ScriptureDisplayOptionGroups getGroup() {
-        return group;
+        return this.group;
     }
 
+    /**
+     * @return the key by which this element is known
+     */
     public String getKey() {
-        return group == null ? name() : group.name();
+        return this.group == null ? name() : this.group.name();
     }
 
     /**
      * @return the defaultOption
      */
     public boolean isDefaultOption() {
-        return defaultOption;
+        return this.defaultOption;
     }
 
+    /**
+     * 
+     * @param key the key of the scripture display option
+     * @return the option whose key is @see key
+     */
     public static ScriptureDisplayOptions getByKeyName(final String key) {
-        return cachedKeyedOptions.get(key);
+        return KEYED_OPTIONS_CACHE.get(key);
     }
 }

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineBean.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineBean.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineBean.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -3,16 +3,12 @@
 import java.io.Serializable;
 
 /**
- * Timeline bean represents the different timelines on which events can be
- * found... TODO: should this be renamed timeband?
+ * Timeline bean represents the different timelines on which events can be found...
  * 
  * @author CJBurrell
  * 
  */
 public class TimelineBean implements Serializable {
-    /**
-	 * 
-	 */
     private static final long serialVersionUID = -1734142151232501392L;
 
     /**
@@ -31,44 +27,35 @@
     private String unit;
 
     /**
-     * default constructor made public
-     */
-    public TimelineBean() {
-
-    }
-
-    /**
      * @return the timelineDescription
      */
     public String getTimelineDescription() {
-        return timelineDescription;
+        return this.timelineDescription;
     }
 
     /**
      * @return the timelineId
      */
     public int getTimelineId() {
-        return timelineId;
+        return this.timelineId;
     }
 
     /**
      * @return the unit
      */
     public String getUnit() {
-        return unit;
+        return this.unit;
     }
 
     /**
-     * @param timelineDescription
-     *            the timelineDescription to set
+     * @param timelineDescription the timelineDescription to set
      */
     public void setTimelineDescription(final String timelineDescription) {
         this.timelineDescription = timelineDescription;
     }
 
     /**
-     * @param timelineId
-     *            the timelineId to set
+     * @param timelineId the timelineId to set
      */
     public void setTimelineId(final int timelineId) {
         this.timelineId = timelineId;
@@ -77,57 +64,10 @@
     /**
      * sets the unit field
      * 
-     * @param unit
-     *            the unit to be set
+     * @param unit the unit to be set
      */
     public void setUnit(final String unit) {
         this.unit = unit;
 
     }
-
-    // /**
-    // * @return the minDate
-    // */
-    // public long getMinDate() {
-    // return minDate;
-    // }
-    //
-    // /**
-    // * @param minDate the minDate to set
-    // */
-    // public void setMinDate(long minDate) {
-    // this.minDate = minDate;
-    // }
-    //
-    // /**
-    // * @return the maxDate
-    // */
-    // public long getMaxDate() {
-    // return maxDate;
-    // }
-    //
-    // /**
-    // * @param maxDate the maxDate to set
-    // */
-    // public void setMaxDate(long maxDate) {
-    // this.maxDate = maxDate;
-    // }
-
-    // /**
-    // * @return the timelineCode
-    // */
-    // public String getTimelineCode() {
-    // return timelineCode;
-    // }
-    //
-    // public void setEventCount(int eventCount) {
-    // this.eventCount = eventCount;
-    // }
-    //
-    // /**
-    // * @return the eventCount
-    // */
-    // public int getEventCount() {
-    // return eventCount;
-    // }
 }

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineEventBean.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineEventBean.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineEventBean.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -3,8 +3,8 @@
 import java.io.Serializable;
 
 /**
- * An Time Event bean, containing all the relevant fields passed from the server
- * to the client. For e.g. the description of the event, its id, the dates, etc.
+ * An Time Event bean, containing all the relevant fields passed from the server to the client. For e.g. the description
+ * of the event, its id, the dates, etc.
  * 
  * @author cjburrell
  * 
@@ -27,8 +27,7 @@
     private int eventId;
 
     /**
-     * the type of the event, where we distinguish battles, from births, etc.
-     * (TODO: still to be done)
+     * the type of the event, where we distinguish battles, from births, etc. (TODO: still to be done)
      */
     private int eventTypeId;
 
@@ -38,8 +37,7 @@
     private Long fromDate;
 
     /**
-     * how precise the date is, whether to the day, month, etc. see schema
-     * definition for details
+     * how precise the date is, whether to the day, month, etc. see schema definition for details
      */
     private String fromPrecision;
 
@@ -59,8 +57,7 @@
     private Long toDate;
 
     /**
-     * the precision of the "to-date", whether to the day, month, etc. see
-     * schema definition for details
+     * the precision of the "to-date", whether to the day, month, etc. see schema definition for details
      */
     private String toPrecision;
 
@@ -68,33 +65,23 @@
      * making public
      */
     public TimelineEventBean() {
-
+        // exposing public constructor for serialisation
     }
 
     /**
      * a constructor to set up everything in one go
      * 
-     * @param eventId
-     *            the event id from the database
-     * @param fromDate
-     *            the from date, at which the event starts/is
-     * @param toDate
-     *            the to date, if the date is a duratio
-     * @param fromPrecision
-     *            how precise the from date is (see schema for more details)
-     * @param toPrecision
-     *            how precise the to date is (see schema for more details)
-     * @param name
-     *            the description of the event
-     * @param timelineId
-     *            the timeband on which to be located
-     * @param importanceId
-     *            the importance id as defined in the input files
-     * @param certainty
-     *            the certainty as defined in the input files
-     * @param eventTypeId
-     *            the event type, describing different types, and therefore
-     *            different representations of the event on the UI
+     * @param eventId the event id from the database
+     * @param fromDate the from date, at which the event starts/is
+     * @param toDate the to date, if the date is a duratio
+     * @param fromPrecision how precise the from date is (see schema for more details)
+     * @param toPrecision how precise the to date is (see schema for more details)
+     * @param name the description of the event
+     * @param timelineId the timeband on which to be located
+     * @param importanceId the importance id as defined in the input files
+     * @param certainty the certainty as defined in the input files
+     * @param eventTypeId the event type, describing different types, and therefore different representations of the
+     *            event on the UI
      * 
      */
     // CHECKSTYLE:OFF
@@ -117,35 +104,35 @@
      * @return the certainty
      */
     public String getCertainty() {
-        return certainty;
+        return this.certainty;
     }
 
     /**
      * @return the eventId
      */
     public int getEventId() {
-        return eventId;
+        return this.eventId;
     }
 
     /**
      * @return the eventTypeId
      */
     public int getEventTypeId() {
-        return eventTypeId;
+        return this.eventTypeId;
     }
 
     /**
      * @return the fromDate
      */
     public Long getFromDate() {
-        return fromDate;
+        return this.fromDate;
     }
 
     /**
      * @return the fromPrecision
      */
     public String getFromPrecision() {
-        return fromPrecision;
+        return this.fromPrecision;
     }
 
     /**
@@ -154,97 +141,88 @@
      * @return the description of the event
      */
     public String getName() {
-        return name;
+        return this.name;
     }
 
     /**
      * @return the timelineId
      */
     public int getTimelineId() {
-        return timelineId;
+        return this.timelineId;
     }
 
     /**
      * @return the toDate
      */
     public Long getToDate() {
-        return toDate;
+        return this.toDate;
     }
 
     /**
      * @return the toPrecision
      */
     public String getToPrecision() {
-        return toPrecision;
+        return this.toPrecision;
     }
 
     /**
-     * @param certainty
-     *            the certainty to set
+     * @param certainty the certainty to set
      */
     public void setCertainty(final String certainty) {
         this.certainty = certainty;
     }
 
     /**
-     * @param eventId
-     *            the eventId to set
+     * @param eventId the eventId to set
      */
     public void setEventId(final int eventId) {
         this.eventId = eventId;
     }
 
     /**
-     * @param eventTypeId
-     *            the eventTypeId to set
+     * @param eventTypeId the eventTypeId to set
      */
     public void setEventTypeId(final int eventTypeId) {
         this.eventTypeId = eventTypeId;
     }
 
     /**
-     * @param fromDate
-     *            the fromDate to set
+     * @param fromDate the fromDate to set
      */
     public void setFromDate(final Long fromDate) {
         this.fromDate = fromDate;
     }
 
     /**
-     * @param fromPrecision
-     *            the fromPrecision to set
+     * @param fromPrecision the fromPrecision to set
      */
     public void setFromPrecision(final String fromPrecision) {
         this.fromPrecision = fromPrecision;
     }
 
     /**
-     * @param name
-     *            the name to set
+     * @param name the name to set
      */
     public void setName(final String name) {
         this.name = name;
     }
 
     /**
-     * @param timelineId
-     *            the timelineId to set
+     * @param timelineId the timelineId to set
      */
     public void setTimelineId(final int timelineId) {
         this.timelineId = timelineId;
     }
 
     /**
-     * @param toDate
-     *            the toDate to set
+     * @param toDate the toDate to set
      */
     public void setToDate(final Long toDate) {
         this.toDate = toDate;
     }
 
     /**
-     * @param toPrecision
-     *            the toPrecision to set
+     * @param toPrecision the toPrecision to set
      */
     public void setToPrecision(final String toPrecision) {
         this.toPrecision = toPrecision;

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -3,8 +3,7 @@
 import net.customware.gwt.dispatch.shared.Result;
 
 /**
- * The dictionary definition that was looked up from the
- * GetDictionaryDefinitionCommand
+ * The dictionary definition that was looked up from the GetDictionaryDefinitionCommand
  * 
  * @author CJBurrell
  * 
@@ -22,34 +21,18 @@
     private String xsltedDefinition;
 
     /**
-     * Default constructor
-     */
-    public GetDictionaryDefinitionResult() {
-
-    }
-
-    /**
      * @return the xsltedDefinition
      */
     public String getXsltedDefinition() {
-        return xsltedDefinition;
+        return this.xsltedDefinition;
     }
 
     /**
      * sets the definition
      * 
-     * @param xsltedDefinition
-     *            the definition to be set
+     * @param definition the definition to be set
      */
-    public void setDefinition(final String xsltedDefinition) {
-        this.xsltedDefinition = xsltedDefinition;
+    public void setDefinition(final String definition) {
+        this.xsltedDefinition = definition;
     }
-
-    /**
-     * @param xsltedDefinition
-     *            the xsltedDefinition to set
-     */
-    public void setXsltedDefinition(final String xsltedDefinition) {
-        this.xsltedDefinition = xsltedDefinition;
-    }
 }

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -24,17 +24,9 @@
     private List<TimelineEventBean> events = new ArrayList<TimelineEventBean>();
 
     /**
-     * public constructor
-     */
-    public GetEventsForDateRangeResult() {
-
-    }
-
-    /**
      * Adds a new Event in Tim to the response
      * 
-     * @param teb
-     *            the event to add to the response
+     * @param teb the event to add to the response
      */
     public void add(final TimelineEventBean teb) {
         getEvents().add(teb);
@@ -45,12 +37,11 @@
      * @return a list of events within a specified date range
      */
     public List<TimelineEventBean> getEvents() {
-        return events;
+        return this.events;
     }
 
     /**
-     * @param events
-     *            the events to set
+     * @param events the events to set
      */
     public void setEvents(final List<TimelineEventBean> events) {
         this.events = events;

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -22,7 +22,7 @@
      * whether no data was returned, because no events matched the biblical
      * reference
      */
-    private boolean isEmpty;
+    private boolean empty;
 
     /**
      * the date of the recommended
@@ -46,7 +46,7 @@
      *            true if no data was found
      */
     public GetTimelineOriginForScriptureResult(final boolean isEmpty) {
-        this.isEmpty = isEmpty;
+        this.empty = isEmpty;
     }
 
     /**
@@ -63,7 +63,7 @@
         this.originDate = originDate;
         this.suggestedTimeScale = unit;
         this.timebandId = timebandId;
-        isEmpty = false;
+        empty = false;
     }
 
     /**
@@ -101,7 +101,7 @@
      * @return the isEmpty
      */
     public boolean isEmpty() {
-        return isEmpty;
+        return empty;
     }
 
     /**
@@ -109,7 +109,7 @@
      *            the isEmpty to set
      */
     public void setEmpty(final boolean isEmpty) {
-        this.isEmpty = isEmpty;
+        this.empty = isEmpty;
     }
 
     /**

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -7,9 +7,8 @@
 import com.tyndalehouse.step.web.shared.common.timeline.TimelineBean;
 
 /**
- * Response from a @see
- * {@link com.tyndalehouse.step.web.shared.command.GetTimelineUISetupCommand}
- * This contains details on how to set up each timeband, their units, etc.
+ * Response from a @see {@link com.tyndalehouse.step.web.shared.command.GetTimelineUISetupCommand} This contains details
+ * on how to set up each timeband, their units, etc.
  * 
  * @author cjburrell
  * 
@@ -27,26 +26,18 @@
     private List<TimelineBean> tlb;
 
     /**
-     * Default constructor made public
-     */
-    public GetTimelineUISetupResult() {
-
-    }
-
-    /**
      * returns a list of timebands
      * 
      * @return a list of timeband beans
      */
     public List<TimelineBean> getTimelines() {
-        return tlb;
+        return this.tlb;
     }
 
     /**
      * sets the list. made available for reflection
      * 
-     * @param tlb
-     *            the list of timeline beans
+     * @param tlb the list of timeline beans
      */
     public void setTimelines(final List<TimelineBean> tlb) {
         this.tlb = tlb;

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/InstallJswordModuleResult.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/InstallJswordModuleResult.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/InstallJswordModuleResult.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -3,9 +3,8 @@
 import net.customware.gwt.dispatch.shared.Result;
 
 /**
- * Response from a @see
- * {@link com.tyndalehouse.step.web.shared.command.InstallJswordModuleCommand}
- * indicating whether the installation was succesful
+ * Response from a @see {@link com.tyndalehouse.step.web.shared.command.InstallJswordModuleCommand} indicating whether
+ * the installation was succesful
  * 
  * @author cjburrell
  * 
@@ -25,14 +24,13 @@
      * Default constructor made public
      */
     public InstallJswordModuleResult() {
-
+        // exposing constructor for serialisation
     }
 
     /**
      * Constructor with the success flag passed in
      * 
-     * @param successful
-     *            true to indicate success
+     * @param successful true to indicate success
      */
     public InstallJswordModuleResult(final boolean successful) {
         this.successful = successful;
@@ -43,12 +41,11 @@
      * @return the successful
      */
     public boolean isSuccessful() {
-        return successful;
+        return this.successful;
     }
 
     /**
-     * @param successful
-     *            the successful to set
+     * @param successful the successful to set
      */
     public void setSuccessful(final boolean successful) {
         this.successful = successful;

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/OsisElementType.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/OsisElementType.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/OsisElementType.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -1,35 +1,129 @@
 package com.tyndalehouse.step.web.shared.scripture;
 
+import static java.util.EnumSet.noneOf;
+
 import java.io.Serializable;
+import java.util.EnumSet;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
+/**
+ * a list of enums used to reference the OSIS XML passed back by JSword
+ * 
+ * @author CJBurrell
+ * 
+ */
 public enum OsisElementType implements Serializable {
-    WORD("w"), NOTE("note"), MILESTONE("milestone"), TRANS_CHANGE("transChange"), MARKER("marker"), LINE_BREAK("lb"), TITLE(
-            "title"), LEMMA("lemma"), MORPH("morph"), ALTERNATIVE_WORDING("<alternativeWording>"), TEXT("<text>"), VERSE(
-            "verse"),
+    /** represents a word, punctuation, etc. */
+    WORD("w", true),
+    /** a note in the text, a cross reference */
+    NOTE("note", false),
+    /** a particular break in the text */
+    MILESTONE("milestone", false),
+    /**
+     * a translator's change, when he's had to add or change something to convey the meaning
+     */
+    TRANS_CHANGE("transChange", true),
+    /** a textual marker in the passage */
+    MARKER("marker", true),
+    /** a line break in the passage */
+    LINE_BREAK("lb", true),
+    /**
+     * The title of the passage, can be repeated each time also for intermediate titles
+     */
+    TITLE("title", true),
+    /**
+     * The strong number or lemma indicating the root and family of a word/expression
+     */
+    LEMMA("lemma", true, true),
+    /** the morphology of the word */
+    MORPH("morph", false, true),
+    /**
+     * not strictly part of OSIS, the computed alternative greek/hebrew/english word
+     */
+    ALTERNATIVE_WORDING("<alternativeWording>", false),
+    /** a piece of text, usually the text node under a word */
+    TEXT("<text>"),
+    /** the element containing all the verses */
+    VERSE("verse", true),
     /** this gives us the verse number */
-    OSIS_ID("osisID"),
+    OSIS_ID("osisID", true, true),
     /**
-     * a quote, which is not a quote from someone, but part of the text that is
-     * quoted
+     * a quote, which is not a quote from someone, but part of the text that is quoted
      */
-    QUOTE("q");
+    QUOTE("q", true);
 
-    private final static Map<String, OsisElementType> cachedTypes = initialiseTypes();
+    private static final Map<String, OsisElementType> CACHED_TYPES = initialiseTypes();
+    /** a default set of attributes used when retrieving a passage */
+    private static final EnumSet<OsisElementType> DEFAULT_ATTRIBUTES = initialiseDefaultAttributes();
+    /** a default set of elements used when retrieving a passage */
+    private static final EnumSet<OsisElementType> DEFAULT_ELEMENTS = initialiseDefaultElements();
+
     private final String osisTag;
+    private boolean defaultOption;
+    private boolean attribute;
 
     /**
      * constructs the enum with an osis tag
      * 
-     * @param osisTag
-     *            the osis tag
+     * @param osisTag the osis tag
      */
     OsisElementType(final String osisTag) {
+        this(osisTag, false, false);
+    }
+
+    /**
+     * constructs the enum with an osis tag
+     * 
+     * @param osisTag the osis tag
+     * @param defaultOption whether the option should be selected by default
+     */
+    OsisElementType(final String osisTag, final boolean defaultOption) {
+        this(osisTag, defaultOption, false);
+    }
+
+    /**
+     * constructs the enum with an osis tag
+     * 
+     * @param osisTag the osis tag
+     * @param defaultOption whether the option should be selected by default
+     * @param attribute true to indicate this is an attribute rather than a node
+     */
+    OsisElementType(final String osisTag, final boolean defaultOption, final boolean attribute) {
         this.osisTag = osisTag;
+        this.defaultOption = defaultOption;
+        this.attribute = attribute;
     }
 
     /**
+     * @return all OETs in a set that are both attributes and defaults
+     */
+    private static EnumSet<OsisElementType> initialiseDefaultAttributes() {
+        final EnumSet<OsisElementType> defaultAttributes = noneOf(OsisElementType.class);
+        for (final OsisElementType oet : values()) {
+            if (oet.isDefaultOption() && oet.isAttribute()) {
+                defaultAttributes.add(oet);
+            }
+        }
+        return defaultAttributes;
+    }
+
+    /**
+     * @return all OETs in a set that are elements and defaults
+     */
+    private static EnumSet<OsisElementType> initialiseDefaultElements() {
+        final EnumSet<OsisElementType> defaultElements = noneOf(OsisElementType.class);
+        for (final OsisElementType oet : values()) {
+            if (oet.isDefaultOption() && !oet.isAttribute()) {
+                defaultElements.add(oet);
+            }
+        }
+        return defaultElements;
+    }
+
+    /**
      * initialises the internal map to speed up further lookups
      * 
      * @return the map reverse mapping for enum resolving
@@ -46,19 +140,48 @@
     /**
      * resolves to the enum from the tag name
      * 
-     * @param tagName
-     *            the tag name
+     * @param tagName the tag name
      * @return the resolved enum
      */
     public static OsisElementType forOsisType(final String tagName) {
-        return cachedTypes.get(tagName);
+        return CACHED_TYPES.get(tagName);
     }
 
     /**
      * @return the osisTag
      */
     public String getOsisTag() {
-        return osisTag;
+        return this.osisTag;
     }
 
+    /**
+     * @return true if the option is on by default
+     */
+    public boolean isDefaultOption() {
+        return this.defaultOption;
+    }
+
+    /**
+     * @return true if the option is an attribute, otherwise false (an element)
+     */
+    public boolean isAttribute() {
+        return this.attribute;
+    }
+
+    /**
+     * @return a copy of the default attributes
+     */
+    public static Set<OsisElementType> getDefaultAttributes() {
+        return new HashSet<OsisElementType>(DEFAULT_ATTRIBUTES);
+    }
+
+    /**
+     * a copy of the default elements
+     * 
+     * @return a set of elements that should be selected by default
+     */
+    public static Set<OsisElementType> getDefaultElements() {
+        return new HashSet<OsisElementType>(DEFAULT_ELEMENTS);
+    }
+
 }

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Passage.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Passage.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Passage.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -4,6 +4,12 @@
 import java.util.Iterator;
 import java.util.Set;
 
+/**
+ * A representation of a passage that can hold multiple attributes and languages
+ * 
+ * @author CJBurrell
+ * 
+ */
 public class Passage implements Serializable, Iterator<PassageElement> {
     private static final long serialVersionUID = -8107771273622629610L;
     private PassageElement rootPassageNode = null;
@@ -17,12 +23,11 @@
      * @return the language
      */
     public PassageLanguage getOriginalLanguage() {
-        return originalLanguage;
+        return this.originalLanguage;
     }
 
     /**
-     * @param language
-     *            the language to set
+     * @param language the language to set
      */
     public void setOriginalLanguage(final PassageLanguage language) {
         this.originalLanguage = language;
@@ -32,12 +37,11 @@
      * @return the rootPassageNode
      */
     public PassageElement getRootPassageNode() {
-        return rootPassageNode;
+        return this.rootPassageNode;
     }
 
     /**
-     * @param rootPassageNode
-     *            the rootPassageNode to set
+     * @param rootPassageNode the rootPassageNode to set
      */
     public void setRootPassageNode(final PassageElement rootPassageNode) {
         this.rootPassageNode = rootPassageNode;
@@ -46,8 +50,7 @@
     /**
      * sets the filter for elements that was used
      * 
-     * @param elementFilter
-     *            the element filter used in this result
+     * @param elementFilter the element filter used in this result
      */
     public void setElementFilter(final Set<OsisElementType> elementFilter) {
         this.elementFilter = elementFilter;
@@ -56,8 +59,7 @@
     /**
      * the attribute filter that was used
      * 
-     * @param attributeFilter
-     *            attribute filter
+     * @param attributeFilter attribute filter
      */
     public void setAttributeFilter(final Set<OsisElementType> attributeFilter) {
         this.attributeFilter = attributeFilter;
@@ -67,54 +69,79 @@
      * @return the elementFilter
      */
     public Set<OsisElementType> getElementFilter() {
-        return elementFilter;
+        return this.elementFilter;
     }
 
     /**
      * @return the attributeFilter
      */
     public Set<OsisElementType> getAttributeFilter() {
-        return attributeFilter;
+        return this.attributeFilter;
     }
 
+    /**
+     * @return the reference of the passage
+     */
     public String getReference() {
-        return reference;
+        return this.reference;
     }
 
+    /**
+     * sets the reference
+     * 
+     * @param reference the refernece of the passage
+     */
     public void setReference(final String reference) {
         this.reference = reference;
     }
 
+    /**
+     * @return the version of the passage
+     */
     public String getVersion() {
-        return version;
+        return this.version;
     }
 
+    /**
+     * sets the version
+     * 
+     * @param version sets the version, kjv, esv, etc. of the passage
+     */
     public void setVersion(final String version) {
         this.version = version;
     }
 
+    /**
+     * @return true, if iterating through and more nodes can be found
+     */
     public boolean hasNext() {
-        if (rootPassageNode == null) {
+        if (this.rootPassageNode == null) {
             return false;
         }
-        return rootPassageNode.hasNext();
+        return this.rootPassageNode.hasNext();
     }
 
+    /**
+     * @return the next element in the passage
+     */
     public PassageElement next() {
-        if (rootPassageNode == null) {
+        if (this.rootPassageNode == null) {
             return null;
         }
-        return rootPassageNode.next();
+        return this.rootPassageNode.next();
     }
 
     /**
-     * Removes the current element from the passage, currently unsupported
+     * removes an element from the passage
      */
     public void remove() {
-
+        // not implemented
     }
 
+    /**
+     * resets the iterator
+     */
     public void reset() {
-        rootPassageNode.reset();
+        this.rootPassageNode.reset();
     }
 }

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/PassageElement.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/PassageElement.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/PassageElement.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -24,8 +24,13 @@
      * 0..n returned element 0..n
      */
     private int currentChild = -1;
-    private String debugId;
 
+    /**
+     * creates a passage element
+     * 
+     * @param typeOfElement the type of element
+     * @param attributes the list of attributes from the OSIS xml
+     */
     public PassageElement(final OsisElementType typeOfElement, final Map<OsisElementType, String> attributes) {
         this.typeOfElement = typeOfElement;
         this.values = attributes;
@@ -35,25 +40,18 @@
      * exposing implementation for GWT Serialisation
      */
     public PassageElement() {
-
+        // exposing for serialisation
     }
 
-    // TODO: remove this?
-    protected PassageElement(final String debugId) {
-        this.debugId = debugId;
-
-    }
-
     /**
      * @return the typeOfElement
      */
     public OsisElementType getTypeOfElement() {
-        return typeOfElement;
+        return this.typeOfElement;
     }
 
     /**
-     * @param typeOfElement
-     *            the typeOfElement to set
+     * @param typeOfElement the typeOfElement to set
      */
     public void setTypeOfElement(final OsisElementType typeOfElement) {
         this.typeOfElement = typeOfElement;
@@ -63,12 +61,11 @@
      * @return the values
      */
     public Map<OsisElementType, String> getValues() {
-        return values;
+        return this.values;
     }
 
     /**
-     * @param values
-     *            the values to set
+     * @param values the values to set
      */
     public void setValues(final Map<OsisElementType, String> values) {
         this.values = values;
@@ -77,14 +74,13 @@
     /**
      * retrieves a value for an attribute
      * 
-     * @param attributeName
-     *            attribute type
+     * @param attributeName attribute type
      * @return the value corresponding to the type passed in
      */
     public String getAttribute(final OsisElementType attributeName) {
-        if (values != null) {
+        if (this.values != null) {
 
-            return values.get(attributeName);
+            return this.values.get(attributeName);
         }
         return null;
     }
@@ -92,8 +88,7 @@
     /**
      * returns the child at the correct index
      * 
-     * @param childIndex
-     *            the index to retrieve in the list
+     * @param childIndex the index to retrieve in the list
      * @return the passage element at the right index
      */
     public PassageElement getChild(final int childIndex) {
@@ -127,24 +122,21 @@
     /**
      * adds an attribute to this element
      * 
-     * @param key
-     *            the key as it is known by, identifying the type of attribute
-     * @param value
-     *            the value that is stored with it
+     * @param key the key as it is known by, identifying the type of attribute
+     * @param value the value that is stored with it
      */
     public void addAttribute(final OsisElementType key, final String value) {
-        values.put(key, value);
+        this.values.put(key, value);
     }
 
     /**
      * adds a child element
      * 
-     * @param pe
-     *            the passage element to be added as a child
+     * @param pe the passage element to be added as a child
      */
     public void addChildElement(final PassageElement pe) {
         if (this.children == null) {
-            children = new ArrayList<PassageElement>();
+            this.children = new ArrayList<PassageElement>();
         }
         this.children.add(pe);
     }
@@ -153,23 +145,22 @@
      * @return the children
      */
     public List<PassageElement> getChildren() {
-        return children;
+        return this.children;
     }
 
     /**
-     * @param children
-     *            the children to set
+     * @param children the children to set
      */
     public void setChildren(final List<PassageElement> children) {
         this.children = children;
     }
 
     /**
-     * returns true if another element can be found
+     * @return true if another element can be found
      */
     public boolean hasNext() {
-        return (currentChild == -1) || (children != null && currentChild < children.size() - 1)
-                || (children != null && children.get(currentChild).hasNext());
+        return (this.currentChild == -1) || (this.children != null && this.currentChild < this.children.size() - 1)
+                || (this.children != null && this.children.get(this.currentChild).hasNext());
     }
 
     /**
@@ -177,16 +168,16 @@
      * 
      */
     public PassageElement next() {
-        if (currentChild == -1) {
-            currentChild++;
+        if (this.currentChild == -1) {
+            this.currentChild++;
             return this;
         }
 
-        if (!children.get(currentChild).hasNext()) {
-            currentChild++;
+        if (!this.children.get(this.currentChild).hasNext()) {
+            this.currentChild++;
         }
 
-        return children.get(currentChild).next();
+        return this.children.get(this.currentChild).next();
     }
 
     /**
@@ -196,17 +187,13 @@
         throw new UnsupportedOperationException("You cannot remove an element from a passage.");
     }
 
-    public String getDebugId() {
-        return debugId;
-    }
-
     /**
      * resets the counters to zero to properly go through the iterator
      */
     public void reset() {
-        currentChild = -1;
-        if (children != null) {
-            for (final PassageElement child : children) {
+        this.currentChild = -1;
+        if (this.children != null) {
+            for (final PassageElement child : this.children) {
                 child.reset();
             }
         }

Deleted: trunk/step-web-shared/src/test/java/com/tyndalehouse/step/web/shared/GettersAndSettersTest.java
===================================================================
--- trunk/step-web-shared/src/test/java/com/tyndalehouse/step/web/shared/GettersAndSettersTest.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/test/java/com/tyndalehouse/step/web/shared/GettersAndSettersTest.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -1,31 +0,0 @@
-package com.tyndalehouse.step.web.shared;
-
-/**
- * Checks that getters, setters and conventions are followed
- * 
- * @author CJBurrell
- * 
- */
-public class GettersAndSettersTest {
-    private final static String RESULT_SUFFIX = "Command";
-    private final static String COMMAND_SUFFIX = "Command";
-    private final static String HANDLER_SUFFIX = "Command";
-
-    /**
-     * automatically tests all getters and setters in command objects and result
-     * objects
-     * 
-     */
-    // @Test
-    public void testGettersAndSetters() {
-
-    }
-
-    /**
-     * Checks that naming conventions are followed
-     */
-    // Test
-    public void testNamingConventions() {
-
-    }
-}

Modified: trunk/step-web-shared/src/test/java/com/tyndalehouse/step/web/shared/scripture/PassageElementTest.java
===================================================================
--- trunk/step-web-shared/src/test/java/com/tyndalehouse/step/web/shared/scripture/PassageElementTest.java	2010-08-27 12:34:09 UTC (rev 174)
+++ trunk/step-web-shared/src/test/java/com/tyndalehouse/step/web/shared/scripture/PassageElementTest.java	2010-08-27 12:34:50 UTC (rev 175)
@@ -4,29 +4,38 @@
 
 import org.junit.Test;
 
+/**
+ * Tests the PassageElement object
+ * 
+ * @author CJBurrell
+ * 
+ */
 public class PassageElementTest {
 
+    /**
+     * tests that we can iterate through a passage
+     */
     @Test
     public void testPassageIterator() {
         final Passage p = new Passage();
         final PassageElement rootPassageNode = new PassageElement();
         p.setRootPassageNode(rootPassageNode);
 
-        final PassageElement a = new PassageElement("a");
-        final PassageElement a1 = new PassageElement("a1");
-        final PassageElement a1a = new PassageElement("a1a");
-        final PassageElement a1b = new PassageElement("a1b");
-        final PassageElement a2 = new PassageElement("a2");
-        final PassageElement b = new PassageElement("b");
-        final PassageElement b1 = new PassageElement("b1");
-        final PassageElement b2 = new PassageElement("b2");
-        final PassageElement b3 = new PassageElement("b3");
-        final PassageElement c = new PassageElement("c");
-        final PassageElement d = new PassageElement("d");
-        final PassageElement d1 = new PassageElement("d1");
-        final PassageElement d1a = new PassageElement("d1a");
-        final PassageElement d1a1 = new PassageElement("d1a1");
-        final PassageElement d1a1a = new PassageElement("d1a1a");
+        final PassageElement a = new PassageElement();
+        final PassageElement a1 = new PassageElement();
+        final PassageElement a1a = new PassageElement();
+        final PassageElement a1b = new PassageElement();
+        final PassageElement a2 = new PassageElement();
+        final PassageElement b = new PassageElement();
+        final PassageElement b1 = new PassageElement();
+        final PassageElement b2 = new PassageElement();
+        final PassageElement b3 = new PassageElement();
+        final PassageElement c = new PassageElement();
+        final PassageElement d = new PassageElement();
+        final PassageElement d1 = new PassageElement();
+        final PassageElement d1a = new PassageElement();
+        final PassageElement d1a1 = new PassageElement();
+        final PassageElement d1a1a = new PassageElement();
 
         rootPassageNode.addChildElement(a);
         a.addChildElement(a1);
@@ -51,8 +60,9 @@
         while (p.hasNext()) {
             final PassageElement nextPassageElement = p.next();
 
-            assertEquals("Got [" + nextPassageElement.getDebugId() + "] instead of [" + elementOrder[ii].getDebugId()
-                    + "]", elementOrder[ii++], nextPassageElement);
+            assertEquals("Wrong passage element", elementOrder[ii++], nextPassageElement);
+            // assertEquals("Got [" + nextPassageElement.getDebugId() + "] instead of [" + elementOrder[ii].getDebugId()
+            // + "]", elementOrder[ii++], nextPassageElement);
         }
     }
 }




More information about the Tynstep-svn mailing list