dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41675
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21250: translate children of OU if getting org units with /api/organisationUnits/ID
------------------------------------------------------------
revno: 21250
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-12-01 17:48:27 +0700
message:
translate children of OU if getting org units with /api/organisationUnits/ID
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.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-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2015-11-12 04:47:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2015-12-01 10:48:27 +0000
@@ -188,7 +188,7 @@
}
postProcessEntities( entities );
- postProcessEntities( entities, options, rpParameters );
+ postProcessEntities( entities, options, rpParameters, translateParams );
if ( fields.contains( "access" ) )
{
@@ -445,7 +445,7 @@
for ( T entity : entities )
{
postProcessEntity( entity );
- postProcessEntity( entity, options, parameters );
+ postProcessEntity( entity, options, parameters, translateParams );
}
CollectionNode collectionNode = fieldFilterService.filter( getEntityClass(), entities, fields );
@@ -810,7 +810,7 @@
* Override to process entities after it has been retrieved from
* storage and before it is returned to the view. Entities is null-safe.
*/
- protected void postProcessEntities( List<T> entityList, WebOptions options, Map<String, String> parameters )
+ protected void postProcessEntities( List<T> entityList, WebOptions options, Map<String, String> parameters, TranslateParams translateParams )
{
}
@@ -834,7 +834,7 @@
* Override to process a single entity after it has been retrieved from
* storage and before it is returned to the view. Entity is null-safe.
*/
- protected void postProcessEntity( T entity, WebOptions options, Map<String, String> parameters ) throws Exception
+ protected void postProcessEntity( T entity, WebOptions options, Map<String, String> parameters, TranslateParams translateParams ) throws Exception
{
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java 2015-10-20 04:15:40 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java 2015-12-01 10:48:27 +0000
@@ -35,6 +35,7 @@
import org.hisp.dhis.dashboard.DashboardSearchResult;
import org.hisp.dhis.dashboard.DashboardService;
import org.hisp.dhis.dxf2.common.ImportOptions;
+import org.hisp.dhis.dxf2.common.TranslateParams;
import org.hisp.dhis.dxf2.webmessage.WebMessageException;
import org.hisp.dhis.hibernate.exception.DeleteAccessDeniedException;
import org.hisp.dhis.hibernate.exception.UpdateAccessDeniedException;
@@ -298,7 +299,7 @@
// -------------------------------------------------------------------------
@Override
- protected void postProcessEntity( Dashboard entity, WebOptions options, Map<String, String> parameters ) throws Exception
+ protected void postProcessEntity( Dashboard entity, WebOptions options, Map<String, String> parameters, TranslateParams translateParams ) throws Exception
{
for ( DashboardItem item : entity.getItems() )
{
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java 2015-10-20 04:15:40 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java 2015-12-01 10:48:27 +0000
@@ -92,7 +92,7 @@
private UserGroupService userGroupService;
@Override
- public void postProcessEntity( org.hisp.dhis.message.MessageConversation entity, WebOptions options, Map<String, String> parameters ) throws Exception
+ public void postProcessEntity( org.hisp.dhis.message.MessageConversation entity, WebOptions options, Map<String, String> parameters, TranslateParams translateParams ) throws Exception
{
Boolean markRead = Boolean.parseBoolean( parameters.get( "markRead" ) );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java 2015-11-12 04:47:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java 2015-12-01 10:48:27 +0000
@@ -179,6 +179,23 @@
return organisationUnits;
}
+ @Override
+ protected void postProcessEntity( OrganisationUnit entity, WebOptions options, Map<String, String> parameters, TranslateParams translateParams )
+ throws Exception
+ {
+ if ( translateParams.isTranslate() )
+ {
+ if ( translateParams.defaultLocale() )
+ {
+ i18nService.internationalise( entity.getChildren() );
+ }
+ else
+ {
+ i18nService.internationalise( entity.getChildren(), translateParams.getLocale() );
+ }
+ }
+ }
+
@RequestMapping( value = "/{uid}/parents", method = RequestMethod.GET )
public List<OrganisationUnit> getEntityList( @PathVariable( "uid" ) String uid,
@RequestParam Map<String, String> parameters, Model model, TranslateParams translateParams,