/**
 * Copyright (c) 2014 All Rights Reserved by the SDL Group.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.sdl.odata.api.mapper;

import com.sdl.odata.api.edm.model.EntityDataModel;
import com.sdl.odata.api.processor.datasource.ODataDataSourceException;

/**
 * Converts OData entities to Datasource entities and vice versa.
 *
 * @param <T> Type of OData entities that this mapper handles.
 * @param <U> Type of Datasource entities that this mapper handles.
 */
public interface EntityMapper<T, U> {

    /**
     * Convert an OData entity to a Datasource entity.
     *
     * @param odataEntity     The OData entity.
     * @param entityDataModel The entity data model.
     * @return The Datasource entity.
     * @throws ODataDataSourceException If an error happens while converting the entity.
     */
    U convertODataEntityToDS(T odataEntity, EntityDataModel entityDataModel) throws ODataDataSourceException;

    /**
     * Convert a Datasource entity to an OData entity.
     *
     * @param <R> The odata entity result type
     * @param dsEntity        The Datasource entity.
     * @param odataEntityClass The class of the OData entity to create.
     * @param entityDataModel  The entity data model.
     * @return The OData entity.
     * @throws ODataDataSourceException If an error happens while converting the entity.
     */
    <R extends T> R convertDSEntityToOData(U dsEntity, Class<R> odataEntityClass, EntityDataModel entityDataModel)
            throws ODataDataSourceException;
}

@@ -779,16 +779,40 @@
 ption;%0A%0A
+import java.util.List;%0A%0A
 /**%0A * C
@@ -1467,16 +1467,499 @@
 ption;%0A%0A
+    /**%0A     * Convert an OData entities list to a Datasource entities list.%0A     *%0A     * @param odataEntities   The list of OData entities.%0A     * @param entityDataModel The entity data model.%0A     * @return The list of Datasource entities.%0A     * @throws ODataDataSourceException If an error happens while converting the entity.%0A     */%0A    List%3CU%3E convertODataEntitiesListToDS(List%3CT%3E odataEntities, EntityDataModel entityDataModel)%0A            throws ODataDataSourceException;%0A%0A
     /**%0A
@@ -2037,16 +2037,29 @@
 aram %3CR%3E
+             
  The oda
@@ -2106,24 +2106,25 @@
 tity        
+ 
 The Datasour
@@ -2549,11 +2549,727 @@
 ception;
+%0A%0A    /**%0A     * Convert a Datasource entities list to an OData entities list.%0A     *%0A     * @param %3CR%3E              The odata entity result type%0A     * @param dsEntities       The list of Datasource entities.%0A     * @param odataEntityClass The class of the OData entity to create.%0A     * @param entityDataModel  The entity data model.%0A     * @return The list of OData entities.%0A     * @throws ODataDataSourceException If an error happens while converting the entity.%0A     */%0A    %3CR extends T%3E List%3CR%3E convertDSEntitiesListToOData(List%3CU%3E dsEntities, Class%3CR%3E odataEntityClass,%0A                                                             EntityDataModel entityDataModel)%0A            throws ODataDataSourceException;
 %0A%7D%0A

Enhance EntityMapper with methods that can convert entities list.