All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adobe.granite.workflow.exec.Workflow Maven / Gradle / Ivy

/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2012 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 **************************************************************************/
package com.adobe.granite.workflow.exec;

import com.adobe.granite.workflow.HasMetaData;
import com.adobe.granite.workflow.exec.filter.WorkItemFilter;
import com.adobe.granite.workflow.model.WorkflowModel;

import java.util.Date;
import java.util.List;

/**
 * A Workflow represents the current state of an instance of a
 * {@link WorkflowModel}. In terms of petri nets the state of a
 * workflow instance can be considered as the collections of tokens (or
 * {@link WorkItem}s) that flow through the workflow instance.
 */
public interface Workflow extends HasMetaData {

    /**
     * Enumerates the possible states of a Workflow
     */
    public enum State {
        /**
         * Workflow is running
         */
        RUNNING,
        /**
         * Workflow is completed
         */
        COMPLETED,

        /**
         * Workflow is suspended
         */
        SUSPENDED,

        /**
         * Workflow is aborted
         */
        ABORTED
    }

    /**
     * Returns the Workflow instance ID.
     *
     * @return The Workflow instance ID.
     */
    String getId();

    /**
     * Returns the list of {@link WorkItem}s assigned to the
     * Workflow instance.
     *
     * @return The list of {@link WorkItem}s assigned to the
     *         Workflow
     */
    List getWorkItems();

    /**
     * Returns a filtered list of {@link WorkItem}s assigned to the
     * Workflow instance.
     *
     * @param filter One is able to filter a subset of the available
     *               {@link WorkItem}s by passing a {@link WorkItemFilter} impl.
     * @return The list of {@link WorkItem}s assigned to the
     *         Workflow
     */
    List getWorkItems(WorkItemFilter filter);

    /**
     * Returns the {@link WorkflowModel} that defines the
     * underlying workflow model of the Workflow instance.
     *
     * @return The {@link WorkflowModel} of the
     *         Workflow.
     */
    WorkflowModel getWorkflowModel();

    /**
     * Indicates if the Workflow instance is still active.
     *
     * @return True if active, otherwise false.
     */
    boolean isActive();

    /**
     * Returns the workflows state. In the default implementation this could be
     * one of RUNNING, SUSPENDED,
     * COMPLETED or ABORTED.
     *
     * @return The current workflows state.
     */
    String getState();

    /**
     * Returns the initiator of the Workflow instance.
     *
     * @return The user who initiated the Workflow.
     */
    String getInitiator();

    /**
     * Getter for the point in time where the Workflow instance
     * was started.
     *
     * @return The start time of the Workflow instance.
     */
    Date getTimeStarted();

    /**
     * Getter for the point in time where the Workflow was
     * finished.
     *
     * @return The end time of the Workflow instance.
     */
    Date getTimeEnded();

    /**
     * Returns the {@link WorkflowData} object assigned to the
     * Workflow instance.
     *
     * @return The {@link WorkflowData} object assigned to the
     *         Workflow instance.
     */
    WorkflowData getWorkflowData();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy