Package org.apache.isis.core.runtime.userprofile

Examples of org.apache.isis.core.runtime.userprofile.PerspectiveEntry


        userProfile.addToPerspectives(((PerspectiveImpl) perspective).getPerspectiveEntry());
    }

    @Override
    public Perspective getPerspective(final String name) {
        final PerspectiveEntry perspectiveEntry = userProfile.getPerspective(name);
        if (perspectiveEntry == null) {
            throw new IsisException("No perspective found for " + name);
        }
        return new PerspectiveImpl(perspectiveEntry);
    }
View Full Code Here


        return new PerspectiveImpl(perspectiveEntry);
    }

    @Override
    public Perspective newPerspective(final String name) {
        final PerspectiveEntry perspectiveEntry = userProfile.newPerspective(name);
        return new PerspectiveImpl(perspectiveEntry);
    }
View Full Code Here

        assertLine("  </options>", 2);
    }

    @Test
    public void perspective() throws Exception {
        final PerspectiveEntry perspective = new PerspectiveEntry();
        perspective.setName("test");
        profile.addToPerspectives(perspective);
        // debug();
        writeContent();
        assertEquals("<profile>\n  <options>\n  </options>\n  <perspectives>\n" + "    <perspective name=\"test\">\n      <services>\n      </services>\n      <objects>\n      </objects>\n    </perspective>\n" + "  </perspectives>\n</profile>\n", writer.toString());
    }
View Full Code Here

        options.add(new CloseViewOption() {
            @Override
            public void execute(final Workspace workspace, final View view, final Location at) {
                final PerspectiveContent parent = (PerspectiveContent) view.getParent().getContent();
                final PerspectiveEntry perspective = parent.getPerspective();
                final ServiceObject serviceContent = (ServiceObject) view.getContent();
                final ObjectAdapter element = serviceContent.getObject();
                perspective.removeFromServices(element);
                super.execute(workspace, view, at);
            }
        });
    }
View Full Code Here

        final Options options = userProfile.getOptions();
        writeOptions(xml, options, null, 0);

        xml.append("  <perspectives>\n");
        for (final String perspectiveName : userProfile.list()) {
            final PerspectiveEntry perspective = userProfile.getPerspective(perspectiveName);

            xml.append("    <perspective" + attribute("name", perspectiveName) + ">\n");
            xml.append("      <services>\n");
            for (final Object service : perspective.getServices()) {
                xml.append("        <service " + attribute("id", ServiceUtil.id(service)) + "/>\n");
            }
            xml.append("      </services>\n");
            xml.append("      <objects>\n");
            for (final Object object : perspective.getObjects()) {
                final ObjectAdapter adapter = getPersistenceSession().getAdapterManager().adapterFor(object);
                xml.append("        <object>" + adapter.getOid().enString(getOidMarshaller()) + "</object>\n");
            }
            xml.append("      </objects>\n");
            xml.append("    </perspective>\n");
View Full Code Here

        final PerspectiveContent perspectiveContent = (PerspectiveContent) view1.getContent();

        // REVIEW is this needed?
        workspace.clearServiceViews();

        final PerspectiveEntry perspective = perspectiveContent.getPerspective();
        for (final Object object : perspective.getObjects()) {
            final ObjectAdapter adapter = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(object);
            workspace.addIconFor(adapter, new Placement(ApplicationWorkspaceBuilder.UNPLACED));
        }

        for (final Object service : perspective.getServices()) {
            final ObjectAdapter adapter = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(service);
            if (isHidden(adapter)) {
                continue;
            }
            workspace.addServiceIconFor(adapter);
View Full Code Here

        final Content content = view.getContent();
        final ObjectAdapter object = content == null ? null : content.getAdapter();

        final List<DebuggableWithTitle> debug = Lists.newArrayList();
        if (content instanceof PerspectiveContent) {
            final PerspectiveEntry perspectiveEntry = ((PerspectiveContent) content).getPerspective();
            debug.add(UserProfilesDebugUtil.asDebuggableWithTitle(perspectiveEntry));
        } else {
            debug.add(new DebugObjectSpecification(content.getSpecification()));
        }
        if (object != null) {
View Full Code Here

        final Options options = userProfile.getOptions();
        writeOptions(xml, options, null, 0);

        xml.append("  <perspectives>\n");
        for (final String perspectiveName : userProfile.list()) {
            final PerspectiveEntry perspective = userProfile.getPerspective(perspectiveName);

            xml.append("    <perspective" + attribute("name", perspectiveName) + ">\n");
            xml.append("      <services>\n");
            for (final Object service : perspective.getServices()) {
                xml.append("        <service " + attribute("id", ServiceUtil.id(service)) + "/>\n");
            }
            xml.append("      </services>\n");
            xml.append("      <objects>\n");
            for (final Object object : perspective.getObjects()) {
                final ObjectAdapter adapter = getPersistenceSession().getAdapterManager().adapterFor(object);
                final OutputStream out = new ByteArrayOutputStream();
                final DataOutputStreamExtended outputImpl = new DataOutputStreamExtended(out);
                adapter.getOid().encode(outputImpl);
                // FIX need to sort out encoding
View Full Code Here

        assertLine("  </options>", 2);
    }

    @Test
    public void perspective() throws Exception {
        final PerspectiveEntry perspective = new PerspectiveEntry();
        perspective.setName("test");
        profile.addToPerspectives(perspective);
        // debug();
        writeContent();
        assertEquals("<profile>\n  <options>\n  </options>\n  <perspectives>\n" + "    <perspective name=\"test\">\n      <services>\n      </services>\n      <objects>\n      </objects>\n    </perspective>\n" + "  </perspectives>\n</profile>\n", writer.toString());
    }
View Full Code Here

        userProfile.addToPerspectives(((PerspectiveImpl) perspective).getPerspectiveEntry());
    }

    @Override
    public Perspective getPerspective(final String name) {
        final PerspectiveEntry perspectiveEntry = userProfile.getPerspective(name);
        if (perspectiveEntry == null) {
            throw new IsisException("No perspective found for " + name);
        }
        return new PerspectiveImpl(perspectiveEntry);
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.runtime.userprofile.PerspectiveEntry

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.