Examples of UnrestrictedSessionRunner


Examples of org.nuxeo.ecm.core.api.UnrestrictedSessionRunner

            TransactionHelper.startTransaction();
            transactionStarted = true;
        }
        try {
            final DocumentLocation docLoc = docView.getDocumentLocation();
            new UnrestrictedSessionRunner(docLoc.getServerName()) {
                @Override
                public void run() throws ClientException {
                    computeDocumentView(session, docView);
                }
            }.runUnrestricted();
View Full Code Here

Examples of org.nuxeo.ecm.core.api.UnrestrictedSessionRunner

    public List<SocialWorkspace> searchDetachedPublicSocialWorkspaces(
            CoreSession session, final String pattern) {

        final List<SocialWorkspace> socialWorkspaces = new ArrayList<SocialWorkspace>();

        UnrestrictedSessionRunner runner = new UnrestrictedSessionRunner(
                session) {

            private static final String ALL_PUBLIC_SOCIAL_WORKSPACE_QUERY = "SELECT * FROM Document "
                    + "WHERE ecm:mixinType != 'HiddenInNavigation' "
                    + "AND ecm:mixinType = '%s' "
                    + "AND ecm:currentLifeCycleState !='deleted' "
                    + "AND socialw:isPublic = 1 ";

            private static final String FULL_TEXT_WHERE_CLAUSE = "AND ecm:fulltext = '%s' ";

            private static final String ORDER_BY = "ORDER BY dc:title";

            @Override
            public void run() throws ClientException {
                String query = String.format(ALL_PUBLIC_SOCIAL_WORKSPACE_QUERY,
                        SOCIAL_WORKSPACE_FACET);
                if (!StringUtils.isBlank(pattern)) {
                    query = String.format(query + FULL_TEXT_WHERE_CLAUSE,
                            pattern);
                }
                query += ORDER_BY;

                DocumentModelList docs = session.query(query);
                for (DocumentModel doc : docs) {
                    doc.detach(true);
                    socialWorkspaces.add(toSocialWorkspace(doc));
                }
            }
        };

        try {
            runner.runUnrestricted();
        } catch (ClientException e) {
            throw new ClientRuntimeException(e);
        }

        return socialWorkspaces;
View Full Code Here

Examples of org.nuxeo.ecm.core.api.UnrestrictedSessionRunner

    public void handleSocialWorkspaceCreation(
            final SocialWorkspace socialWorkspace, final Principal principal) {
        createBaseRelationshipsWithSocialWorkspace(socialWorkspace, principal);
        CoreSession session = socialWorkspace.getDocument().getCoreSession();
        try {
            new UnrestrictedSessionRunner(session) {
                @Override
                public void run() throws ClientException {
                    SocialWorkspace unrestrictedSocialWorkspace = toSocialWorkspace(session.getDocument(new IdRef(
                            socialWorkspace.getId())));
                    initializeSocialWorkspaceRights(unrestrictedSocialWorkspace);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.