Package org.nuxeo.ecm.social.workspace.adapters

Examples of org.nuxeo.ecm.social.workspace.adapters.SocialWorkspace


            if (!SPACE_DOCUMENT_TYPE.equals(doc.getType()) || doc.isProxy()) {
                return;
            }

            SocialWorkspace socialWorkspace = getSocialWorkspaceService().getDetachedSocialWorkspace(
                    doc);

            if (socialWorkspace != null) {
                initializeDashboards(documentEventContext.getCoreSession(),
                        doc, socialWorkspace);
View Full Code Here


        }

        try {
            userinfo.setPassword(RandomStringUtils.randomAlphanumeric(6));

            SocialWorkspace sw = toSocialWorkspace(navigationContext.getCurrentDocument());
            if (isInvitationPossible(sw, userinfo)) {
                boolean autoAccept = !(StringUtils.isBlank(multipleEmails)
                        && sw.mustApproveSubscription());

                userRegistrationService.submitRegistrationRequest(
                        configurationName, userinfo, docinfo,
                        getAdditionalsParameters(), EMAIL, autoAccept, documentManager.getPrincipal().getName());
View Full Code Here

        }

        Locale locale = language != null && !language.isEmpty() ? new Locale(
                language) : Locale.ENGLISH;

        SocialWorkspace socialWorkspace = socialWorkspaceService.getDetachedSocialWorkspace(
                session, new PathRef(contextPath));

        Map<String, Serializable> props = new HashMap<String, Serializable>();
        props.put(LOCALE_PROPERTY, locale);
        props.put(SOCIAL_WORKSPACE_ID_PROPERTY, socialWorkspace.getId());
        props.put(REPOSITORY_NAME_PROPERTY,
                socialWorkspace.getDocument().getRepositoryName());
        props.put(RELATIONSHIP_KIND_PROPERTY, kind);

        if (asActivities) {
            @SuppressWarnings("unchecked")
            PageProvider<ActivityMessage> pageProvider = (PageProvider<ActivityMessage>) pageProviderService.getPageProvider(
View Full Code Here

    protected String contextPath;

    @OperationMethod
    public Blob run() throws Exception {
        NuxeoPrincipal currentUser = (NuxeoPrincipal) session.getPrincipal();
        SocialWorkspace socialWorkspace = socialWorkspaceService.getDetachedSocialWorkspace(
                session, new PathRef(contextPath));

        List<String> targets = relationshipService.getTargetsOfKind(
                ActivityHelper.createDocumentActivityObject(
                        socialWorkspace.getDocument().getRepositoryName(),
                        socialWorkspace.getId()),
                RelationshipKind.fromString("socialworkspace:members"));
        if (targets.contains(ActivityHelper.createUserActivityObject(currentUser))) {
            return buildResponse(socialWorkspace.getDocument(), Status.MEMBER);
        } else if (socialWorkspace.isAdministratorOrMember(currentUser)) {
            return buildResponse(socialWorkspace.getDocument(), Status.MEMBER);
        } else {
            String reqestStatus = socialWorkspace.getSubscriptionRequestStatus(currentUser);
            if (reqestStatus == null) { // no subscrition requests
                return buildResponse(socialWorkspace.getDocument(),
                        Status.NOT_MEMBER);
            } else if (REQUEST_PENDING_STATE.equals(reqestStatus)) {
                return buildResponse(socialWorkspace.getDocument(),
                        Status.REQUEST_PENDING);
            } else if (REQUEST_ACCEPTED_STATE.equals(reqestStatus)) {
                return buildResponse(socialWorkspace.getDocument(),
                        Status.REQUEST_ACCEPTED);
            } else if (REQUEST_REJECTED_STATE.equals(reqestStatus)) {
                return buildResponse(socialWorkspace.getDocument(),
                        Status.REQUEST_REJECTED);
            } else {
                return buildResponse(socialWorkspace.getDocument(),
                        Status.NOT_MEMBER);
            }
        }
    }
View Full Code Here

        DocumentModel sourceDocument = currentDocument;
        if (currentDocument.isProxy()) {
            sourceDocument = documentManager.getSourceDocument(currentDocument.getRef());
        }

        SocialWorkspace socialWorkspace = socialWorkspaceService.getDetachedSocialWorkspace(sourceDocument);

        if (socialWorkspace != null) {
            DocumentModel dashboardSpacesRoot = documentManager.getDocument(new PathRef(
                    socialWorkspace.getDashboardSpacesRootPath()));
            webActions.setCurrentTabIds(SocialWorkspaceActions.MAIN_TABS_COLLABORATION);
            return navigationContext.navigateToDocument(dashboardSpacesRoot,
                    COLLABORATION_VIEW_ID);
        } else {
            return navigationContext.navigateToDocument(currentDocument);
View Full Code Here

            return navigationContext.navigateToDocument(currentDocument);
        }
    }

    public String getCurrentDashboardUrl() throws ClientException {
        SocialWorkspace sw = socialWorkspaceActions.getSocialWorkspace();
        DocumentModel dashboard;
        String view = DASHBOARD_VIEW_ID;
        if (sw == null) {
            dashboard = navigationContext.getCurrentDocument();
            view = "view_collaboration";
        } else {
            dashboard = documentManager.getDocument(new PathRef(sw.getDashboardSpacesRootPath()));
        }

        return restHelper.getDocumentUrl(dashboard, view, false);
    }
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");
        }
        String login = (String) registrationDoc.getPropertyValue(USERNAME_FIELD);
        Principal principal = getUserManager().getPrincipal(login);

        // Set if new member notification is needed
        sw.getDocument().putContextData(MEMBER_NOTIFICATION_DISABLED,
                        registrationDoc.getPropertyValue(NOT_NOTIFY_MEMBER_FIELD));

        Boolean isAdded;
        if (ADMINISTRATOR_RIGHT.equals(registrationDoc.getPropertyValue(DOCUMENT_RIGHT_FIELD))) {
            isAdded = getSocialWorkspaceService().addSocialWorkspaceAdministrator(sw, principal);
        } else {
            isAdded = getSocialWorkspaceService().addSocialWorkspaceMember(sw, principal);
        }

        try {
            return isAdded ? sw.getDocument() : null;
        } finally {
            // reset notification flag
            sw.getDocument().putContextData(MEMBER_NOTIFICATION_DISABLED, false);
        }
    }
