Package org.brixcms.workspace

Examples of org.brixcms.workspace.Workspace


        if (targetState.equals(sitePlugin.getWorkspaceState(workspace))) {
            throw new IllegalStateException("Cannot publish workspace to same state it is already.");
        }

        String name = sitePlugin.getWorkspaceName(workspace);
        Workspace target = sitePlugin.getSiteWorkspace(name, targetState);
        if (target == null) {
            target = sitePlugin.createSite(name, targetState);
        }

        JcrSession sourceSession = brix.getCurrentSession(workspace.getId());
        JcrSession targetSession = brix.getCurrentSession(target.getId());

        brix.clone(sourceSession, targetSession);
    }
View Full Code Here


            this.requiredState = requiredState;
        }

        @Override
        public void onClick() {
            Workspace workspace = PublishingPanel.this.getModelObject();
            PublishingPlugin.get().publish(workspace, targetState);
            Map<String, String> map = new HashMap<String, String>();
            map.put("targetState", targetState);
            getSession().info(getString("published", new Model<Serializable>((Serializable) map)));
        }
View Full Code Here

            getSession().info(getString("published", new Model<Serializable>((Serializable) map)));
        }

        @Override
        public boolean isVisible() {
            Workspace workspace = PublishingPanel.this.getModelObject();
            String state = SitePlugin.get().getWorkspaceState(workspace);
            Action action = new PublishWorkspaceAction(Context.ADMINISTRATION, workspace,
                    targetState);

            return requiredState.equals(state) &&
View Full Code Here

                        modalWindow.show(target);
                    }

                    @Override
                    public boolean isVisible() {
                        Workspace target = ManagePrototypesPanel.this.getModelObject();
                        Action action = new RestorePrototypeAction(Context.ADMINISTRATION, item.getModelObject(), target);
                        return getBrix().getAuthorizationStrategy().isActionAuthorized(action);
                    }
                });

                item.add(new Link<Void>("delete") {
                    @Override
                    public void onClick() {
                        Workspace prototype = item.getModelObject();
                        prototype.delete();
                    }

                    @Override
                    public boolean isVisible() {
                        Action action = new DeletePrototypeAction(Context.ADMINISTRATION, item.getModelObject());
                        return getBrix().getAuthorizationStrategy().isActionAuthorized(action);
                    }
                });
            }
        });

        Form<Object> form = new Form<Object>("form") {
            @Override
            public boolean isVisible() {
                Workspace current = ManagePrototypesPanel.this.getModelObject();
                Action action = new CreatePrototypeAction(Context.ADMINISTRATION, current);
                return getBrix().getAuthorizationStrategy().isActionAuthorized(action);
            }
        };
View Full Code Here

public class WorkspaceManagerRmiTest {
    @Test
    public void test() throws Exception {
        WorkspaceManager remote = EasyMock.createMock(WorkspaceManager.class);

        Workspace workspace = EasyMock.createMock(Workspace.class);

        EasyMock.expect(remote.createWorkspace()).andReturn(workspace);
        workspace.delete();

        EasyMock.replay(remote, workspace);

        Registry registry = LocateRegistry.createRegistry(10000);

        ServerWorkspaceManager server = new ServerWorkspaceManager(remote);
        RemoteStub stub = UnicastRemoteObject.exportObject(server);
        registry.rebind("wm", stub);

        RemoteWorkspaceManager client = (RemoteWorkspaceManager) registry.lookup("wm");
        WorkspaceManager local = new ClientWorkspaceManager(client);

        Workspace w = local.createWorkspace();
        w.delete();
        EasyMock.verify(remote, workspace);

        UnicastRemoteObject.unexportObject(server, true);
    }
View Full Code Here

        }

        @Override
        public boolean isVisible() {
            final Brix brix = Brix.get();
            final Workspace workspace = getWorkspaceModel().getObject();
            final Action action = new AccessWebDavUrlPluginAction(workspace);
            final boolean granted = brix.getAuthorizationStrategy().isActionAuthorized(action);
            return granted;
        }
View Full Code Here

            }
        }
    }

    public Workspace createSite(String name, String state) {
        Workspace workspace = brix.getWorkspaceManager().createWorkspace();
        workspace.setAttribute(Brix.WORKSPACE_ATTRIBUTE_TYPE, WORKSPACE_TYPE);
        setWorkspaceName(workspace, name);
        setWorkspaceState(workspace, state);
        return workspace;
    }
View Full Code Here

    private boolean checkSession(String workspaceId) {
        return brix.getWorkspaceManager().workspaceExists(workspaceId);
    }

    private String getDefaultWorkspaceName() {
        final Workspace workspace = brix.getConfig().getMapper().getWorkspaceForRequest(RequestCycle.get(), brix);
        return (workspace != null) ? workspace.getId() : null;
    }
View Full Code Here

    private List<Workspace> getWorkspaces() {
        Brix brix = getBrix();
        List<Workspace> workspaces = new ArrayList<Workspace>();

        Workspace current = getModelObject();

        for (Plugin p : brix.getPlugins()) {
            List<Workspace> filtered = brix.filterVisibleWorkspaces(p.getWorkspaces(current, false),
                    Context.ADMINISTRATION);
            for (Workspace w : filtered) {
View Full Code Here

        return name;
    }

    private boolean isCurrentWorkspaceValid() {
        WorkspaceManager manager = getBrix().getWorkspaceManager();
        Workspace workspace = getModelObject();
        return workspace != null && manager.workspaceExists(workspace.getId());
    }
View Full Code Here

TOP

Related Classes of org.brixcms.workspace.Workspace

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.