package cn.axzo.workflow.core.converter.json;

import cn.axzo.workflow.common.model.request.bpmn.BpmnJsonNode;
import cn.axzo.workflow.core.common.exception.WorkflowEngineException;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.Process;

import static cn.axzo.workflow.core.common.code.ConvertorRespCode.CONVERTOR_NODE_TYPE_NOT_SUPPORT;


/**
 * 默认的不支持的节点转换器
 *
 * @author wangli
 * @since 2023/10/13 15:13
 */
public class NotSupportConverter extends AbstractBpmnJsonConverter<NotSupportConverter.NotSupportFlowElement> {

    @Override
    public NotSupportFlowElement convertJsonToElement(BpmnJsonNode node, Process process) {
        throw new WorkflowEngineException(CONVERTOR_NODE_TYPE_NOT_SUPPORT, node.getType().getType(), node.getId());
    }

    public static class NotSupportFlowElement extends FlowElement {
        @Override
        public FlowElement clone() {
            return new NotSupportFlowElement();
        }
    }
}
