From: <js...@rh...> - 2009-09-03 18:02:37
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } --></style> <title>[rhq-project.org rhq] [5115] [RHQ-2403] Refactoring findByCriteria methods in managers to delegate to CriteriaQueryRunner to ensure that any persistent collections that are mapped as "bags" will get loaded, provided they are specified in the criteria.</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>5115</dd> <dt>Author</dt> <dd>jsanda</dd> <dt>Date</dt> <dd>2009-09-03 13:02:26 -0500 (Thu, 03 Sep 2009)</dd> </dl> <h3>Log Message</h3> <pre>[RHQ-2403] Refactoring findByCriteria methods in managers to delegate to CriteriaQueryRunner to ensure that any persistent collections that are mapped as "bags" will get loaded, provided they are specified in the criteria.</pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserveralertAlertDefinitionManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserveralertAlertManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverauthSubjectManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverauthzRoleManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseservercontentChannelManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ChannelManagerBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseservereventEventManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/event/EventManagerBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseservermeasurementMeasurementDefinitionManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseservermeasurementMeasurementScheduleManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserveroperationOperationManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverresourceResourceTypeManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverresourcegroupResourceGroupManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserveralertAlertDefinitionManagerBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java (5114 => 5115)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java 2009-09-03 17:42:59 UTC (rev 5114) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java 2009-09-03 18:02:26 UTC (rev 5115) </span><span class="lines">@@ -50,6 +50,7 @@ </span><span class="cx"> import org.rhq.core.domain.util.PageList; import org.rhq.core.domain.util.PageOrdering; import org.rhq.core.domain.util.PersistenceUtility; </span><span class="add">+import org.rhq.core.domain.util.CriteriaQueryRunner; </span><span class="cx"> import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.alert.engine.AlertDefinitionEvent; import org.rhq.enterprise.server.authz.AuthorizationManagerLocal; </span><span class="lines">@@ -632,12 +633,7 @@ </span><span class="cx"> .getId()); } </span><span class="rem">- Query query = generator.getQuery(entityManager); - Query countQuery = generator.getCountQuery(entityManager); - - long count = (Long) countQuery.getSingleResult(); - List<AlertDefinition> alertDefinitions = query.getResultList(); - - return new PageList<AlertDefinition>(alertDefinitions, (int) count, criteria.getPageControl()); </span><span class="add">+ CriteriaQueryRunner<AlertDefinition> queryRunner = new CriteriaQueryRunner(criteria, generator, entityManager); + return queryRunner.execute(); </span><span class="cx"> } } \ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserveralertAlertManagerBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java (5114 => 5115)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java 2009-09-03 17:42:59 UTC (rev 5114) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java 2009-09-03 18:02:26 UTC (rev 5115) </span><span class="lines">@@ -72,6 +72,7 @@ </span><span class="cx"> import org.rhq.core.domain.util.PageList; import org.rhq.core.domain.util.PageOrdering; import org.rhq.core.domain.util.PersistenceUtility; </span><span class="add">+import org.rhq.core.domain.util.CriteriaQueryRunner; </span><span class="cx"> import org.rhq.core.util.collection.ArrayUtils; import org.rhq.core.util.jdbc.JDBCUtil; import org.rhq.enterprise.server.RHQConstants; </span><span class="lines">@@ -903,14 +904,11 @@ </span><span class="cx"> "alertDefinition.resource", subject.getId()); } </span><span class="rem">- Query query = generator.getQuery(entityManager); - Query countQuery = generator.getCountQuery(entityManager); </span><span class="add">+ CriteriaQueryRunner<Alert> queryRunner = new CriteriaQueryRunner(criteria, generator, entityManager); + PageList<Alert> alerts = queryRunner.execute(); </span><span class="cx"> </span><span class="rem">- long count = (Long) countQuery.getSingleResult(); - List<Alert> alerts = query.getResultList(); - </span><span class="cx"> fetchCollectionFields(alerts); </span><span class="rem">- return new PageList<Alert>(alerts, (int) count, criteria.getPageControl()); </span><span class="add">+ return alerts; </span><span class="cx"> } } \ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverauthSubjectManagerBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java (5114 => 5115)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java 2009-09-03 17:42:59 UTC (rev 5114) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java 2009-09-03 18:02:26 UTC (rev 5115) </span><span class="lines">@@ -51,6 +51,7 @@ </span><span class="cx"> import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; import org.rhq.core.domain.util.PersistenceUtility; </span><span class="add">+import org.rhq.core.domain.util.CriteriaQueryRunner; </span><span class="cx"> import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.authz.AuthorizationManagerLocal; import org.rhq.enterprise.server.authz.PermissionException; </span><span class="lines">@@ -647,13 +648,8 @@ </span><span class="cx"> public PageList<Subject> findSubjectsByCriteria(Subject subject, SubjectCriteria criteria) { CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria); </span><span class="rem">- Query query = generator.getQuery(entityManager); - Query countQuery = generator.getCountQuery(entityManager); - - long count = (Long) countQuery.getSingleResult(); - List<Subject> subjects = query.getResultList(); - - return new PageList<Subject>(subjects, (int) count, criteria.getPageControl()); </span><span class="add">+ CriteriaQueryRunner<Subject> queryRunner = new CriteriaQueryRunner(criteria, generator, entityManager); + return queryRunner.execute(); </span><span class="cx"> } } \ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverauthzRoleManagerBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java (5114 => 5115)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java 2009-09-03 17:42:59 UTC (rev 5114) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java 2009-09-03 18:02:26 UTC (rev 5115) </span><span class="lines">@@ -43,6 +43,7 @@ </span><span class="cx"> import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; import org.rhq.core.domain.util.PersistenceUtility; </span><span class="add">+import org.rhq.core.domain.util.CriteriaQueryRunner; </span><span class="cx"> import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.auth.SubjectManagerLocal; </span><span class="lines">@@ -565,13 +566,8 @@ </span><span class="cx"> CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria); </span><span class="rem">- Query query = generator.getQuery(entityManager); - Query countQuery = generator.getCountQuery(entityManager); - - long count = (Long) countQuery.getSingleResult(); - List<Role> roles = query.getResultList(); - - return new PageList<Role>(roles, (int) count, criteria.getPageControl()); </span><span class="add">+ CriteriaQueryRunner<Role> queryRunner = new CriteriaQueryRunner(criteria, generator, entityManager); + return queryRunner.execute(); </span><span class="cx"> } } \ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseservercontentChannelManagerBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ChannelManagerBean.java (5114 => 5115)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ChannelManagerBean.java 2009-09-03 17:42:59 UTC (rev 5114) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ChannelManagerBean.java 2009-09-03 18:02:26 UTC (rev 5115) </span><span class="lines">@@ -49,6 +49,7 @@ </span><span class="cx"> import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; import org.rhq.core.domain.util.PersistenceUtility; </span><span class="add">+import org.rhq.core.domain.util.CriteriaQueryRunner; </span><span class="cx"> import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.authz.AuthorizationManagerLocal; import org.rhq.enterprise.server.authz.PermissionException; </span><span class="lines">@@ -498,13 +499,8 @@ </span><span class="cx"> public PageList<Channel> findChannelsByCriteria(Subject subject, ChannelCriteria criteria) { CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria); </span><span class="rem">- Query query = generator.getQuery(entityManager); - Query countQuery = generator.getCountQuery(entityManager); - - long count = (Long) countQuery.getSingleResult(); - List<Channel> channels = query.getResultList(); - - return new PageList<Channel>(channels, (int) count, criteria.getPageControl()); </span><span class="add">+ CriteriaQueryRunner<Channel> queryRunner = new CriteriaQueryRunner(criteria, generator, entityManager); + return queryRunner.execute(); </span><span class="cx"> } @SuppressWarnings("unchecked") </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseservereventEventManagerBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/event/EventManagerBean.java (5114 => 5115)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/event/EventManagerBean.java 2009-09-03 17:42:59 UTC (rev 5114) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/event/EventManagerBean.java 2009-09-03 18:02:26 UTC (rev 5115) </span><span class="lines">@@ -67,6 +67,7 @@ </span><span class="cx"> import org.rhq.core.domain.util.PageList; import org.rhq.core.domain.util.PageOrdering; import org.rhq.core.domain.util.PersistenceUtility; </span><span class="add">+import org.rhq.core.domain.util.CriteriaQueryRunner; </span><span class="cx"> import org.rhq.core.util.jdbc.JDBCUtil; import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.alert.engine.AlertConditionCacheManagerLocal; </span><span class="lines">@@ -714,13 +715,8 @@ </span><span class="cx"> "source.resource", subject.getId()); } </span><span class="rem">- Query query = generator.getQuery(entityManager); - Query countQuery = generator.getCountQuery(entityManager); - - long count = (Long) countQuery.getSingleResult(); - List<Event> results = query.getResultList(); - - return new PageList<Event>(results, (int) count, criteria.getPageControl()); </span><span class="add">+ CriteriaQueryRunner<Event> queryRunner = new CriteriaQueryRunner(criteria, generator, entityManager); + return queryRunner.execute(); </span><span class="cx"> } } </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseservermeasurementMeasurementDefinitionManagerBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java (5114 => 5115)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java 2009-09-03 17:42:59 UTC (rev 5114) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDefinitionManagerBean.java 2009-09-03 18:02:26 UTC (rev 5115) </span><span class="lines">@@ -41,6 +41,7 @@ </span><span class="cx"> import org.rhq.core.domain.measurement.MeasurementSchedule; import org.rhq.core.domain.util.CriteriaQueryGenerator; import org.rhq.core.domain.util.PageList; </span><span class="add">+import org.rhq.core.domain.util.CriteriaQueryRunner; </span><span class="cx"> import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.auth.SubjectManagerLocal; </span><span class="lines">@@ -139,12 +140,8 @@ </span><span class="cx"> MeasurementDefinitionCriteria criteria) { CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria); </span><span class="rem">- Query query = generator.getQuery(entityManager); - Query countQuery = generator.getCountQuery(entityManager); - - long count = (Long) countQuery.getSingleResult(); - List<MeasurementDefinition> measurementDefinitions = query.getResultList(); - - return new PageList<MeasurementDefinition>(measurementDefinitions, (int) count, criteria.getPageControl()); </span><span class="add">+ CriteriaQueryRunner<MeasurementDefinition> queryRunner = new CriteriaQueryRunner(criteria, generator, + entityManager); + return queryRunner.execute(); </span><span class="cx"> } } \ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseservermeasurementMeasurementScheduleManagerBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java (5114 => 5115)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java 2009-09-03 17:42:59 UTC (rev 5114) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java 2009-09-03 18:02:26 UTC (rev 5115) </span><span class="lines">@@ -76,6 +76,7 @@ </span><span class="cx"> import org.rhq.core.domain.util.PageList; import org.rhq.core.domain.util.PageOrdering; import org.rhq.core.domain.util.PersistenceUtility; </span><span class="add">+import org.rhq.core.domain.util.CriteriaQueryRunner; </span><span class="cx"> import org.rhq.core.util.collection.ArrayUtils; import org.rhq.core.util.jdbc.JDBCUtil; import org.rhq.enterprise.server.RHQConstants; </span><span class="lines">@@ -1276,13 +1277,9 @@ </span><span class="cx"> .getId()); } </span><span class="rem">- Query query = generator.getQuery(entityManager); - Query countQuery = generator.getCountQuery(entityManager); - - long count = (Long) countQuery.getSingleResult(); - List<MeasurementSchedule> results = query.getResultList(); - - return new PageList<MeasurementSchedule>(results, (int) count, criteria.getPageControl()); </span><span class="add">+ CriteriaQueryRunner<MeasurementSchedule> queryRunner = new CriteriaQueryRunner(criteria, generator, + entityManager); + return queryRunner.execute(); </span><span class="cx"> } } \ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserveroperationOperationManagerBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java (5114 => 5115)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java 2009-09-03 17:42:59 UTC (rev 5114) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java 2009-09-03 18:02:26 UTC (rev 5115) </span><span class="lines">@@ -76,6 +76,7 @@ </span><span class="cx"> import org.rhq.core.domain.util.PageList; import org.rhq.core.domain.util.PageOrdering; import org.rhq.core.domain.util.PersistenceUtility; </span><span class="add">+import org.rhq.core.domain.util.CriteriaQueryRunner; </span><span class="cx"> import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.agentclient.AgentClient; import org.rhq.enterprise.server.alert.engine.AlertConditionCacheManagerLocal; </span><span class="lines">@@ -1790,13 +1791,9 @@ </span><span class="cx"> OperationDefinitionCriteria criteria) { CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria); </span><span class="rem">- Query query = generator.getQuery(entityManager); - Query countQuery = generator.getCountQuery(entityManager); - - long count = (Long) countQuery.getSingleResult(); - List<OperationDefinition> results = query.getResultList(); - - return new PageList<OperationDefinition>(results, (int) count, criteria.getPageControl()); </span><span class="add">+ CriteriaQueryRunner<OperationDefinition> queryRunner = new CriteriaQueryRunner(criteria, generator, + entityManager); + return queryRunner.execute(); </span><span class="cx"> } @SuppressWarnings("unchecked") </span><span class="lines">@@ -1808,13 +1805,9 @@ </span><span class="cx"> .getId()); } </span><span class="rem">- Query query = generator.getQuery(entityManager); - Query countQuery = generator.getCountQuery(entityManager); - - long count = (Long) countQuery.getSingleResult(); - List<ResourceOperationHistory> results = query.getResultList(); - - return new PageList<ResourceOperationHistory>(results, (int) count, criteria.getPageControl()); </span><span class="add">+ CriteriaQueryRunner<ResourceOperationHistory> queryRunner = new CriteriaQueryRunner(criteria, generator, + entityManager); + return queryRunner.execute(); </span><span class="cx"> } @SuppressWarnings("unchecked") </span><span class="lines">@@ -1826,12 +1819,8 @@ </span><span class="cx"> .getId()); } </span><span class="rem">- Query query = generator.getQuery(entityManager); - Query countQuery = generator.getCountQuery(entityManager); - - long count = (Long) countQuery.getSingleResult(); - List<GroupOperationHistory> results = query.getResultList(); - - return new PageList<GroupOperationHistory>(results, (int) count, criteria.getPageControl()); </span><span class="add">+ CriteriaQueryRunner<GroupOperationHistory> queryRunner = new CriteriaQueryRunner(criteria, generator, + entityManager); + return queryRunner.execute(); </span><span class="cx"> } } \ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverresourceResourceTypeManagerBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java (5114 => 5115)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java 2009-09-03 17:42:59 UTC (rev 5114) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java 2009-09-03 18:02:26 UTC (rev 5115) </span><span class="lines">@@ -52,6 +52,7 @@ </span><span class="cx"> import org.rhq.core.domain.util.CriteriaQueryGenerator; import org.rhq.core.domain.util.PageList; import org.rhq.core.domain.util.PersistenceUtility; </span><span class="add">+import org.rhq.core.domain.util.CriteriaQueryRunner; </span><span class="cx"> import org.rhq.core.util.collection.ArrayUtils; import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.authz.AuthorizationManagerLocal; </span><span class="lines">@@ -418,13 +419,8 @@ </span><span class="cx"> public PageList<ResourceType> findResourceTypesByCriteria(Subject subject, ResourceTypeCriteria criteria) { CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria); </span><span class="rem">- Query query = generator.getQuery(entityManager); - Query countQuery = generator.getCountQuery(entityManager); - - long count = (Long) countQuery.getSingleResult(); - List<ResourceType> results = query.getResultList(); - - return new PageList<ResourceType>(results, (int) count, criteria.getPageControl()); </span><span class="add">+ CriteriaQueryRunner<ResourceType> queryRunner = new CriteriaQueryRunner(criteria, generator, entityManager); + return queryRunner.execute(); </span><span class="cx"> } @SuppressWarnings("unchecked") </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverresourcegroupResourceGroupManagerBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java (5114 => 5115)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java 2009-09-03 17:42:59 UTC (rev 5114) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java 2009-09-03 18:02:26 UTC (rev 5115) </span><span class="lines">@@ -77,6 +77,7 @@ </span><span class="cx"> import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; import org.rhq.core.domain.util.PersistenceUtility; </span><span class="add">+import org.rhq.core.domain.util.CriteriaQueryRunner; </span><span class="cx"> import org.rhq.core.util.collection.ArrayUtils; import org.rhq.core.util.jdbc.JDBCUtil; import org.rhq.enterprise.server.RHQConstants; </span><span class="lines">@@ -1316,13 +1317,8 @@ </span><span class="cx"> subject.getId()); } </span><span class="rem">- Query query = generator.getQuery(entityManager); - Query countQuery = generator.getCountQuery(entityManager); - - long count = (Long) countQuery.getSingleResult(); - List<ResourceGroup> results = query.getResultList(); - - return new PageList<ResourceGroup>(results, (int) count, criteria.getPageControl()); </span><span class="add">+ CriteriaQueryRunner<ResourceGroup> queryRunner = new CriteriaQueryRunner(criteria, generator, entityManager); + return queryRunner.execute(); </span><span class="cx"> } } \ No newline at end of file </span> </pre> </div> </div> </body> </html> |