WorkflowContextImpl.java 2.96 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.aemfd.docmanager.Document
 *  com.adobe.granite.workflow.WorkflowSession
 *  com.adobe.granite.workflow.exec.WorkItem
 *  com.adobe.granite.workflow.exec.Workflow
 *  com.adobe.granite.workflow.model.WorkflowModel
 */
package com.adobe.aemfd.watchfolder.workflow;

import com.adobe.aemfd.docmanager.Document;
import com.adobe.aemfd.watchfolder.service.ProcessorContextImpl;
import com.adobe.aemfd.watchfolder.workflow.api.WorkflowContext;
import com.adobe.aemfd.watchfolder.workflow.api.payload.WorkflowExecutionContext;
import com.adobe.aemfd.watchfolder.workflow.api.payload.WorkflowInitializationContext;
import com.adobe.granite.workflow.WorkflowSession;
import com.adobe.granite.workflow.exec.WorkItem;
import com.adobe.granite.workflow.exec.Workflow;
import com.adobe.granite.workflow.model.WorkflowModel;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/*
 * This class specifies class file version 49.0 but uses Java 6 signatures.  Assumed Java 6.
 */
public class WorkflowContextImpl
extends ProcessorContextImpl
implements WorkflowContext,
WorkflowInitializationContext,
WorkflowExecutionContext {
    WorkflowModel workflowModel;
    WorkItem workItem;
    WorkflowSession workflowSession;
    Map args;
    Map<String, Document> committedResults = new HashMap<String, Document>();
    Map<String, Object> committedVariables = new HashMap<String, Object>();
    Map<String, Object> variableMap = new HashMap<String, Object>();

    @Override
    public WorkItem getWorkItem() {
        return this.workItem;
    }

    @Override
    public WorkflowSession getWorkflowSession() {
        return this.workflowSession;
    }

    @Override
    public Map getMetadata() {
        return this.args;
    }

    @Override
    public Map<String, Document> getCommittedResults() {
        return this.committedResults == null ? null : Collections.unmodifiableMap(this.committedResults);
    }

    @Override
    public Map<String, Object> getCommittedVariables() {
        return this.committedVariables == null ? null : Collections.unmodifiableMap(this.committedVariables);
    }

    @Override
    public void setVariable(String varName, Object value) {
        this.variableMap.put(varName, value);
    }

    @Override
    public WorkflowModel getWorkflowModel() {
        if (this.workflowModel != null) {
            return this.workflowModel;
        }
        if (this.workItem != null) {
            return this.workItem.getWorkflow().getWorkflowModel();
        }
        return null;
    }

    void clear() {
        this.workflowModel = null;
        this.watchFolderId = null;
        this.inputMap.clear();
        this.committedResults.clear();
        this.committedVariables.clear();
        this.configParameters = null;
        this.resultMap.clear();
        this.variableMap.clear();
        this.workItem = null;
        this.workflowSession = null;
        this.args = null;
    }
}