dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #05753
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1816: Fixed bug <https://bugs.launchpad.net/dhis2/+bug/545729>
------------------------------------------------------------
revno: 1816
committer: hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-05-04 13:47:28 +0700
message:
Fixed bug <https://bugs.launchpad.net/dhis2/+bug/545729>
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.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/java/org/hisp/dhis/dataelement/DefaultDataElementService.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/I18nManagerException.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.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 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryService.java 2010-05-04 06:47:28 +0000
@@ -29,6 +29,8 @@
import java.util.Collection;
+import org.hisp.dhis.dataelement.DataElement;
+
/**
* @author Lars Helge Overland
* @version $Id$
@@ -86,4 +88,12 @@
* @return a collection of DataDictionaries.
*/
Collection<DataDictionary> getAllDataDictionaries();
+
+ /**
+ * Returns data elements with identifier in the given id.
+ *
+ * @param dictionaryId is the id of data dictionary.
+ * @return data elements with identifier in the given id.
+ */
+ Collection<DataElement> getDataElementsByDictionaryId( int dictionaryId );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2010-05-04 06:47:28 +0000
@@ -435,6 +435,15 @@
*/
Collection<DataElementGroup> getGroupsContainingDataElement( DataElement dataElement );
+
+ /**
+ * Returns data elements with identifier in the given id.
+ *
+ * @param groupId is the id of data element group.
+ * @return data elements with identifier in the given id.
+ */
+ Collection<DataElement> getDataElementsByGroupId( int groupId );
+
/**
* Return void
*
=== 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 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/DefaultDataDictionaryService.java 2010-05-04 06:47:28 +0000
@@ -27,9 +27,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
+
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.system.util.Filter;
import org.hisp.dhis.system.util.FilterUtils;
import org.springframework.transaction.annotation.Transactional;
@@ -47,51 +51,63 @@
// -------------------------------------------------------------------------
private GenericIdentifiableObjectStore<DataDictionary> dataDictionaryStore;
-
+
public void setDataDictionaryStore( GenericIdentifiableObjectStore<DataDictionary> dataDictionaryStore )
{
this.dataDictionaryStore = dataDictionaryStore;
}
+ private I18nService i18nService;
+
+ public void setI18nService( I18nService service )
+ {
+ i18nService = service;
+ }
+
// -------------------------------------------------------------------------
// DataDictionary
// -------------------------------------------------------------------------
public int saveDataDictionary( DataDictionary dataDictionary )
- {
- return dataDictionaryStore.save( dataDictionary );
+ {
+ return dataDictionaryStore.save( dataDictionary );
}
-
+
public DataDictionary getDataDictionary( int id )
{
- return dataDictionaryStore.get( id );
+ return i18n( i18nService, dataDictionaryStore.get( id ) );
}
-
+
public Collection<DataDictionary> getDataDictionaries( final Collection<Integer> identifiers )
{
Collection<DataDictionary> dictionaries = getAllDataDictionaries();
-
+
return identifiers == null ? dictionaries : FilterUtils.filter( dictionaries, new Filter<DataDictionary>()
+ {
+ public boolean retain( DataDictionary object )
{
- public boolean retain( DataDictionary object )
- {
- return identifiers.contains( object.getId() );
- }
- } );
+ return identifiers.contains( object.getId() );
+ }
+ } );
}
-
+
public void deleteDataDictionary( DataDictionary dataDictionary )
{
dataDictionaryStore.delete( dataDictionary );
}
-
+
public DataDictionary getDataDictionaryByName( String name )
{
- return dataDictionaryStore.getByName( name );
+ return i18n( i18nService, dataDictionaryStore.getByName( name ) );
}
-
+
public Collection<DataDictionary> getAllDataDictionaries()
{
- return dataDictionaryStore.getAll();
+ return i18n( i18nService, dataDictionaryStore.getAll() );
+ }
+
+ public Collection<DataElement> getDataElementsByDictionaryId( int dictionaryId )
+ {
+ return i18n( i18nService, dataDictionaryStore.get( dictionaryId ).getDataElements() );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2010-05-04 06:47:28 +0000
@@ -242,7 +242,7 @@
{
return i18n( i18nService, dataElementStore.getDataElementsByType( type ) );
}
-
+
public Collection<DataElement> getDataElementsByPeriodType( final PeriodType periodType )
{
Collection<DataElement> dataElements = getAllDataElements();
@@ -323,14 +323,14 @@
}
}
- return dataElements;
+ return i18n( i18nService, dataElements );
}
-
+
public Collection<DataElement> getDataElementsWithoutGroups()
{
return i18n( i18nService, dataElementStore.getDataElementsWithoutGroups() );
}
-
+
public Collection<DataElement> getDataElementsWithoutDataSets()
{
return i18n( i18nService, dataElementStore.getDataElementsWithoutDataSets() );
@@ -340,12 +340,12 @@
{
return dataElementStore.dataElementExists( id );
}
-
+
public boolean dataElementCategoryOptionComboExists( int id )
{
return dataElementStore.dataElementCategoryOptionComboExists( id );
}
-
+
// -------------------------------------------------------------------------
// CalculatedDataElement
// -------------------------------------------------------------------------
@@ -554,6 +554,11 @@
return groups;
}
+ public Collection<DataElement> getDataElementsByGroupId( int groupId )
+ {
+ return i18n( i18nService, dataElementGroupStore.get( groupId ).getMembers() );
+ }
+
// -------------------------------------------------------------------------
// DataElementGroupSet
// -------------------------------------------------------------------------
@@ -617,9 +622,10 @@
{
return dataElementStore.getAllGeneratedOperands();
}
-
+
public Collection<DataElementOperand> getAllGeneratedOperands( Collection<DataElement> dataElements )
{
return dataElementStore.getAllGeneratedOperands( dataElements );
- }
+ }
+
}
=== 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 2010-04-21 19:45:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2010-05-04 06:47:28 +0000
@@ -235,6 +235,8 @@
class="org.hisp.dhis.datadictionary.DefaultDataDictionaryService">
<property name="dataDictionaryStore"
ref="org.hisp.dhis.datadictionary.DataDictionaryStore"/>
+ <property name="i18nService"
+ ref="org.hisp.dhis.i18n.I18nService"/>
</bean>
<bean id="org.hisp.dhis.indicator.IndicatorService"
=== modified file 'dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/I18nManagerException.java'
--- dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/I18nManagerException.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/I18nManagerException.java 2010-05-04 06:47:28 +0000
@@ -32,6 +32,7 @@
* @author Nguyen Dang Quang
* @version $Id: I18nManagerException.java 2869 2007-02-20 14:26:09Z andegje $
*/
+@SuppressWarnings("serial")
public class I18nManagerException
extends Exception
{
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js 2010-03-11 13:21:41 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js 2010-05-04 06:47:28 +0000
@@ -13,7 +13,7 @@
*/
function translate( className, objectId )
{
- var url = "../dhis-web-commons/i18n.action?className=" + className + "&objectId=" + objectId + "&returnUrl=" + window.location.href;
+ var url = "../dhis-web-commons/i18n.action?className=" + className + "&objectId=" + objectId + "&returnUrl=" + htmlEncode( window.location.href );
window.location.href = url;
}
@@ -742,6 +742,10 @@
showWarning();
}
+ else if ( json.response == "nonSufficientAuthority" )
+ {
+ window.location.href = "../dhis-web-commons-about/showSufficientFeedbackForm.action";
+ }
}
);
}
=== 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 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java 2010-05-04 06:47:28 +0000
@@ -165,17 +165,19 @@
{
dataDictionaryId = dataDictionaryModeManager.getCurrentDataDictionary();
}
- else if ( dataDictionaryId == -1 ) // All, reset current data dictionary
+ 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 );
}
-
+
dataElementGroups = new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() );
Collections.sort( dataElementGroups, new DataElementGroupNameComparator() );
@@ -190,17 +192,18 @@
if ( dataDictionaryId != null && dataElementGroupId == null )
{
- dataElements = new ArrayList<DataElement>( dataDictionaryService.getDataDictionary( dataDictionaryId ).getDataElements() );
+ dataElements = new ArrayList<DataElement>( dataDictionaryService
+ .getDataElementsByDictionaryId( dataDictionaryId ) );
}
else if ( dataDictionaryId == null && dataElementGroupId != null )
{
- dataElements = new ArrayList<DataElement>( dataElementService.getDataElementGroup( dataElementGroupId ).getMembers() );
+ dataElements = new ArrayList<DataElement>( dataElementService.getDataElementsByGroupId( dataElementGroupId ) );
}
else if ( dataDictionaryId != null && dataElementGroupId != null )
{
- Collection<DataElement> dictionary = dataDictionaryService.getDataDictionary( dataDictionaryId ).getDataElements();
+ Collection<DataElement> dictionary = dataDictionaryService.getDataElementsByDictionaryId( dataDictionaryId );
- Collection<DataElement> members = dataElementService.getDataElementGroup( dataElementGroupId ).getMembers();
+ Collection<DataElement> members = dataElementService.getDataElementsByGroupId( dataElementGroupId );
dataElements = new ArrayList<DataElement>( CollectionUtils.intersection( dictionary, members ) );
}