dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12436
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3831: Reverted r 3827, 3828, 3829
------------------------------------------------------------
revno: 3831
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-06-02 10:44:31 +0200
message:
Reverted r 3827, 3828, 3829
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/hibernate/
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/hibernate/HibernateDataDictionaryStore.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/DefaultDataDictionaryService.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListAction.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/datadictionary/DataDictionaryService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryService.java 2011-06-02 03:22:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryService.java 2011-06-02 08:44:31 +0000
@@ -30,7 +30,6 @@
import java.util.Collection;
import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.indicator.Indicator;
/**
* @author Lars Helge Overland
@@ -98,12 +97,6 @@
*/
Collection<DataElement> getDataElementsByDictionaryId( int dictionaryId );
- Collection<DataElement> getDataElementsByDictionaryId( String key, int dictionaryId );
-
- Collection<Indicator> getIndicatorsByDictionaryId( int dictionaryId );
-
- Collection<Indicator> getIndicatorsByDictionaryId( String key, int dictionaryId );
-
Collection<DataDictionary> getDataDictionarysBetween( int first, int max );
Collection<DataDictionary> getDataDictionarysBetweenByName( String name, int first, int max );
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryStore.java 2011-06-02 03:22:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryStore.java 1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2004-2009, 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.
- */
-
-package org.hisp.dhis.datadictionary;
-
-import java.util.Collection;
-
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.indicator.Indicator;
-
-/**
- * @author Chau Thu Tran
- * @version $ DataDictionaryStore.java Jun 1, 2011 2:23:14 PM $
- *
- */
-public interface DataDictionaryStore
- extends GenericIdentifiableObjectStore<DataDictionary>
-{
- Collection<DataElement> getDataElements( String key, int dictionaryId );
-
- Collection<Indicator> getIndicators( String key, int dictionaryId );
-}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/DefaultDataDictionaryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/DefaultDataDictionaryService.java 2011-06-02 03:22:21 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/DefaultDataDictionaryService.java 2011-06-02 08:44:31 +0000
@@ -31,9 +31,9 @@
import java.util.Collection;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.i18n.I18nService;
-import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.system.util.Filter;
import org.hisp.dhis.system.util.FilterUtils;
import org.springframework.transaction.annotation.Transactional;
@@ -50,9 +50,9 @@
// Dependencies
// -------------------------------------------------------------------------
- private DataDictionaryStore dataDictionaryStore;
+ private GenericIdentifiableObjectStore<DataDictionary> dataDictionaryStore;
- public void setDataDictionaryStore( DataDictionaryStore dataDictionaryStore )
+ public void setDataDictionaryStore( GenericIdentifiableObjectStore<DataDictionary> dataDictionaryStore )
{
this.dataDictionaryStore = dataDictionaryStore;
}
@@ -111,21 +111,6 @@
return i18n( i18nService, dataDictionaryStore.get( dictionaryId ).getDataElements() );
}
- public Collection<DataElement> getDataElementsByDictionaryId( String key, int dictionaryId )
- {
- return i18n( i18nService, dataDictionaryStore.getDataElements( key, dictionaryId ) );
- }
-
- public Collection<Indicator> getIndicatorsByDictionaryId( int dictionaryId )
- {
- return i18n( i18nService, dataDictionaryStore.get( dictionaryId ).getIndicators() );
- }
-
- public Collection<Indicator> getIndicatorsByDictionaryId( String key, int dictionaryId )
- {
- return i18n( i18nService, dataDictionaryStore.getIndicators( key, dictionaryId ) );
- }
-
public int getDataDictionaryCount()
{
return dataDictionaryStore.getCount();
=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/hibernate'
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/hibernate/HibernateDataDictionaryStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/hibernate/HibernateDataDictionaryStore.java 2011-06-02 03:22:21 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/hibernate/HibernateDataDictionaryStore.java 1970-01-01 00:00:00 +0000
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2004-2009, 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.
- */
-
-package org.hisp.dhis.datadictionary.hibernate;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.hibernate.criterion.Order;
-import org.hibernate.criterion.Restrictions;
-import org.hibernate.transform.Transformers;
-import org.hisp.dhis.datadictionary.DataDictionary;
-import org.hisp.dhis.datadictionary.DataDictionaryStore;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.hibernate.HibernateGenericStore;
-import org.hisp.dhis.indicator.Indicator;
-
-/**
- * @author Chau Thu Tran
- * @version $ HibernateDataDictionaryStore.java Jun 1, 2011 2:24:46 PM $
- *
- */
-public class HibernateDataDictionaryStore
- extends HibernateGenericStore<DataDictionary>
- implements DataDictionaryStore
-{
-
- @SuppressWarnings( "unchecked" )
- public Collection<DataElement> getDataElements( String key, int dictionaryId )
- {
- List<Map> results = getCriteria().createAlias( "dataElements", "dataElement" ).add(
- Restrictions.ilike( "dataElement.name", "%" + key + "%" ) ).add( Restrictions.eq( "id", dictionaryId ) )
- .addOrder( Order.asc( "dataElement.name" ) ).setResultTransformer( Transformers.ALIAS_TO_ENTITY_MAP )
- .list();
-
- Set<DataElement> dataElements = new HashSet<DataElement>();
- for ( Map<String, Object> map : results )
- {
- dataElements.add( (DataElement) map.get( "dataElement" ) );
- }
-
- return dataElements;
- }
-
- @SuppressWarnings( "unchecked" )
- public Collection<Indicator> getIndicators( String key, int dictionaryId )
- {
- List<Map> results = getCriteria().createAlias( "indicators", "indicator" ).add(
- Restrictions.ilike( "indicator.name", "%" + key + "%" ) ).add( Restrictions.eq( "id", dictionaryId ) )
- .addOrder( Order.asc( "indicator.name" ) ).setResultTransformer( Transformers.ALIAS_TO_ENTITY_MAP ).list();
-
- Set<Indicator> indicators = new HashSet<Indicator>();
- for ( Map<String, Object> map : results )
- {
- indicators.add( (Indicator) map.get( "indicator" ) );
- }
-
- return indicators;
- }
-
-}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-06-02 03:22:21 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-06-02 08:44:31 +0000
@@ -42,7 +42,7 @@
<property name="cacheable" value="true"/>
</bean>
- <bean id="org.hisp.dhis.datadictionary.DataDictionaryStore" class="org.hisp.dhis.datadictionary.hibernate.HibernateDataDictionaryStore">
+ <bean id="org.hisp.dhis.datadictionary.DataDictionaryStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
<property name="clazz" value="org.hisp.dhis.datadictionary.DataDictionary" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true"/>
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-06-02 03:07:52 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-06-02 08:44:31 +0000
@@ -302,7 +302,7 @@
{
var key = event.keyCode || event.charCode || event.which;
- var focusField = ( key == 13 || key == 40 ) ? getNextEntryField( field ) : ( ( key == 38 ) ? getPreviousEntryField( field ) : false );
+ var focusField = ( key == 13 || key == 40 ) ? getNextEntryField( field ) : ( key == 38 ) ? getPreviousEntryField( field ) : false;
if ( focusField )
{
@@ -314,39 +314,32 @@
function getNextEntryField( field )
{
- if ( field )
- {
- var index = field.getAttribute( 'tabindex' );
- field = $('input[tabindex="'+(++index)+'"]');
-
- while ( field )
- {
- if ( field.is(':disabled') || field.is(':hidden') )
- {
- field = $('input[tabindex="'+(++index)+'"]');
- }
- else return field;
- }
- }
+ var fields = $('input[name="entryfield"]');
+
+ var index = field.tabIndex;
+
+ while (fields[index]) {
+ if (!fields[index].disabled) {
+ return fields[index];
+ }
+ index++;
+ }
}
function getPreviousEntryField( field )
{
- if ( field )
- {
- var index = field.getAttribute( 'tabindex' );
- field = $('input[tabindex="'+(--index)+'"]');
-
- while ( field )
- {
- if ( field.is(':disabled') || field.is(':hidden') )
- {
- field = $('input[tabindex="'+(--index)+'"]');
- }
- else return field;
- }
- }
+ var fields = $('input[name="entryfield"]');
+
+ var index = field.tabIndex - 2;
+
+ while (fields[index]) {
+ if (!fields[index].disabled) {
+ return fields[index];
+ }
+ index--;
+ }
}
+
// -----------------------------------------------------------------------------
// Data completeness
// -----------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java 2011-06-02 03:22:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java 2011-06-02 08:44:31 +0000
@@ -138,7 +138,7 @@
}
private String key;
-
+
public String getKey()
{
return key;
@@ -165,8 +165,7 @@
dataDictionaryId = null;
}
- else
- // Specified, set current data dictionary
+ else // Specified, set current data dictionary
{
dataDictionaryModeManager.setCurrentDataDictionary( dataDictionaryId );
}
@@ -181,41 +180,23 @@
if ( isNotBlank( key ) ) // Filter on key only if set
{
- if ( dataDictionaryId == null )
- {
- this.paging = createPaging( dataElementService.getDataElementCountByName( key ) );
-
- dataElements = new ArrayList<DataElement>( dataElementService.getDataElementsBetweenByName( key, paging
- .getStartPos(), paging.getPageSize() ) );
- }
- else
- {
- dataElements = new ArrayList<DataElement>( dataDictionaryService.getDataElementsByDictionaryId( key,
- dataDictionaryId ) );
-
- this.paging = createPaging( dataElements.size() );
-
- if ( dataElements.size() > 0 )
- {
- dataElements = getBlockElement( dataElements, paging.getStartPos(), paging.getEndPos() );
- }
- }
+ this.paging = createPaging( dataElementService.getDataElementCountByName( key ) );
+
+ dataElements = new ArrayList<DataElement>( dataElementService.getDataElementsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
}
else if ( dataDictionaryId != null )
{
- dataElements = new ArrayList<DataElement>( dataDictionaryService
- .getDataElementsByDictionaryId( dataDictionaryId ) );
-
+ dataElements = new ArrayList<DataElement>( dataDictionaryService.getDataElementsByDictionaryId( dataDictionaryId ) );
+
this.paging = createPaging( dataElements.size() );
-
- dataElements = getBlockElement( dataElements, paging.getStartPos(), paging.getEndPos() );
+
+ dataElements = getBlockElement( dataElements, paging.getStartPos(), paging.getPageSize() );
}
else
{
this.paging = createPaging( dataElementService.getDataElementCount() );
-
- dataElements = new ArrayList<DataElement>( dataElementService.getDataElementsBetween( paging.getStartPos(),
- paging.getPageSize() ) );
+
+ dataElements = new ArrayList<DataElement>( dataElementService.getDataElementsBetween( paging.getStartPos(), paging.getPageSize() ) );
}
Collections.sort( dataElements, dataElementComparator );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListAction.java 2011-06-02 03:22:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListAction.java 2011-06-02 08:44:31 +0000
@@ -138,7 +138,7 @@
}
private String key;
-
+
public String getKey()
{
return key;
@@ -162,15 +162,14 @@
else if ( dataDictionaryId == -1 ) // All, reset current data dictionary
{
dataDictionaryModeManager.setCurrentDataDictionary( null );
-
+
dataDictionaryId = null;
}
- else
- // Specified, set current data dictionary
+ else // Specified, set current data dictionary
{
dataDictionaryModeManager.setCurrentDataDictionary( dataDictionaryId );
}
-
+
dataDictionaries = new ArrayList<DataDictionary>( dataDictionaryService.getAllDataDictionaries() );
Collections.sort( dataDictionaries, new DataDictionaryNameComparator() );
@@ -181,45 +180,25 @@
if ( isNotBlank( key ) ) // Filter on key only if set
{
- if ( dataDictionaryId == null )
- {
- this.paging = createPaging( indicatorService.getIndicatorCountByName( key ) );
-
- indicators = new ArrayList<Indicator>( indicatorService.getIndicatorsBetweenByName( key, paging
- .getStartPos(), paging.getPageSize() ) );
- }
- else
- {
- indicators = new ArrayList<Indicator>( dataDictionaryService.getIndicatorsByDictionaryId( key,
- dataDictionaryId ) );
-
- this.paging = createPaging( indicators.size() );
-
- if( indicators.size() > 0 )
- {
- indicators = getBlockElement( indicators, paging.getStartPos() , paging.getEndPos() );
- }
- }
+ this.paging = createPaging( indicatorService.getIndicatorCountByName( key ) );
+
+ indicators = new ArrayList<Indicator>( indicatorService.getIndicatorsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
}
else if ( dataDictionaryId != null )
{
- indicators = new ArrayList<Indicator>( dataDictionaryService.getIndicatorsByDictionaryId( dataDictionaryId ) );
-
+ indicators = new ArrayList<Indicator>( dataDictionaryService.getDataDictionary( dataDictionaryId ).getIndicators() );
+
this.paging = createPaging( indicators.size() );
-
- if ( indicators.size() > 0 )
- {
- indicators = getBlockElement( indicators, paging.getStartPos() , paging.getEndPos() );
- }
+
+ indicators = getBlockElement( indicators, paging.getStartPage(), paging.getEndPos() );
}
else
{
this.paging = createPaging( indicatorService.getIndicatorCount() );
-
- indicators = new ArrayList<Indicator>( indicatorService.getIndicatorsBetween( paging.getStartPos(), paging
- .getPageSize() ) );
+
+ indicators = new ArrayList<Indicator>( indicatorService.getIndicatorsBetween( paging.getStartPos(), paging.getPageSize() ) );
}
-
+
Collections.sort( indicators, indicatorComparator );
displayPropertyHandler.handle( indicators );