Package org.rhq.core.domain.resource.composite

Examples of org.rhq.core.domain.resource.composite.ResourceFacets


                return false;
            } else {           
                path = FacesContextUtility.getRequest().getRequestURI();

                //Resource resource = this.resourceManager.getResourceById(subject, ((Resource) node.getData()).getId());
                ResourceFacets facets = this.resourceTypeManager.getResourceFacets(flyweight.getResourceType()
                    .getId());

                String fallbackPath = FunctionTagLibrary.getDefaultResourceTabURL();

                // Switching from a auto group view... default to monitor page
                if (!path.startsWith("/rhq/resource")) {
                    path = fallbackPath;
                } else {
                    if ((path.startsWith("/rhq/resource/configuration/") && !facets.isConfiguration())
                        || (path.startsWith("/rhq/resource/content/") && !facets.isContent())
                        || (path.startsWith("/rhq/resource/operation") && !facets.isOperation())
                        || (path.startsWith("/rhq/resource/events") && !facets.isEvent())) {
                        // This resource doesn't support those facets
                        path = fallbackPath;
                    } else if ((path.startsWith("/rhq/resource/configuration/view-map.xhtml")
                        || path.startsWith("/rhq/resource/configuration/edit-map.xhtml")
                        || path.startsWith("/rhq/resource/configuration/add-map.xhtml") || path
                        .startsWith("/rhq/resource/configuration/edit.xhtml")
                        && facets.isConfiguration())) {
                        path = "/rhq/resource/configuration/view.xhtml";

                    } else if (!path.startsWith("/rhq/resource/content/view.xhtml")
                        && path.startsWith("/rhq/resource/content/") && facets.isContent()) {
                        path = "/rhq/resource/content/view.xhtml";
                    } else if (path.startsWith("/rhq/resource/inventory/")
                        && !(path.startsWith("/rhq/resource/inventory/view.xhtml")
                            || (facets.isPluginConfiguration() && path
                                .startsWith("/rhq/resource/inventory/view-connection.xhtml")) || path
                            .startsWith("/rhq/resource/inventory/view-agent.xhtml"))) {
                        path = "/rhq/resource/inventory/view.xhtml";
                    } else if (path.startsWith("/rhq/resource/operation/resourceOperationHistoryDetails.xhtml")) {
                        path = "/rhq/resource/operation/resourceOperationHistory.xhtml";
                    } else if (path.startsWith("/rhq/resource/operation/resourceOperationScheduleDetails.xhtml")) {
                        path = "/rhq/resource/operation/resourceOperationSchedules.xhtml";
                    } else if (path.startsWith("/rhq/resource/monitor/response.xhtml") && !facets.isCallTime()) {
                        path = fallbackPath;
                    }
                }

                path += ("?id=" + flyweight.getId());
View Full Code Here


     * Inventory, ...) can be displayed for a resource of a certain type
     */
    @Override
    @SuppressWarnings("unchecked")
    public ResourceFacets getResourceFacets(int resourceTypeId) {
        ResourceFacets cachedFacet = ResourceFacetsCache.getSingleton().getResourceFacets(resourceTypeId);
        if (cachedFacet != null) {
            return cachedFacet;
        }
        // be paranoid and fallback to getting the results directly from the database
        Query query = entityManager.createNamedQuery(ResourceType.QUERY_FIND_RESOURCE_FACETS);
        query.setParameter("resourceTypeId", resourceTypeId);
        List<ResourceFacets> facets = query.getResultList();
        if (facets.size() != 1) {
            return new ResourceFacets(resourceTypeId, false, false, false, false, false, false, false, false, false,
                false);
        }
        return facets.get(0);
    }
View Full Code Here

        PageList<ResourceComposite> results = queryRunner.execute();

        for (ResourceComposite nextComposite : results) {
            Resource nextResource = nextComposite.getResource();
            ResourceType nextResourceType = nextResource.getResourceType();
            ResourceFacets facets = typeManager.getResourceFacets(nextResourceType.getId());

            queryRunner.initFetchFields(nextResource); // manual field fetch for composite-wrapped entity
            nextComposite.setResourceFacets(facets);
        }
View Full Code Here

        if (shouldCreateMenu()) {
            for (String header : getMenuHeaders()) {
                addMenuItem(null, header, true);
            }

            ResourceFacets facets = resourceTypeManager.getResourceFacets(getResourceTypeId());

            addQuickLinks(getMenuQuickLinks(), facets);

            addAdditionalMenuItems(menu);
View Full Code Here

            long implicitDown = (Long) row[5];
            long implicitUnknown = (Long) row[6];
            long implicitDisabled = (Long) row[7];
            ResourceGroup group = groupMap.get(groupIds.get(i++));
            ResourceType type = group.getResourceType();
            ResourceFacets facets;
            if (type == null) {
                // mixed group
                facets = ResourceFacets.NONE;
            } else {
                // compatible group
View Full Code Here

        Object[] data = results.get(0);

        ResourceGroup group = (ResourceGroup) data[8];
        ResourceType type = group.getResourceType();
        ResourceFacets facets;
        if (type == null) {
            // mixed group
            facets = ResourceFacets.NONE;
        } else {
            // compatible group
View Full Code Here

        results = getAuthorizedGroupComposites(subject, authzType, results);

        for (ResourceGroupComposite composite : results) {
            ResourceGroup group = composite.getResourceGroup();
            ResourceType type = group.getResourceType();
            ResourceFacets facets = (type != null) ? resourceTypeManager.getResourceFacets(type.getId())
                : ResourceFacets.NONE;

            queryRunner.initFetchFields(group); // manual field fetch for composite-wrapped entity
            composite.setResourceFacets(facets);
        }
View Full Code Here

                results = resourceManager.findExplicitResourceWithAvailabilityByResourceGroup(LookupUtil
                    .getSubjectManager().getOverlord(), getResourceGroup(), pageControl);
            }
            for (ResourceWithAvailability composite : results) {
                ResourceType type = composite.getResource().getResourceType();
                ResourceFacets facets = LookupUtil.getResourceTypeManager().getResourceFacets(type.getId());
                composite.setResourceFacets(facets);
            }

            return results;
        }
View Full Code Here

     * pageContext</em>'s out.
     */
    @Override
    public int doStartTag() throws JspException {
        boolean displayTab;
        ResourceFacets resourceFacets = getResourceFacets();
        if (resourceFacets != null) {
            Tab tab = Tab.valueOf(this.tabName);
            switch (tab) {
            case Monitor:
            case Inventory:
            case Alert: {
                // Always display the Inventory, Monitor, and Alert tabs (even if no metrics are defined for a resource
                // type, the Monitor and Alert tabs can still be used to monitor availablity).
                displayTab = true;
                break;
            }

            case Configuration: {
                displayTab = resourceFacets.isConfiguration();
                break;
            }

            case Control: {
                displayTab = resourceFacets.isOperation();
                break;
            }

            case Content: {
                displayTab = resourceFacets.isContent();
                break;
            }

            default: {
                throw new IllegalStateException("Unrecognized tab name: " + tab);
View Full Code Here

        return subject;
    }

    @Nullable
    private ResourceFacets getResourceFacets() throws JspException {
        ResourceFacets resourceFacets = null;
        HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
        Subject subject = getSubject(request);
        Resource resource = RequestUtils.getResource(request);
        if (resource != null) {
            ResourceUIBean resourceUIBean = new ResourceUIBean(resource, subject);
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.resource.composite.ResourceFacets

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.