use of org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective in project pentaho-platform by pentaho.
the class DefaultPluginPerspectiveManagerIT method testPerspectiveManager.
@Test
public void testPerspectiveManager() {
IPluginPerspectiveManager manager = PentahoSystem.get(IPluginPerspectiveManager.class);
assertNotNull(manager);
IPluginPerspective testPerspective = createTestPerspective("test-perspective-id", "test-perspective-title");
manager.addPluginPerspective(testPerspective);
assertEquals(1, manager.getPluginPerspectives().size());
assertEquals("test-perspective-id", manager.getPluginPerspectives().get(0).getId());
assertEquals("test-perspective-title", manager.getPluginPerspectives().get(0).getTitle());
assertEquals("test-content-url", manager.getPluginPerspectives().get(0).getContentUrl());
manager.getPluginPerspectives().get(0).setContentUrl("different");
assertEquals("different", manager.getPluginPerspectives().get(0).getContentUrl());
manager.removePluginPerspective(testPerspective);
assertEquals(0, manager.getPluginPerspectives().size());
manager.addPluginPerspective(createTestPerspective("test-perspective-id-1", "test-perspective-title-1"));
manager.addPluginPerspective(createTestPerspective("test-perspective-id-2", "test-perspective-title-2"));
manager.addPluginPerspective(createTestPerspective("test-perspective-id-3", "test-perspective-title-3"));
manager.addPluginPerspective(createTestPerspective("test-perspective-id-4", "test-perspective-title-4"));
manager.addPluginPerspective(createTestPerspective("test-perspective-id-5", "test-perspective-title-5"));
assertEquals(5, manager.getPluginPerspectives().size());
for (int i = 0; i < 5; i++) {
assertEquals("test-perspective-id-" + (i + 1), manager.getPluginPerspectives().get(i).getId());
assertEquals("test-perspective-title-" + (i + 1), manager.getPluginPerspectives().get(i).getTitle());
assertEquals(500, manager.getPluginPerspectives().get(i).getLayoutPriority());
}
manager.clearPluginPerspectives();
assertEquals(0, manager.getPluginPerspectives().size());
}
use of org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective in project pentaho-platform by pentaho.
the class PluginManagerResource method getPluginPerpectives.
/**
* Retrieve the list of plugin perspective in the platform
*
* @return list of <code> PluginPerspective </code>
*/
@GET
@Path("/perspectives")
@Produces({ APPLICATION_JSON })
@Facet(name = "Unsupported")
public ArrayList<PluginPerspective> getPluginPerpectives() {
IPluginPerspectiveManager manager = // $NON-NLS-1$
PentahoSystem.get(IPluginPerspectiveManager.class, PentahoSessionHolder.getSession());
ArrayList<PluginPerspective> perspectives = new ArrayList<PluginPerspective>();
for (IPluginPerspective perspective : manager.getPluginPerspectives()) {
PluginPerspective pp = new PluginPerspective();
pp.setId(perspective.getId());
pp.setTitle(perspective.getTitle());
pp.setContentUrl(perspective.getContentUrl());
pp.setLayoutPriority(perspective.getLayoutPriority());
pp.setRequiredSecurityActions(perspective.getRequiredSecurityActions());
pp.setResourceBundleUri(perspective.getResourceBundleUri());
if (perspective.getOverlays() != null) {
ArrayList<Overlay> safeOverlays = new ArrayList<Overlay>();
for (XulOverlay orig : perspective.getOverlays()) {
Overlay tempOverlay = new Overlay(orig.getId(), orig.getOverlayUri(), orig.getSource(), orig.getResourceBundleUri(), orig.getPriority());
safeOverlays.add(tempOverlay);
}
pp.setOverlays(safeOverlays);
}
perspectives.add(pp);
}
return perspectives;
}
Aggregations