/*
 * Copyright 2015 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/

//created on: Aug 2, 2012
package simulation

//list any import classes here.
import org.jbpm.simulation.impl.events.*;
import java.util.Date;


//declare any global variables here




rule "Printout start of process"

    when
        event : StartSimulationEvent();
    then
        System.out.println("Simulation started for process " + event.getProcessId() + " started at " + new Date(event.getStartTime()));

end

rule "Print out end of process"
    when
        event : EndSimulationEvent();
    then
        System.out.println("Simulation ended for process " + event.getProcessId() + " completed at " + new Date(event.getEndTime()));

end

rule "Print out activity of process"
    when
        // exclude HumanTaskActivitySimulationEvent sub class to avoid double printouts
        // in other cases this could be useful to handle generic stuff here and specific in other rules
        event : ActivitySimulationEvent(class != HumanTaskActivitySimulationEvent.class);
    then
        System.out.println("Simulating activity " + event.getActivityName() + " of process " + event.getProcessId() + " it took : " + event.getDuration());

end

rule "Print out human task details of process"

    when
        event : HumanTaskActivitySimulationEvent();
    then
        System.out.println("Simulating activity " + event.getActivityName() + " of process " + event.getProcessId() + " it took : " + event.getDuration() + " wait time : " + event.getWaitTime());

end
