Package org.rhq.coregui.client.gwt

Examples of org.rhq.coregui.client.gwt.ResourceGWTServiceAsync


                    return isEnabled;
                }

                public void executeAction(ListGridRecord[] selection, Object actionValue) {
                    int[] resourceIds = TableUtility.getIds(selection);
                    ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();

                    resourceManager.deleteResources(resourceIds, new AsyncCallback<List<DeleteResourceHistory>>() {
                        public void onFailure(Throwable caught) {
                            if (caught instanceof CannotConnectToAgentException) {
                                CoreGUI.getMessageCenter().notify(
                                    new Message(MSG.view_inventory_resources_deleteFailed2(), Severity.Warning));
                            } else {
View Full Code Here


                    }
                }

                private void uninventoryItems(ListGridRecord[] selection) {
                    int[] resourceIds = TableUtility.getIds(selection);
                    ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();

                    resourceManager.uninventoryResources(resourceIds, new AsyncCallback<List<Integer>>() {
                        public void onFailure(Throwable caught) {
                            CoreGUI.getErrorHandler().handleError(MSG.view_inventory_resources_uninventoryFailed(),
                                caught);
                            refreshTableInfo();
                        }

                        public void onSuccess(List<Integer> result) {
                            CoreGUI.getMessageCenter().notify(
                                new Message(MSG.view_inventory_resources_uninventorySuccessful(), Severity.Info));
                            onActionSuccess();
                        }
                    });
                }

                private boolean containsStorageNodeOrItsResource(ListGridRecord[] selection) {
                    for (ListGridRecord record : selection) {
                        if (record.getAttribute(AncestryUtil.RESOURCE_ANCESTRY) == null
                            || "RHQStorage".equals(record.getAttribute(PLUGIN.propertyName()))) {
                         // is a platform, storage node or child resource of storage node
                            return true;
                        }
                    }
                    return false;
                }
            });

        addTableAction(MSG.common_button_disable(), MSG.view_inventory_resources_disableConfirm(),
            new AvailabilityTypeResourceAuthorizedTableAction(ResourceSearchView.this, TableActionEnablement.ANY,
                EnumSet.complementOf(EnumSet.of(AvailabilityType.DISABLED)), Permission.DELETE_RESOURCE,
                new RecordExtractor<AvailabilityType>() {

                    public Collection<AvailabilityType> extract(Record[] records) {
                        List<AvailabilityType> result = new ArrayList<AvailabilityType>(records.length);
                        for (Record record : records) {
                            result.add(((Resource) record.getAttributeAsObject("resource")).getCurrentAvailability()
                                .getAvailabilityType());
                        }

                        return result;
                    }
                }, //
                new RecordExtractor<Integer>() {

                    public Collection<Integer> extract(Record[] records) {
                        List<Integer> result = new ArrayList<Integer>(records.length);
                        for (Record record : records) {
                            result.add(record.getAttributeAsInt("id"));
                        }

                        return result;
                    }
                }) {

                @Override
                public boolean isEnabled(ListGridRecord[] records) {
                    boolean result = super.isEnabled(records);

                    if (result) {
                        for (Record record : records) {
                            if (record.getAttribute(ResourceDataSourceField.CATEGORY.propertyName()).equals(
                                ResourceCategory.PLATFORM.name())) {
                                result = false;
                                break;
                            }
                        }
                    }

                    return result;
                }

                public void executeAction(ListGridRecord[] selection, Object actionValue) {
                    int[] resourceIds = TableUtility.getIds(selection);
                    ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();

                    resourceManager.disableResources(resourceIds, new AsyncCallback<List<Integer>>() {
                        public void onFailure(Throwable caught) {
                            CoreGUI.getErrorHandler().handleError(MSG.view_inventory_resources_disableFailed(), caught);
                            refreshTableInfo();
                        }

                        public void onSuccess(List<Integer> result) {
                            CoreGUI.getMessageCenter().notify(
                                new Message(
                                    MSG.view_inventory_resources_disableSuccessful(String.valueOf(result.size())),
                                    Severity.Info));
                            onActionSuccess();
                        }
                    });
                }
            });

        addTableAction(MSG.common_button_enable(), MSG.view_inventory_resources_enableConfirm(), ButtonColor.BLUE,
            new AvailabilityTypeResourceAuthorizedTableAction(ResourceSearchView.this, TableActionEnablement.ANY,
                EnumSet.of(AvailabilityType.DISABLED), Permission.DELETE_RESOURCE,
                new RecordExtractor<AvailabilityType>() {

                    public Collection<AvailabilityType> extract(Record[] records) {
                        List<AvailabilityType> result = new ArrayList<AvailabilityType>(records.length);
                        for (Record record : records) {
                            result.add(((Resource) record.getAttributeAsObject("resource")).getCurrentAvailability()
                                .getAvailabilityType());
                        }

                        return result;
                    }
                }, //
                new RecordExtractor<Integer>() {

                    public Collection<Integer> extract(Record[] records) {
                        List<Integer> result = new ArrayList<Integer>(records.length);
                        for (Record record : records) {
                            result.add(record.getAttributeAsInt("id"));
                        }

                        return result;
                    }
                }) {

                @Override
                public boolean isEnabled(ListGridRecord[] records) {
                    boolean result = super.isEnabled(records);

                    if (result) {
                        for (Record record : records) {
                            if (record.getAttribute(ResourceDataSourceField.CATEGORY.propertyName()).equals(
                                ResourceCategory.PLATFORM.name())) {
                                result = false;
                                break;
                            }
                        }
                    }

                    return result;
                }

                public void executeAction(ListGridRecord[] selection, Object actionValue) {
                    int[] resourceIds = TableUtility.getIds(selection);
                    ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();

                    resourceManager.enableResources(resourceIds, new AsyncCallback<List<Integer>>() {
                        public void onFailure(Throwable caught) {
                            CoreGUI.getErrorHandler().handleError(MSG.view_inventory_resources_enableFailed(), caught);
                            refreshTableInfo();
                        }
View Full Code Here

                    for (Integer id : resourceIdsList) {
                        resourceIds[i++] = id;
                    }

                    // ask the server to ignore the selected non-platform resources
                    ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();
                    resourceManager.ignoreResources(resourceIds, new AsyncCallback<Void>() {
                        public void onFailure(Throwable caught) {
                            CoreGUI.getErrorHandler().handleError(MSG.view_inventory_resources_ignoreFailed(), caught);
                            refreshTableInfo();
                        }
View Full Code Here

                    }

                    int[] resourceIds = TableUtility.getIds(selection);

                    // ask the server to unignore the selected resources and immediately commit them to inventory again
                    ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();
                    resourceManager.unignoreAndImportResources(resourceIds, new AsyncCallback<Void>() {
                        public void onFailure(Throwable caught) {
                            CoreGUI.getErrorHandler()
                                .handleError(MSG.view_inventory_resources_unignoreFailed(), caught);
                            refreshTableInfo();
                        }
View Full Code Here

        }
    }

    private void queryResource(Integer entityId, final Integer measurementDefId) {
        ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();

        ResourceCriteria resourceCriteria = new ResourceCriteria();
        resourceCriteria.addFilterId(entityId);
        resourceService.findResourcesByCriteria(resourceCriteria, new AsyncCallback<PageList<Resource>>() {
            @Override
            public void onFailure(Throwable caught) {
                CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_graphs_lookupFailed(), caught);
            }
View Full Code Here

    }

    @Override
    protected void executeFetch(final DSRequest request, final DSResponse response,
        final Criteria unused) {
        ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();

        resourceService.findResourceInstallCounts(true, new AsyncCallback<List<ResourceInstallCount>>() {

            @Override
            public void onSuccess(List<ResourceInstallCount> result) {
                response.setData(buildRecords(result));
                response.setTotalRows(result.size());
View Full Code Here

                                removeResources();
                            }
                        }

                        private void removeResources() {
                            final ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();

                            resourceManager.uninventoryAllResourcesByAgent(agents, new AsyncCallback<Void>() {
                                public void onSuccess(Void result) {
                                    CoreGUI.getMessageCenter().notify(
                                        new Message(MSG.view_adminTopology_agent_delete_submitted(Integer
                                            .toString(agents.length))));
                                    refresh();
View Full Code Here

        return record;
    }

    @Override
    protected void executeFetch(final DSRequest request, final DSResponse response, Criteria unused) {
        ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();

        resourceService.findResourceComplianceCounts(new AsyncCallback<List<ResourceInstallCount>>() {
            @Override
            public void onSuccess(List<ResourceInstallCount> result) {
                response.setData(buildRecords(result));
                response.setTotalRows(result.size());
                processResponse(request.getRequestId(), response);
View Full Code Here

        if (updateSelection) {
            selectedNodeId = ResourceTreeNode.idOf(selectedResourceId);
        }

        final ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();

        // This is an expensive call, but loads all nodes that are visible in the tree given a selected resource
        CoreGUI.showBusy(true);;
        resourceService.getResourceLineageAndSiblings(selectedResourceId,
            new AsyncCallback<List<ResourceLineageComposite>>() {

                public void onFailure(Throwable caught) {
                    CoreGUI.showBusy(false);;
                    boolean resourceDoesNotExist = caught.getMessage().contains("ResourceNotFoundException");
View Full Code Here

            new Message(MSG.widget_resourceFactoryWizard_importSubmitted(getChildType().getName()), Severity.Info));

        ImportResourceRequest request = new ImportResourceRequest(getChildType().getId(), getParentResource().getId(),
            getNewResourceConfiguration());

        ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService(300000);
        final Duration duration = new Duration();
        resourceService.manuallyAddResource(request, new AsyncCallback<ImportResourceResponse>() {
            @Override
            public void onFailure(final Throwable caught) {
                Timer timer = new Timer() {
                    @Override
                    public void run() {
View Full Code Here

TOP

Related Classes of org.rhq.coregui.client.gwt.ResourceGWTServiceAsync

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.