Examples of GroupCategory


Examples of org.rhq.core.domain.resource.group.GroupCategory

        leftPane.setMembersMargin(5);
        leftPane.setAutoHeight();

        Resource resource = null;
        ResourceGroup group = null;
        GroupCategory groupCategory = null;
        Set<ResourceTypeFacet> facets = null;
        Set<ResourceTypeFacet> resourceFacets = null;
        if ((groupComposite != null) && (groupComposite.getResourceGroup() != null)) {
            group = groupComposite.getResourceGroup();
            groupCategory = groupComposite.getResourceGroup().getGroupCategory();
            facets = groupComposite.getResourceFacets().getFacets();
        }
        if (resourceComposite != null) {
            resource = resourceComposite.getResource();
            resourceFacets = this.resourceComposite.getResourceFacets().getFacets();
        }

        //recentMetrics.xhtml
        HLayout recentMetricsTitle = new TitleWithIcon(IconEnum.RECENT_MEASUREMENTS.getIcon24x24Path(),
            RECENT_MEASUREMENTS);
        if ((resource != null) || ((group != null) && (groupCategory.equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
            leftPane.addMember(recentMetricsTitle);
            leftPane.addMember(recentMeasurementsContent);
            recentMeasurementsContent.setHeight(20);
            leftPane.addMember(divider1);
        }
        //recentAlerts.xhtml
        HLayout recentAlertsTitle = new TitleWithIcon(IconEnum.RECENT_ALERTS.getIcon24x24Path(), RECENT_ALERTS);
        leftPane.addMember(recentAlertsTitle);
        leftPane.addMember(recentAlertsContent);
        recentAlertsContent.setHeight(20);
        //recentOOBs.xhtml
        HLayout recentOobsTitle = new TitleWithIcon(IconEnum.SUSPECT_METRICS.getIcon24x24Path(), RECENT_OOB);
        recentOobContent.setHeight(20);
        if ((resource != null) || ((group != null) && (groupCategory.equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
            leftPane.addMember(divider2);
            leftPane.addMember(recentOobsTitle);
            leftPane.addMember(recentOobContent);
        }
        //rightPane
        rightPane.setWidth("50%");
        rightPane.setPadding(5);
        rightPane.setMembersMargin(5);
        rightPane.setAutoHeight();
        firstRightPanePortletLoaded = false;
        //recentConfigUpdates.xhtml
        HLayout recentConfigUpdatesTitle = new TitleWithIcon(IconEnum.CONFIGURE.getIcon24x24Path(),
            RECENT_CONFIGURATIONS);
        recentConfigurationContent.setHeight(20);
        if (((resource != null) && (resourceFacets.contains(ResourceTypeFacet.CONFIGURATION)))
            || (displayGroupConfigurationUpdates(groupCategory, facets))) {//resource
            rightPane.addMember(recentConfigUpdatesTitle);
            rightPane.addMember(recentConfigurationContent);
            firstRightPanePortletLoaded = true;
        }

        //recentOperations.xhtml
        HLayout recentOperationsTitle = new TitleWithIcon(IconEnum.RECENT_OPERATIONS.getIcon24x24Path(),
            RECENT_OPERATIONS);
        recentOperationsContent.setHeight(20);
        if (((resource != null) && (resourceFacets.contains(ResourceTypeFacet.OPERATION)))
            || (displayGroupOperations(groupCategory, facets))) {//resource
            if (firstRightPanePortletLoaded) {
                rightPane.addMember(divider3);
            }
            rightPane.addMember(recentOperationsTitle);
            rightPane.addMember(recentOperationsContent);
            firstRightPanePortletLoaded = true;
        }
        //recentEventCounts.xhtml
        HLayout recentEventsTitle = new TitleWithIcon(IconEnum.EVENTS.getIcon24x24Path(), RECENT_EVENTS);
        recentEventsContent.setHeight(20);
        if (((resource != null) && (resourceFacets.contains(ResourceTypeFacet.EVENT)))
            || displayGroupEvents(groupCategory, facets)) {//resource
            if (firstRightPanePortletLoaded) {
                rightPane.addMember(divider4);
            }
            rightPane.addMember(recentEventsTitle);
            rightPane.addMember(recentEventsContent);
            firstRightPanePortletLoaded = true;
        }
        //recentPackageHistory.xhtml
        HLayout recentPkgHistoryTitle = new TitleWithIcon(IconEnum.CONTENT.getIcon24x24Path(), RECENT_PKG_HISTORY);
        recentPkgHistoryContent.setHeight(20);
        if ((resource != null) || ((group != null) && (groupCategory.equals(GroupCategory.COMPATIBLE)))) {//resource,CompatibleGroup
            if (firstRightPanePortletLoaded) {
                rightPane.addMember(divider5);
            }
            rightPane.addMember(recentPkgHistoryTitle);
            rightPane.addMember(recentPkgHistoryContent);
View Full Code Here

Examples of org.rhq.core.domain.resource.group.GroupCategory

        IconField categoryField = new IconField(CATEGORY.propertyName());
        categoryField.setCellFormatter(new CellFormatter() {
            public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
                String categoryName = (String) value;
                GroupCategory category = GroupCategory.valueOf(categoryName);
                String icon = ImageManager.getGroupIcon(category);
                return "<img class='tableImage' src=\"" + ImageManager.getFullImagePath(icon) + "\" />";
            }
        });
        categoryField.setShowHover(true);
        categoryField.setHoverCustomizer(new HoverCustomizer() {
            public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
                String categoryName = record.getAttribute(CATEGORY.propertyName());
                GroupCategory category = GroupCategory.valueOf(categoryName);
                String displayName;
                switch (category) {
                case COMPATIBLE:
                    displayName = MSG.view_group_summary_compatible();
                    break;
                case MIXED:
                    displayName = MSG.view_group_summary_mixed();
                    break;
                default:
                    throw new IllegalStateException("Unknown group category: " + category);
                }
                return displayName;
            }
        });

        ListGridField nameField = new ListGridField(NAME.propertyName(), NAME.title());
        nameField.setWidth("40%");

        nameField.setCellFormatter(new CellFormatter() {
            public String format(Object value, ListGridRecord record, int i, int i1) {
                String groupId = record.getAttribute("id");
                String groupUrl = LinkManager.getResourceGroupLink(Integer.valueOf(groupId));
                return LinkManager.getHref(groupUrl, value.toString());
            }
        });

        ListGridField descriptionField = new ListGridField(DESCRIPTION.propertyName(), DESCRIPTION.title());
        descriptionField.setWidth("28%");

        ListGridField typeNameField = new ListGridField(TYPE.propertyName(), TYPE.title());
        typeNameField.setWidth("14%");

        ListGridField pluginNameField = new ListGridField(PLUGIN.propertyName(), PLUGIN.title());
        pluginNameField.setWidth("8%");

        ListGridField availabilityChildrenField = new ListGridField(AVAIL_CHILDREN.propertyName(),
            AVAIL_CHILDREN.title(), 185); // 185 due to the html in ResourceGroupCompositeDataSource.getAlignedAvailabilityResults
        availabilityChildrenField.setCanSortClientOnly(true);
        availabilityChildrenField.setCanGroupBy(false);
        availabilityChildrenField.setWrap(false);
        availabilityChildrenField.setAlign(Alignment.LEFT);

        ListGridField availabilityDescendantsField = new ListGridField(AVAIL_DESCENDANTS.propertyName(),
            AVAIL_DESCENDANTS.title(), 185); // 185 due to the html in ResourceGroupCompositeDataSource.getAlignedAvailabilityResults
        availabilityDescendantsField.setCanSortClientOnly(true);
        availabilityDescendantsField.setCanGroupBy(false);
        availabilityDescendantsField.setWrap(false);
        availabilityDescendantsField.setAlign(Alignment.LEFT);

        setListGridFields(idField, categoryField, nameField, descriptionField, typeNameField, pluginNameField,
            availabilityChildrenField, availabilityDescendantsField);

        if (this.showDeleteButton) {
            addTableAction(MSG.common_button_delete(), MSG.common_msg_areYouSure(), ButtonColor.RED, new AuthorizedTableAction(this,
                TableActionEnablement.ANY, Permission.MANAGE_INVENTORY) {
                public void executeAction(ListGridRecord[] selections, Object actionValue) {
                    int[] groupIds = new int[selections.length];
                    int index = 0;
                    for (ListGridRecord selection : selections) {
                        groupIds[index++] = selection.getAttributeAsInt("id");
                    }
                    ResourceGroupGWTServiceAsync resourceGroupManager = GWTServiceLookup.getResourceGroupService();

                    resourceGroupManager.deleteResourceGroups(groupIds, new AsyncCallback<Void>() {
                        public void onFailure(Throwable caught) {
                            CoreGUI.getErrorHandler().handleError(MSG.view_inventory_groups_deleteFailed(), caught);
                            refreshTableInfo();
                        }

                        public void onSuccess(Void result) {
                            CoreGUI.getMessageCenter().notify(
                                new Message(MSG.view_inventory_groups_deleteSuccessful(), Severity.Info));
                            refresh(true);
                        }
                    });
                }
            });
        }

        if (this.showNewButton) {
            addTableAction(MSG.common_button_new(), ButtonColor.BLUE, new AuthorizedTableAction(this, Permission.MANAGE_INVENTORY) {
                public void executeAction(ListGridRecord[] selection, Object actionValue) {
                    GroupCategory category = null;
                    String categoryString = getInitialCriteria() == null ? null : getInitialCriteria().getAttribute(
                        ResourceGroupDataSourceField.CATEGORY.propertyName());
                    if (categoryString != null) {
                        category = GroupCategory.COMPATIBLE.name().equals(categoryString) ? GroupCategory.COMPATIBLE
                            : GroupCategory.MIXED;
View Full Code Here

Examples of org.rhq.core.domain.resource.group.GroupCategory

        }

        public PageList<ResourceGroupComposite> fetchPage(PageControl pc) {
            try {
                String search = getSearch();
                GroupCategory category = getCategory();

                ResourceGroupCriteria criteria = new ResourceGroupCriteria();
                criteria.setPageControl(pc);
                if (search != null && !search.trim().equals("")) {
                    criteria.setSearchExpression(search);
View Full Code Here

Examples of org.rhq.core.domain.resource.group.GroupCategory

                        return;
                    }
                    ResourceGroup group = result.get(0);
                    ResourceGroupTreeView.this.currentGroup = group;

                    GroupCategory groupCategory = group.getGroupCategory();
                    switch (groupCategory) {
                    case MIXED:
                        // For mixed groups, there will only ever be one item in the tree, even if the group is recursive.
                        // This is because mixed groups don't normally have clustered/identical resources across members
                        // so there is no attempt here to build auto cluster nodes.
View Full Code Here

Examples of org.rhq.core.domain.resource.group.GroupCategory

            getTitleBar().setGroup(groupComposite, isRefresh);

            // wipe the canvas views for the current set of subtabs.
            this.getTabSet().destroyViews();

            GroupCategory groupCategory = groupComposite.getResourceGroup().getGroupCategory();
            Set<ResourceTypeFacet> facets = groupComposite.getResourceFacets().getFacets();

            updateSummaryTab();
            updateInventoryTab(facets);
            updateAlertsTab(groupCategory);
View Full Code Here

Examples of org.rhq.core.domain.resource.group.GroupCategory

        }

        Subject subject = RequestUtils.getSubject(request);
        Integer resourceTypeId = newForm.getResourceTypeId();
        String newGroupName = newForm.getName();
        GroupCategory category = null;
        try {
            category = newForm.getGroupCategory();
        } catch (Exception e) {
            RequestUtils.setError(request, "resource.group.inventory.error.GroupTypeIsRequired");
            return returnFailure(request, mapping);
        }

        ResourceTypeManagerLocal resourceTypeManager = LookupUtil.getResourceTypeManager();
        ResourceGroupManagerLocal resourceGroupManager = LookupUtil.getResourceGroupManager();

        ResourceGroup newGroup = new ResourceGroup(newGroupName);
        try {
            if (category == GroupCategory.COMPATIBLE) {
                ResourceType groupResourceType = resourceTypeManager.getResourceTypeById(subject, resourceTypeId);
                newGroup.setResourceType(groupResourceType);
            }
        } catch (ResourceTypeNotFoundException ex) {
            log.debug("group created failed: ", ex);
            RequestUtils.setError(request, "resource.group.inventory.error.ResourceTypeIdNotFound");
            return returnFailure(request, mapping);
        }

        String location = newForm.getLocation();
        String description = newForm.getDescription();
        boolean recursive = newForm.isRecursive();

        try {
            newGroup.setDescription(description);
            //newGroup.setLocation(location);
            newGroup.setRecursive(recursive);

            log.trace("creating group [" + newForm.getName() + "]" + " with attributes " + newForm);

            // ctime, mtime, and modifiedBy should all be persistence hooks
            resourceGroupManager.createResourceGroup(subject, newGroup);
        } catch (Throwable t) {
            log.debug("group creation failed: ", t);
            RequestUtils.setError(request, "resource.group.inventory.error.GroupCreateError", t.getMessage());
            return returnFailure(request, mapping);
        }

        // Check for resources
        int groupId = newGroup.getId();
        Integer[] newResourceIds = newForm.getResourceIds();
        if ((newResourceIds != null) && (newResourceIds.length > 0)) {
            // Clean up after ourselves first
            HttpSession session = request.getSession();
            session.removeAttribute(Constants.RESOURCE_IDS_ATTR);
            session.removeAttribute(Constants.RESOURCE_TYPE_ATTR);

            // Now add the new entities to group
            resourceGroupManager.addResourcesToGroup(subject, groupId, ArrayUtils.unwrapArray(newResourceIds));
        }

        RequestUtils.setConfirmation(request, "resource.group.inventory.confirm.CreateGroup", newGroupName);

        HashMap<String, Object> forwardParams = new HashMap<String, Object>(2);
        forwardParams.put(HubConstants.PARAM_GROUP_ID, groupId);
        forwardParams.put(HubConstants.PARAM_GROUP_CATEGORY, category.name());

        return returnNew(request, mapping, forwardParams);
    }
View Full Code Here

Examples of org.rhq.core.domain.resource.group.GroupCategory

        if (hubForm.getGroupCategory() == null) {
            hubForm.setGroupCategory(HubConstants.DEFAULT_GROUP_CATEGORY);
        }

        GroupCategory groupCategory = GroupCategory.valueOf(hubForm.getGroupCategory());
        PageList<ResourceGroupComposite> groups = getGroups(subject, groupCategory, resourceCategory, resourceTypeName,
            pluginName, groupName, pageControl);
        request.setAttribute(Constants.ALL_RESOURCES_ATTR, groups);

        initGroupTypesPulldownMenu(request, hubForm, subject, groupCategory, groupName, resourceCategory,
            resourceTypeName, pluginName);
        initInventorySummary(subject, request);

        SessionUtils.resetReturnPath(request.getSession());

        Portal portal = Portal.createPortal("resource.hub.ResourceHubTitle", ".group.hub");
        request.setAttribute(Constants.PORTAL_KEY, portal);

        String navHierarchy = HubUtils.buildNavHierarchy(groupCategory.toString(), resourceTypeName);
        request.setAttribute(Constants.INVENTORY_HIERARCHY_ATTR, navHierarchy);
        return returnSuccess(request, mapping);
    }
View Full Code Here

Examples of org.rhq.core.domain.resource.group.GroupCategory

        // Session-encode the URL in case the client doesn't have cookies enabled.
        return encodeURL(url);
    }

    private String buildGroupURL(ResourceGroup resourceGroup) {
        GroupCategory category = resourceGroup.getGroupCategory();
        String url = FunctionTagLibrary.getDefaultGroupTabURL() + "?category=" + category.name() + "&groupId="
            + resourceGroup.getId();

        // Session-encode the URL in case the client doesn't have cookies enabled.
        return encodeURL(url);
    }
View Full Code Here

Examples of org.rhq.core.domain.resource.group.GroupCategory

        if ((composite != null) && (composite.getResourceGroup() != null)) {
            groupMenuMap = new LinkedHashMap<String, String>(groupMenuMap);

            // filter out portlets not relevent for facets
            Set<ResourceTypeFacet> facets = composite.getResourceFacets().getFacets();
            GroupCategory groupCategory = composite.getResourceGroup().getGroupCategory();

            // if not a compatible group do some pruning.
            if (groupCategory != GroupCategory.COMPATIBLE) {
                groupMenuMap.remove(GroupOperationsPortlet.KEY);
                groupMenuMap.remove(GroupMetricsPortlet.KEY);
View Full Code Here

Examples of org.rhq.core.domain.resource.group.GroupCategory

            //                }
            //            } else {
            log.trace("finding group [" + groupId + "]");

            ResourceGroup group = groupManager.getResourceGroupById(subject, groupId, null);
            GroupCategory category = group.getGroupCategory();

            log.trace("finding most recent modifier for resource [" + groupId + "]");
            String modifier = group.getModifiedBy();

            // TODO: jmarques - how are we going to do control on ResourceGroups?
            boolean isControllable = LookupUtil.getOperationManager().isGroupOperationSupported(subject, group.getId());

            RequestUtils.setResourceGroup(request, group);
            request.setAttribute(AttrConstants.RESOURCE_MODIFIER_ATTR, modifier);
            request.setAttribute(AttrConstants.TITLE_PARAM_ATTR, group.getName());
            request.setAttribute("category", category.name());
            request.setAttribute("groupId", groupId);
            request.setAttribute(AttrConstants.CONTROL_ENABLED_ATTR, new Boolean(isControllable));

            // }
        } catch (ResourceGroupNotFoundException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.