package com.cim.idm.wmsextend.generic.schedule;

import com.cim.idm.framework.template.workflow.WorkflowServiceProxy;
import org.jdom.Document;
import org.jdom.Element;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

public class BpelExcuteJob implements Job{

	/*
	* Name : execute
	* Desc : This function is Bpel execute
	* Author : ZXY IDM Team
	* Date : 2011.01.23
	*/
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		String bpel = (String) context.getJobDetail().getJobDataMap().get("bpel");
		Document document = new Document();
		Element message = new Element("message");
		Element header = new Element("header");
		header.addContent(new Element("messagename").setText(bpel));
		Element body = new Element("body");
		
		message.addContent(header);
		message.addContent(body);
		document.setRootElement(message);
		
		
		Object[] object = {document};
		WorkflowServiceProxy.getBpelExecuter().executeProcess( object, bpel);
	}

}
