Examples of ListGridRecord


Examples of com.smartgwt.client.widgets.grid.ListGridRecord

    }

    protected void delete(ListGridRecord[] records) {
        final int[] alertIds = new int[records.length];
        for (int i = 0, selectionLength = records.length; i < selectionLength; i++) {
            ListGridRecord record = records[i];
            Integer alertId = record.getAttributeAsInt("id");
            alertIds[i] = alertId;
        }

        GWTServiceLookup.getAlertService().deleteAlerts(alertIds, new AsyncCallback<Integer>() {
            public void onSuccess(Integer resultCount) {
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.ListGridRecord

    }

    public void acknowledge(ListGridRecord[] records) {
        final int[] alertIds = new int[records.length];
        for (int i = 0, selectionLength = records.length; i < selectionLength; i++) {
            ListGridRecord record = records[i];
            Integer alertId = record.getAttributeAsInt("id");
            alertIds[i] = alertId;
        }

        GWTServiceLookup.getAlertService().acknowledgeAlerts(alertIds, new AsyncCallback<Integer>() {
            public void onSuccess(Integer resultCount) {
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.ListGridRecord

    }

    private void delete(ListGridRecord[] records) {
        final String[] driftDefNames = new String[records.length];
        for (int i = 0, selectionLength = records.length; i < selectionLength; i++) {
            ListGridRecord record = records[i];
            String driftDefName = record.getAttribute(DriftDefinitionDataSource.ATTR_NAME);
            driftDefNames[i] = driftDefName;
        }

        deleteDriftDefinitionsByName(driftDefNames);
    }
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.ListGridRecord

        } else {
            String classname = prop.getClass().getName();
            value = "(value of type " + classname.substring(classname.lastIndexOf(".") + 1) + ")";
        }

        ListGridRecord record = new ListGridRecord();
        record.setAttribute(FIELD_ID, prop.getId());
        record.setAttribute(FIELD_NAME, prop.getName());
        record.setAttribute(FIELD_VALUE, value);
        return record;
    }
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.ListGridRecord

    public ListGridRecord copyValues(Alert from) {
        return convert(from);
    }

    public static ListGridRecord convert(Alert from) {
        ListGridRecord record = new ListGridRecord();
        record.setAttribute("id", from.getId());
        record.setAttribute("ctime", new Date(from.getCtime()));
        if (from.getAcknowledgeTime() != null && from.getAcknowledgeTime().longValue() > 0) {
            record.setAttribute("acknowledgeTime", new Date(from.getAcknowledgeTime().longValue()));
        }
        record.setAttribute("acknowledgingSubject", from.getAcknowledgingSubject());
        record.setAttribute("recovered", from.getRecoveryTime());
        if(from.getRecoveryTime() != null && from.getRecoveryTime().longValue() > 0) {
            record.setAttribute("recoveredTime", new Date(from.getRecoveryTime().longValue()));
        }

        AlertDefinition alertDefinition = from.getAlertDefinition();

        record.setAttribute("definitionId", alertDefinition.getId());
        Resource resource = alertDefinition.getResource();
        record.setAttribute("name", alertDefinition.getName());
        record.setAttribute("description", alertDefinition.getDescription());
        record.setAttribute("priority", ImageManager.getAlertIcon(alertDefinition.getPriority()));

        // for ancestry handling
        record.setAttribute(AncestryUtil.RESOURCE_ID, resource.getId());
        record.setAttribute(AncestryUtil.RESOURCE_NAME, resource.getName());
        record.setAttribute(AncestryUtil.RESOURCE_ANCESTRY, resource.getAncestry());
        record.setAttribute(AncestryUtil.RESOURCE_TYPE_ID, resource.getResourceType().getId());

        AlertDefinition groupAlertDefinition = alertDefinition.getGroupAlertDefinition();
        Integer parentId = alertDefinition.getParentId();
        if (groupAlertDefinition != null && groupAlertDefinition.getGroup() != null) {
            boolean isAutogroup = groupAlertDefinition.getGroup().getAutoGroupParentResource() != null;
            record.setAttribute(FIELD_PARENT, (isAutogroup ? "#Resource/AutoGroup/" : "#ResourceGroup/")
                + groupAlertDefinition.getGroup().getId() + "/Alerts/Definitions/" + groupAlertDefinition.getId());
            record.setLinkText(MSG.view_alert_definition_for_group());
        } else if (parentId != null && parentId.intValue() != 0) {
            record.setAttribute(
                FIELD_PARENT,
                LinkManager.getAdminTemplatesEditLink(AlertDefinitionTemplateTypeView.VIEW_ID.getName(), resource
                    .getResourceType().getId())
                    + "/" + parentId);
            record.setLinkText(MSG.view_alert_definition_for_type());
        }

        Set<AlertConditionLog> conditionLogs = from.getConditionLogs();
        String conditionText;
        String conditionValue;
        if (conditionLogs.size() > 1) {
            conditionText = MSG.view_alerts_field_condition_text_many();
            conditionValue = "--";
        } else if (conditionLogs.size() == 1) {
            AlertConditionLog conditionLog = conditionLogs.iterator().next();
            AlertCondition condition = conditionLog.getCondition();
            conditionText = AlertFormatUtility.formatAlertConditionForDisplay(condition);
            conditionValue = conditionLog.getValue();
            if (condition.getMeasurementDefinition() != null) {
                try {
                    conditionValue = MeasurementConverterClient.format(Double.valueOf(conditionLog.getValue()),
                        condition.getMeasurementDefinition().getUnits(), true);
                } catch (Exception e) {
                    // the condition log value was probably not a number (most likely a trait). Ignore this exception.
                    // even if any other errors occur trying to format the value, ignore this and just use the raw value string
                }
            }
        } else {
            conditionText = MSG.view_alerts_field_condition_text_none();
            conditionValue = "--";
        }
        record.setAttribute("conditionText", conditionText);
        if (conditionValue.contains("extraInfo=")) {
            conditionValue = conditionValue.replaceFirst("extraInfo=\\[","");
            conditionValue = conditionValue.substring(0,conditionValue.length()-1);
        }
        record.setAttribute("conditionValue", conditionValue);

        // We also need the'raw' notification data to show in details
        DataClass[] conditions = new DataClass[from.getConditionLogs().size()];
        int i = 0;
        for (AlertConditionLog log : from.getConditionLogs()) {
            AlertCondition condition = log.getCondition();
            DataClass dc = new DataClass();
            dc.setAttribute("text", AlertFormatUtility.formatAlertConditionForDisplay(condition));
            String value = log.getValue();
            if (condition.getMeasurementDefinition() != null) {
                try {
                    value = MeasurementConverterClient.format(Double.valueOf(log.getValue()), condition
                        .getMeasurementDefinition().getUnits(), true);
                } catch (Exception e) {
                    // the condition log value was probably not a number (most likely a trait). Ignore this exception.
                    // even if any other errors occur trying to format the value, ignore this and just use the raw value string
                }
            }
            // Remove the extraInfo=[ ] that is added when storing the raw event data in the data base
            if (value.contains("extraInfo=")) {
                value = value.replaceFirst("extraInfo=\\[","");
                value = value.substring(0,value.length()-1);
            }
            dc.setAttribute("value", value);
            conditions[i++] = dc;
        }
        record.setAttribute("conditionLogs", conditions);
        record.setAttribute("conditionExpression", alertDefinition.getConditionExpression());

        String recoveryInfo = AlertFormatUtility.getAlertRecoveryInfo(from);
        record.setAttribute("recoveryInfo", recoveryInfo);

        // Alert notification logs
        DataClass[] notifications = new DataClass[from.getAlertNotificationLogs().size()];
        i = 0;
        for (AlertNotificationLog log : from.getAlertNotificationLogs()) {
            DataClass dc = new DataClass();
            dc.setAttribute("sender", log.getSender());
            dc.setAttribute("status", log.getResultState().name());
            dc.setAttribute("message", log.getMessage());

            notifications[i++] = dc;
        }
        record.setAttribute("notificationLogs", notifications);
        return record;
    }
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.ListGridRecord

            @Override
            public void onDoubleClick(DoubleClickEvent event) {
                ListGrid listGrid = (ListGrid) event.getSource();
                ListGridRecord[] selectedRows = listGrid.getSelectedRecords();
                if (selectedRows != null && selectedRows.length == 1) {
                    ListGridRecord record = selectedRows[0];
                    Integer resourceId = record.getAttributeAsInt(AncestryUtil.RESOURCE_ID);
                    Integer driftDefId = record.getAttributeAsInt(DriftDataSource.ATTR_CHANGESET_DEF_ID);
                    String driftId = getId(record);
                    String url = LinkManager.getDriftCarouselDriftLink(resourceId, driftDefId, driftId);
                    CoreGUI.goToView(url);
                }
            }
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.ListGridRecord

                return null;
            }

            @Override
            public ListGridRecord copyValues(DriftDefinition from) {
                ListGridRecord record = new ListGridRecord();

                record.setAttribute(DriftDefinitionDataSource.ATTR_ID, from.getId());

                record.setAttribute(DriftDefinitionDataSource.ATTR_NAME, from.getName());
                record.setAttribute(DriftDefinitionDataSource.ATTR_DESCRIPTION, from.getDescription());

                record.setAttribute(DriftDefinitionDataSource.ATTR_IS_ENABLED, String.valueOf(from.isEnabled()));
                record.setAttribute(DriftDefinitionDataSource.ATTR_IS_ENABLED_ICON,
                    ImageManager.getAvailabilityIcon(from.isEnabled()));
                record.setAttribute(DriftDefinitionDataSource.ATTR_COMPLIANCE, from.getComplianceStatus().ordinal());
                record
                    .setAttribute(DriftDefinitionDataSource.ATTR_COMPLIANCE_ICON, ImageManager.getAvailabilityIcon(from
                        .getComplianceStatus() == DriftComplianceStatus.IN_COMPLIANCE));

                record.setAttribute(DriftDefinitionDataSource.ATTR_ATTACHED, from.isAttached() ? MSG.common_val_yes()
                    : MSG.common_val_no());

                // for ancestry handling
                Resource resource = from.getResource();
                record.setAttribute(AncestryUtil.RESOURCE_ID, resource.getId());
                record.setAttribute(AncestryUtil.RESOURCE_NAME, resource.getName());
                record.setAttribute(AncestryUtil.RESOURCE_ANCESTRY, resource.getAncestry());
                record.setAttribute(AncestryUtil.RESOURCE_TYPE_ID, resource.getResourceType().getId());

                return record;
            }
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.ListGridRecord

        @Override
        protected String getViewUrl(ListGridRecord[] selection) {
            String viewUrl = super.getViewUrl(selection);
            if (viewUrl != null) {
                ListGridRecord selectedRecord = selection[0];
                Integer operationHistoryId = selectedRecord.getAttributeAsInt(OperationHistoryDataSource.Field.ID);
                viewUrl += "/example=" + operationHistoryId;
            }
            return viewUrl;
        }
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.ListGridRecord

        return null;
    }

    @Override
    public ListGridRecord copyValues(DriftSnapshotDirectory from) {
        ListGridRecord record = new ListGridRecord();

        String dirPath = from.getDirectoryPath();
        record.setAttribute(ATTR_DIR_PATH, (null == dirPath || "".equals(dirPath.trim())) ? "./" : dirPath);
        record.setAttribute(ATTR_FILES, from.getFiles());
        record.setAttribute(ATTR_ADDED, from.getAdded());
        record.setAttribute(ATTR_CHANGED, from.getChanged());
        record.setAttribute(ATTR_REMOVED, from.getRemoved());

        return record;
    }
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.ListGridRecord

    }

    @Override
    public ListGridRecord copyValues(ResourceComposite from) {
        Resource res = from.getResource();
        ListGridRecord record = new ListGridRecord();
        record.setAttribute("resourceComposite", from);
        record.setAttribute("resource", res);
        record.setAttribute("id", res.getId());
        record.setAttribute(NAME.propertyName(), res.getName());
        record.setAttribute(KEY.propertyName(), res.getResourceKey());
        record.setAttribute(DESCRIPTION.propertyName(), res.getDescription());
        record.setAttribute(LOCATION.propertyName(), res.getLocation());
        record.setAttribute(TYPE.propertyName(), res.getResourceType().getId());
        record.setAttribute(PLUGIN.propertyName(), res.getResourceType().getPlugin());
        record.setAttribute(VERSION.propertyName(), res.getVersion());
        record.setAttribute(CATEGORY.propertyName(), res.getResourceType().getCategory().name());
        record.setAttribute("icon", ImageManager.getResourceIcon(res.getResourceType().getCategory(), res
            .getCurrentAvailability().getAvailabilityType()));
        record.setAttribute(AVAILABILITY.propertyName(),
            ImageManager.getAvailabilityIconFromAvailType(res.getCurrentAvailability().getAvailabilityType()));
        record.setAttribute(CTIME.propertyName(), res.getCtime());
        record.setAttribute(ITIME.propertyName(), res.getItime());
        record.setAttribute(MTIME.propertyName(), res.getMtime());
        record.setAttribute(MODIFIER.propertyName(), res.getModifiedBy());
        record.setAttribute(INVENTORY_STATUS.propertyName(), res.getInventoryStatus());

        record.setAttribute("resourcePermission", from.getResourcePermission());

        // for ancestry handling      
        record.setAttribute(AncestryUtil.RESOURCE_ANCESTRY, res.getAncestry());
        record.setAttribute(AncestryUtil.RESOURCE_TYPE_ID, res.getResourceType().getId());

        return record;
    }
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.