Examples of DocumentEventContext


Examples of org.nuxeo.ecm.core.event.impl.DocumentEventContext

        if (!(event.getContext() instanceof DocumentEventContext)) {
            return;
        }

        DocumentEventContext ctx = (DocumentEventContext) event.getContext();
        DocumentModel doc = ctx.getSourceDocument();

        if (!ARTICLE_TYPE.equals(doc.getType())) {
            return;
        }
View Full Code Here

Examples of org.nuxeo.ecm.core.event.impl.DocumentEventContext

    public void handleEvent(Event event) throws ClientException {
        if (!(event.getContext() instanceof DocumentEventContext)) {
            return;
        }

        DocumentEventContext ctx = (DocumentEventContext) event.getContext();
        if (ctx.hasProperty(DO_NOT_PROCESS)) {
            return;
        }

        DocumentModel doc = ctx.getSourceDocument();
        if (!isSocialWorkspace(doc)) {
            return;
        }

        doc.putContextData(ScopeType.REQUEST, DO_NOT_PROCESS, true);
View Full Code Here

Examples of org.nuxeo.ecm.core.event.impl.DocumentEventContext

            return;
        }

        EventContext eventContext = event.getContext();
        if (eventContext instanceof DocumentEventContext) {
            DocumentEventContext documentEventContext = (DocumentEventContext) eventContext;
            DocumentModel doc = documentEventContext.getSourceDocument();

            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

Examples of org.nuxeo.ecm.core.event.impl.DocumentEventContext

        }
    }

    public void addDocumentContextToMap(
            Map<DocumentRef, List<Event>> socialDocuments, Event event) {
        DocumentEventContext docCtx = (DocumentEventContext) event.getContext();

        DocumentRef docRef = docCtx.getSourceDocument().getRef();
        if (socialDocuments.containsKey(docRef)) {
            socialDocuments.get(docRef).add(event);
        } else {
            List<Event> docContextes = new ArrayList<Event>();
            docContextes.add(event);
View Full Code Here

Examples of org.nuxeo.ecm.core.event.impl.DocumentEventContext

            Map.Entry<DocumentRef, List<Event>> eventContexts) {
        List<Principal> addedMembers = new ArrayList<Principal>();
        List<Principal> removedMembers = new ArrayList<Principal>();

        for (Event event : eventContexts.getValue()) {
            DocumentEventContext docCtx = (DocumentEventContext) event.getContext();
            List<Principal> principals = (List<Principal>) docCtx.getProperty(CTX_PRINCIPALS_PROPERTY);
            if (event.getName().equals(EVENT_MEMBERS_ADDED)) {
                addedMembers.addAll(principals);
            } else if (event.getName().equals(EVENT_MEMBERS_REMOVED)) {
                removedMembers.addAll(principals);
            }
        }

        if (!addedMembers.isEmpty() || !removedMembers.isEmpty()) {
            DocumentEventContext context = (DocumentEventContext) eventContexts.getValue().get(
                    0).getContext();
            notifyMembers(context, addedMembers, removedMembers);
        }
    }
View Full Code Here

Examples of org.nuxeo.ecm.core.event.impl.DocumentEventContext

    private static void fireEventMembersManagement(
            SocialWorkspace socialWorkspace, List<Principal> usernames,
            String eventName) {
        if (socialWorkspace.isMembersNotificationEnabled()) {
            DocumentModel doc = socialWorkspace.getDocument();
            EventContext ctx = new DocumentEventContext(doc.getCoreSession(),
                    doc.getCoreSession().getPrincipal(), doc);
            ctx.setProperty(CTX_PRINCIPALS_PROPERTY, (Serializable) usernames);

            try {
                Framework.getLocalService(EventService.class).fireEvent(
                        ctx.newEvent(eventName));
            } catch (ClientException e) {
                log.warn("Unable to notify social workspace members", e);
            }
        }
    }
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.