1.7.5.2.2. 节点动作代码

package com.seeyon.ctp.workflow.devnode;

import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.seeyon.ctp.workflow.supernode.BaseSuperNodeAction;
import com.seeyon.ctp.workflow.supernode.SuperNodeResponse;

/**
 * 工作流订票节点。
 * 
 * @author wayne
 * 
 */
public class TicketNodeAction extends BaseSuperNodeAction {

    private static final Log logger = LogFactory.getLog(TicketNodeAction.class);

    public int getOrder() {
        return 1;
    }

    public String getNodeId() {
        return "dev_node_ticket";
    }

    public String getNodeName() {
        return "订票节点";
    }

    public SuperNodeResponse executeAction(String token, String activityId,
            Map<String, Object> params) {

        SuperNodeResponse response = new SuperNodeResponse();
        response.setReturnCode(0);
        response.setReturnMsg("等待确认:" + token);
        // TODO 调用机票服务(如携程、腾邦),发送乘客姓名、身份证、起点、目的地、航班信息。
        // 将token同时发送给第三方,等待回调。
        System.out.println("等待确认:" + token);
        return response;
    }

    public void cancelAction(String token, String activityId) {
        logger.info("撤销订票:" + token);
    }

    public SuperNodeResponse confirmAction(String token, String activityId,
            Map<String, Object> params) {
        return this.executeAction(token, activityId, params);
    }

}