modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
| 4
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
| 9 +
modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
| 76 ++++++----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/assist/GroupSearchAssistant.java
| 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/assist/ResourceSearchAssistant.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/test/ResourceGroupTestBean.java
| 6
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
| 2
7 files changed, 70 insertions(+), 33 deletions(-)
New commits:
commit eded9dd4d1657e25f2f661801ecbc2c11b12214d
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Oct 19 21:32:19 2010 -0400
Updating resource type queries to filter on the deleted flag
Since the deleted flag is new, all existing queries need to be updated
to filter on deleted = false.
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
index 6adee0f..59deef4 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
@@ -65,9 +65,9 @@ import org.jetbrains.annotations.Nullable;
@NamedQuery(name = ConfigurationDefinition.QUERY_FIND_DEPLOYMENT_BY_PACKAGE_TYPE_ID,
query = "SELECT cd FROM PackageType pt JOIN pt.deploymentConfigurationDefinition cd
"
+ "WHERE pt.id = :packageTypeId"),
@NamedQuery(name = ConfigurationDefinition.QUERY_FIND_RESOURCE_BY_RESOURCE_TYPE_ID,
query = "SELECT cd FROM ResourceType rt JOIN rt.resourceConfigurationDefinition cd
"
- + "WHERE rt.id = :resourceTypeId"),
+ + "WHERE rt.id = :resourceTypeId AND rt.deleted = false"),
@NamedQuery(name = ConfigurationDefinition.QUERY_FIND_PLUGIN_BY_RESOURCE_TYPE_ID,
query = "SELECT cd FROM ResourceType rt JOIN rt.pluginConfigurationDefinition cd
"
- + "WHERE rt.id = :resourceTypeId") })
+ + "WHERE rt.id = :resourceTypeId AND rt.deleted = false") })
@SequenceGenerator(name = "SEQ", sequenceName =
"RHQ_CONFIG_DEF_ID_SEQ")
@Table(name = "RHQ_CONFIG_DEF")
@XmlSeeAlso( { PropertyDefinitionSimple.class, PropertyDefinitionList.class,
PropertyDefinitionMap.class })
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
index f7435f3..7d88f6b 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
@@ -55,7 +55,10 @@ public class ResourceTypeCriteria extends Criteria {
private CreateDeletePolicy filterCreateDeletePolicy;
private Boolean filterSupportsManualAdd;
private String filterPluginName; // needs overrides
- private Integer filterBundleTypeId; // needs overrides
+ private Integer filterBundleTypeId; // needs overrides
+ // by default, we don't want to fetch resource types that
+ // are marked deleted
+ private Boolean filterDeleted = false;
private boolean fetchSubCategory;
private boolean fetchChildResourceTypes;
@@ -138,6 +141,10 @@ public class ResourceTypeCriteria extends Criteria {
this.filterBundleTypeId = filterBundleTypeId;
}
+ public void addFilterDeleted(boolean deleted) {
+ this.filterDeleted = deleted;
+ }
+
public void fetchSubCategory(boolean fetchSubCategory) {
this.fetchSubCategory = fetchSubCategory;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
index add1a53..a2ac4e9 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
@@ -79,19 +79,22 @@ import org.rhq.core.domain.util.Summary;
@Table(name = ResourceType.TABLE_NAME)
@SequenceGenerator(name = "SEQ", sequenceName =
"RHQ_RESOURCE_TYPE_ID_SEQ")
@NamedQueries( {
- @NamedQuery(name = ResourceType.QUERY_FIND_BY_PLUGIN, query = "SELECT rt FROM
ResourceType AS rt WHERE rt.plugin = :plugin"),
+ @NamedQuery(name = ResourceType.QUERY_FIND_BY_PLUGIN, query = "SELECT rt FROM
ResourceType AS rt " +
+ "WHERE rt.plugin = :plugin AND rt.deleted = false"),
@NamedQuery(name = ResourceType.QUERY_FIND_BY_NAME_AND_PLUGIN, // TODO: QUERY: names
are case-sensitive
- query = "SELECT rt FROM ResourceType AS rt WHERE LOWER(rt.name) = LOWER(:name)
AND rt.plugin = :plugin"),
- @NamedQuery(name = ResourceType.QUERY_FIND_ALL, query = "SELECT rt FROM
ResourceType AS rt"),
+ query = "SELECT rt FROM ResourceType AS rt WHERE LOWER(rt.name) = LOWER(:name)
AND rt.plugin = :plugin " +
+ "AND rt.deleted = false"),
+ @NamedQuery(name = ResourceType.QUERY_FIND_ALL, query = "SELECT rt FROM
ResourceType AS rt where rt.deleted = false"),
@NamedQuery(name = ResourceType.QUERY_FIND_BY_PARENT_AND_NAME, // TODO: QUERY: Not
looking up by the full key, get rid of this query
- query = "SELECT rt FROM ResourceType AS rt WHERE :parent MEMBER OF
rt.parentResourceTypes AND rt.name = :name"),
+ query = "SELECT rt FROM ResourceType AS rt WHERE :parent MEMBER OF
rt.parentResourceTypes AND rt.name = :name " +
+ "AND rt.deleted = false"),
/* authz'ed queries for ResourceTypeManagerBean */
@NamedQuery(name = ResourceType.QUERY_FIND_CHILDREN, query = "SELECT
rt.childResourceTypes "
- + "FROM ResourceType rt WHERE rt.id = :resourceTypeId "),
+ + "FROM ResourceType rt WHERE rt.id = :resourceTypeId AND rt.deleted =
false"),
@NamedQuery(name = ResourceType.FIND_CHILDREN_BY_PARENT, query = "SELECT
DISTINCT rt FROM ResourceType AS rt "
+ "JOIN FETCH rt.parentResourceTypes AS pa " + // also fetch parents,
as we need them later
- "WHERE pa IN (:resourceType)"),
+ "WHERE rt.deleted = false and pa IN (:resourceType)"),
@NamedQuery(name = ResourceType.FIND_ALL_TEMPLATE_COUNT_COMPOSITES, query =
"" //
+ "SELECT new
org.rhq.core.domain.resource.composite.ResourceTypeTemplateCountComposite" //
+ "(" //
@@ -101,13 +104,14 @@ import org.rhq.core.domain.util.Summary;
+ " (SELECT COUNT(ad) FROM AlertDefinition AS ad WHERE ad.resourceType = rt
AND ad.deleted = FALSE AND ad.enabled = TRUE), "//
+ " (SELECT COUNT(ad) FROM AlertDefinition AS ad WHERE ad.resourceType = rt
AND ad.deleted = FALSE AND ad.enabled = FALSE) "//
+ ")" //
- + "FROM ResourceType AS rt"),
+ + "FROM ResourceType AS rt WHERE rt.deleted = false"),
@NamedQuery(name = ResourceType.QUERY_FIND_BY_CATEGORY, query = "SELECT rt FROM
ResourceType AS rt "
- + "WHERE rt.category = :category"),
+ + "WHERE rt.category = :category and rt.deleted = false"),
@NamedQuery(name = ResourceType.QUERY_FIND_UTILIZED_BY_CATEGORY, query = "SELECT
DISTINCT res.resourceType "
+ "FROM Resource res, IN (res.implicitGroups) g, IN (g.roles) r, IN
(r.subjects) s " //
+ "WHERE s = :subject " //
+ "AND res.resourceType.category = :category "
+ + "AND res.resourceType.deleted = false "
+ "AND (UPPER(res.name) LIKE :nameFilter ESCAPE :escapeChar OR :nameFilter
is null) "
+ "AND (res.resourceType.plugin = :pluginName OR :pluginName is null)
"
+ "AND (:inventoryStatus = res.inventoryStatus OR :inventoryStatus is null)
"
@@ -116,6 +120,7 @@ import org.rhq.core.domain.util.Summary;
+ "FROM Resource res " //
+ "WHERE res.resourceType.category = :category "
+ "AND (UPPER(res.name) LIKE :nameFilter ESCAPE :escapeChar OR :nameFilter
is null) "
+ + "AND res.resourceType.deleted = false "
+ "AND (res.resourceType.plugin = :pluginName OR :pluginName is null)
"
+ "AND (:inventoryStatus = res.inventoryStatus OR :inventoryStatus is null)
"
+ "ORDER BY res.resourceType.name "),
@@ -124,10 +129,12 @@ import org.rhq.core.domain.util.Summary;
+ "WHERE s = :subject "
+ "AND res.parentResource = :parentResource "
+ "AND res.resourceType.category = :category "
+ + "AND res.resourceType.deleted = false "
+ "AND (:inventoryStatus = res.inventoryStatus OR :inventoryStatus is null)
"),
@NamedQuery(name = ResourceType.QUERY_FIND_UTILIZED_CHILDREN_BY_CATEGORY_admin, query
= "SELECT DISTINCT res.resourceType "
+ "FROM Resource res "
+ "WHERE res.parentResource = :parentResource "
+ + "AND res.resourceType.deleted = false "
+ "AND res.resourceType.category = :category "
+ "AND (:inventoryStatus = res.inventoryStatus OR :inventoryStatus is null)
"),
@NamedQuery(name = ResourceType.QUERY_FIND_BY_RESOURCE_GROUP, query = ""
//
@@ -136,26 +143,27 @@ import org.rhq.core.domain.util.Summary;
+ " JOIN rg.resourceType rt" //
+ " JOIN rg.roles r JOIN r.subjects s " //
+ " WHERE s = :subject " //
+ + " AND rt.deleted = false "
+ " AND ( rt.plugin = :pluginName OR :pluginName is null ) "),
@NamedQuery(name = ResourceType.QUERY_FIND_BY_RESOURCE_GROUP_admin, query =
"" //
+ "SELECT DISTINCT rt " //
+ " FROM ResourceGroup rg " //
+ " JOIN rg.resourceType rt" //
- + " WHERE ( rt.plugin = :pluginName OR :pluginName is null ) "),
+ + " WHERE rt.deleted = false AND ( rt.plugin = :pluginName OR :pluginName is
null ) "),
@NamedQuery(name = ResourceType.QUERY_GET_EXPLICIT_RESOURCE_TYPE_COUNTS_BY_GROUP,
query = "SELECT type.id, type.name, COUNT(type.id) "
+ "FROM ResourceGroup rg JOIN rg.explicitResources res JOIN res.resourceType
type "
- + "WHERE rg.id = :groupId "
+ + "WHERE rg.id = :groupId AND res.resourceType.deleted = false "
+ "GROUP BY type.id, type.name "),
@NamedQuery(name = ResourceType.QUERY_GET_IMPLICIT_RESOURCE_TYPE_COUNTS_BY_GROUP,
query = "SELECT type.id, type.name, COUNT(type.id) "
+ "FROM ResourceGroup rg JOIN rg.implicitResources res JOIN res.resourceType
type "
- + "WHERE rg.id = :groupId "
+ + "WHERE rg.id = :groupId AND res.resourceType.deleted = false "
+ "GROUP BY type.id, type.name "),
@NamedQuery(name = ResourceType.QUERY_FIND_BY_SUBCATEGORY, query = "SELECT rt
" + "FROM ResourceType rt "
- + "WHERE rt.subCategory = :subCategory"),
+ + "WHERE rt.subCategory = :subCategory AND rt.deleted = false"),
@NamedQuery(name = ResourceType.QUERY_FIND_BY_ID_WITH_ALL_OPERATIONS, query =
"SELECT DISTINCT rt "
+ "FROM ResourceType rt " + "LEFT JOIN FETCH
rt.operationDefinitions def "
+ "LEFT JOIN FETCH def.parametersConfigurationDefinition "
- + "LEFT JOIN FETCH def.resultsConfigurationDefinition " + "WHERE
rt.id = :id"),
+ + "LEFT JOIN FETCH def.resultsConfigurationDefinition " + "WHERE
rt.id = :id AND rt.deleted = false"),
@NamedQuery(name = ResourceType.QUERY_FIND_RESOURCE_FACETS, query = "" //
+ "SELECT new org.rhq.core.domain.resource.composite.ResourceFacets "
//
+ " ( " //
@@ -170,21 +178,26 @@ import org.rhq.core.domain.util.Summary;
+ " (SELECT COUNT(propDef) FROM rt.pluginConfigurationDefinition
pluginConfig JOIN pluginConfig.propertyDefinitions propDef WHERE propDef.name =
'snapshotLogEnabled')" // support
+ " ) " //
+ " FROM ResourceType rt " //
- + " WHERE ( rt.id = :resourceTypeId OR :resourceTypeId IS NULL )"),
+ + " WHERE rt.deleted = false AND ( rt.id = :resourceTypeId OR
:resourceTypeId IS NULL )"),
@NamedQuery(name = ResourceType.QUERY_FIND_DUPLICATE_TYPE_NAMES, query = ""
//
+ " SELECT rt.name " //
- + " FROM ResourceType rt " //
- + "GROUP BY rt.name " //
+ + " FROM ResourceType rt " //
+ + " WHERE rt.deleted = false "
+ + " GROUP BY rt.name " //
+ " HAVING COUNT(rt.name) > 1"), //
@NamedQuery(name = ResourceType.QUERY_DYNAMIC_CONFIG_WITH_PLUGIN, query =
"" //
- + "SELECT rt.plugin || ' - ' || rt.name, rt.plugin || '-' ||
rt.name FROM ResourceType rt") //
+ + "SELECT rt.plugin || ' - ' || rt.name, rt.plugin || '-' ||
rt.name FROM ResourceType rt WHERE rt.deleted = false") //
})
@NamedNativeQueries( {
// TODO: Add authz conditions to the below query.
@NamedNativeQuery(name = ResourceType.QUERY_FIND_CHILDREN_BY_CATEGORY, query =
"" //
- + "(SELECT crt.id, crt.name, crt.category, crt.creation_data_type,
crt.create_delete_policy, crt.singleton, crt.supports_manual_add, crt.description,
crt.plugin, crt.ctime, crt.mtime, crt.subcategory_id, crt.plugin_config_def_id,
crt.res_config_def_id "
+ + "(SELECT crt.id, crt.name, crt.category, crt.creation_data_type,
crt.create_delete_policy, crt.singleton, "
+ + "crt.supports_manual_add, crt.description, crt.plugin, crt.ctime,
crt.mtime, crt.subcategory_id, "
+ + "crt.plugin_config_def_id, crt.res_config_def_id, crt.deleted
"
+ "FROM RHQ_resource_type crt, RHQ_resource res, RHQ_resource_type rt,
RHQ_resource_type_parents rtp "
+ "WHERE res.id = ? "
+ + "AND crt.deleted = false "
+ + "AND rt.deleted = false "
+ "AND res.resource_type_id = rt.id "
+ "AND rt.id = rtp.parent_resource_type_id "
+ "AND rtp.resource_type_id = crt.id "
@@ -192,20 +205,29 @@ import org.rhq.core.domain.util.Summary;
+
// "ORDER BY crt.name " +
"UNION "
- + "SELECT DISTINCT crt2.id, crt2.name, crt2.category,
crt2.creation_data_type, crt2.create_delete_policy, crt2.singleton,
crt2.supports_manual_add, crt2.description, crt2.plugin, crt2.ctime, crt2.mtime,
crt2.subcategory_id, crt2.plugin_config_def_id, crt2.res_config_def_id "
- + "FROM RHQ_resource_type crt2 " + "WHERE 1 = "
+ + "SELECT DISTINCT crt2.id, crt2.name, crt2.category,
crt2.creation_data_type, crt2.create_delete_policy, "
+ + "crt2.singleton, crt2.supports_manual_add,
crt2.description, crt2.plugin, crt2.ctime, "
+ + "crt2.mtime, crt2.subcategory_id,
crt2.plugin_config_def_id, crt2.res_config_def_id, crt2.deleted "
+ + "FROM RHQ_resource_type crt2 " + "WHERE crt2.deleted = false AND
1 = "
+ "(SELECT COUNT(res2.id) "
+ "FROM RHQ_resource res2, RHQ_resource_type rt2 "
+ "WHERE res2.id = ? "
+ + "AND rt2.deleted = false "
+ "AND res2.resource_type_id = rt2.id " + "AND rt2.category =
'PLATFORM') "
+ "AND 0 = "
+ "(SELECT COUNT(rtp2.resource_type_id) "
+ "FROM RHQ_resource_type_parents rtp2 "
- + "WHERE rtp2.resource_type_id = crt2.id) " + "AND crt2.category =
? " + " ) ORDER BY name", resultSetMapping =
ResourceType.MAPPING_FIND_CHILDREN_BY_CATEGORY),
+ + "WHERE rtp2.resource_type_id = crt2.id) "
+ + "AND crt2.deleted = false "
+ + "AND crt2.category = ? " + " ) ORDER BY name",
resultSetMapping = ResourceType.MAPPING_FIND_CHILDREN_BY_CATEGORY),
@NamedNativeQuery(name = ResourceType.QUERY_FIND_CHILDREN_BY_CATEGORY_admin, query =
"" //
- + "(SELECT crt.id, crt.name, crt.category, crt.creation_data_type,
crt.create_delete_policy, crt.singleton, crt.supports_manual_add, crt.description,
crt.plugin, crt.ctime, crt.mtime, crt.subcategory_id, crt.plugin_config_def_id,
crt.res_config_def_id "
+ + "(SELECT crt.id, crt.name, crt.category, crt.creation_data_type,
crt.create_delete_policy, crt.singleton, "
+ + "crt.supports_manual_add, crt.description, crt.plugin, crt.ctime,
crt.mtime, crt.subcategory_id, "
+ + "crt.plugin_config_def_id, crt.res_config_def_id, crt.deleted
"
+ "FROM RHQ_resource_type crt, RHQ_resource res, RHQ_resource_type rt,
RHQ_resource_type_parents rtp "
+ "WHERE res.id = ? "
+ + "AND crt.deleted = false "
+ + "AND rt.deleted = false "
+ "AND res.resource_type_id = rt.id "
+ "AND rt.id = rtp.parent_resource_type_id "
+ "AND rtp.resource_type_id = crt.id "
@@ -213,16 +235,20 @@ import org.rhq.core.domain.util.Summary;
+
// "ORDER BY crt.name " +
"UNION "
- + "(SELECT DISTINCT crt2.id, crt2.name, crt2.category,
crt2.creation_data_type, crt2.create_delete_policy, crt2.singleton,
crt2.supports_manual_add, crt2.description, crt2.plugin, crt2.ctime, crt2.mtime,
crt2.subcategory_id, crt2.plugin_config_def_id, crt2.res_config_def_id "
- + "FROM RHQ_resource_type crt2 " + "WHERE 1 = "
+ + "(SELECT DISTINCT crt2.id, crt2.name, crt2.category,
crt2.creation_data_type, crt2.create_delete_policy, "
+ + "crt2.singleton, crt2.supports_manual_add,
crt2.description, crt2.plugin, crt2.ctime, "
+ + "crt2.mtime, crt2.subcategory_id,
crt2.plugin_config_def_id, crt2.res_config_def_id, "
+ + "crt2.deleted "
+ + "FROM RHQ_resource_type crt2 " + "WHERE crt2.deleted = false AND
1 = "
+ "(SELECT COUNT(res2.id) "
+ "FROM RHQ_resource res2, RHQ_resource_type rt2 "
+ "WHERE res2.id = ? "
+ + "AND rt2.deleted = false "
+ "AND res2.resource_type_id = rt2.id " + "AND rt2.category =
'PLATFORM') "
+ "AND 0 = "
+ "(SELECT COUNT(rtp2.resource_type_id) "
+ "FROM RHQ_resource_type_parents rtp2 "
- + "WHERE rtp2.resource_type_id = crt2.id) " + "AND crt2.category =
? " +
+ + "WHERE rtp2.resource_type_id = crt2.id) " + "AND crt2.category =
? AND crt2.deleted = false" +
// "ORDER BY crt2.name" +
")) ORDER BY name", resultSetMapping =
ResourceType.MAPPING_FIND_CHILDREN_BY_CATEGORY) //
})
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/assist/GroupSearchAssistant.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/assist/GroupSearchAssistant.java
index ce31d79..ba27137 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/assist/GroupSearchAssistant.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/assist/GroupSearchAssistant.java
@@ -62,7 +62,7 @@ public class GroupSearchAssistant extends TabAwareSearchAssistant {
+ "SELECT DISTINCT type.name " //
+ " FROM ResourceType type, ResourceGroup rg " //
+ " WHERE rg.resourceType = type " // only suggest names that
exist for visible groups in inventory
- + " AND rg.visible = true " //
+ + " AND rg.visible = true AND rg.resourceType.deleted =
false" //
+ conditionallyAddJPQLString("type.name", filter) //
+ conditionallyAddJPQLString("rg.groupCategory", tab) //
+ conditionallyAddAuthzFragment(getAuthzFragment()) //
@@ -73,7 +73,7 @@ public class GroupSearchAssistant extends TabAwareSearchAssistant {
+ "SELECT DISTINCT type.plugin " //
+ " FROM ResourceType type, ResourceGroup rg " //
+ " WHERE rg.resourceType = type " // only suggest names that
exist for visible groups in inventory
- + " AND rg.visible = true " //
+ + " AND rg.visible = true AND rg.resourceType.deleted =
false" //
+ conditionallyAddJPQLString("type.plugin", filter) //
+ conditionallyAddJPQLString("rg.groupCategory", tab) //
+ conditionallyAddAuthzFragment(getAuthzFragment()) //
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/assist/ResourceSearchAssistant.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/assist/ResourceSearchAssistant.java
index f315405..35c7d17 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/assist/ResourceSearchAssistant.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/assist/ResourceSearchAssistant.java
@@ -66,6 +66,7 @@ public class ResourceSearchAssistant extends TabAwareSearchAssistant {
+ " FROM ResourceType type, Resource res, PropertyDefinitionSimple
simpleDefinition " //"
+ " JOIN type.pluginConfigurationDefinition.propertyDefinitions
definition " //
+ " WHERE res.resourceType = type " // only suggest names that
exist for resources in inventory
+ + " AND res.resourceType.deleted = false"
+ " AND simpleDefinition = definition " // only suggest names
for simple properties
+ " AND simpleDefinition.type <> 'PASSWORD' "
// do not suggest hidden/password property types
+ conditionallyAddJPQLString("definition.name", filter) //
@@ -79,6 +80,7 @@ public class ResourceSearchAssistant extends TabAwareSearchAssistant {
+ " FROM ResourceType type, Resource res, PropertyDefinitionSimple
simpleDefinition " //"
+ " JOIN type.resourceConfigurationDefinition.propertyDefinitions
definition " //
+ " WHERE res.resourceType = type " // only suggest names that
exist for resources in inventory
+ + " AND res.resourceType.deleted = false"
+ " AND simpleDefinition = definition " // only suggest names
for simple properties
+ " AND simpleDefinition.type <> 'PASSWORD' "
// do not suggest hidden/password property types
+ conditionallyAddJPQLString("definition.name", filter) //
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/test/ResourceGroupTestBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/test/ResourceGroupTestBean.java
index b8ea6ea..731a74d 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/test/ResourceGroupTestBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/test/ResourceGroupTestBean.java
@@ -47,9 +47,11 @@ public class ResourceGroupTestBean implements
ResourceGroupTestBeanLocal {
@SuppressWarnings("unchecked")
public void setupCompatibleGroups() {
- List<ResourceType> types = entityManager.createQuery("SELECT rt FROM
ResourceType rt").getResultList();
+ List<ResourceType> types = entityManager
+ .createQuery("SELECT rt FROM ResourceType rt WHERE rt.deleted =
false")
+ .getResultList();
for (ResourceType type : types) {
- Query query = entityManager.createQuery("SELECT res FROM Resource res
WHERE res.resourceType = :type");
+ Query query = entityManager.createQuery("SELECT res FROM Resource res
WHERE res.resourceType = :type AND res.resourceType.deleted = false");
query.setParameter("type", type);
List<Resource> resources = query.getResultList();
ResourceGroup compatGroup = new ResourceGroup("Compat Group - " +
getNextCompat(), type);
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index ab55bac..f44b9b3 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -245,7 +245,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
}
// remove ResourceTypes which cascade remove BundleTypes
- q = em.createQuery("SELECT rt FROM ResourceType rt WHERE rt.name LIKE
'" + TEST_PREFIX + "%'");
+ q = em.createQuery("SELECT rt FROM ResourceType rt WHERE rt.deleted =
false and rt.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(ResourceType.class, ((ResourceType)
removeMe).getId()));