core: rv GetEntityPermissionsi[ForUserAndGroups]

Change get_entity_permissions and
get_entity_permissions_for_user_and_groups to use a return value instead
of an output parameter.

Although the main reasoning behind this is standardisation and code
cleanliness, there is an added performance bonus as this change removes
an explicit conversion of the returned uuid to a varchar.

Change-Id: I26d94fc765c927763af6bb0fa6775b4aaced6a28
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Remove JobIdRowMapper

This patch removes JobIdRowMapper and uses the createGuidMapper() method
from BaseDAODbFacade, for code-reuse sake.

Change-Id: I0e37803c53bff7cfac654408bd2fd317e8a84003
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Extract VmPoolMapRowMapper

Extracted VmPoolMapRowMapper in VmPoolDAODbFacadeImpl as per the
backend's coding conventions.

Change-Id: I8ad16cf87574ac1a8f74b15fd0d2188b4c2083d2
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Inline RolesRowMapper

Inlined RolesRowMapper in RolesDAODbFacadeImpl as per project
conventions.
Additionally, this refactoring will allow the RolesRowMapper to benefit
from the utilities present in BaseDbFacadeDAO, such as Guid mapping
(which will be implemented in a subsequent patch).

Change-Id: I3566fcba185f00e0548265714aa13002e4e60bb2
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Inline RoleGroupMapsRowMapper

Inlined RoleGroupMapsRowMapper in RoleGroupMapsDAODbFacadeImpl as per
project conventions.
Additionally, this refactoring will allow the RoleGroupMapsRowMapper
to benefit from the utilities present in BaseDbFacadeDAO, such as
Guid mapping (which will be implemented in a subsequent patch).

Change-Id: I541535b86dc80279ee95e63751e4395000ea11d1
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Example: Use UUID for handling database Guids

The Postgres JDBC Driver natively supports the java.util.UUID type as a
representation of a database uuid, in both directions -
1. ResultSet#getObject(int) and ResultSet#getObject(String) return a
   UUID instance when applied to a uuid column.
2. PreparedStatement#setObject(int, Object) can receive a UUID and apply
   it to a uuid column.

Using the proper type has several benefits:
1. Save the CPU operations on UUID.getString() and Guid(String) when
   using ResultSet.getObject(int) or ResultSet.getObject(String).
2. Save the CPU operations on Guid.toString() and having the DATABASE
   convert a String passed to a PreparedStatement to a uuid.
3. Bind Guids as native uuids instead of varchars, making sure that
   indexes will be used in the query.

This patch is an example how this should be done, presented on
StoragePoolIsoMapDAODbFacadeImpl.
This DAO was chosen since it's one of the simplest DAOs and requires the
least amount of code changes. If this patch will be accepted, subsequent
patches will apply the same changes to the other DAOs.

Change-Id: I4d30e1ab7303ecad68dbc9005ac5c6ef733f1707
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Don't create Guid from String in DAO module

This patch continues the work done in the previous patch and utilizes
the new mechanisms to pass Guids as uuids to and from the database
throughout the various DAOs.

Change-Id: I0f6aec5aa512638c2dbfaa567784f295d01e5ac9
Signed-off-by: Allon Mureinik <amureini@redhat.com>