package com.eactive.eai.transformer.layout;

import com.eactive.eai.transformer.message.Message;
import com.eactive.eai.transformer.message.MessageException;

public class InvalidNodeException extends MessageException {
	private static final long serialVersionUID = 9163257642181516975L;
	private Item invalidChildNode = null;
    
    public InvalidNodeException(String message, Message m, Item currentNode) {
        super(message);
    }
    
    public InvalidNodeException(String message, Message m, Item currentNode, Item invalidChildNode) {
        this(message, m, currentNode);
        this.invalidChildNode = invalidChildNode;
    }
    
    @Override
    public String getMessage() {
        StringBuilder sb = new StringBuilder();
        sb.append("전문항목과 레이아웃항목 점검요망.");
        if (invalidChildNode != null) {
	        sb.append("(에러항목 = " + invalidChildNode.getName() + ") ");
        }
        sb.append("\n" + super.getMessage());
        return sb.toString();                                                                                            
    }
}
