Package org.rhq.core.domain.resource.group

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


        return (defs != null) && (defs.size() > 0);
    }

    @Override
    public boolean isGroupOperationSupported(Subject subject, int resourceGroupId) {
        ResourceGroup group;

        try {
            group = resourceGroupManager.getResourceGroupById(subject, resourceGroupId, null);
            if (group.getGroupCategory() == GroupCategory.MIXED) {
                return false;
            }
        } catch (ResourceGroupNotFoundException e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("isGroupOperationSupported: group does not exist: " + resourceGroupId);
            }
            return false;
        } catch (PermissionException pe) {
            // notice we caught this exception before propogating it up to the EJB layer, so
            // our transaction is not rolled back
            if (LOG.isDebugEnabled()) {
                LOG.debug("isGroupOperationSupported: User cannot view (and thus) control group: " + resourceGroupId);
            }
            return false;
        }

        if (!authorizationManager.hasGroupPermission(subject, Permission.CONTROL, group.getId())) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("isGroupOperationSupported: User cannot control group: " + group);
            }
            return false;
        }

        Set<OperationDefinition> defs = group.getResourceType().getOperationDefinitions();

        return (defs != null) && (defs.size() > 0);
    }
View Full Code Here


        return resource;
    }

    private ResourceGroup getCompatibleGroupIfAuthorized(Subject subject, int compatibleGroupId) {
        ResourceGroup group;

        try {
            // resourceGroupManager will test for necessary permissions too
            group = resourceGroupManager.getResourceGroupById(subject, compatibleGroupId, GroupCategory.COMPATIBLE);
        } catch (ResourceGroupNotFoundException e) {
View Full Code Here

        return group;
    }

    private void ensureControlPermission(Subject subject, OperationHistory history) throws PermissionException {
        if (history instanceof GroupOperationHistory) {
            ResourceGroup group = ((GroupOperationHistory) history).getGroup();
            ensureControlPermission(subject, group);
        } else {
            Resource resource = ((ResourceOperationHistory) history).getResource();
            ensureControlPermission(subject, resource);
        }
View Full Code Here

        }
    }

    private void ensureViewPermission(Subject subject, OperationHistory history) throws PermissionException {
        if (history instanceof GroupOperationHistory) {
            ResourceGroup group = ((GroupOperationHistory) history).getGroup();
            if (!authorizationManager.canViewGroup(subject, group.getId())) {
                throw new PermissionException("User [" + subject.getName()
                    + "] does not have permission to view operation history for group [" + group + "]");
            }
        } else {
            Resource resource = ((ResourceOperationHistory) history).getResource();
View Full Code Here

import org.rhq.enterprise.server.util.LookupUtil;

public class DeleteResourcesFromGroupUIBean {
    public String removeSelectedResources() {
        Subject subject = EnterpriseFacesContextUtility.getSubject();
        ResourceGroup group = EnterpriseFacesContextUtility.getResourceGroup();
        String[] selectedResources = FacesContextUtility.getRequest().getParameterValues("selectedResources");

        int i = 0;
        if ((selectedResources == null) || (selectedResources.length == 0)) {
            FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN,
                "Nothing deleted, as no group members were selected");
            return "successOrFailure";
        }

        int[] selectedResourceInts = new int[selectedResources.length];
        for (String resourceIdString : selectedResources) {
            selectedResourceInts[i++] = Integer.parseInt(resourceIdString);
        }

        try {
            LookupUtil.getResourceGroupManager().removeResourcesFromGroup(subject, group.getId(), selectedResourceInts);

            FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Removed the selected group members");
        } catch (Exception e) {
            FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, ThrowableUtil.getAllMessages(e));
        }
View Full Code Here

        }

        @Override
        public PageList<ResourceWithAvailability> fetchDataForPage(PageControl pageControl) {
            Subject subject = EnterpriseFacesContextUtility.getSubject();
            ResourceGroup resourceGroup = EnterpriseFacesContextUtility.getResourceGroup();

            PageList<ResourceWithAvailability> results = resourceManager
                .findExplicitResourceWithAvailabilityByResourceGroup(LookupUtil.getSubjectManager().getOverlord(),
                        resourceGroup, pageControl);
View Full Code Here

        return "viewHistory";
    }

    public String deleteSelectedUpdates() {
        Subject subject = EnterpriseFacesContextUtility.getSubject();
        ResourceGroup resourceGroup = EnterpriseFacesContextUtility.getResourceGroup();

        String[] selectedUpdateStringIds = FacesContextUtility.getRequest().getParameterValues("selectedUpdates");
        Integer[] selectedUpdateIds = StringUtility.getIntegerArray(selectedUpdateStringIds);

        try {
            int deleteCount = configurationManager.deleteGroupPluginConfigurationUpdates(subject, resourceGroup
                .getId(), selectedUpdateIds);
            if (deleteCount == selectedUpdateIds.length) {
                FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Deleted " + selectedUpdateIds.length
                    + " group connection property updates.");
            } else {
View Full Code Here

            super(view, beanName);
        }

        @Override
        public PageList<GroupPluginConfigurationUpdate> fetchPage(PageControl pc) {
            ResourceGroup requestResourceGroup = EnterpriseFacesContextUtility.getResourceGroup();
            ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();

            if (requestResourceGroup == null) {
                requestResourceGroup = resourceGroup;
            } else {
                resourceGroup = requestResourceGroup;
            }

            PageList<GroupPluginConfigurationUpdate> results = null;
            results = configurationManager.findGroupPluginConfigurationUpdates(
                requestResourceGroup.getId(), pc);
            return results;
        }
View Full Code Here

    }

    public ConfigurationSet getConfigurationSet() {
        if (this.configurationSet == null) {
            Subject subject = EnterpriseFacesContextUtility.getSubject();
            ResourceGroup group = EnterpriseFacesContextUtility.getResourceGroup();
            int groupPluginConfigurationUpdateId = getPluginResourceConfigurationUpdateId();

            this.pluginConfigurations = this.configurationManager.getPluginConfigurationMapForGroupUpdate(subject,
                groupPluginConfigurationUpdateId);
            this.configurationSet = GroupPluginConfigurationUtility.buildConfigurationSet(subject, group,
View Full Code Here

            super(view, beanName);
        }

        @Override
        public PageList<ConfigurationUpdateComposite> fetchPage(PageControl pc) {
            ResourceGroup requestResourceGroup = EnterpriseFacesContextUtility.getResourceGroup();

            if (requestResourceGroup == null) {
                requestResourceGroup = resourceGroup;
            } else {
                resourceGroup = requestResourceGroup;
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.resource.group.ResourceGroup

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.