From 581d033af3770340c125dd381751092925f2e22f Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 2 Nov 2005 15:21:39 +0000 Subject: [PATCH] propagate changes from schema update. git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@83 be28352e-c001-0410-b1a7-c7978e42abec --- .../objects/core/AnnotationElementDescriptor.java | 2 +- .../vamsas/objects/core/DataSetAnnotations.java | 96 +++++++++++++++----- .../objects/core/DataSetAnnotationsDescriptor.java | 30 +++--- .../objects/core/SequenceTypeDescriptor.java | 4 +- 4 files changed, 93 insertions(+), 39 deletions(-) diff --git a/src/org/vamsas/objects/core/AnnotationElementDescriptor.java b/src/org/vamsas/objects/core/AnnotationElementDescriptor.java index fd3d521..943bb99 100644 --- a/src/org/vamsas/objects/core/AnnotationElementDescriptor.java +++ b/src/org/vamsas/objects/core/AnnotationElementDescriptor.java @@ -104,7 +104,7 @@ public class AnnotationElementDescriptor extends org.exolab.castor.xml.util.XMLC fieldValidator = new org.exolab.castor.xml.FieldValidator(); fieldValidator.setMinOccurs(1); { //-- local scope - IntegerValidator typeValidator= new IntegerValidator(); + IntegerValidator typeValidator = new IntegerValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); diff --git a/src/org/vamsas/objects/core/DataSetAnnotations.java b/src/org/vamsas/objects/core/DataSetAnnotations.java index 60f2d84..cea5a3b 100644 --- a/src/org/vamsas/objects/core/DataSetAnnotations.java +++ b/src/org/vamsas/objects/core/DataSetAnnotations.java @@ -45,12 +45,22 @@ implements java.io.Serializable /** * Field _end */ - private java.lang.String _end; + private int _end; + + /** + * keeps track of state for field: _end + */ + private boolean _has_end; /** * Field _begin */ - private java.lang.String _begin; + private int _begin; + + /** + * keeps track of state for field: _begin + */ + private boolean _has_begin; /** * Field _seqRef @@ -154,6 +164,24 @@ implements java.io.Serializable } //-- void addProvenance(int, org.vamsas.objects.core.Provenance) /** + * Method deleteBegin + * + */ + public void deleteBegin() + { + this._has_begin= false; + } //-- void deleteBegin() + + /** + * Method deleteEnd + * + */ + public void deleteEnd() + { + this._has_end= false; + } //-- void deleteEnd() + + /** * Method enumerateAnnotationElement * * @@ -201,19 +229,13 @@ implements java.io.Serializable } else if (temp._type != null) return false; - if (this._end != null) { - if (temp._end == null) return false; - else if (!(this._end.equals(temp._end))) - return false; - } - else if (temp._end != null) + if (this._end != temp._end) return false; - if (this._begin != null) { - if (temp._begin == null) return false; - else if (!(this._begin.equals(temp._begin))) - return false; - } - else if (temp._begin != null) + if (this._has_end != temp._has_end) + return false; + if (this._begin != temp._begin) + return false; + if (this._has_begin != temp._has_begin) return false; if (this._seqRef != null) { if (temp._seqRef == null) return false; @@ -313,13 +335,13 @@ implements java.io.Serializable /** * Returns the value of field 'begin'. * - * @return String + * @return int * @return the value of field 'begin'. */ - public java.lang.String getBegin() + public int getBegin() { return this._begin; - } //-- java.lang.String getBegin() + } //-- int getBegin() /** * Returns the value of field 'description'. @@ -335,13 +357,13 @@ implements java.io.Serializable /** * Returns the value of field 'end'. * - * @return String + * @return int * @return the value of field 'end'. */ - public java.lang.String getEnd() + public int getEnd() { return this._end; - } //-- java.lang.String getEnd() + } //-- int getEnd() /** * Returns the value of field 'id'. @@ -436,6 +458,30 @@ implements java.io.Serializable } //-- java.lang.String getType() /** + * Method hasBegin + * + * + * + * @return boolean + */ + public boolean hasBegin() + { + return this._has_begin; + } //-- boolean hasBegin() + + /** + * Method hasEnd + * + * + * + * @return boolean + */ + public boolean hasEnd() + { + return this._has_end; + } //-- boolean hasEnd() + + /** * Method isValid * * @@ -568,10 +614,11 @@ implements java.io.Serializable * * @param begin the value of field 'begin'. */ - public void setBegin(java.lang.String begin) + public void setBegin(int begin) { this._begin = begin; - } //-- void setBegin(java.lang.String) + this._has_begin = true; + } //-- void setBegin(int) /** * Sets the value of field 'description'. @@ -588,10 +635,11 @@ implements java.io.Serializable * * @param end the value of field 'end'. */ - public void setEnd(java.lang.String end) + public void setEnd(int end) { this._end = end; - } //-- void setEnd(java.lang.String) + this._has_end = true; + } //-- void setEnd(int) /** * Sets the value of field 'id'. diff --git a/src/org/vamsas/objects/core/DataSetAnnotationsDescriptor.java b/src/org/vamsas/objects/core/DataSetAnnotationsDescriptor.java index 064823f..f74d6bc 100644 --- a/src/org/vamsas/objects/core/DataSetAnnotationsDescriptor.java +++ b/src/org/vamsas/objects/core/DataSetAnnotationsDescriptor.java @@ -106,21 +106,25 @@ public class DataSetAnnotationsDescriptor extends org.exolab.castor.xml.util.XML } desc.setValidator(fieldValidator); //-- _end - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_end", "end", org.exolab.castor.xml.NodeType.Attribute); - desc.setImmutable(true); + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute); handler = new org.exolab.castor.xml.XMLFieldHandler() { public java.lang.Object getValue( java.lang.Object object ) throws IllegalStateException { DataSetAnnotations target = (DataSetAnnotations) object; - return target.getEnd(); + if(!target.hasEnd()) + return null; + return new java.lang.Integer(target.getEnd()); } public void setValue( java.lang.Object object, java.lang.Object value) throws IllegalStateException, IllegalArgumentException { try { DataSetAnnotations target = (DataSetAnnotations) object; - target.setEnd( (java.lang.String) value); + // ignore null values for non optional primitives + if (value == null) return; + + target.setEnd( ((java.lang.Integer)value).intValue()); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); @@ -139,27 +143,30 @@ public class DataSetAnnotationsDescriptor extends org.exolab.castor.xml.util.XML fieldValidator = new org.exolab.castor.xml.FieldValidator(); fieldValidator.setMinOccurs(1); { //-- local scope - StringValidator typeValidator = new StringValidator(); - typeValidator.setWhiteSpace("preserve"); + IntegerValidator typeValidator = new IntegerValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); //-- _begin - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_begin", "begin", org.exolab.castor.xml.NodeType.Attribute); - desc.setImmutable(true); + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_begin", "begin", org.exolab.castor.xml.NodeType.Attribute); handler = new org.exolab.castor.xml.XMLFieldHandler() { public java.lang.Object getValue( java.lang.Object object ) throws IllegalStateException { DataSetAnnotations target = (DataSetAnnotations) object; - return target.getBegin(); + if(!target.hasBegin()) + return null; + return new java.lang.Integer(target.getBegin()); } public void setValue( java.lang.Object object, java.lang.Object value) throws IllegalStateException, IllegalArgumentException { try { DataSetAnnotations target = (DataSetAnnotations) object; - target.setBegin( (java.lang.String) value); + // ignore null values for non optional primitives + if (value == null) return; + + target.setBegin( ((java.lang.Integer)value).intValue()); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); @@ -178,8 +185,7 @@ public class DataSetAnnotationsDescriptor extends org.exolab.castor.xml.util.XML fieldValidator = new org.exolab.castor.xml.FieldValidator(); fieldValidator.setMinOccurs(1); { //-- local scope - StringValidator typeValidator = new StringValidator(); - typeValidator.setWhiteSpace("preserve"); + IntegerValidator typeValidator = new IntegerValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); diff --git a/src/org/vamsas/objects/core/SequenceTypeDescriptor.java b/src/org/vamsas/objects/core/SequenceTypeDescriptor.java index 0c4ded0..d7c39fc 100644 --- a/src/org/vamsas/objects/core/SequenceTypeDescriptor.java +++ b/src/org/vamsas/objects/core/SequenceTypeDescriptor.java @@ -104,7 +104,7 @@ public class SequenceTypeDescriptor extends org.exolab.castor.xml.util.XMLClassD fieldValidator = new org.exolab.castor.xml.FieldValidator(); fieldValidator.setMinOccurs(1); { //-- local scope - IntegerValidator typeValidator= new IntegerValidator(); + IntegerValidator typeValidator = new IntegerValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -146,7 +146,7 @@ public class SequenceTypeDescriptor extends org.exolab.castor.xml.util.XMLClassD fieldValidator = new org.exolab.castor.xml.FieldValidator(); fieldValidator.setMinOccurs(1); { //-- local scope - IntegerValidator typeValidator= new IntegerValidator(); + IntegerValidator typeValidator = new IntegerValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); -- 1.7.10.2