View Full Code Here

    }

    public String navigateToCollaborationView() throws ClientException {
        DocumentModel currentDocument = navigationContext.getCurrentDocument();
        if (isSocialWorkspace(currentDocument)) {
            SocialWorkspace socialWorkspace = toSocialWorkspace(currentDocument);
            DocumentModel dashboardSpacesRoot = documentManager.getDocument(new PathRef(
                    socialWorkspace.getDashboardSpacesRootPath()));
            webActions.setCurrentTabIds(SocialWorkspaceActions.MAIN_TABS_COLLABORATION);
            return navigationContext.navigateToDocument(dashboardSpacesRoot,
                    COLLABORATION_VIEW_ID);
        } else if (isSocialDocument(currentDocument)) {
            webActions.setCurrentTabIds(SocialWorkspaceActions.MAIN_TABS_COLLABORATION);
View Full Code Here

    protected String navigateToListing(String listingView)
            throws ClientException {
        DocumentModel currentDocument = navigationContext.getCurrentDocument();

        SocialWorkspace socialWorkspace = socialWorkspaceService.getDetachedSocialWorkspace(currentDocument);
        if (socialWorkspace != null) {
            DocumentModel dashboardSpacesRoot = documentManager.getDocument(new PathRef(
                    socialWorkspace.getDashboardSpacesRootPath()));
            return navigationContext.navigateToDocument(dashboardSpacesRoot,
                    listingView);
        } else {
            return navigationContext.navigateToDocument(currentDocument);
        }
View Full Code Here

    }

    public void notifyMembers(DocumentEventContext docCtx,
            List<Principal> addedMembers, List<Principal> removedMembers) {

        SocialWorkspace sw = docCtx.getSourceDocument().getAdapter(
                SocialWorkspace.class);

        if (sw == null) {
            log.info("Event is handling a non social workspace document");
            return;
        }

        OperationContext ctx = new OperationContext(docCtx.getCoreSession());
        ctx.setInput(docCtx.getSourceDocument());
        ctx.put("addedMembers", buildPrincipalsString(addedMembers));
        ctx.put("removedMembers", buildPrincipalsString(removedMembers));

        Expression from = Scripting.newExpression("Env[\"mail.from\"]");
        // join both list to remove email of directly affected members
        addedMembers.addAll(removedMembers);
        StringList to = buildRecipientsList(sw, addedMembers);

        if (to.isEmpty()) {
            log.info("No recipients found for member notification in"
                    + docCtx.getSourceDocument().getId());
            return;
        }

        String subject = "Member Activity of " + sw.getTitle();
        String template = TEMPLATE_ADDED;
        String message = loadTemplate(template);

        try {
            OperationChain chain = new OperationChain("SendMail");
View Full Code Here

TOP

Related Classes of org.nuxeo.ecm.social.workspace.adapters.SocialWorkspace

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.