dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34611
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17744: minor fix, assume [0, Integer.MAX_VALUE] as default min/max for properties
------------------------------------------------------------
revno: 17744
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-12-19 14:43:08 +0100
message:
minor fix, assume [0, Integer.MAX_VALUE] as default min/max for properties
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Property.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/SchemaUtils.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Property.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Property.java 2014-12-19 13:27:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Property.java 2014-12-19 13:43:08 +0000
@@ -178,12 +178,12 @@
/**
* Maximum length/size/value of this property.
*/
- private Integer max;
+ private int max = Integer.MAX_VALUE;
/**
* Minimum length/size/value of this property.
*/
- private Integer min;
+ private int min;
/**
* Cascading used when doing CRUD operations.
@@ -482,24 +482,24 @@
@JsonProperty
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public Integer getMax()
+ public int getMax()
{
return max;
}
- public void setMax( Integer max )
+ public void setMax( int max )
{
this.max = max;
}
@JsonProperty
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public Integer getMin()
+ public int getMin()
{
return min;
}
- public void setMin( Integer min )
+ public void setMin( int min )
{
this.min = min;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/SchemaUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/SchemaUtils.java 2014-12-19 13:28:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/SchemaUtils.java 2014-12-19 13:43:08 +0000
@@ -64,15 +64,12 @@
{
PropertyRange propertyRange = property.getGetterMethod().getAnnotation( PropertyRange.class );
- int propertyMax = property.getMax() != null ? property.getMax() : Integer.MAX_VALUE;
- int propertyMin = property.getMin() != null ? property.getMin() : 0;
-
- if ( propertyRange.max() >= 0 && propertyRange.max() <= propertyMax )
+ if ( propertyRange.max() >= 0 && propertyRange.max() <= property.getMax() )
{
property.setMax( propertyRange.max() );
}
- if ( propertyRange.min() >= propertyMin && propertyRange.min() <= propertyMax )
+ if ( propertyRange.min() >= property.getMin() && propertyRange.min() <= property.getMax() )
{
property.setMin( propertyRange.min() > property.getMax() ? property.getMax() : propertyRange.min() );
}