Allon Mureinik has uploaded a new change for review.

Change subject: core: Singleton row mapper for Tags
......................................................................

core: Singleton row mapper for Tags

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

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


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/08/11908/1

diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/TagDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/TagDAODbFacadeImpl.java
index ed7b2f8..292e44c 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/TagDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/TagDAODbFacadeImpl.java
@@ -5,12 +5,12 @@
 import java.util.List;
 
 import org.ovirt.engine.core.common.businessentities.TagsType;
-import org.ovirt.engine.core.common.businessentities.tags;
 import org.ovirt.engine.core.common.businessentities.TagsUserGroupMap;
 import org.ovirt.engine.core.common.businessentities.TagsUserMap;
 import org.ovirt.engine.core.common.businessentities.TagsVdsMap;
 import org.ovirt.engine.core.common.businessentities.TagsVmMap;
 import org.ovirt.engine.core.common.businessentities.TagsVmPoolMap;
+import org.ovirt.engine.core.common.businessentities.tags;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.compat.NGuid;
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
@@ -18,12 +18,12 @@
 
 /**
  * <code>TagDAODbFacadeImpl</code> provides an implementation of {@link 
TagDAO} that uses code refactored from the
- * {@link DbFacade} class.
- *
- *
+ * {@link org.ovirt.engine.core.dal.dbbroker.DbFacade} class.
  */
 public class TagDAODbFacadeImpl extends BaseDAODbFacade implements TagDAO {
-    private class TagRowMapper implements ParameterizedRowMapper<tags> {
+    private static class TagRowMapper implements ParameterizedRowMapper<tags> {
+        public static final TagRowMapper instance = new TagRowMapper();
+
         @Override
         public tags mapRow(ResultSet rs, int rowNum) throws SQLException {
             tags entity = new tags();
@@ -58,7 +58,7 @@
                 .addValue("tag_id", id);
 
         return getCallsHandler()
-                        .executeRead("GettagsBytag_id", new TagRowMapper(), 
parameterSource);
+                .executeRead("GettagsBytag_id", TagRowMapper.instance, 
parameterSource);
     }
 
     @Override
@@ -67,7 +67,7 @@
                 .addValue("tag_name", name);
 
         return getCallsHandler()
-                .executeRead("GettagsBytag_name", new TagRowMapper(), 
parameterSource);
+                .executeRead("GettagsBytag_name", TagRowMapper.instance, 
parameterSource);
     }
 
     @SuppressWarnings("unchecked")
@@ -76,7 +76,7 @@
         MapSqlParameterSource parameterSource = 
getCustomMapSqlParameterSource();
 
         return getCallsHandler()
-                .executeReadList("GetAllFromtags", new TagRowMapper(), 
parameterSource);
+                .executeReadList("GetAllFromtags", TagRowMapper.instance, 
parameterSource);
     }
 
     @SuppressWarnings("unchecked")
@@ -86,7 +86,7 @@
                 .addValue("parent_id", id);
 
         return getCallsHandler()
-                .executeReadList("GettagsByparent_id", new TagRowMapper(), 
parameterSource);
+                .executeReadList("GettagsByparent_id", TagRowMapper.instance, 
parameterSource);
     }
 
     @SuppressWarnings("unchecked")
@@ -96,7 +96,7 @@
                 .addValue("group_ids", ids);
 
         return getCallsHandler()
-                .executeReadList("GetTagsByUserGroupId", new TagRowMapper(), 
parameterSource);
+                .executeReadList("GetTagsByUserGroupId", 
TagRowMapper.instance, parameterSource);
     }
 
     @SuppressWarnings("unchecked")
@@ -106,7 +106,7 @@
                 .addValue("tag_ids", ids);
 
         return getCallsHandler()
-                .executeReadList("GetUserGroupTagsByTagIds", new 
TagRowMapper(), parameterSource);
+                .executeReadList("GetUserGroupTagsByTagIds", 
TagRowMapper.instance, parameterSource);
     }
 
     @SuppressWarnings("unchecked")
@@ -116,7 +116,7 @@
                 .addValue("user_ids", ids);
 
         return getCallsHandler()
-                .executeReadList("GetTagsByUserId", new TagRowMapper(), 
parameterSource);
+                .executeReadList("GetTagsByUserId", TagRowMapper.instance, 
parameterSource);
     }
 
     @SuppressWarnings("unchecked")
@@ -126,7 +126,7 @@
                 .addValue("tag_ids", ids);
 
         return getCallsHandler()
-                .executeReadList("GetUserTagsByTagIds", new TagRowMapper(), 
parameterSource);
+                .executeReadList("GetUserTagsByTagIds", TagRowMapper.instance, 
parameterSource);
     }
 
     @SuppressWarnings("unchecked")
@@ -136,7 +136,7 @@
                 .addValue("vds_ids", ids);
 
         return getCallsHandler()
-                .executeReadList("GetTagsByVdsId", new TagRowMapper(), 
parameterSource);
+                .executeReadList("GetTagsByVdsId", TagRowMapper.instance, 
parameterSource);
     }
 
     @SuppressWarnings("unchecked")
@@ -146,7 +146,7 @@
                 .addValue("tag_ids", ids);
 
         return getCallsHandler()
-                .executeReadList("GetVdsTagsByTagIds", new TagRowMapper(), 
parameterSource);
+                .executeReadList("GetVdsTagsByTagIds", TagRowMapper.instance, 
parameterSource);
     }
 
     @SuppressWarnings("unchecked")
@@ -156,7 +156,7 @@
                 .addValue("vm_ids", ids);
 
         return getCallsHandler()
-                .executeReadList("GetTagsByVmId", new TagRowMapper(), 
parameterSource);
+                .executeReadList("GetTagsByVmId", TagRowMapper.instance, 
parameterSource);
     }
 
     @SuppressWarnings("unchecked")
@@ -166,7 +166,7 @@
                 .addValue("tag_ids", ids);
 
         return getCallsHandler()
-                .executeReadList("GetVmTagsByTagId", new TagRowMapper(), 
parameterSource);
+                .executeReadList("GetVmTagsByTagId", TagRowMapper.instance, 
parameterSource);
     }
 
     @SuppressWarnings("unchecked")
@@ -176,7 +176,7 @@
                 .addValue("vm_pool_ids", ids);
 
         return getCallsHandler()
-                .executeReadList("GetTagsByVmpoolId", new TagRowMapper(), 
parameterSource);
+                .executeReadList("GetTagsByVmpoolId", TagRowMapper.instance, 
parameterSource);
     }
 
     @Override


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I016cee1e6e219924b11e6a3cfe33efd8bc5202a3
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