package com.sforce.async; import com.sforce.ws.ConnectionException; import com.sforce.ws.bind.TypeInfo; import com.sforce.ws.bind.TypeMapper; import com.sforce.ws.bind.XMLizable; import com.sforce.ws.parser.XmlInputStream; import com.sforce.ws.parser.XmlOutputStream; import com.sforce.ws.util.Verbose; import java.io.IOException; import javax.xml.namespace.QName; public class AsyncApiException extends Exception implements XMLizable { public AsyncApiException() {} public AsyncApiException(String message, AsyncExceptionCode code, Throwable th) { super(code + " : " + message, th); this.exceptionCode = code; this.exceptionMessage = message; } public AsyncApiException(String message, AsyncExceptionCode code) { super(code + " : " + message); this.exceptionCode = code; this.exceptionMessage = message; } public String getMessage() { return this.exceptionCode + " : " + this.exceptionMessage; } private static final TypeInfo exceptionCode__typeInfo = new TypeInfo("http://www.force.com/2009/06/asyncapi/dataload", "exceptionCode", "http://www.force.com/2009/06/asyncapi/dataload", "AsyncExceptionCode", 1, 1, true); private boolean exceptionCode__is_set = false; private AsyncExceptionCode exceptionCode; public AsyncExceptionCode getExceptionCode() { return this.exceptionCode; } public void setExceptionCode(AsyncExceptionCode exceptionCode) { this.exceptionCode = exceptionCode; this.exceptionCode__is_set = true; } private static final TypeInfo exceptionMessage__typeInfo = new TypeInfo("http://www.force.com/2009/06/asyncapi/dataload", "exceptionMessage", "http://www.w3.org/2001/XMLSchema", "string", 1, 1, true); private boolean exceptionMessage__is_set = false; private String exceptionMessage; public String getExceptionMessage() { return this.exceptionMessage; } public void setExceptionMessage(String exceptionMessage) { this.exceptionMessage = exceptionMessage; this.exceptionMessage__is_set = true; } public void write(QName __element, XmlOutputStream __out, TypeMapper __typeMapper) throws IOException { __out.writeStartTag(__element.getNamespaceURI(), __element.getLocalPart()); writeFields(__out, __typeMapper); __out.writeEndTag(__element.getNamespaceURI(), __element.getLocalPart()); } protected void writeFields(XmlOutputStream __out, TypeMapper __typeMapper) throws IOException { __typeMapper.writeObject(__out, exceptionCode__typeInfo, this.exceptionCode, this.exceptionCode__is_set); __typeMapper.writeString(__out, exceptionMessage__typeInfo, this.exceptionMessage, this.exceptionMessage__is_set); } public void load(XmlInputStream __in, TypeMapper __typeMapper) throws IOException, ConnectionException { __typeMapper.consumeStartTag(__in); loadFields(__in, __typeMapper); __typeMapper.consumeEndTag(__in); } protected void loadFields(XmlInputStream __in, TypeMapper __typeMapper) throws IOException, ConnectionException { __in.peekTag(); if (__typeMapper.isElement(__in, exceptionCode__typeInfo)) setExceptionCode((AsyncExceptionCode)__typeMapper.readObject(__in, exceptionCode__typeInfo, AsyncExceptionCode.class)); __in.peekTag(); if (__typeMapper.isElement(__in, exceptionMessage__typeInfo)) setExceptionMessage(__typeMapper.readString(__in, exceptionMessage__typeInfo, String.class)); } public String toString() { StringBuilder sb = new StringBuilder(); sb.append("[AsyncApiException "); sb.append(" exceptionCode="); sb.append("'").append(Verbose.toString(this.exceptionCode)).append("'\n"); sb.append(" exceptionMessage="); sb.append("'").append(Verbose.toString(this.exceptionMessage)).append("'\n"); sb.append("]\n"); return sb.toString(); } }