From: <jsh...@rh...> - 2009-01-14 15:28:10
|
<!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] [2625] fix some AutoGroup queries</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>2625</dd> <dt>Author</dt> <dd>jshaughn</dd> <dt>Date</dt> <dd>2009-01-14 09:28:04 -0600 (Wed, 14 Jan 2009)</dd> </dl> <h3>Log Message</h3> <pre>fix some AutoGroup queries</pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulescoredomainsrcmainjavaorgrhqcoredomainresourceResourcejava">rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulescoredomainsrcmainjavaorgrhqcoredomainresourceResourcejava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java (2624 => 2625)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java 2009-01-14 14:32:13 UTC (rev 2624) +++ rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java 2009-01-14 15:28:04 UTC (rev 2625) </span><span class="lines">@@ -87,62 +87,44 @@ </span><span class="cx"> @Entity @NamedQueries( { @NamedQuery(name = Resource.QUERY_FIND_PROBLEM_RESOURCES_ALERT_ADMIN, query = "" // </span><span class="rem">- + " SELECT DISTINCT new org.rhq.core.domain.resource.composite.ProblemResourceComposite" - + " ( " </span><span class="add">+ + " SELECT DISTINCT new org.rhq.core.domain.resource.composite.ProblemResourceComposite" + " ( " </span><span class="cx"> + " res.id, res.name, avail.availabilityType, COUNT(DISTINCT alert.id)" </span><span class="rem">- + " ) " - + " FROM Resource res " - + " LEFT JOIN res.availability avail " - + " LEFT JOIN res.alertDefinitions alertDef " </span><span class="add">+ + " ) " + " FROM Resource res " + " LEFT JOIN res.availability avail " + " LEFT JOIN res.alertDefinitions alertDef " </span><span class="cx"> + " LEFT JOIN alertDef.alerts alert " </span><span class="rem">- + " WHERE avail.endTime IS NULL " - + " AND res.inventoryStatus = 'COMMITTED' " </span><span class="add">+ + " WHERE avail.endTime IS NULL " + " AND res.inventoryStatus = 'COMMITTED' " </span><span class="cx"> + " AND (( avail.availabilityType = 0 AND avail.startTime >= :oldest) " + " OR (alert.ctime >= :oldest)) " + "GROUP BY res.id, res.name, avail.availabilityType "), @NamedQuery(name = Resource.QUERY_FIND_PROBLEM_RESOURCES_ALERT, query = "" // </span><span class="rem">- + " SELECT DISTINCT new org.rhq.core.domain.resource.composite.ProblemResourceComposite" - + " ( " </span><span class="add">+ + " SELECT DISTINCT new org.rhq.core.domain.resource.composite.ProblemResourceComposite" + " ( " </span><span class="cx"> + " res.id, res.name, avail.availabilityType, COUNT(DISTINCT alert.id)" </span><span class="rem">- + " ) " - + " FROM Resource res " - + " LEFT JOIN res.availability avail " - + " LEFT JOIN res.alertDefinitions alertDef " </span><span class="add">+ + " ) " + " FROM Resource res " + " LEFT JOIN res.availability avail " + " LEFT JOIN res.alertDefinitions alertDef " </span><span class="cx"> + " LEFT JOIN alertDef.alerts alert " + " WHERE avail.endTime IS NULL " + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" </span><span class="rem">- + " AND res.inventoryStatus = 'COMMITTED' " - + " AND (( avail.availabilityType = 0 AND avail.startTime >= :oldest) " - + " OR (alert.ctime >= :oldest)) " + "GROUP BY res.id, res.name, avail.availabilityType "), </span><span class="add">+ + " AND res.inventoryStatus = 'COMMITTED' " + " AND (( avail.availabilityType = 0 AND avail.startTime >= :oldest) " + + " OR (alert.ctime >= :oldest)) " + + "GROUP BY res.id, res.name, avail.availabilityType "), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_PROBLEM_RESOURCES_ALERT_COUNT_ADMIN, query = "" // </span><span class="rem">- + " SELECT COUNT( DISTINCT res.id ) " - + " FROM Resource res " - + " LEFT JOIN res.availability avail " </span><span class="add">+ + " SELECT COUNT( DISTINCT res.id ) " + " FROM Resource res " + " LEFT JOIN res.availability avail " </span><span class="cx"> + " LEFT JOIN res.alertDefinitions alertDef " </span><span class="rem">- + " LEFT JOIN alertDef.alerts alert " - + " WHERE avail.endTime IS NULL " </span><span class="add">+ + " LEFT JOIN alertDef.alerts alert " + " WHERE avail.endTime IS NULL " </span><span class="cx"> + " AND res.inventoryStatus = 'COMMITTED' " </span><span class="rem">- + " AND (( avail.availabilityType = 0 AND avail.startTime >= :oldest) " - + " OR (alert.ctime >= :oldest)) "), </span><span class="add">+ + " AND (( avail.availabilityType = 0 AND avail.startTime >= :oldest) " + " OR (alert.ctime >= :oldest)) "), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_PROBLEM_RESOURCES_ALERT_COUNT, query = "" // </span><span class="rem">- + " SELECT COUNT( DISTINCT res.id ) " - + " FROM Resource res " // </span><span class="add">+ + " SELECT COUNT( DISTINCT res.id ) " + " FROM Resource res " // </span><span class="cx"> + " LEFT JOIN res.availability avail " // + " LEFT JOIN res.alertDefinitions alertDef " // + " LEFT JOIN alertDef.alerts alert " // + " WHERE avail.endTime IS NULL " // </span><span class="rem">- + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" - + " AND res.inventoryStatus = 'COMMITTED' " // </span><span class="add">+ + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" + " AND res.inventoryStatus = 'COMMITTED' " // </span><span class="cx"> + " AND (( avail.availabilityType = 0 AND avail.startTime >= :oldest) " // + " OR (alert.ctime >= :oldest)) "), /* the following three are for auto-group details */ @NamedQuery(name = Resource.QUERY_FIND_BY_PARENT_AND_TYPE, query = "" // </span><span class="rem">- + " SELECT res, a.availabilityType " - + " FROM Resource res " // - + " JOIN res.currentAvailability a " - + " WHERE res.parentResource = :parent " // - + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" - + " AND res.resourceType = :type " // </span><span class="add">+ + " SELECT res, a.availabilityType " + " FROM Resource res " // + + " JOIN res.currentAvailability a " + " WHERE res.parentResource = :parent " // + + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" + " AND res.resourceType = :type " // </span><span class="cx"> + " AND res.inventoryStatus = :inventoryStatus " // + "ORDER BY res.name"), @NamedQuery(name = Resource.QUERY_FIND_BY_PARENT_AND_TYPE_ADMIN, query = "" // </span><span class="lines">@@ -159,11 +141,9 @@ </span><span class="cx"> + " AND res.resourceType.id = :type " // + " AND res.inventoryStatus = :inventoryStatus "), @NamedQuery(name = Resource.QUERY_FIND_BY_PARENT_AND_INVENTORY_STATUS, query = "" // </span><span class="rem">- + "SELECT res " - + " FROM Resource res " // </span><span class="add">+ + "SELECT res " + " FROM Resource res " // </span><span class="cx"> + " WHERE res.parentResource = :parent " // </span><span class="rem">- + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" - + " AND res.inventoryStatus = :inventoryStatus "), </span><span class="add">+ + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" + " AND res.inventoryStatus = :inventoryStatus "), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_BY_PARENT_AND_INVENTORY_STATUS_ADMIN, query = "" // + "SELECT res " + " FROM Resource res " // + " WHERE res.parentResource = :parent " // </span><span class="lines">@@ -178,8 +158,7 @@ </span><span class="cx"> + " WHERE res.parentResource.id = :parentResourceId " // + " AND (:inventoryStatus = res.inventoryStatus OR :inventoryStatus is null)"), @NamedQuery(name = Resource.QUERY_FIND_CHILDREN, query = "" // </span><span class="rem">- + "SELECT res " - + " FROM Resource res " // </span><span class="add">+ + "SELECT res " + " FROM Resource res " // </span><span class="cx"> + " WHERE res.parentResource = :parent " // + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)"), @NamedQuery(name = Resource.QUERY_FIND_CHILDREN_ADMIN, query = "" // </span><span class="lines">@@ -191,111 +170,86 @@ </span><span class="cx"> + " FROM Resource res JOIN res.childResources child JOIN res.implicitGroups g JOIN g.roles r JOIN r.subjects s " + " WHERE (res.itime >= :oldestEpochTime OR ((child.itime >= :oldestEpochTime) AND (child.inventoryStatus = 'COMMITTED'))) " + " AND res.resourceType.category = 'PLATFORM' " </span><span class="rem">- + " AND res.inventoryStatus = 'COMMITTED' " - + " AND s = :subject " + "ORDER BY res.itime DESC "), </span><span class="add">+ + " AND res.inventoryStatus = 'COMMITTED' " + " AND s = :subject " + "ORDER BY res.itime DESC "), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_RECENTLY_ADDED_PLATFORMS_ADMIN, query = "" // + " SELECT DISTINCT new org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite(res.id, res.name, res.itime) " + " FROM Resource res JOIN res.childResources child " + " WHERE ((res.itime >= :oldestEpochTime) OR ((child.itime >= :oldestEpochTime) AND (child.inventoryStatus = 'COMMITTED'))) " + " AND res.resourceType.category = 'PLATFORM' " </span><span class="rem">- + " AND res.inventoryStatus = 'COMMITTED' " - + "ORDER BY res.itime DESC "), - @NamedQuery(name = Resource.QUERY_RECENTLY_ADDED_SERVERS, query = "" - + " SELECT DISTINCT new org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite(res.id, res.name, res.itime) " - + " FROM Resource res JOIN res.implicitGroups g JOIN g.roles r JOIN r.subjects s " - + " WHERE res.itime >= :oldestEpochTime " + " AND res.resourceType.category = 'SERVER' " - + " AND res.inventoryStatus = 'COMMITTED' " + " AND res.parentResource.id = :platformId " - + " AND s = :subject " + "ORDER BY res.itime DESC "), </span><span class="add">+ + " AND res.inventoryStatus = 'COMMITTED' " + "ORDER BY res.itime DESC "), + @NamedQuery(name = Resource.QUERY_RECENTLY_ADDED_SERVERS, query = "" + " SELECT DISTINCT new org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite(res.id, res.name, res.itime) " + + " FROM Resource res JOIN res.implicitGroups g JOIN g.roles r JOIN r.subjects s " + " WHERE res.itime >= :oldestEpochTime " + " AND res.resourceType.category = 'SERVER' " + + " AND res.inventoryStatus = 'COMMITTED' " + " AND res.parentResource.id = :platformId " + " AND s = :subject " + "ORDER BY res.itime DESC "), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_RECENTLY_ADDED_SERVERS_ADMIN, query = "" </span><span class="rem">- + " SELECT DISTINCT new org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite(res.id, res.name, res.itime) " - + " FROM Resource res " + " WHERE res.itime >= :oldestEpochTime " - + " AND res.resourceType.category = 'SERVER' " + " AND res.inventoryStatus = 'COMMITTED' " </span><span class="add">+ + " SELECT DISTINCT new org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite(res.id, res.name, res.itime) " + " FROM Resource res " + + " WHERE res.itime >= :oldestEpochTime " + " AND res.resourceType.category = 'SERVER' " + " AND res.inventoryStatus = 'COMMITTED' " </span><span class="cx"> + " AND res.parentResource.id = :platformId " + "ORDER BY res.itime DESC "), @NamedQuery(name = Resource.QUERY_FIND_AVAILABILITY_BY_RESOURCE_ID, query = "" // </span><span class="rem">- + "SELECT new org.rhq.core.domain.resource.composite.ResourceWithAvailability(res, a.availabilityType) " - + " FROM Resource res " // </span><span class="add">+ + "SELECT new org.rhq.core.domain.resource.composite.ResourceWithAvailability(res, a.availabilityType) " + " FROM Resource res " // </span><span class="cx"> + " JOIN res.currentAvailability a " // </span><span class="rem">- + " WHERE res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" - + " AND res.id = :id "), </span><span class="add">+ + " WHERE res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" + " AND res.id = :id "), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_AVAILABILITY_BY_RESOURCE_ID_ADMIN, query = "" // </span><span class="rem">- + "SELECT new org.rhq.core.domain.resource.composite.ResourceWithAvailability(res, a.availabilityType) " - + " FROM Resource res JOIN res.currentAvailability a " // </span><span class="add">+ + "SELECT new org.rhq.core.domain.resource.composite.ResourceWithAvailability(res, a.availabilityType) " + " FROM Resource res JOIN res.currentAvailability a " // </span><span class="cx"> + " WHERE res.id = :id "), @NamedQuery(name = Resource.QUERY_FIND_AVAILABILITY_BY_RESOURCE_IDS, query = "" // </span><span class="rem">- + "SELECT res, a.availabilityType " - + " FROM Resource res " // </span><span class="add">+ + "SELECT res, a.availabilityType " + " FROM Resource res " // </span><span class="cx"> + " LEFT OUTER JOIN res.availability a " // + " WHERE (a is null OR a.startTime = (SELECT MAX(aa.startTime) FROM Availability aa where res.id = aa.resource.id)) " // + " AND res.id IN (:ids) " // </span><span class="rem">- + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" - + "ORDER BY res.name "), </span><span class="add">+ + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" + "ORDER BY res.name "), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_AVAILABILITY_BY_RESOURCE_IDS_ADMIN, query = "" // </span><span class="rem">- + "SELECT res, a.availabilityType " - + " FROM Resource res " // </span><span class="add">+ + "SELECT res, a.availabilityType " + " FROM Resource res " // </span><span class="cx"> + " LEFT OUTER JOIN res.availability a " // + " WHERE (a is null OR a.startTime = (SELECT MAX(aa.startTime) FROM Availability aa where res.id = aa.resource.id)) " // + " AND res.id IN (:ids) " // + "ORDER BY res.name "), @NamedQuery(name = Resource.QUERY_FIND_RESOURCE_AUTOGROUP_COMPOSITE, query = "" </span><span class="rem">- + " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) " - + " FROM Resource res " - + " JOIN res.resourceType rt LEFT JOIN rt.subCategory JOIN res.currentAvailability a " - + " WHERE res.id = :id " - + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" - + "GROUP BY rt "), </span><span class="add">+ + " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) " + " FROM Resource res " + + " JOIN res.resourceType rt LEFT JOIN rt.subCategory JOIN res.currentAvailability a " + " WHERE res.id = :id " + + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" + "GROUP BY res.parentResource, rt "), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_RESOURCE_AUTOGROUPS_COMPOSITE, query = "" // + " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) " + " FROM Resource res " + " JOIN res.resourceType rt JOIN res.currentAvailability a " + " WHERE res.id IN ( :ids ) " </span><span class="rem">- + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" - + "GROUP BY rt "), </span><span class="add">+ + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" + "GROUP BY res.parentResource, rt "), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_RESOURCE_AUTOGROUP_COMPOSITE_ADMIN, query = "" // + " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) " </span><span class="rem">- + " FROM Resource res JOIN res.currentAvailability a JOIN res.resourceType rt LEFT JOIN rt.subCategory " - + " WHERE res.id = :id " + "GROUP BY rt"), </span><span class="add">+ + " FROM Resource res JOIN res.currentAvailability a JOIN res.resourceType rt LEFT JOIN rt.subCategory " + " WHERE res.id = :id " + "GROUP BY res.parentResource, rt"), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_RESOURCE_AUTOGROUPS_COMPOSITE_ADMIN, query = "" // + " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) " </span><span class="rem">- + " FROM Resource res JOIN res.currentAvailability a JOIN res.resourceType rt LEFT JOIN rt.subCategory " - + " WHERE res.id IN ( :ids ) " + "GROUP BY rt"), </span><span class="add">+ + " FROM Resource res JOIN res.currentAvailability a JOIN res.resourceType rt LEFT JOIN rt.subCategory " + " WHERE res.id IN ( :ids ) " + "GROUP BY res.parentResource, rt"), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_CHILDREN_AUTOGROUP_COMPOSITES, query = "" </span><span class="rem">- + " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) " - + " FROM Resource res " - + " JOIN res.resourceType rt LEFT JOIN rt.subCategory JOIN res.currentAvailability a " - + " WHERE res.parentResource = :parent " // - + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" - + " AND res.inventoryStatus = :inventoryStatus " // - + "GROUP BY rt "), </span><span class="add">+ + " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) " + " FROM Resource res " + + " JOIN res.resourceType rt LEFT JOIN rt.subCategory JOIN res.currentAvailability a " + " WHERE res.parentResource = :parent " // + + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" + " AND res.inventoryStatus = :inventoryStatus " // + + "GROUP BY res.parentResource, rt "), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_CHILDREN_AUTOGROUP_COMPOSITES_ADMIN, query = "" // </span><span class="rem">- + " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) " - + " FROM Resource res " // </span><span class="add">+ + " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) " + " FROM Resource res " // </span><span class="cx"> + " JOIN res.currentAvailability a " // + " JOIN res.resourceType rt LEFT JOIN rt.subCategory " // + " WHERE res.parentResource = :parent " // </span><span class="rem">- + " AND res.inventoryStatus = :inventoryStatus GROUP BY rt"), </span><span class="add">+ + " AND res.inventoryStatus = :inventoryStatus GROUP BY res.parentResource, rt"), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_CHILDREN_AUTOGROUP_COMPOSITES_BY_TYPE, query = "" </span><span class="rem">- + " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) " - + " FROM Resource res " - + " JOIN res.resourceType rt LEFT JOIN rt.subCategory JOIN res.currentAvailability a " - + " WHERE res.parentResource = :parent " // </span><span class="add">+ + " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) " + " FROM Resource res " + + " JOIN res.resourceType rt LEFT JOIN rt.subCategory JOIN res.currentAvailability a " + " WHERE res.parentResource = :parent " // </span><span class="cx"> + " AND rt.id IN ( :resourceTypeIds ) " // </span><span class="rem">- + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" - + " AND res.inventoryStatus = :inventoryStatus " // - + "GROUP BY rt "), </span><span class="add">+ + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" + " AND res.inventoryStatus = :inventoryStatus " // + + "GROUP BY res.parentResource, rt "), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_CHILDREN_AUTOGROUP_COMPOSITES_BY_TYPE_ADMIN, query = "" // </span><span class="rem">- + " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) " - + " FROM Resource res " // </span><span class="add">+ + " SELECT new org.rhq.core.domain.resource.group.composite.AutoGroupComposite(avg(a.availabilityType), res.parentResource, rt, count(res)) " + " FROM Resource res " // </span><span class="cx"> + " JOIN res.currentAvailability a " // + " JOIN res.resourceType rt LEFT JOIN rt.subCategory " // + " WHERE res.parentResource = :parent " // + " AND rt.id IN ( :resourceTypeIds ) " // </span><span class="rem">- + " AND res.inventoryStatus = :inventoryStatus GROUP BY rt"), </span><span class="add">+ + " AND res.inventoryStatus = :inventoryStatus GROUP BY res.parentResource, rt"), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_CHILDREN_BY_CATEGORY_AND_INVENTORY_STATUS, query = "" // + "SELECT res " // + " FROM Resource res " // + " WHERE res.parentResource = :parent " // + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" </span><span class="rem">- + " AND res.resourceType.category = :category " + " AND res.inventoryStatus = :status "), </span><span class="add">+ + " AND res.resourceType.category = :category " + + " AND res.inventoryStatus = :status "), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_CHILDREN_BY_CATEGORY_AND_INVENTORY_STATUS_ADMIN, query = "" // + "SELECT res " // + " FROM Resource res " // </span><span class="lines">@@ -351,8 +305,7 @@ </span><span class="cx"> + "SELECT res " // + " FROM Resource res " // + " WHERE res.resourceType = :type " // </span><span class="rem">- + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" - + " AND res.id IN ( :ids ) "), </span><span class="add">+ + " AND res.id IN (SELECT rr.id FROM Resource rr JOIN rr.implicitGroups g JOIN g.roles r JOIN r.subjects s WHERE s = :subject)" + " AND res.id IN ( :ids ) "), </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_BY_TYPE_AND_IDS_ADMIN, query = "" // + "SELECT res " // + " FROM Resource res " // </span><span class="lines">@@ -422,8 +375,7 @@ </span><span class="cx"> + " FROM ResourceGroup rg JOIN rg.implicitResources res LEFT JOIN res.parentResource parent " // + " LEFT JOIN res.currentAvailability a " // + " WHERE rg.id = :groupId " // </span><span class="rem">- + " AND rg.id IN (SELECT irg.id FROM ResourceGroup irg JOIN irg.roles r JOIN r.subjects s WHERE s = :subject) " - + " AND res.inventoryStatus = 'COMMITTED' "), // </span><span class="add">+ + " AND rg.id IN (SELECT irg.id FROM ResourceGroup irg JOIN irg.roles r JOIN r.subjects s WHERE s = :subject) " + " AND res.inventoryStatus = 'COMMITTED' "), // </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_IMPLICIT_RESOURCES_WITH_AVAILABILITY_FOR_RESOURCE_GROUP_ADMIN, query = "" // + "SELECT new org.rhq.core.domain.resource.composite.ResourceWithAvailability(res, " // + " (SELECT parentRes FROM Resource parentRes WHERE parentRes = res.parentResource), " // </span><span class="lines">@@ -633,19 +585,13 @@ </span><span class="cx"> @NamedQuery(name = Resource.QUERY_FIND_BY_ID_WITH_INSTALLED_PACKAGE_HIST, query = "SELECT r FROM Resource AS r LEFT JOIN r.installedPackageHistory ip WHERE r.id = :id"), @NamedQuery(name = Resource.QUERY_FIND_PLATFORM_BY_AGENT, query = "SELECT res FROM Resource res WHERE res.resourceType.category = :category AND res.agent = :agent"), @NamedQuery(name = Resource.QUERY_FIND_PAREBT_ID, query = "SELECT res.parentResource.id FROM Resource AS res WHERE res.id = :id"), </span><span class="rem">- @NamedQuery(name = Resource.QUERY_FIND_ROOT_PLATFORM_OF_RESOURCE, query = "" - + "SELECT DISTINCT r FROM Resource r " - + "WHERE r.parentResource.id is null " - + "AND " - + " ( " - + " r.id = :resourceId " - + " OR EXISTS (SELECT rr FROM Resource rr WHERE rr.id = :resourceId AND rr.parentResource = r) " </span><span class="add">+ @NamedQuery(name = Resource.QUERY_FIND_ROOT_PLATFORM_OF_RESOURCE, query = "" + "SELECT DISTINCT r FROM Resource r " + "WHERE r.parentResource.id is null " + "AND " + " ( " + + " r.id = :resourceId " + " OR EXISTS (SELECT rr FROM Resource rr WHERE rr.id = :resourceId AND rr.parentResource = r) " </span><span class="cx"> + " OR EXISTS (SELECT rr FROM Resource rr WHERE rr.id = :resourceId AND rr.parentResource.parentResource = r) " + " OR EXISTS (SELECT rr FROM Resource rr WHERE rr.id = :resourceId AND rr.parentResource.parentResource.parentResource = r) " + " OR EXISTS (SELECT rr FROM Resource rr WHERE rr.id = :resourceId AND rr.parentResource.parentResource.parentResource.parentResource = r) " + " OR EXISTS (SELECT rr FROM Resource rr WHERE rr.id = :resourceId AND rr.parentResource.parentResource.parentResource.parentResource.parentResource = r) " </span><span class="rem">- + " OR EXISTS (SELECT rr FROM Resource rr WHERE rr.id = :resourceId AND rr.parentResource.parentResource.parentResource.parentResource.parentResource.parentResource = r) " - + " )") }) </span><span class="add">+ + " OR EXISTS (SELECT rr FROM Resource rr WHERE rr.id = :resourceId AND rr.parentResource.parentResource.parentResource.parentResource.parentResource.parentResource = r) " + " )") }) </span><span class="cx"> @SequenceGenerator(name = "RHQ_RESOURCE_SEQ", sequenceName = "RHQ_RESOURCE_ID_SEQ") @Table(name = "RHQ_RESOURCE") @XmlAccessorType(XmlAccessType.FIELD) </span><span class="lines">@@ -1571,8 +1517,7 @@ </span><span class="cx"> //Subject owner; //String location; parentResource = (Resource) in.readObject(); </span><span class="rem">- resourceType = new ResourceType(in.readUTF(), in.readUTF(), (ResourceCategory) in.readObject(), - (parentResource != null) ? parentResource.getResourceType() : null); </span><span class="add">+ resourceType = new ResourceType(in.readUTF(), in.readUTF(), (ResourceCategory) in.readObject(), (parentResource != null) ? parentResource.getResourceType() : null); </span><span class="cx"> childResources = (Set<Resource>) in.readObject(); pluginConfiguration = (Configuration) in.readObject(); </span> </pre> </div> </div> </body> </html> |