package com.hp.oo.engine.execution.events.services;

import com.hp.oo.enginefacade.execution.ExecutionEnums;
import com.hp.oo.enginefacade.execution.log.StepInfo;
import com.hp.oo.enginefacade.execution.log.StepLog;
import com.hp.oo.internal.sdk.execution.events.ExecutionEvent;

import java.lang.Long;import java.lang.String;import java.util.List;

/**
 * Date: 3/6/12
 *
 * @author Dima Rassin
 */
public interface ExecutionEventService {
    /**
     *
     * @param events
     */
    void createEvents(List<ExecutionEvent> events);

    /**
     *
     * @param executionId
     * @return
     */
    List<ExecutionEvent> readEventsByExecutionId(String executionId); // used by FlowExecutionController in flow-execution-impl

    /**
     * Returns a representation of the steps under the specified path for a given executionId
     * This method will aggregate the event table into an hierarchical representation of it for a given
     * execution
     * @param executionId the execution id
     * @param path a path (in the form of %d.%d.%d) for a given parent step
     * @return a list of the child steps
     */
    List<StepInfo> readStepsInfoByPath(String executionId, String path);

    /**
     * Returns a representation of the steps under the specified path for a given executionId
     * This method will aggregate the event table into an hierarchical representation of it for a given
     * execution
     * @param executionId the execution id
     * @param path a path (in the form of %d.%d.%d) for a given parent step
     * @param count the max number of steps to returned
     * @return a list of the child steps
     */
    List<StepInfo> readStepsInfoByPath(String executionId, String path, int count);

    /**
     * Returns a representation of all the steps for a given executionId for use when execution logLevel = ERROR
     * This method will aggregate the event table into an hierarchical representation of it for a given
     * execution
     * @param executionId the execution id
     * @return a list of the child steps
     */
    List<StepInfo> readAllStepsInfo(String executionId);

    /**
     * Returns an aggregation of all the events for a given step
     * @param executionId the execution id
     * @param path a path (in the form of %d.%d.%d) for a given step
     * @return an object of aggregated data
     */
    StepLog readExecutionStepLogByPath(String executionId, String path);

    /**
     * Returns the event containing the data for a specific pause
     * @param executionId the uuid of the relevant execution
     * @param pauseId the id of the pause entity
     * @return an event
     */
    ExecutionEvent readPauseEvent(String executionId, long pauseId);

    List<ExecutionEvent> readEventsByExecutionIdByEventType(String executionId, ExecutionEnums.Event... eventType);

    List<ExecutionEvent> readEventsByExecutionIdAndIndexGreaterByEventType(String executionId, Long index , ExecutionEnums.Event... eventType) ;

    /**
     *
     * @param executionEvents
     * @return
     */
    StepLog aggregateEventsToStepLog(List<ExecutionEvent> executionEvents);

    /**
     * Reads <param>numOfEvents</param> events for the given <param>executionId</param>. Only events with the step path
     * bigger than or equal to <param>stepPath</param> will be read.
     * @param executionId the execution id for which to read events
     * @param stepPath the step path from which to start reading (inclusive)
     * @param numOfEvents the number of events to read
     */
    List<ExecutionEvent> readEventsByExecutionIdAndStepPath(String executionId, String stepPath, int numOfEvents);
}

@@ -3398,23 +3398,28 @@
 @param s
-tepPath
+equenceOrder
  the ste
@@ -3580,23 +3580,23 @@
 onIdAndS
-tepPath
+eqOrder
 (String 
@@ -3620,32 +3620,309 @@
 ng s
-tepPath, int numOfEvents
+equenceOrder, int numOfEvents);%0A%0A    /**%0A     * Reads events for the given %3Cparam%3EexecutionId%3C/param%3E. Only events with the step path%0A     * @param executionId%0A     * @param stepPath%0A     * @return%0A     */%0A    List%3CExecutionEvent%3E readEventsByExecutionIdAndStepPath(String executionId, String stepPath
 );%0A%7D

add new API