All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xlcloud.console.stacks.StackBlueprintsMenuItemsProducer Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2012 AMG.lab, a Bull Group Company
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.xlcloud.console.stacks;

import java.util.Set;

import javax.enterprise.context.ApplicationScoped;

import org.xlcloud.console.context.IdentityContext;
import org.xlcloud.console.menu.BaseMenuItemsProducer;
import org.xlcloud.console.menu.CoreMenuGroupLabel;
import org.xlcloud.console.menu.MenuItem;
import org.xlcloud.service.Entitlement;
import org.xlcloud.service.HttpAction;
import org.xlcloud.service.api.WebResourceRegistry;

/**
 * Produces menu items for Stack Blueprints.
 *
 * @author Piotr Kulasek-Szwed, AMG.net
 */
@ApplicationScoped
public class StackBlueprintsMenuItemsProducer extends BaseMenuItemsProducer {

    private static final String ACTIVATION_PATH = "/stackBlueprint/.*";

    private static final MenuItem STACK_BLUEPRINT_LIST;

    static {
        Entitlement publicStackBlueprintsEntitlement = new Entitlement();
        publicStackBlueprintsEntitlement.setResource(WebResourceRegistry.STACK_BLUEPRINTS);
        publicStackBlueprintsEntitlement.getAction().add(HttpAction.GET);

        Entitlement privateStackBlueprintsEntitlement = new Entitlement();
        privateStackBlueprintsEntitlement.setResource("accounts/{accId}/" + WebResourceRegistry.STACK_BLUEPRINTS);
        privateStackBlueprintsEntitlement.getAction().add(HttpAction.GET);

        STACK_BLUEPRINT_LIST = new MenuItem(40, "/stackBlueprint/stackBlueprints", "Stack Blueprints", "menu.item.stackBlueprints",
                CoreMenuGroupLabel.PLATFORM_CONFIGURATION, ACTIVATION_PATH, publicStackBlueprintsEntitlement, privateStackBlueprintsEntitlement);
    }

    /** {@inheritDoc} */
    @Override
    protected Set getMenuItems(IdentityContext identityContext) {
        return asSet(STACK_BLUEPRINT_LIST);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy