Package org.rhq.core.domain.common

Examples of org.rhq.core.domain.common.EntityContext


    public static WebUserPreferences getWebUserPreferences() {
        return EnterpriseFacesContextUtility.getWebUser().getWebPreferences();
    }

    public static String contextFragmentURL() {
        EntityContext context = WebUtility.getEntityContext();
        switch (context.type) {
        case Resource:
            return ParamConstants.RESOURCE_ID_PARAM + "=" + String.valueOf(context.resourceId);
        case ResourceGroup:
            return ParamConstants.GROUP_ID_PARAM + "=" + String.valueOf(context.groupId);
        case AutoGroup:
            return ParamConstants.PARENT_RESOURCE_ID_PARAM + "=" + String.valueOf(context.parentResourceId) + "&"
                + ParamConstants.RESOURCE_TYPE_ID_PARAM + "=" + String.valueOf(context.resourceTypeId);
        default:
            throw new IllegalArgumentException(context.getUnknownContextMessage());
        }
    }
View Full Code Here


     * This legacy struts action expects a "ctype" parameter where the new UI uses "type".
     *
     * @return context fragment of the URL based on the current entity.
     */
    public static String contextFragmentURLForIndicatorsChart() {
        EntityContext context = WebUtility.getEntityContext();
        switch (context.type) {
        case AutoGroup:
            return ParamConstants.PARENT_RESOURCE_ID_PARAM + "=" + String.valueOf(context.parentResourceId) + "&"
                + ParamConstants.CHILD_RESOURCE_TYPE_ID_PARAM + "=" + String.valueOf(context.resourceTypeId);
        default:
View Full Code Here

        int parentResourceId = WebUtility.getOptionalIntRequestParameter(request,
            ParamConstants.PARENT_RESOURCE_ID_PARAM, -1);
        int resourceTypeId = WebUtility.getOptionalIntRequestParameter(request, ParamConstants.RESOURCE_TYPE_ID_PARAM,
            -1);

        return new EntityContext(resourceId, groupId, parentResourceId, resourceTypeId);
    }
View Full Code Here

    }

    @Override
    public List<AvailabilityPoint> findAvailabilitiesForResource(Subject subject, int resourceId,
        long fullRangeBeginTime, long fullRangeEndTime, int numberOfPoints, boolean withCurrentAvailability) {
        EntityContext context = new EntityContext(resourceId, -1, -1, -1);
        return getAvailabilitiesForContext(subject, context, fullRangeBeginTime, fullRangeEndTime, numberOfPoints,
            withCurrentAvailability);
    }
View Full Code Here

    }

    @Override
    public List<AvailabilityPoint> findAvailabilitiesForResourceGroup(Subject subject, int groupId,
        long fullRangeBeginTime, long fullRangeEndTime, int numberOfPoints, boolean withCurrentAvailability) {
        EntityContext context = new EntityContext(-1, groupId, -1, -1);
        return getAvailabilitiesForContext(subject, context, fullRangeBeginTime, fullRangeEndTime, numberOfPoints,
            withCurrentAvailability);
    }
View Full Code Here

    @Override
    public List<AvailabilityPoint> findAvailabilitiesForAutoGroup(Subject subject, int parentResourceId,
        int resourceTypeId, long fullRangeBeginTime, long fullRangeEndTime, int numberOfPoints,
        boolean withCurrentAvailability) {
        EntityContext context = new EntityContext(-1, -1, parentResourceId, resourceTypeId);
        return getAvailabilitiesForContext(subject, context, fullRangeBeginTime, fullRangeEndTime, numberOfPoints,
            withCurrentAvailability);
    }
View Full Code Here

        long begin = rangePreferences.begin;
        long end = rangePreferences.end;

        int[] measurementDefinitionIds;
        try {
            EntityContext context = new EntityContext(-1, -1, parent, type);
            measurementDefinitionIds = fillDefinitionIdsFromUserPreferences(context, viewName, subject);
        } catch (IllegalArgumentException iae) {
            // If we can't get stuff from preferences, get the defaults.
            measurementDefinitionIds = resourceGroupManager.findDefinitionsForAutoGroup(subject, parent, type, true);
        }
View Full Code Here

        /*
         * Try to get the schedules for this view from the preferences and extract the
         * schedule ids from it. If this fails, fall back to defaults.
         */
        try {
            EntityContext context = new EntityContext(resourceId, -1, -1, -1);
            List<String> charts = viewManager.getCharts(subject, context, viewName);

            int[] schIds = new int[charts.size()];
            int i = 0;
            for (String metric : charts) {
View Full Code Here

        INITIAL_CRITERIA.addCriteria(EventCompositeDatasource.FILTER_SEVERITIES, severityNames);
    }

    public static EventCompositeHistoryView get(ResourceGroupComposite composite) {
        String tableTitle = MSG.view_inventory_eventHistory_groupEventHistory();
        EntityContext context = EntityContext.forGroup(composite.getResourceGroup().getId());
        boolean hasWriteAccess = composite.getResourcePermission().isEvent();
        return new EventCompositeHistoryView(tableTitle, context, hasWriteAccess);
    }
View Full Code Here

        return new EventCompositeHistoryView(tableTitle, context, hasWriteAccess);
    }

    public static EventCompositeHistoryView get(ResourceComposite composite) {
        String tableTitle = MSG.view_inventory_eventHistory_resourceEventHistory();
        EntityContext context = EntityContext.forResource(composite.getResource().getId());
        boolean hasWriteAccess = composite.getResourcePermission().isEvent();
        return new EventCompositeHistoryView(tableTitle, context, hasWriteAccess);
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.common.EntityContext

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.