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

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


                public boolean isEnabled(ListGridRecord[] selection) {
                    boolean isEnabled = super.isEnabled(selection);

                    if (isEnabled) {
                        for (ListGridRecord record : selection) {
                            ResourceComposite resComposite = (ResourceComposite) record
                                .getAttributeAsObject("resourceComposite");
                            Resource res = resComposite.getResource();
                            if (!(isEnabled = res.getResourceType().isDeletable())) {
                                break;
                            }
                            ResourcePermission resPermission = resComposite.getResourcePermission();
                            if (!(isEnabled = resPermission.isDeleteResource())) {
                                break;
                            }
                        }
                    }
View Full Code Here


            }
        });

        setListGridFields(errorTypeField, timeField, summaryField, iconField);

        ResourceComposite resourceComposite = titleBar.getResource();
        Set<Permission> resourcePermissions = resourceComposite.getResourcePermission().getPermissions();
        final boolean canModifyResource = resourcePermissions.contains(Permission.MODIFY_RESOURCE);
        addTableAction(MSG.common_button_delete(), MSG.common_msg_areYouSure(), ButtonColor.RED,
            new AbstractTableAction(canModifyResource ? TableActionEnablement.ANY : TableActionEnablement.NEVER) {
            public void executeAction(final ListGridRecord[] selection, Object actionValue) {
                if (selection == null || selection.length == 0) {
View Full Code Here

                }

                @Override
                public void onSuccess(PageList<ResourceComposite> resourceCompositePageList) {
                    if (!resourceCompositePageList.isEmpty()) {
                        final ResourceComposite resourceComposite = resourceCompositePageList.get(0);
                        final Resource resource = resourceComposite.getResource();
                        // Load the fully fetched ResourceType.
                        ResourceType resourceType = resource.getResourceType();
                        ResourceTypeRepository.Cache.getInstance().getResourceTypes(resourceType.getId(),
                            EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
                            new ResourceTypeRepository.TypeLoadedCallback() {
View Full Code Here

    }

    @Override
    public ResourceComposite copyValues(Record from) {
        // not very strong...
        return new ResourceComposite(new Resource(from.getAttributeAsInt("id")), AvailabilityType.DOWN);
    }
View Full Code Here

                }

                @Override
                public void onSuccess(PageList<ResourceComposite> results) {
                    if (!results.isEmpty()) {
                        final ResourceComposite resourceComposite = results.get(0);
                        resource = resourceComposite.getResource();
                        // Load the fully fetched ResourceType.
                        ResourceType resourceType = resource.getResourceType();
                        ResourceTypeRepository.Cache.getInstance().getResourceTypes(resourceType.getId(),
                            EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
                            new ResourceTypeRepository.TypeLoadedCallback() {
View Full Code Here

                    }

                    @Override
                    public void onSuccess(PageList<ResourceComposite> results) {
                        if (!results.isEmpty()) {
                            final ResourceComposite resourceComposite = results.get(0);

                            final Resource resource = resourceComposite.getResource();
                            final ResourceType resourceType = resource.getResourceType();

                            ResourceTypeRepository.Cache.getInstance().getResourceTypes(
                                    resourceType.getId(),
                                    EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
                                    new ResourceTypeRepository.TypeLoadedCallback() {
                                        public void onTypesLoaded(ResourceType type) {
                                            resource.setResourceType(type);
                                            //metric definitions
                                            final Set<MeasurementDefinition> definitions = type.getMetricDefinitions();

                                            //build id mapping for measurementDefinition instances Ex. Free Memory -> MeasurementDefinition[100071]
                                            HashMap<String, MeasurementDefinition> measurementDefMapTemp = new HashMap<String, MeasurementDefinition>();
                                            for (MeasurementDefinition definition : definitions) {
                                                if(null != definition){
                                                    measurementDefMapTemp.put(definition.getDisplayName(), definition);
                                                }
                                            }
                                            final HashMap<String, MeasurementDefinition> measurementDefMap = new HashMap<String, MeasurementDefinition>(measurementDefMapTemp);
                                            //bundle definition ids for asynch call.
                                            int[] definitionArrayIds = new int[definitions.size()];
                                            final String[] displayOrder = new String[definitions.size()];
                                            measurementDefMap.keySet().toArray(displayOrder);
                                            //sort the charting data ex. Free Memory, Free Swap Space,..System Load
                                            Arrays.sort(displayOrder);

                                            //organize definitionArrayIds for ordered request on server.
                                            int index = 0;
                                            for (String definitionToDisplay : displayOrder) {
                                                definitionArrayIds[index++] = measurementDefMap.get(definitionToDisplay)
                                                        .getId();
                                            }


                            GWTServiceLookup.getMeasurementDataService().getHighestNOOBsForResource(resourceId,
                                    Integer.valueOf(resultCount), new AsyncCallback<PageList<MeasurementOOBComposite>>() {
                                @Override
                                public void onFailure(Throwable caught) {
                                    Log.debug("Error retrieving out of bound metrics for resource [" + resourceId + "]:"
                                            + caught.getMessage());
                                    currentlyLoading = false;
                                }

                                @Override
                                public void onSuccess(PageList<MeasurementOOBComposite> result) {
                                    VLayout column = new VLayout();
                                    column.setHeight(10);
                                    column.setWidth100();
                                    if (!result.isEmpty()) {
                                        for (final MeasurementOOBComposite oob : result) {
                                            DynamicForm row = new DynamicForm();
                                            row.setWidth100();
                                            row.setNumCols(2);
                                            row.setColWidths("*", 100);

                                            final String title = oob.getScheduleName();
                                            LinkItem link = new LinkItem();
                                            link.setLinkTitle(title);
                                            link.setShowTitle(false);
                                            link.setClipValue(false);
                                            link.setWrap(true);
                                            link.addClickHandler(new ClickHandler() {
                                                @Override
                                                public void onClick(ClickEvent event) {
                                                    ChartViewWindow window = new ChartViewWindow(title);
                                                    D3GraphListView graphView = D3GraphListView
                                                            .createSingleGraph(resourceComposite.getResource(),
                                                                    oob.getDefinitionId(), true);

                                                    window.addItem(graphView);
                                                    window.show();
                                                }
View Full Code Here

                public void onSuccess(PageList<ResourceComposite> result) {
                    if (result.isEmpty()) {
                        onFailure(new Exception(MSG.view_inventory_resource_loadFailed(String.valueOf(resourceId))));
                    } else {
                        final ResourceComposite resourceComposite = result.get(0);

                        // make sure we have all the Type information necessary to render the menus
                        ResourceType type = resource.getResourceType();
                        ResourceTypeRepository.Cache.getInstance().getResourceTypes(
                            type.getId(),
View Full Code Here

TOP

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

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.