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);
}
}
}
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);
}
}
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;
}
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;
}
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);
}
}
Aggregations