Search in sources :

Example 1 with IPluginPerspective

use of org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective in project pentaho-platform by pentaho.

the class SystemPathXmlPluginProvider method processPerspectives.

/**
 * @param plugin
 * @param doc
 */
protected void processPerspectives(PlatformPlugin plugin, Document doc) {
    // TODO Auto-generated method stub
    // $NON-NLS-1$
    List<?> nodes = doc.selectNodes("/*/perspective");
    for (Object obj : nodes) {
        Element node = (Element) obj;
        if (node != null) {
            IPluginPerspective perspective = PerspectiveUtil.createPerspective(node);
            plugin.addPluginPerspective(perspective);
        }
    }
}
Also used : Element(org.dom4j.Element) IPluginPerspective(org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective)

Example 2 with IPluginPerspective

use of org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective in project pentaho-platform by pentaho.

the class PentahoSystemPluginManager method registerPerspectives.

private void registerPerspectives(IPlatformPlugin plugin, ClassLoader loader) {
    for (IPluginPerspective pluginPerspective : plugin.getPluginPerspectives()) {
        // PentahoSystem.get( IPluginPerspectiveManager.class ).addPluginPerspective( pluginPerspective );
        final IPentahoObjectRegistration referenceHandle = PentahoSystem.registerReference(new SingletonPentahoObjectReference.Builder<IPluginPerspective>(IPluginPerspective.class).object(pluginPerspective).attributes(Collections.<String, Object>singletonMap(PLUGIN_ID, plugin.getId())).build(), IPluginPerspective.class);
        registerReference(plugin.getId(), referenceHandle);
    }
}
Also used : BeanDefinitionBuilder(org.springframework.beans.factory.support.BeanDefinitionBuilder) IPentahoObjectRegistration(org.pentaho.platform.api.engine.IPentahoObjectRegistration) IPluginPerspective(org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective)

Example 3 with IPluginPerspective

use of org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective in project pentaho-platform by pentaho.

the class PerspectiveUtil method createPerspective.

static IPluginPerspective createPerspective(Element perspectiveNode) {
    if (perspectiveNode != null) {
        // $NON-NLS-1$
        String title = perspectiveNode.attributeValue("title");
        // $NON-NLS-1$
        String id = perspectiveNode.attributeValue("id");
        // $NON-NLS-1$
        String contentUrl = perspectiveNode.attributeValue("content-url");
        // $NON-NLS-1$
        String resourceBundleUri = perspectiveNode.attributeValue("resourcebundle");
        // $NON-NLS-1$
        String layoutPriorityStr = perspectiveNode.attributeValue("layout-priority");
        int layoutPriority = DEFAULT_LAYOUT_PRIORITY;
        if (layoutPriorityStr != null && layoutPriorityStr.length() > 0) {
            try {
                layoutPriority = Integer.parseInt(layoutPriorityStr);
            } catch (Exception e) {
                layoutPriority = DEFAULT_LAYOUT_PRIORITY;
            }
        }
        String securityActionStr = perspectiveNode.attributeValue("required-security-action");
        ArrayList<String> actions = new ArrayList<String>();
        if (securityActionStr != null) {
            StringTokenizer st = new StringTokenizer(securityActionStr, ";, ");
            while (st.hasMoreTokens()) {
                String action = st.nextToken();
                actions.add(action);
            }
        }
        // $NON-NLS-1$
        ArrayList<XulOverlay> overlays = processOverlays(perspectiveNode);
        IPluginPerspective perspective = new DefaultPluginPerspective();
        perspective.setTitle(title);
        perspective.setId(id);
        perspective.setContentUrl(contentUrl);
        perspective.setLayoutPriority(layoutPriority);
        perspective.setOverlays(overlays);
        perspective.setRequiredSecurityActions(actions);
        perspective.setResourceBundleUri(resourceBundleUri);
        return perspective;
    }
    return null;
}
Also used : XulOverlay(org.pentaho.ui.xul.XulOverlay) DefaultXulOverlay(org.pentaho.ui.xul.impl.DefaultXulOverlay) StringTokenizer(java.util.StringTokenizer) DefaultPluginPerspective(org.pentaho.platform.plugin.services.pluginmgr.perspective.pojo.DefaultPluginPerspective) ArrayList(java.util.ArrayList) IPluginPerspective(org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective)

Example 4 with IPluginPerspective

use of org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective in project pentaho-platform by pentaho.

the class DefaultPluginPerspectiveManager method getPluginPerspectives.

public List<IPluginPerspective> getPluginPerspectives() {
    // Compatibility check for old PerspectiveManager behavior. If the pluginPerspectives is empty,
    // we'll look in PentahoSystem
    List<IPluginPerspective> perspectives = (pluginPerspectives.isEmpty()) ? PentahoSystem.getAll(IPluginPerspective.class, null) : pluginPerspectives;
    // don't return the actual list, otherwise the user could remove items without going through our api
    ArrayList<IPluginPerspective> allowedPerspectives = new ArrayList<IPluginPerspective>();
    for (IPluginPerspective perspective : perspectives) {
        ArrayList<String> actions = perspective.getRequiredSecurityActions();
        IAuthorizationPolicy policy = PentahoSystem.get(IAuthorizationPolicy.class);
        boolean allowed = true;
        if (policy != null && actions != null && !actions.isEmpty()) {
            // we're going to have to check the user
            for (String actionName : actions) {
                allowed = policy.isAllowed(actionName);
                if (!allowed) {
                    // don't need to check anymore
                    break;
                }
            }
        }
        if (allowed) {
            allowedPerspectives.add(perspective);
        }
    }
    return allowedPerspectives;
}
Also used : IAuthorizationPolicy(org.pentaho.platform.api.engine.IAuthorizationPolicy) ArrayList(java.util.ArrayList) IPluginPerspective(org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective)

Example 5 with IPluginPerspective

use of org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective in project pentaho-platform by pentaho.

the class MantleModel method showSchedules.

@Bindable
public void showSchedules() {
    IPluginPerspective perspective = PerspectiveManager.getInstance().getActivePerspective();
    boolean showing = perspective.getId().equalsIgnoreCase(PerspectiveManager.SCHEDULES_PERSPECTIVE);
    if (!showing || !this.showBrowserSelected) {
        PerspectiveManager.getInstance().setPerspective(PerspectiveManager.SCHEDULES_PERSPECTIVE);
    }
}
Also used : IPluginPerspective(org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective) Bindable(org.pentaho.ui.xul.stereotype.Bindable)

Aggregations

IPluginPerspective (org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective)12 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)2 IPluginPerspectiveManager (org.pentaho.platform.api.engine.perspective.IPluginPerspectiveManager)2 DefaultPluginPerspective (org.pentaho.platform.plugin.services.pluginmgr.perspective.pojo.DefaultPluginPerspective)2 XulOverlay (org.pentaho.ui.xul.XulOverlay)2 Bindable (org.pentaho.ui.xul.stereotype.Bindable)2 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)1 MenuBar (com.google.gwt.user.client.ui.MenuBar)1 MenuItem (com.google.gwt.user.client.ui.MenuItem)1 StringTokenizer (java.util.StringTokenizer)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Facet (org.codehaus.enunciate.Facet)1 Element (org.dom4j.Element)1 FileChooserDialog (org.pentaho.gwt.widgets.client.filechooser.FileChooserDialog)1 FileChooserListener (org.pentaho.gwt.widgets.client.filechooser.FileChooserListener)1 RepositoryFile (org.pentaho.gwt.widgets.client.filechooser.RepositoryFile)1 RepositoryFileTree (org.pentaho.gwt.widgets.client.filechooser.RepositoryFileTree)1