/**
 * ResetInfoAction.java
 * Created on Jun 27, 2008
 * (C) Copyright TANDBERG Television Ltd.
 */
package com.tandbergtv.watchpoint.pmm.action.asset.distribution;

import org.apache.log4j.Logger;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;

/**
 * This action class resets the scheduleId, contextId and status
 * variable in the context.  
 * 
 * @author spuranik
 */
public class ResetInfoAction implements ActionHandler {

	private static final long serialVersionUID = 1L;
	private static String DEFAULT_CONTEXT_ID = "defaultContextId";
	private static String DEFAULT_SCHEDULE_ID = "defaultScheduleId";
	private static String STATUS = "status";
	private static int DEFAULT_INT_VALUE = 0;
	private static String DEFAULT_STRING_VALUE = "";

	private static final Logger logger = Logger.getLogger(ResetInfoAction.class);

	/* (non-Javadoc)
	 * @see org.jbpm.graph.def.ActionHandler#execute(org.jbpm.graph.exe.ExecutionContext)
	 */
	public void execute(ExecutionContext context) throws Exception {

		context.setVariable(DEFAULT_CONTEXT_ID, DEFAULT_INT_VALUE);
		context.setVariable(DEFAULT_SCHEDULE_ID, DEFAULT_INT_VALUE);
		context.setVariable(STATUS, DEFAULT_STRING_VALUE);
		logger.debug("Reset 'contextId', 'scheduleId', and 'status' variables");
	}
}
