dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21116
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9913: dxf2 import fixes
------------------------------------------------------------
revno: 9913
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-02-27 17:24:44 +0700
message:
dxf2 import fixes
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ObjectBridge.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java
dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.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/dataelement/DataElementGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2013-02-13 03:57:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2013-02-27 10:24:44 +0000
@@ -150,45 +150,6 @@
}
// -------------------------------------------------------------------------
- // hashCode and equals
- // -------------------------------------------------------------------------
-
- @Override
- public int hashCode()
- {
- return name.hashCode();
- }
-
- @Override
- public boolean equals( Object o )
- {
- if ( this == o )
- {
- return true;
- }
-
- if ( o == null )
- {
- return false;
- }
-
- if ( !(o instanceof DataElementGroup) )
- {
- return false;
- }
-
- final DataElementGroup other = (DataElementGroup) o;
-
- return name.equals( other.getName() );
- }
-
- @Override
- public String toString()
- {
- return "[" + name + "]";
- }
-
- // -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2013-02-25 12:33:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2013-02-27 10:24:44 +0000
@@ -213,16 +213,16 @@
// Logic
// -------------------------------------------------------------------------
- public void addOrganisationUnit( OrganisationUnit unit )
+ public void addOrganisationUnit( OrganisationUnit organisationUnit )
{
- sources.add( unit );
- unit.getDataSets().add( this );
+ sources.add( organisationUnit );
+ organisationUnit.getDataSets().add( this );
}
- public void removeOrganisationUnit( OrganisationUnit unit )
+ public void removeOrganisationUnit( OrganisationUnit organisationUnit )
{
- sources.remove( unit );
- unit.getDataSets().remove( this );
+ sources.remove( organisationUnit );
+ organisationUnit.getDataSets().remove( this );
}
public void removeAllOrganisationUnits()
@@ -379,9 +379,11 @@
this.periodType = periodType;
}
+ /*
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ */
public DataEntryForm getDataEntryForm()
{
return dataEntryForm;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java 2013-02-13 03:57:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java 2013-02-27 10:24:44 +0000
@@ -44,7 +44,7 @@
import java.util.List;
import java.util.Set;
-@JacksonXmlRootElement( localName = "section", namespace = DxfNamespaces.DXF_2_0)
+@JacksonXmlRootElement(localName = "section", namespace = DxfNamespaces.DXF_2_0)
public class Section
extends BaseIdentifiableObject
{
@@ -151,52 +151,13 @@
}
// -------------------------------------------------------------------------
- // hashCode, equals and toString
- // -------------------------------------------------------------------------
-
- @Override
- public int hashCode()
- {
- return name.hashCode();
- }
-
- @Override
- public boolean equals( Object object )
- {
- if ( this == object )
- {
- return true;
- }
-
- if ( object == null )
- {
- return false;
- }
-
- if ( getClass() != object.getClass() )
- {
- return false;
- }
-
- final Section other = (Section) object;
-
- return name.equals( other.getName() );
- }
-
- @Override
- public String toString()
- {
- return "[" + name + "]";
- }
-
- // -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
@JsonProperty
- @JsonSerialize( as = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class, ExportView.class} )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+ @JsonSerialize(as = BaseIdentifiableObject.class)
+ @JsonView({ DetailedView.class, ExportView.class })
+ @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
public DataSet getDataSet()
{
return dataSet;
@@ -208,10 +169,10 @@
}
@JsonProperty
- @JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class, ExportView.class} )
- @JacksonXmlElementWrapper( localName = "dataElements", namespace = DxfNamespaces.DXF_2_0)
- @JacksonXmlProperty( localName = "dataElement", namespace = DxfNamespaces.DXF_2_0)
+ @JsonSerialize(contentAs = BaseIdentifiableObject.class)
+ @JsonView({ DetailedView.class, ExportView.class })
+ @JacksonXmlElementWrapper(localName = "dataElements", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "dataElement", namespace = DxfNamespaces.DXF_2_0)
public List<DataElement> getDataElements()
{
return dataElements;
@@ -233,9 +194,9 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
- @JacksonXmlElementWrapper( localName = "greyedFields", namespace = DxfNamespaces.DXF_2_0)
- @JacksonXmlProperty( localName = "greyedField", namespace = DxfNamespaces.DXF_2_0)
+ @JsonView({ DetailedView.class, ExportView.class })
+ @JacksonXmlElementWrapper(localName = "greyedFields", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "greyedField", namespace = DxfNamespaces.DXF_2_0)
public Set<DataElementOperand> getGreyedFields()
{
return greyedFields;
@@ -255,7 +216,7 @@
{
Section section = (Section) other;
- dataSet = section.getDataSet();
+ dataSet = section.getDataSet() == null ? dataSet : section.getDataSet();
removeAllDataElements();
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 2012-12-06 09:06:40 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 2013-02-27 10:24:44 +0000
@@ -42,7 +42,13 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -57,7 +63,7 @@
// Dependencies
//-------------------------------------------------------------------------------------------------------
- @Autowired( required = false )
+ @Autowired(required = false)
private Set<Importer> importerClasses = new HashSet<Importer>();
@Autowired
@@ -117,6 +123,8 @@
log.info( "User '" + currentUserService.getCurrentUsername() + "' started import at " + new Date() );
}
+ long totalStartTime = System.nanoTime();
+
for ( Map.Entry<Class<? extends IdentifiableObject>, String> entry : ExchangeClasses.getImportMap().entrySet() )
{
Object value = ReflectionUtils.invokeGetterMethod( entry.getValue(), metaData );
@@ -140,7 +148,15 @@
log.info( message );
}
+ long startTime = System.nanoTime();
ImportTypeSummary importTypeSummary = doImport( objects, importOptions );
+ // TODO do we need this?
+ sessionFactory.getCurrentSession().flush();
+ long endTime = System.nanoTime();
+ long duration = endTime - startTime;
+ double seconds = (double) duration / 1000000000.0;
+
+ System.err.println( "Duration: " + seconds );
if ( importTypeSummary != null )
{
@@ -160,6 +176,12 @@
}
}
+ long endTime = System.nanoTime();
+ long duration = endTime - totalStartTime;
+ double seconds = (double) duration / 1000000000.0;
+
+ System.err.println( "Total Duration: " + seconds );
+
if ( importOptions.isDryRun() )
{
sessionFactory.getCurrentSession().clear();
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java 2013-02-22 05:43:28 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java 2013-02-27 10:24:44 +0000
@@ -75,6 +75,8 @@
private Map<Class<? extends IdentifiableObject>, Map<String, IdentifiableObject>> codeMap;
+ private Map<Class<? extends IdentifiableObject>, Map<String, IdentifiableObject>> nameMap;
+
private boolean writeEnabled = true;
//-------------------------------------------------------------------------------------------------------
@@ -100,6 +102,7 @@
periodTypeMap = new HashMap<String, PeriodType>();
uidMap = new HashMap<Class<? extends IdentifiableObject>, Map<String, IdentifiableObject>>();
codeMap = new HashMap<Class<? extends IdentifiableObject>, Map<String, IdentifiableObject>>();
+ nameMap = new HashMap<Class<? extends IdentifiableObject>, Map<String, IdentifiableObject>>();
for ( Class<?> type : registeredTypes )
{
@@ -107,6 +110,7 @@
populateIdentifiableObjectMap( type );
populateIdentifiableObjectMap( type, IdentifiableObject.IdentifiableProperty.UID );
populateIdentifiableObjectMap( type, IdentifiableObject.IdentifiableProperty.CODE );
+ populateIdentifiableObjectMap( type, IdentifiableObject.IdentifiableProperty.NAME );
}
log.info( "Finished updating lookup maps at " + new Date() );
@@ -118,6 +122,7 @@
masterMap = null;
uidMap = null;
codeMap = null;
+ nameMap = null;
periodTypeMap = null;
writeEnabled = true;
@@ -163,6 +168,24 @@
{
codeMap.put( (Class<? extends IdentifiableObject>) clazz, map );
}
+ else if ( property == IdentifiableObject.IdentifiableProperty.NAME )
+ {
+ try
+ {
+ IdentifiableObject identifiableObject = (IdentifiableObject) clazz.newInstance();
+
+ if ( identifiableObject.haveUniqueNames() )
+ {
+ nameMap.put( (Class<? extends IdentifiableObject>) clazz, map );
+ }
+ }
+ catch ( InstantiationException ignored )
+ {
+ }
+ catch ( IllegalAccessException ignored )
+ {
+ }
+ }
}
}
@@ -245,11 +268,13 @@
if ( objects.size() > 1 )
{
- log.debug( "Multiple objects found for " + objectName + ", object discarded, returning null." );
+ log.debug( "Multiple objects found for " +
+ (objectName == null ? objectName : "UNKNOWN_NAME (" + object.getClass().getName() + ")") + ", object discarded, returning null." );
}
else
{
- log.debug( "No object found for " + objectName + ", returning null." );
+ log.debug( "No object found for " +
+ (objectName == null ? objectName : "UNKNOWN_NAME (" + object.getClass().getName() + ")") + ", returning null." );
}
}
@@ -334,6 +359,16 @@
objects.add( (T) match );
}
}
+
+ if ( identifiableObject.haveUniqueNames() && identifiableObject.getName() != null )
+ {
+ IdentifiableObject match = getNameMatch( identifiableObject );
+
+ if ( match != null )
+ {
+ objects.add( (T) match );
+ }
+ }
}
return objects;
@@ -397,6 +432,18 @@
return null;
}
+ private IdentifiableObject getNameMatch( IdentifiableObject identifiableObject )
+ {
+ Map<String, IdentifiableObject> map = nameMap.get( identifiableObject.getClass() );
+
+ if ( map != null )
+ {
+ return map.get( identifiableObject.getName() );
+ }
+
+ return null;
+ }
+
private boolean _typeSupported( Class<?> clazz )
{
for ( Class<?> c : registeredTypes )
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java 2013-02-25 12:33:35 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java 2013-02-27 10:24:44 +0000
@@ -100,6 +100,10 @@
allExportClasses.put( OptionSet.class, "optionSets" );
allExportClasses.put( Attribute.class, "attributeTypes" );
+ allExportClasses.put( MapLegend.class, "mapLegends" );
+ allExportClasses.put( MapLegendSet.class, "mapLegendSets" );
+ allExportClasses.put( MapLayer.class, "mapLayers" );
+
allExportClasses.put( OrganisationUnit.class, "organisationUnits" );
allExportClasses.put( OrganisationUnitLevel.class, "organisationUnitLevels" );
allExportClasses.put( OrganisationUnitGroup.class, "organisationUnitGroups" );
@@ -131,11 +135,8 @@
allExportClasses.put( ValidationRule.class, "validationRules" );
allExportClasses.put( ValidationRuleGroup.class, "validationRuleGroups" );
+ allExportClasses.put( MapView.class, "mapViews" );
allExportClasses.put( org.hisp.dhis.mapping.Map.class, "maps" );
- allExportClasses.put( MapView.class, "mapViews" );
- allExportClasses.put( MapLegend.class, "mapLegends" );
- allExportClasses.put( MapLegendSet.class, "mapLegendSets" );
- allExportClasses.put( MapLayer.class, "mapLayers" );
allExportClasses.put( User.class, "users" );
allExportClasses.put( UserGroup.class, "userGroups" );
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ObjectBridge.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ObjectBridge.java 2012-04-22 16:16:24 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ObjectBridge.java 2013-02-27 10:24:44 +0000
@@ -75,7 +75,7 @@
<T> Collection<T> getObjects( T object );
/**
- * Get all objects for a specified class. These objects might not be a persisted object
+ * Get all objects for a specified class. These objects might not be persisted
* depending on the flag {@code writeEnabled}.
*
* @param clazz Clazz to match against
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2012-10-25 16:44:59 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2013-02-27 10:24:44 +0000
@@ -39,7 +39,12 @@
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataelement.DataElementOperandService;
import org.hisp.dhis.dxf2.importsummary.ImportConflict;
-import org.hisp.dhis.dxf2.metadata.*;
+import org.hisp.dhis.dxf2.metadata.ExchangeClasses;
+import org.hisp.dhis.dxf2.metadata.ImportOptions;
+import org.hisp.dhis.dxf2.metadata.ImportTypeSummary;
+import org.hisp.dhis.dxf2.metadata.ImportUtils;
+import org.hisp.dhis.dxf2.metadata.Importer;
+import org.hisp.dhis.dxf2.metadata.ObjectBridge;
import org.hisp.dhis.dxf2.metadata.handlers.ObjectHandler;
import org.hisp.dhis.dxf2.metadata.handlers.ObjectHandlerUtils;
import org.hisp.dhis.expression.Expression;
@@ -54,7 +59,12 @@
import org.springframework.beans.factory.annotation.Autowired;
import java.lang.reflect.Field;
-import java.util.*;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import static org.hisp.dhis.system.util.PredicateUtils.idObjectCollectionsWithScanned;
import static org.hisp.dhis.system.util.PredicateUtils.idObjects;
@@ -91,7 +101,7 @@
@Autowired
private SessionFactory sessionFactory;
- @Autowired( required = false )
+ @Autowired(required = false)
private List<ObjectHandler<T>> objectHandlers;
//-------------------------------------------------------------------------------------------------------
@@ -164,7 +174,7 @@
if ( expression != null )
{
- ReflectionUtils.invokeSetterMethod( fieldName, object, new Object[] { null } );
+ ReflectionUtils.invokeSetterMethod( fieldName, object, new Object[]{ null } );
}
}
@@ -344,9 +354,9 @@
if ( !options.isDryRun() )
{
- sessionFactory.getCurrentSession().flush();
+ // sessionFactory.getCurrentSession().flush();
nonIdentifiableObjects.save( object );
- sessionFactory.getCurrentSession().flush();
+ // sessionFactory.getCurrentSession().flush();
}
log.debug( "Save successful." );
@@ -380,13 +390,18 @@
log.debug( "Starting update of object " + ImportUtils.getDisplayName( persistedObject ) + " (" + persistedObject.getClass()
.getSimpleName() + ")" );
+ if ( persistedObject.getName().contains( "java" ) )
+ {
+ System.err.println( "clazz: " + persistedObject.getClass().getName() + ", persistedObject: " + persistedObject );
+ }
+
objectBridge.updateObject( persistedObject );
if ( !options.isDryRun() )
{
- sessionFactory.getCurrentSession().flush();
+ // sessionFactory.getCurrentSession().flush();
nonIdentifiableObjects.save( persistedObject );
- sessionFactory.getCurrentSession().flush();
+ //sessionFactory.getCurrentSession().flush();
}
log.debug( "Update successful." );
@@ -427,9 +442,7 @@
for ( T object : objects )
{
ObjectHandlerUtils.preObjectHandlers( object, objectHandlers );
-
importObjectLocal( object );
-
ObjectHandlerUtils.postObjectHandlers( object, objectHandlers );
}
@@ -634,7 +647,7 @@
if ( ref != null )
{
fieldMap.put( field, ref );
- ReflectionUtils.invokeSetterMethod( field.getName(), object, new Object[] { null } );
+ ReflectionUtils.invokeSetterMethod( field.getName(), object, new Object[]{ null } );
}
}
} );
=== modified file 'dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml 2012-12-14 13:46:47 +0000
+++ dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml 2013-02-27 10:24:44 +0000
@@ -106,6 +106,10 @@
<constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.indicator.IndicatorGroupSet" />
</bean>
+ <bean id="mapImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter">
+ <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.mapping.Map" />
+ </bean>
+
<bean id="mapViewImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter">
<constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.mapping.MapView" />
</bean>
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java 2013-01-14 21:35:56 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java 2013-02-27 10:24:44 +0000
@@ -37,7 +37,14 @@
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* @author Lars Helge Overland
@@ -50,7 +57,7 @@
@Autowired
private CurrentUserService currentUserService;
-
+
@Autowired
private Set<GenericIdentifiableObjectStore<IdentifiableObject>> identifiableObjectStores;
@@ -117,7 +124,7 @@
}
@Override
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
public <T extends IdentifiableObject> T get( Class<T> clazz, String uid )
{
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
@@ -131,7 +138,7 @@
}
@Override
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
public <T extends IdentifiableObject> T getByCode( Class<T> clazz, String code )
{
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
@@ -145,7 +152,7 @@
}
@Override
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
public <T extends IdentifiableObject> T getByName( Class<T> clazz, String name )
{
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
@@ -177,7 +184,7 @@
}
@Override
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
public <T extends IdentifiableObject> Collection<T> getAll( Class<T> clazz )
{
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
@@ -191,7 +198,7 @@
}
@Override
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
public <T extends IdentifiableObject> Collection<T> getAllSorted( Class<T> clazz )
{
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
@@ -205,7 +212,7 @@
}
@Override
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
public <T extends IdentifiableObject> Collection<T> getLikeName( Class<T> clazz, String name )
{
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
@@ -219,7 +226,7 @@
}
@Override
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
public <T extends IdentifiableObject> Collection<T> getBetween( Class<T> clazz, int first, int max )
{
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
@@ -233,7 +240,7 @@
}
@Override
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
public <T extends IdentifiableObject> Collection<T> getBetweenByName( Class<T> clazz, String name, int first, int max )
{
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
@@ -247,7 +254,7 @@
}
@Override
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
public <T extends IdentifiableObject> Collection<T> getByLastUpdated( Class<T> clazz, Date lastUpdated )
{
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
@@ -261,7 +268,7 @@
}
@Override
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
public <T extends IdentifiableObject> Collection<T> getByLastUpdatedSorted( Class<T> clazz, Date lastUpdated )
{
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
@@ -278,24 +285,24 @@
public <T extends IdentifiableObject> Set<Integer> convertToId( Class<T> clazz, Collection<String> uids )
{
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
-
+
Set<Integer> ids = new HashSet<Integer>();
-
+
for ( String uid : uids )
{
IdentifiableObject object = store.getByUid( uid );
-
+
if ( object != null )
{
ids.add( object.getId() );
}
}
-
+
return ids;
}
-
+
@Override
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
public <T extends IdentifiableObject> Map<String, T> getIdMap( Class<T> clazz, IdentifiableProperty property )
{
Map<String, T> map = new HashMap<String, T>();
@@ -345,7 +352,7 @@
}
@Override
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
public <T extends NameableObject> Map<String, T> getIdMap( Class<T> clazz, NameableProperty property )
{
Map<String, T> map = new HashMap<String, T>();
@@ -369,7 +376,7 @@
}
@Override
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
public <T extends IdentifiableObject> T getObject( Class<T> clazz, IdentifiableProperty property, String id )
{
GenericIdentifiableObjectStore<T> store = (GenericIdentifiableObjectStore<T>) getIdentifiableObjectStore( clazz );
@@ -447,9 +454,12 @@
if ( store == null )
{
- log.warn( "No IdentifiableObjectStore found for class: " + clazz );
-
store = identifiableObjectStoreMap.get( clazz.getSuperclass() );
+
+ if ( store == null )
+ {
+ log.warn( "No IdentifiableObjectStore found for class: " + clazz );
+ }
}
return store;
@@ -461,9 +471,12 @@
if ( store == null )
{
- log.warn( "No NameableObjectStore found for class: " + clazz );
-
store = nameableObjectStoreMap.get( clazz.getSuperclass() );
+
+ if ( store == null )
+ {
+ log.warn( "No NameableObjectStore found for class: " + clazz );
+ }
}
return store;
@@ -478,7 +491,7 @@
public <T extends IdentifiableObject> List<T> getAllAccessible( Class<T> clazz )
{
User user = currentUserService.getCurrentUser();
-
+
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
if ( user == null || store == null )
@@ -494,7 +507,7 @@
public <T extends IdentifiableObject> List<T> getAccessibleLikeName( Class<T> clazz, String name )
{
User user = currentUserService.getCurrentUser();
-
+
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
if ( user == null || store == null )
@@ -510,7 +523,7 @@
public <T extends IdentifiableObject> List<T> getAccessibleBetween( Class<T> clazz, int first, int max )
{
User user = currentUserService.getCurrentUser();
-
+
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
if ( user == null || store == null )
@@ -526,7 +539,7 @@
public <T extends IdentifiableObject> List<T> getAccessibleBetweenLikeName( Class<T> clazz, String name, int first, int max )
{
User user = currentUserService.getCurrentUser();
-
+
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
if ( user == null || store == null )
@@ -542,7 +555,7 @@
public <T extends IdentifiableObject> List<T> getAccessibleByLastUpdated( Class<T> clazz, Date lastUpdated )
{
User user = currentUserService.getCurrentUser();
-
+
GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
if ( store == null )