dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17467
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6959: minor fixes
------------------------------------------------------------
revno: 6959
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-05-16 11:54:13 +0200
message:
minor fixes
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.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/importers/DefaultIdentifiableObjectImporter.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.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/BaseNameableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java 2012-04-17 08:04:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java 2012-05-16 09:54:13 +0000
@@ -27,6 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
@@ -90,9 +91,6 @@
this.description = description;
}
- @JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
- @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public String getAlternativeName()
{
return alternativeName;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java 2012-05-14 20:24:22 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java 2012-05-16 09:54:13 +0000
@@ -100,8 +100,8 @@
/**
* Returns all objects that are equal to or newer than given date
*
- * @param lastUpdate Date to compare to
+ * @param lastUpdated Date to compare to
* @return All objects equal or newer than given date
*/
- List<T> getByLastUpdated(Date lastUpdate);
+ List<T> getByLastUpdated(Date lastUpdated);
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java 2012-05-13 16:59:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java 2012-05-16 09:54:13 +0000
@@ -31,6 +31,7 @@
import org.hisp.dhis.common.NameableObject.NameableProperty;
import java.util.Collection;
+import java.util.Date;
import java.util.Map;
/**
@@ -47,11 +48,17 @@
<T extends IdentifiableObject> T getByCode( Class<T> clazz, String code );
<T extends IdentifiableObject> T getByName( Class<T> clazz, String name );
-
+
<T extends IdentifiableObject> T search( Class<T> clazz, String query );
<T extends IdentifiableObject> Collection<T> getAll( Class<T> clazz );
+ <T extends IdentifiableObject> Collection<T> getBetween( Class<T> clazz, int first, int max );
+
+ <T extends IdentifiableObject> Collection<T> getBetweenByName( Class<T> clazz, String name, int first, int max );
+
+ <T extends IdentifiableObject> Collection<T> getByLastUpdated( Class<T> clazz, Date lastUpdated );
+
void delete( IdentifiableObject object );
<T extends IdentifiableObject> Map<String, T> getIdMap( Class<T> clazz, IdentifiableProperty property );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2012-05-08 17:24:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2012-05-16 09:54:13 +0000
@@ -576,7 +576,6 @@
this.parent = parent;
}
- @JsonIgnore
public String getAlternativeName()
{
return getShortName();
=== 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-05-14 20:24:22 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 2012-05-16 09:54:13 +0000
@@ -29,9 +29,14 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.hibernate.SessionFactory;
import org.hisp.dhis.cache.HibernateCacheManager;
import org.hisp.dhis.dxf2.importsummary.ImportConflict;
import org.hisp.dhis.dxf2.importsummary.ImportSummary;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
+import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.user.CurrentUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -68,6 +73,9 @@
@Autowired
private CurrentUserService currentUserService;
+ @Autowired
+ private SessionFactory sessionFactory;
+
//-------------------------------------------------------------------------------------------------------
// ImportService Implementation
//-------------------------------------------------------------------------------------------------------
=== 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 2012-05-14 20:24:22 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java 2012-05-16 09:54:13 +0000
@@ -34,7 +34,9 @@
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.common.NameableObject;
+import org.hisp.dhis.concept.Concept;
import org.hisp.dhis.constant.Constant;
+import org.hisp.dhis.datadictionary.DataDictionary;
import org.hisp.dhis.dataelement.*;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.document.Document;
@@ -117,16 +119,16 @@
registeredTypes.add( Document.class );
registeredTypes.add( Constant.class );
registeredTypes.add( Attribute.class );
- // registeredTypes.add( Concept.class );
+ registeredTypes.add( Concept.class );
registeredTypes.add( SqlView.class );
registeredTypes.add( Chart.class );
registeredTypes.add( Report.class );
registeredTypes.add( ReportTable.class );
- // registeredTypes.add( DataDictionary.class );
+ registeredTypes.add( DataDictionary.class );
- registeredTypes.add( User.class );
- registeredTypes.add( UserGroup.class );
- registeredTypes.add( UserAuthorityGroup.class );
+ // registeredTypes.add( User.class );
+ // registeredTypes.add( UserGroup.class );
+ // registeredTypes.add( UserAuthorityGroup.class );
registeredTypes.add( OrganisationUnitLevel.class );
registeredTypes.add( OrganisationUnit.class );
=== 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-05-08 17:24:42 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2012-05-16 09:54:13 +0000
@@ -42,6 +42,7 @@
import org.hisp.dhis.dxf2.utils.OrganisationUnitUtils;
import org.hisp.dhis.importexport.ImportStrategy;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitComparator;
import org.hisp.dhis.period.Period;
=== 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 2012-05-13 16:59:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java 2012-05-16 09:54:13 +0000
@@ -171,20 +171,20 @@
public <T extends IdentifiableObject> T search( Class<T> clazz, String query )
{
T object = get( clazz, query );
-
+
if ( object == null )
{
object = getByCode( clazz, query );
}
-
+
if ( object == null )
{
object = getByName( clazz, query );
}
-
+
return object;
}
-
+
@Override
@SuppressWarnings( "unchecked" )
public <T extends IdentifiableObject> Collection<T> getAll( Class<T> clazz )
@@ -203,6 +203,54 @@
@Override
@SuppressWarnings( "unchecked" )
+ public <T extends IdentifiableObject> Collection<T> getBetween( Class<T> clazz, int first, int max )
+ {
+ GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
+
+ if ( store == null )
+ {
+ log.warn( "No IdentifiableObject store found for " + clazz + ", returning empty collection (getBetween)." );
+
+ return new ArrayList<T>();
+ }
+
+ return (Collection<T>) store.getBetween( first, max );
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public <T extends IdentifiableObject> Collection<T> getBetweenByName( Class<T> clazz, String name, int first, int max )
+ {
+ GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
+
+ if ( store == null )
+ {
+ log.warn( "No IdentifiableObject store found for " + clazz + ", returning empty collection (getBetween)." );
+
+ return new ArrayList<T>();
+ }
+
+ return (Collection<T>) store.getBetweenByName( name, first, max );
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public <T extends IdentifiableObject> Collection<T> getByLastUpdated( Class<T> clazz, Date lastUpdated )
+ {
+ GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
+
+ if ( store == null )
+ {
+ log.warn( "No IdentifiableObject store found for " + clazz + ", returning empty collection (getBetween)." );
+
+ return new ArrayList<T>();
+ }
+
+ return (Collection<T>) store.getByLastUpdated( lastUpdated );
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
public <T extends IdentifiableObject> Map<String, T> getIdMap( Class<T> clazz, IdentifiableProperty property )
{
Map<String, T> map = new HashMap<String, T>();
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java 2012-05-07 16:32:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java 2012-05-16 09:54:13 +0000
@@ -27,6 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hibernate.SessionFactory;
import org.hisp.dhis.api.utils.ContextUtils;
import org.hisp.dhis.api.utils.ContextUtils.CacheStrategy;
import org.hisp.dhis.common.view.ExportView;