All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cfml.parsing.cfscript.script.CFTransactionStatement Maven / Gradle / Ivy

There is a newer version: 2.11.0
Show newest version
package cfml.parsing.cfscript.script;

import java.io.Serializable;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

import org.antlr.v4.runtime.Token;

import cfml.parsing.cfscript.CFExpression;
import cfml.parsing.cfscript.CFIdentifier;
import cfml.parsing.util.ArrayBuilder;

public class CFTransactionStatement extends CFParsedAttributeStatement implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	private CFScriptStatement body;
	
	private static HashSet supportedAttributes;
	
	static {
		supportedAttributes = new HashSet();
		supportedAttributes.add("ACTION");
		supportedAttributes.add("SAVEPOINT");
		supportedAttributes.add("ISOLATION");
	}
	
	public CFScriptStatement getBody() {
		return body;
	}
	
	public static HashSet getSupportedAttributes() {
		return supportedAttributes;
	}
	
	public CFTransactionStatement(Token _t, Map _attr, CFScriptStatement _body) {
		super(_t, _attr);
		
		body = _body;
	}
	
	@Override
	public String Decompile(int indent) {
		StringBuilder sb = new StringBuilder();
		sb.append("transaction ");
		DecompileAttributes(sb);
		if (body == null) {
			sb.append(";");
		} else {
			sb.append(body.Decompile(0));
		}
		
		return sb.toString();
	}
	
	@Override
	public List decomposeScript() {
		return ArrayBuilder.createCFScriptStatement(body);
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy