← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18248: Added SchemaDescriptor for Translation. Changed TranslationStore to use IdObjectStore. Rewrote Tr...

 

------------------------------------------------------------
revno: 18248
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-02-13 13:16:30 +0700
message:
  Added SchemaDescriptor for Translation. Changed TranslationStore to use IdObjectStore. Rewrote TranslationController to use AbstractCrudController instead (this means some minor API changes in translation web-api)
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/TranslationSchemaDescriptor.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/DefaultTranslationService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/hibernate/HibernateTranslationStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/translation/TranslationStoreTest.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/TranslationController.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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/TranslationSchemaDescriptor.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/TranslationSchemaDescriptor.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/TranslationSchemaDescriptor.java	2015-02-13 06:16:30 +0000
@@ -0,0 +1,57 @@
+package org.hisp.dhis.schema.descriptors;
+
+/*
+ * Copyright (c) 2004-2015, 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.
+ */
+
+import org.hisp.dhis.constant.Constant;
+import org.hisp.dhis.schema.Schema;
+import org.hisp.dhis.schema.SchemaDescriptor;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Component
+public class TranslationSchemaDescriptor implements SchemaDescriptor
+{
+    public static final String SINGULAR = "translation";
+
+    public static final String PLURAL = "translations";
+
+    public static final String API_ENDPOINT = "/" + PLURAL;
+
+    @Override
+    public Schema getSchema()
+    {
+        Schema schema = new Schema( Constant.class, SINGULAR, PLURAL );
+        schema.setApiEndpoint( API_ENDPOINT );
+        schema.setOrder( 3000 );
+
+        return schema;
+    }
+}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationStore.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationStore.java	2015-02-13 06:16:30 +0000
@@ -28,38 +28,25 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+
+import java.util.Collection;
 import java.util.Locale;
-import java.util.Collection;
 
 /**
  * @author Oyvind Brucker
  */
 public interface TranslationStore
+    extends GenericIdentifiableObjectStore<Translation>
 {
     String ID = TranslationStore.class.getName();
 
     /**
-     * Adds a Translation.
-     * 
-     * @param translation the Translation.
-     */
-    void addTranslation( Translation translation );
-
-    /**
-     * Updates a Translation.
-     * 
-     * @param translation the Translation.
-     */
-    void updateTranslation( Translation translation );
-
-    /**
      * Retrieves a Translation.
-     * 
-     *
      *
      * @param className the class name.
-     * @param locale the locale.
-     * @param property the property.
+     * @param locale    the locale.
+     * @param property  the property.
      * @param objectUid
      * @return a Translation.
      */
@@ -68,12 +55,10 @@
     /**
      * Retrieves a Translation. Only exact matches on the given
      * Locale will be returned.
-     * 
-     *
      *
      * @param className the class name.
-     * @param locale the locale.
-     * @param property the property.
+     * @param locale    the locale.
+     * @param property  the property.
      * @param objectUid
      * @return a Translation.
      */
@@ -81,11 +66,9 @@
 
     /**
      * Retrieves a Collection of Translations.
-     * 
-     *
      *
      * @param className the class name.
-     * @param locale the locale.
+     * @param locale    the locale.
      * @param objectUid the id.
      * @return a Collection of Translations.
      */
@@ -94,47 +77,32 @@
     /**
      * Retrieves a Collection of Translations. Only exact matches on the given
      * Locale will be returned.
-     * 
      *
      * @param className the class name.
      * @param objectUid the id.
-     * @param locale the locale.
+     * @param locale    the locale.
      * @return a Collection of Translations.
      */
     Collection<Translation> getTranslationsNoFallback( String className, String objectUid, Locale locale );
-    
+
     /**
      * Retrieves a Collection of Translations.
-     * 
+     *
      * @param className the class name.
-     * @param locale the locale.
+     * @param locale    the locale.
      * @return a Collection of Translations.
      */
     Collection<Translation> getTranslations( String className, Locale locale );
 
     /**
      * Retrieves a Collection of Translations.
-     * 
+     *
      * @param locale the locale.
      * @return a Collection of Translations.
      */
     Collection<Translation> getTranslations( Locale locale );
 
     /**
-     * Retrieves a Collection of all Translations.
-     * 
-     * @return a Collection of all Translations.
-     */
-    Collection<Translation> getAllTranslations();
-
-    /**
-     * Deletes a Translation.
-     * 
-     * @param translation the Translation.
-     */
-    void deleteTranslation( Translation translation );
-
-    /**
      * Deletes Translations.
      *
      * @param className the class name.

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/DefaultTranslationService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/DefaultTranslationService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/DefaultTranslationService.java	2015-02-13 06:16:30 +0000
@@ -60,7 +60,7 @@
     @Override
     public void addTranslation( Translation translation )
     {
-        translationStore.addTranslation( translation );
+        translationStore.save( translation );
     }
 
     @Override
@@ -75,7 +75,7 @@
     @Override
     public void updateTranslation( Translation translation )
     {
-        translationStore.updateTranslation( translation );
+        translationStore.update( translation );
     }
 
     @Override
@@ -117,13 +117,13 @@
     @Override
     public Collection<Translation> getAllTranslations()
     {
-        return translationStore.getAllTranslations();
+        return translationStore.getAll();
     }
 
     @Override
     public void deleteTranslation( Translation translation )
     {
-        translationStore.deleteTranslation( translation );
+        translationStore.delete( translation );
     }
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/hibernate/HibernateTranslationStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/hibernate/HibernateTranslationStore.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/hibernate/HibernateTranslationStore.java	2015-02-13 06:16:30 +0000
@@ -28,56 +28,26 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collection;
-import java.util.List;
-import java.util.Locale;
-
 import org.hibernate.Criteria;
 import org.hibernate.Query;
 import org.hibernate.Session;
-import org.hibernate.SessionFactory;
 import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
 import org.hisp.dhis.system.util.LocaleUtils;
 import org.hisp.dhis.translation.Translation;
 import org.hisp.dhis.translation.TranslationStore;
 
+import java.util.Collection;
+import java.util.List;
+import java.util.Locale;
+
 /**
  * @author Oyvind Brucker
  */
 public class HibernateTranslationStore
+    extends HibernateIdentifiableObjectStore<Translation>
     implements TranslationStore
 {
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private SessionFactory sessionFactory;
-
-    public void setSessionFactory( SessionFactory sessionFactory )
-    {
-        this.sessionFactory = sessionFactory;
-    }
-
-    // -------------------------------------------------------------------------
-    // Translation
-    // -------------------------------------------------------------------------
-
-    @Override
-    public void addTranslation( Translation translation )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        session.save( translation );
-    }
-
-    @Override
-    public void updateTranslation( Translation translation )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        session.update( translation );
-    }
-
     @Override
     @SuppressWarnings( "unchecked" )
     public Translation getTranslation( String className, Locale locale, String property, String objectUid )
@@ -94,9 +64,9 @@
         criteria.setCacheable( true );
 
         List<Translation> list = criteria.list();
-        
+
         List<Translation> translations = LocaleUtils.getTranslationsHighestSpecifity( list );
-        
+
         return !translations.isEmpty() ? translations.get( 0 ) : null;
     }
 
@@ -115,11 +85,11 @@
 
         criteria.setCacheable( true );
 
-        List<Translation> translations = criteria.list();     
-               
+        List<Translation> translations = criteria.list();
+
         return !translations.isEmpty() ? translations.get( 0 ) : null;
     }
-    
+
     @Override
     @SuppressWarnings( "unchecked" )
     public Collection<Translation> getTranslations( String className, Locale locale, String objectUid )
@@ -135,7 +105,7 @@
         criteria.setCacheable( true );
 
         List<Translation> translations = criteria.list();
-        
+
         return LocaleUtils.getTranslationsHighestSpecifity( translations );
     }
 
@@ -170,7 +140,7 @@
         criteria.setCacheable( true );
 
         List<Translation> translations = criteria.list();
-        
+
         return LocaleUtils.getTranslationsHighestSpecifity( translations );
     }
 
@@ -185,29 +155,8 @@
         criteria.add( Restrictions.eq( "locale", locale.toString() ) );
 
         criteria.setCacheable( true );
-        
-        return criteria.list();
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public Collection<Translation> getAllTranslations()
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        Criteria criteria = session.createCriteria( Translation.class );
-
-        criteria.setCacheable( true );
-
-        return criteria.list();
-    }
-
-    @Override
-    public void deleteTranslation( Translation translation )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        session.delete( translation );
+
+        return criteria.list();
     }
 
     @Override

=== 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	2015-01-22 18:19:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2015-02-13 06:16:30 +0000
@@ -283,10 +283,6 @@
     <property name="sessionFactory" ref="sessionFactory" />
   </bean>
 
-  <bean id="org.hisp.dhis.translation.TranslationStore" class="org.hisp.dhis.translation.hibernate.HibernateTranslationStore">
-    <property name="sessionFactory" ref="sessionFactory" />
-  </bean>
-
   <bean id="org.hisp.dhis.aggregation.AggregatedDataValueStore" class="org.hisp.dhis.aggregation.jdbc.JdbcAggregatedDataValueStore">
     <property name="statementManager" ref="statementManager" />
     <property name="statementBuilder" ref="statementBuilder" />
@@ -306,6 +302,13 @@
     <property name="cacheable" value="true" />
   </bean>
 
+  <bean id="org.hisp.dhis.translation.TranslationStore" class="org.hisp.dhis.translation.hibernate.HibernateTranslationStore">
+    <property name="clazz" value="org.hisp.dhis.translation.Translation" />
+    <property name="sessionFactory" ref="sessionFactory" />
+    <property name="jdbcTemplate" ref="jdbcTemplate" />
+    <property name="cacheable" value="true" />
+  </bean>
+
   <bean id="org.hisp.dhis.configuration.ConfigurationStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
     <property name="sessionFactory" ref="sessionFactory" />
     <property name="clazz" value="org.hisp.dhis.configuration.Configuration" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/translation/TranslationStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/translation/TranslationStoreTest.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/translation/TranslationStoreTest.java	2015-02-13 06:16:30 +0000
@@ -28,13 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Locale;
-
 import org.hisp.dhis.DhisSpringTest;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -42,6 +35,10 @@
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.Locale;
+
+import static org.junit.Assert.*;
+
 /**
  * @author Oyvind Brucker
  */
@@ -80,48 +77,48 @@
     public void testAddGet()
     {
         translation1a = new Translation( className1, locale1, "name", "cheers", className1 + uid1 );
-        translation1b = new Translation( className1, locale1, "shortName", "goodbye",className1 + uid1 );
-        translation2a = new Translation( className1, locale2, "name", "hello",className1 + uid1 );
-        translation2b = new Translation( className2, locale2, "name", "hey",className1 + uid1 );
-        translation2c = new Translation( className2, locale3, "name", "bonjour",className1 + uid2 );
-        
-        translationStore.addTranslation( translation1a );
-        translationStore.addTranslation( translation1b );
-        
+        translation1b = new Translation( className1, locale1, "shortName", "goodbye", className1 + uid1 );
+        translation2a = new Translation( className1, locale2, "name", "hello", className1 + uid1 );
+        translation2b = new Translation( className2, locale2, "name", "hey", className1 + uid1 );
+        translation2c = new Translation( className2, locale3, "name", "bonjour", className1 + uid2 );
+
+        translationStore.save( translation1a );
+        translationStore.save( translation1b );
+
         assertEquals( translation1a, translationStore.getTranslation( className1, Locale.UK, "name", uid1 ) );
         assertEquals( translation1b, translationStore.getTranslation( className1, Locale.UK, "shortName", uid1 ) );
     }
-    
+
     @Test
     public void delete()
     {
-        translationStore.addTranslation( translation1a );
-        translationStore.addTranslation( translation1b );
-        
+        translationStore.save( translation1a );
+        translationStore.save( translation1b );
+
         assertNotNull( translationStore.getTranslation( className1, Locale.UK, "name", uid1 ) );
         assertNotNull( translationStore.getTranslation( className1, Locale.UK, "shortName", uid1 ) );
-        
-        translationStore.deleteTranslation( translation1a );
-        
+
+        translationStore.delete( translation1a );
+
         assertNull( translationStore.getTranslation( className1, Locale.UK, "name", uid1 ) );
         assertNotNull( translationStore.getTranslation( className1, Locale.UK, "shortName", uid1 ) );
 
-        translationStore.deleteTranslation( translation1b );
+        translationStore.delete( translation1b );
 
         assertNull( translationStore.getTranslation( className1, Locale.UK, "name", uid1 ) );
         assertNull( translationStore.getTranslation( className1, Locale.UK, "shortName", uid1 ) );
     }
-    
+
     @Test
     public void testUpdateTranslation()
     {
-        translationStore.addTranslation( translation1a );
-        
+        translationStore.save( translation1a );
+
         assertEquals( translation1a, translationStore.getTranslation( className1, Locale.UK, "name", uid1 ) );
-        
+
         translation1a.setValue( "regards" );
-        
-        translationStore.updateTranslation( translation1a );
+
+        translationStore.update( translation1a );
 
         assertEquals( "regards", translationStore.getTranslation( className1, Locale.UK, "name", uid1 ).getValue() );
     }
@@ -129,12 +126,12 @@
     @Test
     public void testGetTranslations1()
     {
-        translationStore.addTranslation( translation1a );
-        translationStore.addTranslation( translation1b );
-        translationStore.addTranslation( translation2a );
-        translationStore.addTranslation( translation2b );
-        translationStore.addTranslation( translation2c );
-        
+        translationStore.save( translation1a );
+        translationStore.save( translation1b );
+        translationStore.save( translation2a );
+        translationStore.save( translation2b );
+        translationStore.save( translation2c );
+
         assertEquals( 2, translationStore.getTranslations( className1, Locale.UK, uid1 ).size() );
         assertTrue( translationStore.getTranslations( className1, Locale.UK, uid1 ).contains( translation1a ) );
         assertTrue( translationStore.getTranslations( className1, Locale.UK, uid1 ).contains( translation1b ) );
@@ -143,27 +140,27 @@
     @Test
     public void testGetTranslations2()
     {
-        translationStore.addTranslation( translation1a );
-        translationStore.addTranslation( translation1b );
-        translationStore.addTranslation( translation2a );
-        translationStore.addTranslation( translation2b );
-        translationStore.addTranslation( translation2c );
-        
+        translationStore.save( translation1a );
+        translationStore.save( translation1b );
+        translationStore.save( translation2a );
+        translationStore.save( translation2b );
+        translationStore.save( translation2c );
+
         assertEquals( 2, translationStore.getTranslations( className1, Locale.UK ).size() );
         assertTrue( translationStore.getTranslations( className1, Locale.UK, uid1 ).contains( translation1a ) );
         assertTrue( translationStore.getTranslations( className1, Locale.UK, uid1 ).contains( translation1b ) );
     }
-    
+
     @Test
     @Ignore
     public void testGetAllTranslations()
     {
-        translationStore.addTranslation( translation1a );
-        translationStore.addTranslation( translation1b );
-        translationStore.addTranslation( translation2a );
-        translationStore.addTranslation( translation2b );
-        translationStore.addTranslation( translation2c );
-        
-        assertEquals( 5, translationStore.getAllTranslations().size() );
+        translationStore.save( translation1a );
+        translationStore.save( translation1b );
+        translationStore.save( translation2a );
+        translationStore.save( translation2b );
+        translationStore.save( translation2c );
+
+        assertEquals( 5, translationStore.getAll().size() );
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/TranslationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/TranslationController.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/TranslationController.java	2015-02-13 06:16:30 +0000
@@ -28,49 +28,43 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.dxf2.utils.JacksonUtils;
-import org.hisp.dhis.translation.TranslationService;
-import org.hisp.dhis.translation.Translations;
-import org.springframework.beans.factory.annotation.Autowired;
+import com.google.common.collect.Lists;
+import org.hisp.dhis.common.Pager;
+import org.hisp.dhis.schema.descriptors.TranslationSchemaDescriptor;
+import org.hisp.dhis.translation.Translation;
+import org.hisp.dhis.webapi.webdomain.WebMetaData;
+import org.hisp.dhis.webapi.webdomain.WebOptions;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-import static org.hisp.dhis.webapi.utils.ContextUtils.CONTENT_TYPE_JSON;
+
+import java.util.List;
 
 /**
- * @author kprakash.
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 @Controller
-@RequestMapping(value = TranslationController.RESOURCE_PATH)
-public class TranslationController
+@RequestMapping( value = TranslationSchemaDescriptor.API_ENDPOINT )
+public class TranslationController extends AbstractCrudController<Translation>
 {
-    public static final String RESOURCE_PATH = "/translations";
-
-    @Autowired
-    private ContextUtils contextUtils;
-
-
-    @Autowired
-    private TranslationService translationService;
-
-
-    @RequestMapping( produces = CONTENT_TYPE_JSON, method = RequestMethod.GET )
-    public void exportJson( HttpServletResponse response ) throws IOException
-    {
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, ContextUtils.CacheStrategy.NO_CACHE, "translations.json", false );
-        JacksonUtils.toJson( response.getOutputStream(), new Translations( translationService.getAllTranslations() ) );
-    }
-
-    @RequestMapping(method = RequestMethod.POST, consumes = CONTENT_TYPE_JSON)
-    public void importJson( HttpServletRequest request ) throws IOException
-    {
-        Translations translations = JacksonUtils.fromJson( request.getInputStream(), Translations.class );
-        translationService.createOrUpdate( translations.getTranslations() );
-    }
-}
\ No newline at end of file
+    @Override
+    protected List<Translation> getEntityList( WebMetaData metaData, WebOptions options, List<String> filters )
+    {
+        List<Translation> entityList;
+
+        if ( options.hasPaging() )
+        {
+            int count = manager.getCount( getEntityClass() );
+
+            Pager pager = new Pager( options.getPage(), count, options.getPageSize() );
+            metaData.setPager( pager );
+
+            entityList = Lists.newArrayList( manager.getBetween( getEntityClass(), pager.getOffset(), pager.getPageSize() ) );
+        }
+        else
+        {
+            entityList = Lists.newArrayList( manager.getAll( getEntityClass() ) );
+        }
+
+        return entityList;
+    }
+}