Bug 534922 (RHQ-1671)

Summary: TabDisplayCheckTag unnecessarily creates ResourceUIBean objects when it really just needs the resource facets
Product: [Other] RHQ Project Reporter: Charles Crouch <ccrouch>
Component: No ComponentAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedCC: hbrock
Target Milestone: ---Keywords: Improvement
Target Release: ---   
Hardware: All   
OS: All   
URL: http://jira.rhq-project.org/browse/RHQ-1671
Whiteboard:
Fixed In Version: 1.2 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Charles Crouch 2009-02-26 20:34:00 UTC
Right now TabDisplayCheckTag.getResourceFacets() does

ResourceUIBean resourceUIBean = new ResourceUIBean(resource, subject);
resourceFacets = resourceUIBean.getFacets(resource, subject);

new ResourceUIBean(resource, subject) ends up doing
 Query query = entityManager.createNamedQuery(ResourceError.QUERY_FIND_BY_RESOURCE_ID_AND_ERROR_TYPE);

which is an neccessary query which TabDisplayCheckTag shouldnt care about.

So the alternative would be to put a static method on ResourceUIBean that returned just what TabDisplayCheckTag needed

//ResourceUIBean resourceUIBean = new ResourceUIBean(resource, subject);
resourceFacets = ResourceUIBean.getFacets(resource, subject);

Then on ResourceUIBean you would have

    public static ResourceFacets getFacets(Resource resource, Subject subject) {
        ResourceTypeManagerLocal resourceTypeManager = LookupUtil.getResourceTypeManager();
        ResourceFacets facets;
        try {
            facets = resourceTypeManager.getResourceFacets(subject, resource.getResourceType().getId());
        } catch (ResourceTypeNotFoundException e) {
            throw new RuntimeException(e);
        }

        return facets;
    }


Comment 1 Joseph Marques 2009-02-27 14:20:03 UTC
this is no longer an issue since we don't have any references to the old struts tabs anymore.  all resource / group / autogroup / autocluster tabs are JSF today.  thus, TabDisplayCheckTag will never be called.

Comment 2 Red Hat Bugzilla 2009-11-10 20:37:57 UTC
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-1671