dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34348
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17633: for dynamic schemas that are not based on implementation, but rather on interfaces.. get real con...
------------------------------------------------------------
revno: 17633
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-12-01 14:31:16 +0700
message:
for dynamic schemas that are not based on implementation, but rather on interfaces.. get real concrete interface implementation, this is needed for proper scanning of schema information (annotations are only present on implementations)
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseDimensionalObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/PropertyIntrospectorService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.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/common/BaseDimensionalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseDimensionalObject.java 2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseDimensionalObject.java 2014-12-01 07:31:16 +0000
@@ -42,7 +42,7 @@
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-@JacksonXmlRootElement( localName = "dimensionalObject", namespace = DxfNamespaces.DXF_2_0 )
+@JacksonXmlRootElement( localName = "dimension", namespace = DxfNamespaces.DXF_2_0 )
public class BaseDimensionalObject
extends BaseNameableObject implements DimensionalObject
{
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java 2014-10-21 17:05:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java 2014-12-01 07:31:16 +0000
@@ -46,7 +46,7 @@
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
-public abstract class AbstractPropertyIntrospectorService
+public abstract class AbstractPropertyIntrospectorService
implements PropertyIntrospectorService
{
// simple alias map for our concrete implementations of the core interfaces.
@@ -81,6 +81,17 @@
return classMapCache.get( klass );
}
+ @Override
+ public Class<?> getConcreteClass( Class<?> klass )
+ {
+ if ( BASE_ALIAS_MAP.containsKey( klass ) )
+ {
+ return BASE_ALIAS_MAP.get( klass );
+ }
+
+ return klass;
+ }
+
/**
* Introspect a class and return a map with key=property-name, and value=Property class.
*
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/PropertyIntrospectorService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/PropertyIntrospectorService.java 2014-04-14 06:43:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/PropertyIntrospectorService.java 2014-12-01 07:31:16 +0000
@@ -51,4 +51,7 @@
* @return Map with key property-name and value Property
*/
Map<String, Property> getPropertiesMap( Class<?> klass );
+
+ // TODO should probably be moved out of PropertyIntrospectorService, useful other places also
+ Class<?> getConcreteClass( Class<?> klass );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.java 2014-09-30 07:02:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.java 2014-12-01 07:31:16 +0000
@@ -121,13 +121,14 @@
return schema;
}
- klass = ReflectionUtils.getRealClass( klass );
+ klass = propertyIntrospectorService.getConcreteClass( ReflectionUtils.getRealClass( klass ) );
String name = getName( klass );
schema = new Schema( klass, name, name + "s" );
schema.setDisplayName( beautify( schema.getName() ) );
schema.setPropertyMap( Maps.newHashMap( propertyIntrospectorService.getPropertiesMap( schema.getKlass() ) ) );
+ schema.setMetadata( false );
updateSelf( schema );
@@ -198,6 +199,7 @@
{
Property property = schema.getPropertyMap().get( "__self__" );
schema.setName( property.getName() );
+ schema.setCollectionName( schema.getPlural() );
schema.setNamespace( property.getNamespace() );
schema.getPropertyMap().remove( "__self__" );