|
From: <jg...@us...> - 2006-08-07 08:09:23
|
Revision: 32 Author: jgongo Date: 2006-08-07 01:09:12 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/surveyforge/?rev=32&view=rev Log Message: ----------- Relation between ConceptualDataElement and ObjectVariable is now unidirectional and mandatory Modified Paths: -------------- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ConceptualDataElement.java trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ObjectVariable.java Modified: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ConceptualDataElement.java =================================================================== --- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ConceptualDataElement.java 2006-08-01 10:26:24 UTC (rev 31) +++ trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ConceptualDataElement.java 2006-08-07 08:09:12 UTC (rev 32) @@ -46,8 +46,7 @@ @JoinColumn(name = "question_id") private Question question; /** */ - @ManyToOne(optional = true) - @JoinColumn(name = "objectVariable_id", insertable = false, updatable = false) + @ManyToOne private ObjectVariable objectVariable; @@ -91,9 +90,10 @@ */ public void setObjectVariable( ObjectVariable objectVariable ) { - if( this.objectVariable != null ) this.objectVariable.removeConceptualDataElement( this ); - this.objectVariable = objectVariable; - if( this.objectVariable != null ) this.objectVariable.addConceptualDataElement( this ); + if( objectVariable != null ) + this.objectVariable = objectVariable; + else + throw new NullPointerException( ); } @Override Modified: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ObjectVariable.java =================================================================== --- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ObjectVariable.java 2006-08-01 10:26:24 UTC (rev 31) +++ trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ObjectVariable.java 2006-08-07 08:09:12 UTC (rev 32) @@ -51,49 +51,42 @@ @Entity public class ObjectVariable implements Serializable { - private static final long serialVersionUID = 4288089682729653747L; + private static final long serialVersionUID = 4288089682729653747L; @Id @Column(length = 50) @GeneratedValue(generator = "system-uuid") @GenericGenerator(name = "system-uuid", strategy = "uuid") - private String id; + private String id; /** Version for optimistic locking. */ @javax.persistence.Version - private int lockingVersion; + private int lockingVersion; /** * Unique and language independent identifier for the object variable. The identifier is unique among all object variables. The * identifier should contain identifications for the statistical object and the global variable it is based on. */ @Column(unique = true, length = 50) - private String identifier; + private String identifier; /** The name is the official, language dependent name of the global variable, provided by the owner of the variable. */ @Column(length = 250) - private String name = ""; + private String name = ""; /** Short general multilingual description of the object variable, including its purpose, its main subject areas etc. */ @Column(length = 500) - private String description = ""; + private String description = ""; /** * Each object variable belongs to a statistical object or unit. The object variable exists only in the context of the object * variable. */ @ManyToOne @JoinColumn(name = "statisticalObjectType_id", insertable = false, updatable = false) - private StatisticalObjectType statisticalObjectType; + private StatisticalObjectType statisticalObjectType; /** An object variable should refer to a global variable definition that reflects the general concepts of the object variable. */ @ManyToOne @JoinColumn(name = "globalVariable_id", insertable = false, updatable = false) - private GlobalVariable globalVariable; + private GlobalVariable globalVariable; - /** Based on an object variable a number of data elements may refer to this object variable. */ - @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL}) - @IndexColumn(name = "dataElementsIndex") - @JoinColumn(name = "objectVariable_id") - private List<ConceptualDataElement> conceptualDataElements = new ArrayList<ConceptualDataElement>( ); - - private ObjectVariable( ) {} @@ -235,36 +228,6 @@ throw new NullPointerException( ); } - /** - * Returns the list of {@link ConceptualDataElement} linked to this ObjectVariable. - * - * @return Returns the list of ConceptualDataElements. - */ - public List<ConceptualDataElement> getConceptualDataElements( ) - { - return Collections.unmodifiableList( conceptualDataElements ); - } - - /** - * Adds a new {@link ConceptualDataElement} to the list. - * - * @param dataElements The conceptualDataElement to add. - */ - protected void addConceptualDataElement( ConceptualDataElement conceptualDataElement ) - { - this.conceptualDataElements.add( conceptualDataElement ); - } - - /** - * Removes a {@link ConceptualDataElement} from the list. - * - * @param dataElements The conceptualDataElement to remove. - */ - protected void removeConceptualDataElement( ConceptualDataElement conceptualDataElement ) - { - this.conceptualDataElements.remove( conceptualDataElement ); - } - @Override public boolean equals( Object object ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <jg...@us...> - 2006-08-07 09:59:04
|
Revision: 37 Author: jgongo Date: 2006-08-07 02:58:55 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/surveyforge/?rev=37&view=rev Log Message: ----------- Minor fixes in relations with ValueDomain Modified Paths: -------------- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/DataElement.java trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/RegisterDataElement.java Modified: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/DataElement.java =================================================================== --- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/DataElement.java 2006-08-07 09:55:29 UTC (rev 36) +++ trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/DataElement.java 2006-08-07 09:58:55 UTC (rev 37) @@ -67,7 +67,7 @@ /** */ private int maxResponses = 1; /** */ - @ManyToOne + @ManyToOne(cascade = {CascadeType.ALL}) @JoinColumn(name = "valueDomain_id") private ValueDomain valueDomain; /** */ Modified: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/RegisterDataElement.java =================================================================== --- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/RegisterDataElement.java 2006-08-07 09:55:29 UTC (rev 36) +++ trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/RegisterDataElement.java 2006-08-07 09:58:55 UTC (rev 37) @@ -34,6 +34,7 @@ * @author jsegura */ @Entity +// TODO: Improve javadocs public class RegisterDataElement extends DataElement { private static final long serialVersionUID = -8986375207717119033L; @@ -56,13 +57,21 @@ * @throws NullPointerException If the ValueDomain or the identifier or the ConceptualDataElements are <code>null</code> or the * identifier is empty. */ - public RegisterDataElement( ConceptualDataElement conceptualDataElement, ValueDomain valueDomain, String identifier ) + public RegisterDataElement( ConceptualDataElement conceptualDataElement, String identifier ) { - super( valueDomain, identifier ); + super( conceptualDataElement.getValueDomain( ).clone( ), identifier ); this.setConceptualDataElement( conceptualDataElement ); } /** + * Creates a new instance of ConceptualDataElement linked with a {@link ConceptualDataElement}. + */ + public RegisterDataElement( ValueDomain valueDomain, String identifier ) + { + super( valueDomain, identifier ); + } + + /** * Returns the ConceptualDataElement that describes the RegisterDataElement. * * @return Returns the conceptualDataElement. @@ -80,6 +89,10 @@ */ public void setConceptualDataElement( ConceptualDataElement conceptualDataElement ) { + if( conceptualDataElement == null ) + { + this.setValueDomain( conceptualDataElement.getValueDomain( ).clone( ) ); + } this.conceptualDataElement = conceptualDataElement; } @@ -114,5 +127,4 @@ { this.question = question; } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <jg...@us...> - 2006-08-07 09:59:58
|
Revision: 38 Author: jgongo Date: 2006-08-07 02:59:51 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/surveyforge/?rev=38&view=rev Log Message: ----------- Cloneable support for ValueDomain, now abstract Modified Paths: -------------- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/LogicalValueDomain.java trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ValueDomain.java Modified: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/LogicalValueDomain.java =================================================================== --- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/LogicalValueDomain.java 2006-08-07 09:58:55 UTC (rev 37) +++ trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/LogicalValueDomain.java 2006-08-07 09:59:51 UTC (rev 38) @@ -21,13 +21,8 @@ */ package org.surveyforge.core.metadata; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; +import java.io.Serializable; -import org.hibernate.annotations.GenericGenerator; - /** * @author jsegura */ @@ -36,18 +31,22 @@ { private static final long serialVersionUID = 2066579378848047283L; -// @Id -// @Column(length = 50) -// @GeneratedValue(generator = "system-uuid") -// @GenericGenerator(name = "system-uuid", strategy = "uuid") -// private String id; -// /** Version for optimistic locking. */ -// @javax.persistence.Version -// private int lockingVersion; + // @Id + // @Column(length = 50) + // @GeneratedValue(generator = "system-uuid") + // @GenericGenerator(name = "system-uuid", strategy = "uuid") + // private String id; + // /** Version for optimistic locking. */ + // @javax.persistence.Version + // private int lockingVersion; - public boolean isValid( Object object ) + public boolean isValid( Serializable object ) { return (Boolean.class.isInstance( object )); } - +// +// public LogicalValueDomain clone( ) +// { +// return (LogicalValueDomain) super.clone( ); +// } } Modified: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ValueDomain.java =================================================================== --- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ValueDomain.java 2006-08-07 09:58:55 UTC (rev 37) +++ trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ValueDomain.java 2006-08-07 09:59:51 UTC (rev 38) @@ -35,7 +35,7 @@ * @author jsegura */ @Entity -public class ValueDomain implements Serializable +public abstract class ValueDomain implements Serializable, Cloneable { private static final long serialVersionUID = -83487445078388347L; @@ -51,10 +51,21 @@ public ValueDomain( ) {} - public boolean isValid( Serializable data ) + public abstract boolean isValid( Serializable data ); + + @Override + public ValueDomain clone( ) { - // TODO Auto-generated method stub - return false; + try + { + ValueDomain copy = (ValueDomain) super.clone( ); + copy.id = null; + copy.lockingVersion = 0; + return copy; + } + catch( CloneNotSupportedException exc ) + { + throw new InternalError( exc.getLocalizedMessage( ) ); + } } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <jg...@us...> - 2006-08-08 08:34:35
|
Revision: 43 Author: jgongo Date: 2006-08-08 01:34:17 -0700 (Tue, 08 Aug 2006) ViewCVS: http://svn.sourceforge.net/surveyforge/?rev=43&view=rev Log Message: ----------- Initial set of value domain classes Modified Paths: -------------- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ValueDomain.java Added Paths: ----------- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/ trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/ClassificationValueDomain.java trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/LogicalValueDomain.java trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/QuantityValueDomain.java trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/StringValueDomain.java Modified: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ValueDomain.java =================================================================== --- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ValueDomain.java 2006-08-07 12:59:49 UTC (rev 42) +++ trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/ValueDomain.java 2006-08-08 08:34:17 UTC (rev 43) @@ -27,6 +27,8 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; import org.hibernate.annotations.GenericGenerator; @@ -35,6 +37,7 @@ * @author jsegura */ @Entity +@Inheritance(strategy = InheritanceType.JOINED) public abstract class ValueDomain implements Serializable, Cloneable { private static final long serialVersionUID = -83487445078388347L; Added: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/ClassificationValueDomain.java =================================================================== --- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/ClassificationValueDomain.java (rev 0) +++ trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/ClassificationValueDomain.java 2006-08-08 08:34:17 UTC (rev 43) @@ -0,0 +1,96 @@ +/* + * surveyforge-core - Copyright (C) 2006 OPEN input - http://www.openinput.com/ + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to + * the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA + * + * $Id$ + */ +package org.surveyforge.core.metadata.domain; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.ManyToOne; + +import org.surveyforge.classification.Level; +import org.surveyforge.core.metadata.ValueDomain; + +/** + * @author jgonzalez + */ +@Entity +public class ClassificationValueDomain extends ValueDomain + { + private static final long serialVersionUID = 2295375925240989153L; + + @ManyToOne + private Level level; + private boolean sublevelsAllowed = true; + + public ClassificationValueDomain( Level level ) + { + this( level, true ); + } + + public ClassificationValueDomain( Level level, boolean sublevelsAllowed ) + { + this.setLevel( level ); + this.setSublevelsAllowed( sublevelsAllowed ); + } + + public Level getLevel( ) + { + return this.level; + } + + public void setLevel( Level level ) + { + if( level != null ) + this.level = level; + else + throw new NullPointerException( ); + } + + public boolean isSublevelsAllowed( ) + { + return this.sublevelsAllowed; + } + + public void setSublevelsAllowed( boolean sublevelsAllowed ) + { + this.sublevelsAllowed = sublevelsAllowed; + } + + @Override + public boolean isValid( Serializable object ) + { + if( object instanceof String ) + { + String code = (String) object; + return this.getLevel( ).isIncludedInLevel( code, this.isSublevelsAllowed( ) ); + } + else + return false; + } + + @Override + public ClassificationValueDomain clone( ) + { + ClassificationValueDomain copy = (ClassificationValueDomain) super.clone( ); + return copy; + } + } Property changes on: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/ClassificationValueDomain.java ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Copied: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/LogicalValueDomain.java (from rev 38, trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/LogicalValueDomain.java) =================================================================== --- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/LogicalValueDomain.java (rev 0) +++ trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/LogicalValueDomain.java 2006-08-08 08:34:17 UTC (rev 43) @@ -0,0 +1,48 @@ +/* + * surveyforge-core - Copyright (C) 2006 OPEN input - http://www.openinput.com/ + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to + * the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA + * + * $Id$ + */ +package org.surveyforge.core.metadata.domain; + +import java.io.Serializable; + +import javax.persistence.Entity; + +import org.surveyforge.core.metadata.ValueDomain; + +/** + * @author jsegura + */ +@Entity +public class LogicalValueDomain extends ValueDomain + { + private static final long serialVersionUID = 2066579378848047283L; + + public boolean isValid( Serializable object ) + { + return (Boolean.class.isInstance( object )); + } + + @Override + public LogicalValueDomain clone( ) + { + return (LogicalValueDomain) super.clone( ); + } + } Added: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/QuantityValueDomain.java =================================================================== --- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/QuantityValueDomain.java (rev 0) +++ trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/QuantityValueDomain.java 2006-08-08 08:34:17 UTC (rev 43) @@ -0,0 +1,150 @@ +/* + * surveyforge-core - Copyright (C) 2006 OPEN input - http://www.openinput.com/ + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to + * the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA + * + * $Id$ + */ +package org.surveyforge.core.metadata.domain; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Entity; + +import org.surveyforge.core.metadata.ValueDomain; + +/** + * @author jgonzalez + */ +@Entity +public class QuantityValueDomain extends ValueDomain + { + private static final long serialVersionUID = 475119088217988415L; + + private int precision = 1; + private int scale; + + private BigDecimal minimum = BigDecimal.valueOf( Integer.MIN_VALUE ); + private BigDecimal maximum = BigDecimal.valueOf( Integer.MAX_VALUE ); ; + + /** + * + */ + public QuantityValueDomain( int precision, int scale ) + { + this.setPrecision( precision ); + this.setScale( scale ); + } + + /** + * @return Returns the precision. + */ + public int getPrecision( ) + { + return precision; + } + + /** + * @param precision The precision to set. + */ + public void setPrecision( int precision ) + { + if( precision > 0 && precision >= this.getScale( ) ) + this.precision = precision; + else + throw new IllegalArgumentException( ); + } + + /** + * @return Returns the scale. + */ + public int getScale( ) + { + return scale; + } + + /** + * @param scale The scale to set. + */ + public void setScale( int scale ) + { + if( scale >= 0 && scale <= this.getPrecision( ) ) + this.scale = scale; + else + throw new IllegalArgumentException( ); + } + + /** + * @return Returns the minimum. + */ + public BigDecimal getMinimum( ) + { + return this.minimum; + } + + /** + * @param minimum The minimum to set. + */ + public void setMinimum( BigDecimal minimum ) + { + if( minimum.compareTo( this.getMaximum( ) ) < 0 ) + this.minimum = minimum; + else + throw new IllegalArgumentException( ); + } + + /** + * @return Returns the maximum. + */ + public BigDecimal getMaximum( ) + { + return this.maximum; + } + + /** + * @param maximum The maximum to set. + */ + public void setMaximum( BigDecimal maximum ) + { + if( this.getMinimum( ).compareTo( maximum ) < 0 ) + this.maximum = maximum; + else + throw new IllegalArgumentException( ); + } + + @Override + public boolean isValid( Serializable object ) + { + if( object instanceof BigDecimal ) + { + BigDecimal quantity = (BigDecimal) object; + return quantity.scale( ) <= this.getScale( ) + && (quantity.precision( ) - quantity.scale( )) <= (this.getPrecision( ) - this.getScale( )) + && this.getMinimum( ).compareTo( quantity ) <= 0 && quantity.compareTo( this.getMaximum( ) ) <= 0; + } + else + return false; + } + + @Override + public QuantityValueDomain clone( ) + { + QuantityValueDomain copy = (QuantityValueDomain) super.clone( ); + return copy; + } + } Property changes on: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/QuantityValueDomain.java ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id Added: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/StringValueDomain.java =================================================================== --- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/StringValueDomain.java (rev 0) +++ trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/StringValueDomain.java 2006-08-08 08:34:17 UTC (rev 43) @@ -0,0 +1,91 @@ +/* + * surveyforge-core - Copyright (C) 2006 OPEN input - http://www.openinput.com/ + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to + * the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA + * + * $Id$ + */ +package org.surveyforge.core.metadata.domain; + +import java.io.Serializable; + +import javax.persistence.Entity; + +import org.surveyforge.core.metadata.ValueDomain; + +/** + * @author jgonzalez + */ +@Entity +public class StringValueDomain extends ValueDomain + { + private static final long serialVersionUID = -5056062679246063821L; + + private int minLength = 0; + private int maxLength = Integer.MAX_VALUE; + + public StringValueDomain( int minLength, int maxLength ) + { + this.setMinLength( minLength ); + this.setMaxLength( maxLength ); + } + + public int getMinLength( ) + { + return this.minLength; + } + + public void setMinLength( int minLength ) + { + if( minLength >= 0 && minLength <= this.getMaxLength( ) ) + this.minLength = minLength; + else + throw new IllegalArgumentException( ); + } + + public int getMaxLength( ) + { + return this.maxLength; + } + + public void setMaxLength( int maxLength ) + { + if( maxLength > 0 && maxLength >= this.getMinLength( ) ) + this.maxLength = maxLength; + else + throw new IllegalArgumentException( ); + } + + @Override + public boolean isValid( Serializable object ) + { + if( object instanceof String ) + { + String string = (String) object; + return this.getMinLength( ) <= string.length( ) && string.length( ) <= this.getMaxLength( ); + } + else + return false; + } + + @Override + public StringValueDomain clone( ) + { + StringValueDomain copy = (StringValueDomain) super.clone( ); + return copy; + } + } Property changes on: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/StringValueDomain.java ___________________________________________________________________ Name: svn:keywords + Date Revision Author HeadURL Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |