Package org.nuxeo.ecm.core.api

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


        DocumentRef docRef;
        if (ref != null && ref.startsWith("/")) { // doc identified by absolute
            // path
            docRef = new PathRef(ref);
        } else { // // doc identified by id
            docRef = new IdRef(ref);
        }
        return docRef;
    }
View Full Code Here


     * @return true if the current user has the right to Add Children to the
     *         current Document and false otherwise
     */
    public boolean hasAddChildrenRight(String docId) {
        try {
            IdRef docRef = new IdRef(docId);
            boolean hasPermission = ctx.getCoreSession().hasPermission(docRef,
                    ADD_CHILDREN);
            return hasPermission;
        } catch (Exception e) {
            return false;
View Full Code Here

    public Object documentCommentList(@QueryParam("docRef") String ref)
            throws Exception {
        // build freemarker arguments map
        Map<String, Object> args = new HashMap<String, Object>();
        CoreSession session = ctx.getCoreSession();
        IdRef docRef = new IdRef(ref);
        DocumentModel doc = session.getDocument(docRef);
        args.put("doc", doc);
        return Response.ok(getView("document_comments_template").args(args)).header(
                "docRef", ref).build();
    }
View Full Code Here

                    request.getParameter("commentContent"));
            myComment.setProperty("comment", "creationDate",
                    Calendar.getInstance());
            // Retrieve document to comment
            String docToCommentRef = request.getParameter("docToCommentRef");
            DocumentModel docToComment = session.getDocument(new IdRef(
                    docToCommentRef));
            String commentParentRef = request.getParameter("commentParentRef");
            // Create comment
            CommentableDocument commentableDoc = null;
            if (docToComment != null) {
                commentableDoc = docToComment.getAdapter(CommentableDocument.class);
            }
            DocumentModel newComment;
            if (commentParentRef != null) {
                // if exists retrieve comment parent
                DocumentModel commentParent = session.getDocument(new IdRef(
                        commentParentRef));
                newComment = commentableDoc.addComment(commentParent, myComment);
            } else {
                newComment = commentableDoc.addComment(myComment);
            }
View Full Code Here

    @POST
    @Path("docLike")
    public Object docLike(@FormParam("docRef") String docRef) throws Exception {
        // Get document
        CoreSession session = ctx.getCoreSession();
        DocumentModel docToLike = session.getDocument(new IdRef(docRef));
        // Get Like Services
        LikeService likeService = Framework.getLocalService(LikeService.class);
        // Get user name
        String userName = ctx.getPrincipal().getName();
        if (likeService.hasUserLiked(userName, docToLike)) {
View Full Code Here

     * document link builder sets in the
     * {@link org.nuxeo.ecm.webengine.model.WebContext}.
     */
    public String computeDocumentURL(DocumentModel doc) {
        DocumentLocation docLoc = new DocumentLocationImpl(
                doc.getRepositoryName(), new IdRef(doc.getId()));
        DocumentView docView = new DocumentViewImpl(docLoc, doc.getAdapter(
                TypeInfo.class).getDefaultView());
        DocumentViewCodecManager documentViewCodecManager = Framework.getLocalService(DocumentViewCodecManager.class);
        String documentLinkBuilder = (String) ctx.getProperty("documentLinkBuilder");
        String codecName = isBlank(documentLinkBuilder) ? documentViewCodecManager.getDefaultCodecName()
View Full Code Here

        DefaultActivityLinkBuilder {

    @Override
    public String getDocumentURL(String repositoryName, String documentId) {
        DocumentLocation docLoc = new DocumentLocationImpl(repositoryName,
                new IdRef(documentId));
        DocumentView docView = new DocumentViewImpl(docLoc,
                "view_social_document");
        URLPolicyService urlPolicyService = Framework.getLocalService(URLPolicyService.class);
        return VirtualHostHelper.getContextPathProperty()
                + "/"
View Full Code Here

            DocumentModel registrationDoc) throws ClientException {
        String docId = (String) registrationDoc.getPropertyValue(DOCUMENT_ID_FIELD);
        if (StringUtils.isBlank(docId)) {
            throw new ClientException("SocialWorkspace id is missing");
        }
        SocialWorkspace sw = toSocialWorkspace(session.getDocument(new IdRef(
                docId)));
        if (sw == null) {
            throw new ClientException(
                    "Document passed is not a Social Workspace");
        }
View Full Code Here

        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);
                    initializeNewsItemsRootRights(unrestrictedSocialWorkspace);
                    if (unrestrictedSocialWorkspace.isPublic()) {
                        makeSocialWorkspacePublic(unrestrictedSocialWorkspace);
View Full Code Here

        DocumentModel copy = session.copy(fileOutOfSocialWorkspace.getRef(),
                socialWorkspace.getDocument().getRef(),
                "Copy of File out of Social Workspace");
        String copyId = copy.getId();
        session.save();
        copy = session.getDocument(new IdRef(copyId));

        assertNotNull(copy);
        assertTrue(copy.hasFacet(SOCIAL_DOCUMENT_FACET));
        assertFalse(fileOutOfSocialWorkspace.hasFacet(SOCIAL_DOCUMENT_FACET));
View Full Code Here

TOP

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

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.