/**
 * EstimateMaxPitchDurationAction.java
 * Created on Aug 11, 2008
 * (C) Copyright TANDBERG Television Ltd.
 */
package com.tandbergtv.watchpoint.pmm.action.asset.distribution.mediapath;

import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;

/**
 * @author Vlada Jakobac
 *
 */
public class EstimateMaxPitchDurationAction implements ActionHandler {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	/* (non-Javadoc)
	 * @see org.jbpm.graph.def.ActionHandler#execute(org.jbpm.graph.exe.ExecutionContext)
	 */
	public void execute(ExecutionContext ec) throws Exception {
		String fileSize = (String)ec.getVariable(AssetDistributionVariables.FILE_SIZE.toString());//in bytes
		int maxPitchDurationInMin = PitchDurationEstimator.maxPitchDurationInMin(fileSize);
		ec.setVariable(AssetDistributionVariables.MAX_PITCH_DURATION_IN_MIN.toString(), new Integer(maxPitchDurationInMin));
	}

}
