Allon Mureinik has uploaded a new change for review.

Change subject: core: LUN_storage_server_connection_map row mapper
......................................................................

core: LUN_storage_server_connection_map row mapper

Added a singleton row mapper for StorageServerConnectionLunMapDAO, as
specified by http://www.ovirt.org/Backend_Coding_Standards .

Change-Id: Ibd986b67d43c054a98144cde365d6e3f82d82641
Signed-off-by: Allon Mureinik <[email protected]>
---
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageServerConnectionLunMapDAODbFacadeImpl.java
1 file changed, 21 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/73/12473/1

diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageServerConnectionLunMapDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageServerConnectionLunMapDAODbFacadeImpl.java
index 6f062f5..0af93be 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageServerConnectionLunMapDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageServerConnectionLunMapDAODbFacadeImpl.java
@@ -3,13 +3,14 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.List;
+
 import org.apache.commons.lang.NotImplementedException;
-import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
-import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
 import 
org.ovirt.engine.core.common.businessentities.LUN_storage_server_connection_map;
 import 
org.ovirt.engine.core.common.businessentities.LUN_storage_server_connection_map_id;
 import org.ovirt.engine.core.utils.linq.LinqUtils;
 import org.ovirt.engine.core.utils.linq.Predicate;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
 
 /**
  * <code>StorageServerConnectionLunMapDAODbFacadeImpl</code> provides an 
implementation of {@link LUN_storage_server_connection_map}
@@ -20,24 +21,27 @@
 public class StorageServerConnectionLunMapDAODbFacadeImpl extends 
BaseDAODbFacade implements
         StorageServerConnectionLunMapDAO {
 
+    private static final class StorageServerConnectionLunMapRowMapper
+            implements 
ParameterizedRowMapper<LUN_storage_server_connection_map> {
+        public static final StorageServerConnectionLunMapRowMapper instance =
+                new StorageServerConnectionLunMapRowMapper();
+
+        @Override
+        public LUN_storage_server_connection_map mapRow(ResultSet rs, int 
rowNum) throws SQLException {
+            LUN_storage_server_connection_map entity = new 
LUN_storage_server_connection_map();
+            entity.setLunId(rs.getString("LUN_id"));
+            
entity.setstorage_server_connection(rs.getString("storage_server_connection"));
+            return entity;
+        }
+    }
+
     @Override
     public LUN_storage_server_connection_map 
get(LUN_storage_server_connection_map_id id) {
         MapSqlParameterSource parameterSource = 
getCustomMapSqlParameterSource().addValue("lUN_id", id.lunId).addValue(
                 "storage_server_connection", id.storageServerConnection);
 
-        ParameterizedRowMapper<LUN_storage_server_connection_map> mapper =
-                new 
ParameterizedRowMapper<LUN_storage_server_connection_map>() {
-                    @Override
-                    public LUN_storage_server_connection_map mapRow(ResultSet 
rs, int rowNum) throws SQLException {
-                        LUN_storage_server_connection_map entity = new 
LUN_storage_server_connection_map();
-                        entity.setLunId(rs.getString("LUN_id"));
-                        
entity.setstorage_server_connection(rs.getString("storage_server_connection"));
-                        return entity;
-                    }
-                };
-
         return 
getCallsHandler().executeRead("GetLUN_storage_server_connection_mapByLUNBystorage_server_conn",
-                mapper,
+                StorageServerConnectionLunMapRowMapper.instance,
                 parameterSource);
     }
 
@@ -60,22 +64,12 @@
                 });
     }
 
-    @SuppressWarnings("unchecked")
     private List<LUN_storage_server_connection_map> 
getAllLUNStorageServerConnection() {
         MapSqlParameterSource parameterSource = 
getCustomMapSqlParameterSource();
 
-        ParameterizedRowMapper<LUN_storage_server_connection_map> mapper =
-                new 
ParameterizedRowMapper<LUN_storage_server_connection_map>() {
-                    @Override
-                    public LUN_storage_server_connection_map mapRow(ResultSet 
rs, int rowNum) throws SQLException {
-                        LUN_storage_server_connection_map entity = new 
LUN_storage_server_connection_map();
-                        entity.setLunId(rs.getString("LUN_id"));
-                        
entity.setstorage_server_connection(rs.getString("storage_server_connection"));
-                        return entity;
-                    }
-                };
-
-        return 
getCallsHandler().executeReadList("GetAllFromLUN_storage_server_connection_map",
 mapper, parameterSource);
+        return 
getCallsHandler().executeReadList("GetAllFromLUN_storage_server_connection_map",
+                StorageServerConnectionLunMapRowMapper.instance,
+                parameterSource);
     }
 
     @Override


--
To view, visit http://gerrit.ovirt.org/12473
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd986b67d43c054a98144cde365d6e3f82d82641
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to