Search in sources :

Example 1 with Action

use of org.xwiki.extension.distribution.internal.DocumentsModifiedDuringDistributionListener.DocumentStatus.Action in project xwiki-platform by xwiki.

the class DocumentsModifiedDuringDistributionListener method checkDistributionAction.

private void checkDistributionAction(Event event, XWikiDocument document, XWikiContext xcontext) {
    if (DistributionAction.DISTRIBUTION_ACTION.equals(xcontext.getAction())) {
        String distributionWiki = xcontext.getOriginalWikiId();
        DocumentStatus.Action action = toAction(event);
        addDocument(distributionWiki, document, action, null, null);
    }
}
Also used : Action(org.xwiki.extension.distribution.internal.DocumentsModifiedDuringDistributionListener.DocumentStatus.Action)

Example 2 with Action

use of org.xwiki.extension.distribution.internal.DocumentsModifiedDuringDistributionListener.DocumentStatus.Action in project xwiki-platform by xwiki.

the class DocumentsModifiedDuringDistributionListener method checkXARHandler.

private void checkXARHandler(Event event, XWikiDocument document, XWikiContext xcontext) {
    ExecutionContext context = this.execution.getContext();
    if (context != null) {
        XarExtensionPlan xarExtensionPlan = (XarExtensionPlan) context.getProperty(XarExtensionPlan.CONTEXTKEY_XARINSTALLPLAN);
        if (xarExtensionPlan != null) {
            Request request = this.jobContext.getCurrentJob().getRequest();
            // It's a job started by the Distribution Wizard
            if (StringUtils.equals(request.<String>getProperty("context.action"), "distribution")) {
                String distributionWiki = request.getProperty("context.wiki");
                if (distributionWiki != null) {
                    DocumentReference reference = document.getDocumentReferenceWithLocale();
                    DocumentStatus.Action action = toAction(event);
                    LocalExtension previousExtension = xarExtensionPlan.getPreviousXarExtension(reference);
                    LocalExtension nextExtension = xarExtensionPlan.getNextXarExtension(reference);
                    addDocument(distributionWiki, document, action, previousExtension, nextExtension);
                }
            }
        }
    }
}
Also used : ExecutionContext(org.xwiki.context.ExecutionContext) XarExtensionPlan(org.xwiki.extension.xar.internal.handler.XarExtensionPlan) Request(org.xwiki.job.Request) Action(org.xwiki.extension.distribution.internal.DocumentsModifiedDuringDistributionListener.DocumentStatus.Action) LocalExtension(org.xwiki.extension.LocalExtension) DocumentReference(org.xwiki.model.reference.DocumentReference)

Aggregations

Action (org.xwiki.extension.distribution.internal.DocumentsModifiedDuringDistributionListener.DocumentStatus.Action)2 ExecutionContext (org.xwiki.context.ExecutionContext)1 LocalExtension (org.xwiki.extension.LocalExtension)1 XarExtensionPlan (org.xwiki.extension.xar.internal.handler.XarExtensionPlan)1 Request (org.xwiki.job.Request)1 DocumentReference (org.xwiki.model.reference.DocumentReference)1