dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16782
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6471: Fixed bug <965971> There is no validation on the length of OrgUnit Group name.
------------------------------------------------------------
revno: 6471
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-04-03 17:52:58 +0700
message:
Fixed bug <965971> There is no validation on the length of OrgUnit Group name.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupForm.vm
--
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/common/BaseIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2012-04-02 17:23:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2012-04-03 10:52:58 +0000
@@ -113,7 +113,7 @@
// -------------------------------------------------------------------------
@JsonProperty( value = "internalId" )
- @JsonView( {DetailedView.class, IdentifiableObjectView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, IdentifiableObjectView.class, ExportView.class } )
@JacksonXmlProperty( isAttribute = true )
public int getId()
{
@@ -138,7 +138,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, IdentifiableObjectView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, IdentifiableObjectView.class, ExportView.class } )
@JacksonXmlProperty( isAttribute = true )
public String getCode()
{
@@ -146,12 +146,12 @@
}
public void setCode( String code )
- {
+ {
this.code = code;
}
@JsonProperty
- @JsonView( {DetailedView.class, IdentifiableObjectView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, IdentifiableObjectView.class, ExportView.class } )
@JacksonXmlProperty( isAttribute = true )
public String getName()
{
@@ -164,7 +164,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, IdentifiableObjectView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, IdentifiableObjectView.class, ExportView.class } )
@JacksonXmlProperty( isAttribute = true )
public Date getLastUpdated()
{
@@ -205,13 +205,14 @@
/**
* Get a map of uids to internal identifiers
- *
+ *
* @param objects the IdentifiableObjects to put in the map
* @return the map
*/
public static Map<String, Integer> getUIDMap( Collection<? extends BaseIdentifiableObject> objects )
{
Map<String, Integer> map = new HashMap<String, Integer>();
+
for ( IdentifiableObject object : objects )
{
String uid = object.getUid();
@@ -225,7 +226,7 @@
/**
* Get a map of codes to internal identifiers
- *
+ *
* @param objects the NameableObjects to put in the map
* @return the map
*/
@@ -244,7 +245,7 @@
/**
* Get a map of names to internal identifiers
- *
+ *
* @param objects the NameableObjects to put in the map
* @return the map
*/
@@ -270,7 +271,6 @@
", code='" + code + '\'' +
", name='" + name + '\'' +
", lastUpdated=" + lastUpdated +
- ", displayName='" + displayName + '\'' +
- '}';
+ ", displayName='" + displayName + '\'' + '}';
}
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java 2012-03-27 17:38:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java 2012-04-03 10:52:58 +0000
@@ -84,7 +84,7 @@
@Override
public String getCode()
{
- return name;
+ return (name != null && name.length() > 50) ? name.substring( 0, 50 ) : name;
}
public void addOrganisationUnit( OrganisationUnit organisationUnit )
@@ -160,7 +160,7 @@
@JsonProperty( value = "organisationUnits" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "organisationUnits", namespace = Dxf2Namespace.NAMESPACE )
@JacksonXmlProperty( localName = "organisationUnit", namespace = Dxf2Namespace.NAMESPACE )
public Set<OrganisationUnit> getMembers()
@@ -175,7 +175,7 @@
@JsonProperty( value = "organisationUnitGroupSet" )
@JsonSerialize( as = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public OrganisationUnitGroupSet getGroupSet()
{
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2012-03-28 12:26:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2012-04-03 10:52:58 +0000
@@ -43,7 +43,6 @@
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.hierarchy.HierarchyViolationException;
-import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitLevelComparator;
import org.hisp.dhis.system.util.AuditLogUtil;
import org.hisp.dhis.system.util.ConversionUtils;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java 2012-04-03 10:52:58 +0000
@@ -39,7 +39,7 @@
/**
* @author Torgeir Lorange Ostby
*/
-@SuppressWarnings("serial")
+@SuppressWarnings( "serial" )
public class AddOrganisationUnitGroupAction
extends ActionSupport
{
@@ -80,14 +80,15 @@
throws Exception
{
OrganisationUnitGroup organisationUnitGroup = new OrganisationUnitGroup( name );
-
- Collection<OrganisationUnit> selectedOrganisationUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits();
+
+ Collection<OrganisationUnit> selectedOrganisationUnits = selectionTreeManager
+ .getReloadedSelectedOrganisationUnits();
for ( OrganisationUnit unit : selectedOrganisationUnits )
{
organisationUnitGroup.addOrganisationUnit( unit );
}
-
+
organisationUnitGroupService.addOrganisationUnitGroup( organisationUnitGroup );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupForm.vm 2011-08-18 15:12:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupForm.vm 2012-04-03 10:52:58 +0000
@@ -11,7 +11,7 @@
<input type="hidden" name="id" id="id" style="width:300px" value="$!organisationUnitGroup.id"/>
<p>$i18n.getString( "name" )
- <em title="$i18n.getString( "required" )" class="required">*</em>
+ <em title="$i18n.getString( 'required' )" class="required">*</em>
<input type="text" name="name" id="name" style="width:300px" value="$!organisationUnitGroup.name">
</p>
<table>