← Back to team overview

dhis2-devs team mailing list archive

Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 824: Fixed a violation of the DRY principle introduced by yours truly.

 

That was a nice commit message... Liked it... and nice fix!!
---
Regards,
Saptarshi PURKAYASTHA
Director R & D, HISP India
Health Information Systems Programme

My Tech Blog:  http://sunnytalkstech.blogspot.com
You Live by CHOICE, Not by CHANCE


2009/10/6 <noreply@xxxxxxxxxxxxx>

> ------------------------------------------------------------
> revno: 824
> committer: Lars Helge Oeverland larshelge@xxxxxxxxx
> branch nick: trunk
> timestamp: Tue 2009-10-06 13:12:35 +0200
> message:
>  Fixed a violation of the DRY principle introduced by yours truly.
> modified:
>
>  dhis-2/dhis-options/src/main/java/org/hisp/dhis/options/displayproperty/DefaultDisplayPropertyHandler.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-options/src/main/java/org/hisp/dhis/options/displayproperty/DefaultDisplayPropertyHandler.java'
> ---
> dhis-2/dhis-options/src/main/java/org/hisp/dhis/options/displayproperty/DefaultDisplayPropertyHandler.java
>  2009-10-05 16:07:55 +0000
> +++
> dhis-2/dhis-options/src/main/java/org/hisp/dhis/options/displayproperty/DefaultDisplayPropertyHandler.java
>  2009-10-06 11:12:35 +0000
> @@ -51,36 +51,9 @@
>
>     public List<? extends IdentifiableObject> handle( List<? extends
> IdentifiableObject> list )
>     {
> -        if ( displayProperty.equals(
> DisplayPropertyManager.DISPLAY_PROPERTY_SHORTNAME ) )
> -        {
> -            for ( IdentifiableObject object : list )
> -            {
> -                if ( object.getShortName() != null )
> -                {
> -                    object.setName( object.getShortName() );
> -                }
> -            }
> -        }
> -        else if ( displayProperty.equals(
> DisplayPropertyManager.DISPLAY_PROPERTY_CODE ) )
> -        {
> -            for ( IdentifiableObject object : list )
> -            {
> -                if ( object.getCode() != null )
> -                {
> -                    object.setName( object.getCode() );
> -                }
> -            }
> -        }
> -
> -        else if ( displayProperty.equals(
> DisplayPropertyManager.DISPLAY_PROPERTY_ALTERNATIVENAME ) )
> -        {
> -            for ( IdentifiableObject object : list )
> -            {
> -                if ( object.getAlternativeName() != null )
> -                {
> -                    object.setName( object.getAlternativeName() );
> -                }
> -            }
> +        for ( IdentifiableObject object : list )
> +        {
> +            handle( object );
>         }
>
>         return list;
> @@ -101,8 +74,7 @@
>             {
>                 object.setName( object.getCode() );
>             }
> -        }
> -
> +        }
>         else if ( displayProperty.equals(
> DisplayPropertyManager.DISPLAY_PROPERTY_ALTERNATIVENAME ) )
>         {
>             if ( object.getAlternativeName() != null )
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>

References