dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35701
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18272: more support for i18n web-api translation
------------------------------------------------------------
revno: 18272
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-02-16 13:41:14 +0700
message:
more support for i18n web-api translation
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/DimensionController.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-02-16 05:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2015-02-16 06:41:14 +0000
@@ -338,7 +338,7 @@
serialize( request, response, summary );
}
- protected void translate( List<T> entities, TranslateOptions translateOptions )
+ protected void translate( List<?> entities, TranslateOptions translateOptions )
{
if ( translateOptions.isTranslate() )
{
=== 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-01-22 11:23:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java 2015-02-16 06:41:14 +0000
@@ -28,20 +28,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.dashboard.Dashboard.MAX_ITEMS;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.dashboard.Dashboard;
import org.hisp.dhis.dashboard.DashboardItem;
import org.hisp.dhis.dashboard.DashboardSearchResult;
import org.hisp.dhis.dashboard.DashboardService;
+import org.hisp.dhis.dxf2.metadata.TranslateOptions;
import org.hisp.dhis.dxf2.utils.JacksonUtils;
import org.hisp.dhis.hibernate.exception.DeleteAccessDeniedException;
import org.hisp.dhis.schema.descriptors.DashboardItemSchemaDescriptor;
@@ -57,6 +49,14 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.hisp.dhis.dashboard.Dashboard.MAX_ITEMS;
+
/**
* @author Lars Helge Overland
*/
@@ -73,7 +73,6 @@
Model model, HttpServletResponse response ) throws Exception
{
DashboardSearchResult result = dashboardService.search( query, max );
-
model.addAttribute( "model", result );
return "dashboardSearchResult";
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DimensionController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DimensionController.java 2015-02-11 19:41:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DimensionController.java 2015-02-16 06:41:14 +0000
@@ -42,6 +42,7 @@
import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dxf2.metadata.TranslateOptions;
import org.hisp.dhis.node.AbstractNode;
import org.hisp.dhis.node.Node;
import org.hisp.dhis.node.NodeUtils;
@@ -96,7 +97,7 @@
@RequestMapping( value = "/{uid}/items", method = RequestMethod.GET )
public @ResponseBody RootNode getItems( @PathVariable String uid, @RequestParam Map<String, String> parameters,
- Model model, HttpServletRequest request, HttpServletResponse response )
+ TranslateOptions translateOptions, Model model, HttpServletRequest request, HttpServletResponse response )
{
List<String> fields = Lists.newArrayList( contextService.getParameterValues( "fields" ) );
List<String> filters = Lists.newArrayList( contextService.getParameterValues( "filter" ) );
@@ -107,10 +108,11 @@
}
List<NameableObject> items = dimensionService.getCanReadDimensionItems( uid );
-
items = objectFilterService.filter( items, filters );
Collections.sort( items, IdentifiableObjectNameComparator.INSTANCE );
+ translate( items, translateOptions );
+
RootNode rootNode = NodeUtils.createMetadata();
CollectionNode collectionNode = rootNode.addChild( fieldFilterService.filter( getEntityClass(), items, fields ) );