Package org.nuxeo.ecm.core.api

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


        public DocumentRef getCollaborationDashboardSpaceRef() {
            return collaborationDashboardSpaceRef;
        }

        public void run() throws ClientException {
            DocumentModel socialWorkspaceContainer = getSocialWorkspaceService().getSocialWorkspaceContainer(
                    session);
            DocumentModel collaborationDashboardSpace = session.createDocumentModel(
                    socialWorkspaceContainer.getPathAsString(),
                    COLLABORATION_DASHBOARD_SPACE_NAME, SPACE_DOCUMENT_TYPE);
            collaborationDashboardSpace.setPropertyValue("dc:title",
                    "global dashboard space");
            collaborationDashboardSpace.setPropertyValue("dc:description",
                    "global dashboard space");
            collaborationDashboardSpace = session.createDocument(collaborationDashboardSpace);

            addInitialGadgets(collaborationDashboardSpace);
            collaborationDashboardSpaceRef = collaborationDashboardSpace.getRef();

        }
View Full Code Here


            DocumentModel contextDocument, String spaceName,
            Map<String, String> parameters) throws SpaceException {
        try {
            if (isSocialWorkspace(contextDocument)) {
                SocialWorkspace socialWorkspace = toSocialWorkspace(contextDocument);
                DocumentModel doc = session.getDocument(new PathRef(
                        socialWorkspace.getPublicDashboardSpacePath()));
                return doc.getAdapter(Space.class);
            } else {
                // assume dashboard spaces root
                DocumentModel doc = session.getDocument(new PathRef(
                        contextDocument.getPathAsString() + "/"
                                + PUBLIC_DASHBOARD_SPACE_NAME));
                return doc.getAdapter(Space.class);
            }
        } catch (ClientException e) {
            throw new SpaceException(e);
        }
    }
View Full Code Here

@LocalDeploy("org.nuxeo.ecm.social.workspace.core:test-social-workspace-service-contrib.xml")
public class TestAdapters extends AbstractSocialWorkspaceTest {

    @Test
    public void testArticleAdapter() throws Exception {
        DocumentModel article = session.createDocumentModel(
                session.getRootDocument().getPathAsString(), "article1",
                ARTICLE_TYPE);
        assertNotNull(article);
        article = session.createDocument(article);
        session.save();

        Article adapter = article.getAdapter(Article.class);
        assertNotNull(adapter);
        assertNotNull(adapter.getCreated());
    }
View Full Code Here

                administratorsGroup);
    }

    @Test
    public void testShouldNotBeSocialDocument() throws Exception {
        DocumentModel outOfSocialWorkspace = createDocument("/",
                "wrong place of creation", ARTICLE_TYPE);
        assertNull(toSocialDocument(outOfSocialWorkspace));
    }
View Full Code Here

    }

    @Test
    public void shouldCreatePrivateProxyForSocialDocumentPrivate()
            throws Exception {
        DocumentModel privateNews = createSocialDocument(
                socialWorkspaceDoc.getPathAsString(), "private news",
                NEWS_ITEM_TYPE, false);
        SocialDocument socialDocument = toSocialDocument(privateNews);

        assertTrue(socialDocument.isDocumentInSocialWorkspace());
View Full Code Here

    }

    @Test
    public void shouldCreatePrivateProxyForSocialDocumentWithFacetAdded()
            throws Exception {
        DocumentModel socialDocumentFacetedNotePrivate = session.createDocumentModel(
                socialWorkspaceDoc.getPathAsString(), "Social Document Note1",
                "Note");
        socialDocumentFacetedNotePrivate.addFacet(SOCIAL_DOCUMENT_FACET);
        socialDocumentFacetedNotePrivate = session.createDocument(socialDocumentFacetedNotePrivate);
        session.save();
        eventService.waitForAsyncCompletion();
        session.save();
        socialDocumentFacetedNotePrivate = session.getDocument(socialDocumentFacetedNotePrivate.getRef());

        SocialDocument socialDocument = toSocialDocument(socialDocumentFacetedNotePrivate);
        assertTrue(socialDocument.isRestrictedToMembers());
        assertFalse(socialDocument.isPublic());
        assertNull(socialDocument.getPublicDocument());
        assertNotNull(socialDocument.getRestrictedDocument());
        assertTrue(socialDocument.getRestrictedDocument().isProxy());
        checkRestricted(socialDocument.getRestrictedDocument());

        DocumentModel socialDocumentFacetedNotePublic = session.createDocumentModel(
                socialWorkspaceDoc.getPathAsString(), "Social Document Note2",
                "Note");
        socialDocumentFacetedNotePublic.addFacet(SOCIAL_DOCUMENT_FACET);
        socialDocumentFacetedNotePublic.setPropertyValue(
                SOCIAL_DOCUMENT_IS_PUBLIC_PROPERTY, true);
        socialDocumentFacetedNotePublic = session.createDocument(socialDocumentFacetedNotePublic);
        session.save();
        eventService.waitForAsyncCompletion();
        session.save();
        socialDocumentFacetedNotePublic = session.getDocument(socialDocumentFacetedNotePublic.getRef());

        socialDocument = toSocialDocument(socialDocumentFacetedNotePublic);
        assertFalse(socialDocument.isRestrictedToMembers());
        assertTrue(socialDocument.isPublic());
        assertNotNull(socialDocument.getPublicDocument());
View Full Code Here

    }

    @Test
    public void shouldCreatePrivateProxyForSocialDocumentPublic()
            throws Exception {
        DocumentModel privateNews = createSocialDocument(
                socialWorkspaceDoc.getPathAsString(), "private news",
                NEWS_ITEM_TYPE, true);

        SocialDocument socialDocument = toSocialDocument(privateNews);
View Full Code Here

        checkPublic(socialDocument.getPublicDocument());
    }

    @Test
    public void shouldNotCreatePrivateProxyForArticlePrivate() throws Exception {
        DocumentModel privateArticle = createSocialDocument(
                socialWorkspaceDoc.getPathAsString(), "privatenews",
                ARTICLE_TYPE, false);

        SocialDocument socialDocument = toSocialDocument(privateArticle);
View Full Code Here

    }

    @Test
    public void shouldNotCreatePrivateProxyForArticlePublic() throws Exception {
        DocumentModel privateArticle = createSocialDocument(
                socialWorkspaceDoc.getPathAsString(), "privatenews",
                ARTICLE_TYPE, true);

        SocialDocument socialDocument = toSocialDocument(privateArticle);
View Full Code Here

        Long targetLimit = null;
        if (limit != null) {
            targetLimit = limit.longValue();
        }

        DocumentModel doc = session.getDocument(new PathRef(contextPath));
        if (StringUtils.isBlank(activityStreamName)) {
            // assume we are on a Social workspace
            activityStreamName = "socialWorkspaceWallActivityStream";
        }
View Full Code Here

TOP

Related Classes of org.nuxeo.ecm.core.api.DocumentModel

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.