Package org.rhq.core.domain.resource.flyweight

Examples of org.rhq.core.domain.resource.flyweight.ResourceFlyweight


        HttpServletResponse response = (HttpServletResponse) FacesContextUtility.getFacesContext().getExternalContext()
            .getResponse();

        String path = "";
        if (node.getData() instanceof ResourceFlyweight) {
            ResourceFlyweight flyweight = (ResourceFlyweight) node.getData();
           
            if (flyweight.isLocked()) {
                FacesContext.getCurrentInstance().addMessage(
                    "leftNavTreeForm:leftNavTree",
                    new FacesMessage(FacesMessage.SEVERITY_WARN,
                        "You have not been granted view access to this resource", null));

                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());
            }
        } else if (node.getData() instanceof AutoGroupCompositeFlyweight) {
            AutoGroupCompositeFlyweight ag = (AutoGroupCompositeFlyweight) node.getData();
            if (ag.getResourceType() == null) {
                //XXX this is a temporary measure. The subcategories will get the content page in the end.
View Full Code Here


            AutoGroupCompositeFlyweight composite = ((AutoGroupCompositeFlyweight) level);
            return composite.getName();
        } else if (level instanceof ResourceWithAvailability) {
            return ((ResourceWithAvailability) level).getResource().getName();
        } else if (level instanceof ResourceFlyweight) {
            ResourceFlyweight fly = (ResourceFlyweight) level;
            String name = fly.getName();
            if (fly.isLocked()) {
                name += " (locked)";
            }
            return name;
        }
        return level.toString();
View Full Code Here

            HashSet<Integer> visibleIdSet = new HashSet<Integer>(visibleResources);

            ListIterator<ResourceFlyweight> iter = resources.listIterator();
            while (iter.hasNext()) {
                ResourceFlyweight res = iter.next();
                res.setLocked(!visibleIdSet.contains(res.getId()));
            }
        }

        return resources;
    }
View Full Code Here

            //we don't need the resource type reference here, only in the cache
            flyweightCache
                .constructResourceType(typeId, typeName, typePlugin, typeSingleton, typeCategory, subCategory);

            ResourceFlyweight resourceFlyweight = flyweightCache.constructResource(resourceId, resourceName,
                resourceUuid, resourceKey, parentId, typeId, availType);

            resources.add(resourceFlyweight);
        }
View Full Code Here

                    }
                    childGroupNode.addMember(node);
                    childGroupNode.setClusterKey(parentNode.getClusterKey());

                } else if (level instanceof ResourceFlyweight) {
                    ResourceFlyweight res = (ResourceFlyweight) level;
                    ClusterKey parentKey = parentNode.getClusterKey();
                    ClusterKey key = null;
                    if (parentKey == null) {
                        key = new ClusterKey(((ResourceGroup) parentNode.getData()).getId(), res.getResourceType()
                            .getId(), res.getResourceKey());
                    } else {
                        key = new ClusterKey(parentKey, res.getResourceType().getId(), res.getResourceKey());
                    }
                    ResourceGroupTreeNode childGroupNode = children.get(key);

                    if (childGroupNode == null) {
                        childGroupNode = new ResourceGroupTreeNode(key, parentNode);
View Full Code Here

        HibernatePerformanceMonitor.get().stop(monitorId, "ResourceTree tree construction");
        log.debug("Constructed tree in " + (end - start));
    }

    public static ResourceTreeNode load(int rootId, List<ResourceFlyweight> resources) {
        ResourceFlyweight found = null;
        for (ResourceFlyweight res : resources) {
            if (res.getId() == rootId) {
                found = res;
            }
        }
View Full Code Here

        return root;
    }

    public static void load(ResourceTreeNode parentNode) {
        if (parentNode.getData() instanceof ResourceFlyweight) {
            ResourceFlyweight parentResource = (ResourceFlyweight) parentNode.getData();

            Map<Object, List<ResourceFlyweight>> children = new HashMap<Object, List<ResourceFlyweight>>();
            for (ResourceFlyweight res : parentResource.getChildResources()) {
                if (res.getResourceType().getSubCategory() != null) {
                    // These are children that have subcategories
                    // Split them by if they are a sub-sub category or just a category
                    String categoryKey = res.getResourceType().getSubCategory();
                    addToList(children, categoryKey, res);
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.resource.flyweight.ResourceFlyweight

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.