Allon Mureinik has uploaded a new change for review.

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

core: Singleton row mapper for Bookmarks

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

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


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/07/11907/1

diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/BookmarkDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/BookmarkDAODbFacadeImpl.java
index 79fef92..b7dad40 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/BookmarkDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/BookmarkDAODbFacadeImpl.java
@@ -3,11 +3,12 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.List;
-import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
-import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
+
 import org.ovirt.engine.core.common.businessentities.Bookmark;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
 
 /**
  * <code>BookmarkDAODbFacadeImpl</code> provides a concrete implementation of 
<code>BookmarkDAO</code> that uses
@@ -16,8 +17,9 @@
  *
  */
 public class BookmarkDAODbFacadeImpl extends BaseDAODbFacade implements 
BookmarkDAO {
-    private class BookmarkRowMapper implements
-            ParameterizedRowMapper<Bookmark> {
+    private static class BookmarkRowMapper implements 
ParameterizedRowMapper<Bookmark> {
+        public static final BookmarkRowMapper instance = new 
BookmarkRowMapper();
+
         @Override
         public Bookmark mapRow(ResultSet rs, int rowNum) throws SQLException {
             Bookmark entity = new Bookmark();
@@ -57,14 +59,14 @@
     public Bookmark get(Guid id) {
         MapSqlParameterSource parameterSource = new BookmarkSqlParameterSource(
                 id);
-        return getCallsHandler().executeRead("GetBookmarkBybookmark_id", new 
BookmarkRowMapper(), parameterSource);
+        return getCallsHandler().executeRead("GetBookmarkBybookmark_id", 
BookmarkRowMapper.instance, parameterSource);
     }
 
     @Override
     public Bookmark getByName(String name) {
         MapSqlParameterSource parameterSource = new BookmarkSqlParameterSource(
                 name);
-        return getCallsHandler().executeRead("GetBookmarkBybookmark_name", new 
BookmarkRowMapper(), parameterSource);
+        return getCallsHandler().executeRead("GetBookmarkBybookmark_name", 
BookmarkRowMapper.instance, parameterSource);
     }
 
     @SuppressWarnings("unchecked")
@@ -72,7 +74,7 @@
     public List<Bookmark> getAll() {
         MapSqlParameterSource parameterSource = new 
BookmarkSqlParameterSource();
 
-        return getCallsHandler().executeReadList("GetAllFromBookmarks", new 
BookmarkRowMapper(), parameterSource);
+        return getCallsHandler().executeReadList("GetAllFromBookmarks", 
BookmarkRowMapper.instance, parameterSource);
     }
 
     @Override


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

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