dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35664
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18249: minor fixes
------------------------------------------------------------
revno: 18249
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-02-13 14:14:23 +0700
message:
minor fixes
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/TranslationSchemaDescriptor.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/Translation.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.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/descriptors/TranslationSchemaDescriptor.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/TranslationSchemaDescriptor.java 2015-02-13 06:16:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/TranslationSchemaDescriptor.java 2015-02-13 07:14:23 +0000
@@ -28,9 +28,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.hisp.dhis.constant.Constant;
import org.hisp.dhis.schema.Schema;
import org.hisp.dhis.schema.SchemaDescriptor;
+import org.hisp.dhis.translation.Translation;
import org.springframework.stereotype.Component;
/**
@@ -48,7 +48,7 @@
@Override
public Schema getSchema()
{
- Schema schema = new Schema( Constant.class, SINGULAR, PLURAL );
+ Schema schema = new Schema( Translation.class, SINGULAR, PLURAL );
schema.setApiEndpoint( API_ENDPOINT );
schema.setOrder( 3000 );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/Translation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/Translation.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/Translation.java 2015-02-13 07:14:23 +0000
@@ -35,6 +35,8 @@
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.DxfNamespaces;
+import java.util.Objects;
+
/**
* @author Oyvind Brucker
*/
@@ -58,7 +60,7 @@
public Translation()
{
- setAutoFields();
+ setAutoFields();
}
public Translation( String className, String locale, String property, String value, String objectUid )
@@ -132,10 +134,6 @@
this.value = value;
}
- // -------------------------------------------------------------------------
- // hashCode, equals and toString
- // -------------------------------------------------------------------------
-
@JsonProperty
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getObjectUid()
@@ -148,47 +146,53 @@
this.objectUid = objectUid;
}
+ // -------------------------------------------------------------------------
+ // hashCode, equals and toString
+ // -------------------------------------------------------------------------
+
@Override
public int hashCode()
{
- final int prime = 31;
- int result = 1;
-
- result = result * prime + className.hashCode();
- result = result * prime + objectUid.hashCode();
- result = result * prime + locale.hashCode();
- result = result * prime + property.hashCode();
-
- return result;
+ return 31 * super.hashCode() + Objects.hash( objectUid, className, locale, property, value );
}
@Override
- public boolean equals( Object o )
+ public boolean equals( Object obj )
{
- if ( this == o )
+ if ( this == obj )
{
return true;
}
-
- if ( o == null )
- {
- return false;
- }
-
- if ( !( o instanceof Translation ) )
- {
- return false;
- }
-
- Translation translation = (Translation) o;
-
- return className.equals( translation.getClassName() ) && objectUid == translation.getObjectUid() &&
- locale.equals( translation.getLocale() ) && property.equals( translation.getProperty());
+ if ( obj == null || getClass() != obj.getClass() )
+ {
+ return false;
+ }
+ if ( !super.equals( obj ) )
+ {
+ return false;
+ }
+
+ final Translation other = (Translation) obj;
+
+ return Objects.equals( this.objectUid, other.objectUid )
+ && Objects.equals( this.className, other.className )
+ && Objects.equals( this.locale, other.locale )
+ && Objects.equals( this.property, other.property )
+ && Objects.equals( this.value, other.value );
}
@Override
public String toString()
{
- return "[Class name: " + className + " objectUid: " + objectUid + " uid: " + uid + " locale: " + locale + " property: " + property + " value: " + value + "]";
+ final StringBuilder sb = new StringBuilder( "Translation{" );
+
+ sb.append( "objectUid='" ).append( objectUid ).append( '\'' );
+ sb.append( ", className='" ).append( className ).append( '\'' );
+ sb.append( ", locale='" ).append( locale ).append( '\'' );
+ sb.append( ", property='" ).append( property ).append( '\'' );
+ sb.append( ", value='" ).append( value ).append( '\'' );
+ sb.append( '}' );
+
+ return sb.toString();
}
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java 2015-02-13 07:14:23 +0000
@@ -87,6 +87,7 @@
import org.hisp.dhis.trackedentity.TrackedEntity;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup;
+import org.hisp.dhis.translation.Translation;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserAuthorityGroup;
import org.hisp.dhis.user.UserGroup;
@@ -228,6 +229,8 @@
private List<TrackedEntityAttributeGroup> trackedEntityAttributeGroups = new ArrayList<>();
+ private List<Translation> translations = new ArrayList<>();
+
public MetaData()
{
}
@@ -999,6 +1002,19 @@
}
@JsonProperty
+ @JacksonXmlElementWrapper( localName = "translations", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlProperty( localName = "translation", namespace = DxfNamespaces.DXF_2_0 )
+ public List<Translation> getTranslations()
+ {
+ return translations;
+ }
+
+ public void setTranslations( List<Translation> translations )
+ {
+ this.translations = translations;
+ }
+
+ @JsonProperty
@JacksonXmlElementWrapper( localName = "dimensions", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "dimension", namespace = DxfNamespaces.DXF_2_0 )
public List<DimensionalObject> getDimensions()