Allon Mureinik has posted comments on this change.
Change subject: core: AsyncTaskEntities - batch + get by task id
......................................................................
Patch Set 11: (9 inline comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/AsyncTaskUtils.java
Line 53: }
Line 54: }
Line 55:
Line 56: private static List<AsyncTaskEntity> buildAsyncTaskEntities(Guid
taskId, Map<Guid, VdcObjectType> entitiesMap) {
Line 57: List<AsyncTaskEntity> results = new ArrayList<>();
Initialize it with the size of the map
Line 58: for (Map.Entry<Guid, VdcObjectType> entry :
entitiesMap.entrySet()) {
Line 59: results.add(new AsyncTaskEntity(taskId, entry.getValue(),
entry.getKey()));
Line 60:
Line 61: }
....................................................
File
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/AsyncTaskDAODbFacadeImpl.java
Line 44: }
Line 45:
Line 46: private static class AsyncTaskEntityRowMapper implements
RowMapper<AsyncTaskEntity> {
Line 47:
Line 48: public static RowMapper<AsyncTaskEntity> instance = new
AsyncTaskEntityRowMapper();
should be final
Line 49:
Line 50: @Override
Line 51: public AsyncTaskEntity mapRow(ResultSet rs, int rowNum) throws
SQLException {
Line 52: AsyncTaskEntity entity = new AsyncTaskEntity();
Line 49:
Line 50: @Override
Line 51: public AsyncTaskEntity mapRow(ResultSet rs, int rowNum) throws
SQLException {
Line 52: AsyncTaskEntity entity = new AsyncTaskEntity();
Line 53:
entity.setEntityId(Guid.createGuidFromString(rs.getString("entity_id")));
use getGuid
Line 54:
entity.setTaskId(Guid.createGuidFromString(rs.getString("async_task_id")));
Line 55:
entity.setEntityType(VdcObjectType.valueOf(rs.getString("entity_type")));
Line 56: return entity;
Line 57: }
Line 50: @Override
Line 51: public AsyncTaskEntity mapRow(ResultSet rs, int rowNum) throws
SQLException {
Line 52: AsyncTaskEntity entity = new AsyncTaskEntity();
Line 53:
entity.setEntityId(Guid.createGuidFromString(rs.getString("entity_id")));
Line 54:
entity.setTaskId(Guid.createGuidFromString(rs.getString("async_task_id")));
use getGuid
Line 55:
entity.setEntityType(VdcObjectType.valueOf(rs.getString("entity_type")));
Line 56: return entity;
Line 57: }
Line 58: }
Line 51: public AsyncTaskEntity mapRow(ResultSet rs, int rowNum) throws
SQLException {
Line 52: AsyncTaskEntity entity = new AsyncTaskEntity();
Line 53:
entity.setEntityId(Guid.createGuidFromString(rs.getString("entity_id")));
Line 54:
entity.setTaskId(Guid.createGuidFromString(rs.getString("async_task_id")));
Line 55:
entity.setEntityType(VdcObjectType.valueOf(rs.getString("entity_type")));
why is this passed as a string and not as an int?
Line 56: return entity;
Line 57: }
Line 58: }
Line 59:
Line 114: return
SerializationFactory.getSerializer().serialize(params);
Line 115: }
Line 116: }
Line 117:
Line 118: private MapSqlParameterMapper<AsyncTaskEntity> mapper = new
MapSqlParameterMapper<AsyncTaskEntity>() {
why isn't this static final?
Line 119:
Line 120: @Override
Line 121: public MapSqlParameterSource map(AsyncTaskEntity entity) {
Line 122: CustomMapSqlParameterSource paramSource =
getCustomMapSqlParameterSource();
Line 121: public MapSqlParameterSource map(AsyncTaskEntity entity) {
Line 122: CustomMapSqlParameterSource paramSource =
getCustomMapSqlParameterSource();
Line 123: paramSource.addValue("task_id", entity.getTaskId()).
Line 124: addValue("entity_id", entity.getEntityId()).
Line 125: addValue("entity_type",
entity.getEntityType().toString());
why as a string and not as an int?
Line 126: return paramSource;
Line 127:
Line 128: }
Line 129: };
....................................................
File
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/AsyncTaskDAOTest.java
Line 280: for (AsyncTaskEntity entity : entities) {
Line 281: assertTrue(entities.contains(entity));
Line 282: }
Line 283:
Line 284: // TODO: Missing DAO API to get all entities associated with
a single task
please do :-)
Line 285: }
....................................................
File packaging/dbscripts/async_tasks_sp.sql
Line 112: CREATE OR REPLACE FUNCTION GetAsyncTaskEntitiesByTaskId(v_task_id
UUID)
Line 113: RETURNS SETOF async_tasks_entities
Line 114: AS $procedure$
Line 115: BEGIN
Line 116: RETURN QUERY SELECT * FROM async_tasks_entities
please move FROM to a new line
Line 117: WHERE async_task_id = v_task_id;
Line 118: END; $procedure$
Line 119: LANGUAGE plpgsql;
Line 120:
--
To view, visit http://gerrit.ovirt.org/16447
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb4889cbc71b9beadf107430cdc0d5db3b081dea
Gerrit-PatchSet: 11
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Eli Mesika <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches