Package org.rhq.core.domain.criteria

Examples of org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria


            });
    }

    @Override
    protected GroupResourceConfigurationUpdateCriteria getFetchCriteria(final DSRequest request) {
        GroupResourceConfigurationUpdateCriteria criteria = new GroupResourceConfigurationUpdateCriteria();

        ArrayList<Integer> groupIds = new ArrayList<Integer>(1);
        groupIds.add(this.groupId);
        criteria.addFilterResourceGroupIds(groupIds);

        PageControl pageControl = getPageControl(request);
        pageControl.addDefaultOrderingField(Field.ID, PageOrdering.DESC);
        criteria.setPageControl(pageControl);

        return criteria;
    }
View Full Code Here


                    if (!results.isEmpty()) {
                        groupComposite = results.get(0);
                        //instantiate view

                        PageControl lastFive = new PageControl(0, 5);
                        GroupResourceConfigurationUpdateCriteria criteria = new GroupResourceConfigurationUpdateCriteria();
                        criteria.setPageControl(lastFive);
                        //TODO: spinder: move this up into the pageControl.
                        criteria.addSortStatus(PageOrdering.DESC);
                        List<Integer> filterResourceGroupIds = new ArrayList<Integer>();
                        filterResourceGroupIds.add(context.getGroupId());
                        criteria.addFilterResourceGroupIds(filterResourceGroupIds);

                        groupHistoryTable = new GroupConfigurationHistoryCriteriaTable(groupComposite);
                    } else {
                        ResourceGroup emptyGroup = new ResourceGroup("");
                        emptyGroup.setId(-1);
View Full Code Here

        }

        @Override
        protected GroupResourceConfigurationUpdateCriteria getFetchCriteria(final DSRequest request) {
            //initialize criteria
            GroupResourceConfigurationUpdateCriteria criteria = new GroupResourceConfigurationUpdateCriteria();

            criteria.addFilterResourceGroupIds(Arrays.asList(groupId));

            PageControl pageControl = new PageControl(0, Integer.valueOf(Constant.RESULT_COUNT_DEFAULT));

            //customize query with latest configuration selections

            //retrieve previous settings from portlet config
            if (portletConfig != null) {
                //            //result sort order
                //            PropertySimple property = portletConfig.getSimple(Constant.RESULT_SORT_ORDER);
                //            if (property != null) {
                //                String currentSetting = property.getStringValue();
                //                if (currentSetting.trim().isEmpty() || currentSetting.equalsIgnoreCase(PageOrdering.DESC.name())) {
                //                    criteria.addSortStatus(PageOrdering.DESC);
                //                } else {
                //                    criteria.addSortStatus(PageOrdering.ASC);
                //                }
                //            }
                //result timeframe if enabled
                PropertySimple property = portletConfig.getSimple(Constant.METRIC_RANGE_ENABLE);
                if (null != property && Boolean.valueOf(property.getBooleanValue())) {//then proceed setting

                    boolean isAdvanced = Boolean.valueOf(portletConfig.getSimpleValue(
                        Constant.METRIC_RANGE_BEGIN_END_FLAG, Constant.METRIC_RANGE_BEGIN_END_FLAG_DEFAULT));
                    if (isAdvanced) {
                        //Advanced time settings
                        String currentSetting = portletConfig.getSimpleValue(Constant.METRIC_RANGE,
                            Constant.METRIC_RANGE_DEFAULT);
                        String[] range = currentSetting.split(",");
                        if (range.length == 2) {
                            criteria.addFilterStartTime(Long.valueOf(range[0]));
                            criteria.addFilterEndTime(Long.valueOf(range[1]));
                        }
                    } else {
                        //Simple time settings
                        property = portletConfig.getSimple(Constant.METRIC_RANGE_LASTN);
                        if (property != null) {
                            int lastN = Integer.valueOf(portletConfig.getSimpleValue(Constant.METRIC_RANGE_LASTN,
                                Constant.METRIC_RANGE_LASTN_DEFAULT));
                            int units = Integer.valueOf(portletConfig.getSimpleValue(Constant.METRIC_RANGE_UNIT,
                                Constant.METRIC_RANGE_UNIT_DEFAULT));
                            ArrayList<Long> beginEnd = MeasurementUtility.calculateTimeFrame(lastN, units);
                            criteria.addFilterStartTime(Long.valueOf(beginEnd.get(0)));
                            criteria.addFilterEndTime(Long.valueOf(beginEnd.get(1)));
                        }
                    }
                }

                //result count
                String currentSetting = portletConfig.getSimpleValue(Constant.RESULT_COUNT,
                    Constant.RESULT_COUNT_DEFAULT);
                if (currentSetting.trim().isEmpty()) {
                    pageControl.setPageSize(Integer.valueOf(Constant.RESULT_COUNT_DEFAULT));
                } else {
                    pageControl.setPageSize(Integer.valueOf(currentSetting));
                }

                criteria.setPageControl(pageControl);

                //detect operation status filter
                property = portletConfig.getSimple(Constant.CONFIG_UPDATE_STATUS);
                if (property != null) {
                    currentSetting = portletConfig.getSimpleValue(Constant.CONFIG_UPDATE_STATUS,
                        Constant.CONFIG_UPDATE_STATUS_DEFAULT);
                    String[] parsedValues = currentSetting.trim().split(",");
                    if (currentSetting.trim().isEmpty()
                        || parsedValues.length == ConfigurationUpdateStatus.values().length) {
                        //all operation stati assumed
                    } else {
                        ConfigurationUpdateStatus[] updateStatus = new ConfigurationUpdateStatus[parsedValues.length];
                        int indx = 0;
                        for (String priority : parsedValues) {
                            ConfigurationUpdateStatus s = ConfigurationUpdateStatus.valueOf(priority);
                            updateStatus[indx++] = s;
                        }
                        criteria.addFilterStatuses(updateStatus);
                    }
                }
            }
            return criteria;
        }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria

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.