← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18786: minor fixes

 

------------------------------------------------------------
revno: 18786
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-03-31 22:04:51 +0700
message:
  minor fixes
removed:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ProgramStageSectionController.java
added:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramStageSectionController.java
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/descriptors/ProgramStageSectionSchemaDescriptor.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityInstance.hbm.xml


--
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	2015-03-31 06:22:06 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Property.java	2015-03-31 15:04:51 +0000
@@ -33,7 +33,6 @@
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
 import org.hisp.dhis.common.DxfNamespaces;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.NameableObject;
@@ -41,6 +40,7 @@
 
 import java.lang.reflect.Method;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -658,8 +658,9 @@
     @Override
     public int hashCode()
     {
-        return Objects.hashCode( klass, itemKlass, getterMethod, name, fieldName, persisted, collectionName, description,
-            namespace, attribute, simple, collection, identifiableObject, nameableObject );
+        return Objects.hash( klass, propertyType, itemKlass, itemPropertyType, getterMethod, setterMethod, name, fieldName, persisted, collectionName,
+            collectionWrapping, description, namespace, attribute, simple, collection, owner, identifiableObject, nameableObject, readable, writable,
+            unique, required, length, max, min, cascade, manyToMany, oneToOne, manyToOne, owningRole, inverseRole, constants );
     }
 
     @Override
@@ -669,6 +670,7 @@
         {
             return true;
         }
+
         if ( obj == null || getClass() != obj.getClass() )
         {
             return false;
@@ -676,15 +678,39 @@
 
         final Property other = (Property) obj;
 
-        return Objects.equal( this.klass, other.klass ) && Objects.equal( this.itemKlass, other.itemKlass )
-            && Objects.equal( this.propertyType, other.propertyType ) && Objects.equal( this.itemPropertyType, other.itemPropertyType )
-            && Objects.equal( this.getterMethod, other.getterMethod ) && Objects.equal( this.setterMethod, other.setterMethod )
-            && Objects.equal( this.name, other.name ) && Objects.equal( this.fieldName, other.fieldName )
-            && Objects.equal( this.persisted, other.persisted ) && Objects.equal( this.collectionName, other.collectionName )
-            && Objects.equal( this.description, other.description ) && Objects.equal( this.namespace, other.namespace )
-            && Objects.equal( this.attribute, other.attribute ) && Objects.equal( this.simple, other.simple )
-            && Objects.equal( this.collection, other.collection ) && Objects.equal( this.identifiableObject, other.identifiableObject )
-            && Objects.equal( this.nameableObject, other.nameableObject );
+        return Objects.equals( this.klass, other.klass )
+            && Objects.equals( this.propertyType, other.propertyType )
+            && Objects.equals( this.itemKlass, other.itemKlass )
+            && Objects.equals( this.itemPropertyType, other.itemPropertyType )
+            && Objects.equals( this.getterMethod, other.getterMethod )
+            && Objects.equals( this.setterMethod, other.setterMethod )
+            && Objects.equals( this.name, other.name )
+            && Objects.equals( this.fieldName, other.fieldName )
+            && Objects.equals( this.persisted, other.persisted )
+            && Objects.equals( this.collectionName, other.collectionName )
+            && Objects.equals( this.collectionWrapping, other.collectionWrapping )
+            && Objects.equals( this.description, other.description )
+            && Objects.equals( this.namespace, other.namespace )
+            && Objects.equals( this.attribute, other.attribute )
+            && Objects.equals( this.simple, other.simple )
+            && Objects.equals( this.collection, other.collection )
+            && Objects.equals( this.owner, other.owner )
+            && Objects.equals( this.identifiableObject, other.identifiableObject )
+            && Objects.equals( this.nameableObject, other.nameableObject )
+            && Objects.equals( this.readable, other.readable )
+            && Objects.equals( this.writable, other.writable )
+            && Objects.equals( this.unique, other.unique )
+            && Objects.equals( this.required, other.required )
+            && Objects.equals( this.length, other.length )
+            && Objects.equals( this.max, other.max )
+            && Objects.equals( this.min, other.min )
+            && Objects.equals( this.cascade, other.cascade )
+            && Objects.equals( this.manyToMany, other.manyToMany )
+            && Objects.equals( this.oneToOne, other.oneToOne )
+            && Objects.equals( this.manyToOne, other.manyToOne )
+            && Objects.equals( this.owningRole, other.owningRole )
+            && Objects.equals( this.inverseRole, other.inverseRole )
+            && Objects.equals( this.constants, other.constants );
     }
 
     @Override
@@ -696,17 +722,34 @@
             .add( "itemKlass", itemKlass )
             .add( "itemPropertyType", itemPropertyType )
             .add( "getterMethod", getterMethod )
+            .add( "setterMethod", setterMethod )
             .add( "name", name )
             .add( "fieldName", fieldName )
             .add( "persisted", persisted )
             .add( "collectionName", collectionName )
+            .add( "collectionWrapping", collectionWrapping )
             .add( "description", description )
             .add( "namespace", namespace )
             .add( "attribute", attribute )
             .add( "simple", simple )
             .add( "collection", collection )
+            .add( "owner", owner )
             .add( "identifiableObject", identifiableObject )
             .add( "nameableObject", nameableObject )
+            .add( "readable", readable )
+            .add( "writable", writable )
+            .add( "unique", unique )
+            .add( "required", required )
+            .add( "length", length )
+            .add( "max", max )
+            .add( "min", min )
+            .add( "cascade", cascade )
+            .add( "manyToMany", manyToMany )
+            .add( "oneToOne", oneToOne )
+            .add( "manyToOne", manyToOne )
+            .add( "owningRole", owningRole )
+            .add( "inverseRole", inverseRole )
+            .add( "constants", constants )
             .toString();
     }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/ProgramStageSectionSchemaDescriptor.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/ProgramStageSectionSchemaDescriptor.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/ProgramStageSectionSchemaDescriptor.java	2015-03-31 15:04:51 +0000
@@ -49,6 +49,7 @@
     public Schema getSchema()
     {
         Schema schema = new Schema( ProgramStageSection.class, SINGULAR, PLURAL );
+        schema.setApiEndpoint( API_ENDPOINT );
         schema.setOrder( 1511 );
 
         return schema;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java	2015-03-31 06:22:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java	2015-03-31 15:04:51 +0000
@@ -42,6 +42,7 @@
 import org.hibernate.type.CollectionType;
 import org.hibernate.type.ManyToOneType;
 import org.hibernate.type.OneToOneType;
+import org.hibernate.type.SetType;
 import org.hibernate.type.SingleColumnType;
 import org.hibernate.type.TextType;
 import org.hibernate.type.Type;
@@ -150,6 +151,14 @@
 
                 joinTableToRoles.get( associatedJoinable.getTableName() ).add( collection.getRole() );
             }
+            else if ( collection.isInverse() )
+            {
+                if ( SetType.class.isInstance( collection.getType() ) )
+                {
+                    SetType setType = (SetType) collection.getType();
+                    Joinable joinable = setType.getAssociatedJoinable( sessionFactoryImplementor );
+                }
+            }
         }
 
         Iterator<Map.Entry<String, List<String>>> entryIterator = joinTableToRoles.entrySet().iterator();
@@ -244,6 +253,15 @@
             if ( ManyToOneType.class.isInstance( type ) )
             {
                 property.setManyToOne( true );
+
+                if ( property.isOwner() )
+                {
+                    property.setOwningRole( klass.getName() + "." + property.getName() );
+                }
+                else
+                {
+                    property.setInverseRole( klass.getName() + "." + property.getName() );
+                }
             }
             else if ( OneToOneType.class.isInstance( type ) )
             {

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityInstance.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityInstance.hbm.xml	2014-04-08 15:34:26 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityInstance.hbm.xml	2015-03-31 15:04:51 +0000
@@ -11,25 +11,25 @@
       <generator class="native" />
     </id>
     &identifiableProperties;
-    
+
     <set name="attributeValues" inverse="true">
       <key column="trackedentityinstanceid" />
       <one-to-many class="org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue" />
     </set>
-    
+
     <set name="programInstances">
       <key column="trackedentityinstanceid" />
       <one-to-many class="org.hisp.dhis.program.ProgramInstance" />
     </set>
-    
+
     <many-to-one name="representative" class="org.hisp.dhis.trackedentity.TrackedEntityInstance" column="representativeid"
       foreign-key="fk_trackedentityinstance_representativeid" />
 
     <many-to-one name="organisationUnit" class="org.hisp.dhis.organisationunit.OrganisationUnit" column="organisationunitid"
       foreign-key="fk_trackedentityinstance_organisationunitid" not-null="true" />
-	
-	<many-to-one name="trackedEntity" class="org.hisp.dhis.trackedentity.TrackedEntity" 
-	   column="trackedentityid" foreign-key="fk_trackedentityinstance_trackedentityid" />
-	
+
+    <many-to-one name="trackedEntity" class="org.hisp.dhis.trackedentity.TrackedEntity"
+      column="trackedentityid" foreign-key="fk_trackedentityinstance_trackedentityid" />
+
   </class>
 </hibernate-mapping>

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ProgramStageSectionController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ProgramStageSectionController.java	2015-02-16 07:04:07 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ProgramStageSectionController.java	1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
-/**
- * 
- */
-package org.hisp.dhis.webapi.controller;
-
-/*
- * Copyright (c) 2004-2015, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.program.ProgramStageSection;
-import org.hisp.dhis.schema.descriptors.ProgramStageSectionSchemaDescriptor;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-/**
- * @author Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
- */
-@Controller
-@RequestMapping( value = ProgramStageSectionSchemaDescriptor.API_ENDPOINT )
-public class ProgramStageSectionController
-    extends AbstractCrudController<ProgramStageSection>
-{
-}
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramStageSectionController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramStageSectionController.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramStageSectionController.java	2015-03-31 15:04:51 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.webapi.controller.event;
+
+/*
+ * Copyright (c) 2004-2015, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.schema.descriptors.ProgramStageSectionSchemaDescriptor;
+import org.hisp.dhis.webapi.controller.AbstractCrudController;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Controller
+@RequestMapping( value = ProgramStageSectionSchemaDescriptor.API_ENDPOINT )
+public class ProgramStageSectionController
+    extends AbstractCrudController<ProgramStageSection>
+{
+}