Package org.nuxeo.ecm.core.event

Examples of org.nuxeo.ecm.core.event.EventContext


public class DeleteSocialDocumentListener implements EventListener {

    @Override
    public void handleEvent(Event event) throws ClientException {
        EventContext ctx = event.getContext();
        if (!(ctx instanceof DocumentEventContext)) {
            return;
        }
        DocumentModel document = ((DocumentEventContext) ctx).getSourceDocument();
        if (!SocialWorkspaceHelper.isSocialDocument(document)) {
            return;
        }

        if (!ctx.hasProperty(TRANSTION_EVENT_OPTION_TRANSITION)) {
            return;
        }

        if (!DELETE_TRANSITION.equals(ctx.getProperty(TRANSTION_EVENT_OPTION_TRANSITION))) {
            return;
        }

        CoreSession session = ctx.getCoreSession();

        SocialDocument socialDocument = toSocialDocument(document);
        cleanProxy(session, socialDocument);
    }
View Full Code Here


        if (!DOCUMENT_CREATED.equals(eventName)
                && !DOCUMENT_UPDATED.equals(eventName)) {
            return;
        }

        EventContext ctx = event.getContext();
        if (!(ctx instanceof DocumentEventContext)) {
            return;
        }
        DocumentModel document = ((DocumentEventContext) ctx).getSourceDocument();
        if (document instanceof DeletedDocumentModel) {
            return;
        }

        if (ctx.hasProperty(ALREADY_PROCESSED)) {
            return;
        }

        if (!SocialWorkspaceHelper.isSocialDocument(document)) {
            return;
View Full Code Here

        String eventName = event.getName();
        if (!validEventTypes.contains(eventName)) {
            return;
        }

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

        List<String> allowedTypes = getSocialWorkspaceAllowedSubTypes();
        DocumentModel document = ((DocumentEventContext) ctx).getSourceDocument();
        if (document.hasFacet(FacetNames.FOLDERISH)
                || !allowedTypes.contains(document.getType())) {
            return;
        }

        if (document.getParentRef() == null) {
            return;
        }

        CoreSession session = ctx.getCoreSession();
        DocumentModel documentParent = session.getDocument(document.getParentRef());
        SocialWorkspace sws = getSocialWorkspaceService().getSocialWorkspace(
                documentParent);

        if (sws == null) {
View Full Code Here

        if (!DOCUMENT_CREATED.equals(event.getName())) {
            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()) {
View Full Code Here

    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

Related Classes of org.nuxeo.ecm.core.event.EventContext

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.