diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2013-12-20 12:35:28 +0100 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2013-12-20 12:35:28 +0100 |
commit | defceef8afef538555c13d33e344a89a828a3d97 (patch) | |
tree | 24b44f970f161d5b139dde501ca0f5d883f9fdea /src/main/java/at/gv/util/client/mis | |
download | egovutils-defceef8afef538555c13d33e344a89a828a3d97.tar.gz egovutils-defceef8afef538555c13d33e344a89a828a3d97.tar.bz2 egovutils-defceef8afef538555c13d33e344a89a828a3d97.zip |
inital
Diffstat (limited to 'src/main/java/at/gv/util/client/mis')
8 files changed, 600 insertions, 0 deletions
diff --git a/src/main/java/at/gv/util/client/mis/MISClient.java b/src/main/java/at/gv/util/client/mis/MISClient.java new file mode 100644 index 0000000..88afc8b --- /dev/null +++ b/src/main/java/at/gv/util/client/mis/MISClient.java @@ -0,0 +1,93 @@ +package at.gv.util.client.mis; + +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.net.ssl.SSLContext; +import javax.xml.namespace.QName; +import javax.xml.ws.BindingProvider; +import javax.xml.ws.WebServiceContext; +import javax.xml.ws.handler.Handler; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.util.LaxHostNameVerifier; +import at.gv.util.LoggingHandler; +import at.gv.util.MiscUtil; +import at.gv.util.client.moaid.MOAIDClient; +import at.gv.util.config.EgovUtilConfiguration; +import at.gv.util.ex.EgovUtilException; +import at.gv.util.wsdl.mis.MandateIssuePortType; +import at.gv.util.wsdl.mis.MandateIssueService; +import at.gv.util.wsdl.szr.SZRException; +import at.gv.util.xsd.mis.MandateIssueRequestType; +import at.gv.util.xsd.mis.MandateIssueResponseType; + +import com.sun.xml.ws.developer.JAXWSProperties; + +public class MISClient { + + @Resource + WebServiceContext wsContext; + + private EgovUtilConfiguration config = null; + Logger log = LoggerFactory.getLogger(MISClient.class); + + public MISClient() {} + + public MISClient(EgovUtilConfiguration config) { + if (config == null) { + throw new NullPointerException("Parameter config must not be null."); + } + this.config = config; + + + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + public MandateIssueResponseType sendMandateIssueRequest(MandateIssueRequestType mir, String misServiceURL) throws SZRException, EgovUtilException { + MiscUtil.assertNotNull(mir, "mir"); + MiscUtil.assertNotNull(misServiceURL, "misServiceURL"); + + URL url = MOAIDClient.class.getResource("/wsdl/mis/mis-1.0.3.wsdl"); + MandateIssueService service = new MandateIssueService(url, new QName("http://reference.e-government.gv.at/namespace/mandates/mis/1.0/wsdl", "MandateIssueService")); + MandateIssuePortType port = service.getMandateIssuePort(); + + log.debug("MIS connection URL: " + misServiceURL); + BindingProvider bindingProvider = (BindingProvider) port; + Map<String, Object> requestContext = bindingProvider.getRequestContext(); + requestContext.put( + BindingProvider.ENDPOINT_ADDRESS_PROPERTY, misServiceURL); + + log.trace("Adding JAX-WS request/response trace handler."); + List<Handler> handlerList = bindingProvider.getBinding().getHandlerChain(); + if (handlerList == null) { + handlerList = new ArrayList(); + } + LoggingHandler loggingHandler = new LoggingHandler(); + handlerList.add(loggingHandler); + bindingProvider.getBinding().setHandlerChain(handlerList); + + // check for ssl + if (misServiceURL.toLowerCase().startsWith("https")) { + log.trace("Using ssl for MIS client request."); + SSLContext sslContext = config.getMISsslConfiguration().getSSLContext(false); + if (sslContext == null) { + throw new EgovUtilException("SSL context from configuration is empty. Please configure an SSL context in the configuration first."); + } + requestContext.put(JAXWSProperties.SSL_SOCKET_FACTORY, sslContext.getSocketFactory()); + + // check for lax hostname + if (this.config.getMISsslConfiguration().useLaxHostNameVerifier()) { + log.trace("LaxHostnameVerifier enabled. This setting is not recommended to use."); + requestContext.put(JAXWSProperties.HOSTNAME_VERIFIER, new LaxHostNameVerifier()); + } + } + return port.mandateIssueOperation(mir); + } + +} diff --git a/src/main/java/at/gv/util/client/mis/MISClientException.java b/src/main/java/at/gv/util/client/mis/MISClientException.java new file mode 100644 index 0000000..74d3a4a --- /dev/null +++ b/src/main/java/at/gv/util/client/mis/MISClientException.java @@ -0,0 +1,23 @@ +package at.gv.util.client.mis; + +public class MISClientException extends Exception { + + private static final long serialVersionUID = 5173056345209288701L; + + public MISClientException() { + super(); + } + + public MISClientException(String message, Throwable cause) { + super(message, cause); + } + + public MISClientException(String message) { + super(message); + } + + public MISClientException(Throwable cause) { + super(cause); + } + +} diff --git a/src/main/java/at/gv/util/client/mis/simple/MISMandate.java b/src/main/java/at/gv/util/client/mis/simple/MISMandate.java new file mode 100644 index 0000000..fe4159a --- /dev/null +++ b/src/main/java/at/gv/util/client/mis/simple/MISMandate.java @@ -0,0 +1,23 @@ +package at.gv.util.client.mis.simple; + +public class MISMandate { + + private boolean isProfRep = false; + private byte[] mandate = null; + + public boolean isProfRep() { + return isProfRep; + } + public void setProfRep(boolean isProfRep) { + this.isProfRep = isProfRep; + } + public byte[] getMandate() { + return mandate; + } + public void setMandate(byte[] mandate) { + this.mandate = mandate; + } + + + +} diff --git a/src/main/java/at/gv/util/client/mis/simple/MISSessionId.java b/src/main/java/at/gv/util/client/mis/simple/MISSessionId.java new file mode 100644 index 0000000..c9adc66 --- /dev/null +++ b/src/main/java/at/gv/util/client/mis/simple/MISSessionId.java @@ -0,0 +1,23 @@ +package at.gv.util.client.mis.simple; + +public class MISSessionId { + + private String sessiondId = null; + private String redirectURL = null; + + public String getSessiondId() { + return sessiondId; + } + public void setSessiondId(String sessiondId) { + this.sessiondId = sessiondId; + } + public String getRedirectURL() { + return redirectURL; + } + public void setRedirectURL(String redirectURL) { + this.redirectURL = redirectURL; + } + + + +} diff --git a/src/main/java/at/gv/util/client/mis/simple/MISSimpleClient.java b/src/main/java/at/gv/util/client/mis/simple/MISSimpleClient.java new file mode 100644 index 0000000..34ba951 --- /dev/null +++ b/src/main/java/at/gv/util/client/mis/simple/MISSimpleClient.java @@ -0,0 +1,233 @@ +package at.gv.util.client.mis.simple; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.TransformerException; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.StringRequestEntity; +import org.apache.xpath.XPathAPI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import at.gv.util.DOMUtils; + +public class MISSimpleClient { + + private final static String SOAP_NS = "http://schemas.xmlsoap.org/soap/envelope/"; + private final static String MIS_NS = "http://reference.e-government.gv.at/namespace/mandates/mis/1.0/xsd"; + + private static Element NS_NODE = null; + + private static Logger log = LoggerFactory.getLogger(MISSimpleClient.class); + + static { + try { + NS_NODE = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument().createElement("test"); + NS_NODE.setAttribute("xmlns:soap", SOAP_NS); + NS_NODE.setAttribute("xmlns:mis", MIS_NS); + } catch (Exception e) { + log.warn("Error initializing namespace node.", e); + } + } + + public static List sendGetMandatesRequest(String webServiceURL, String sessionId) throws MISSimpleClientException { + if (webServiceURL == null) { + throw new NullPointerException("Argument webServiceURL must not be null."); + } + if (sessionId == null) { + throw new NullPointerException("Argument sessionId must not be null."); + } + try { + Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + Element mirElement = doc.createElementNS(MIS_NS, "MandateIssueRequest"); + Element sessionIdElement = doc.createElementNS(MIS_NS, "SessionID"); + sessionIdElement.appendChild(doc.createTextNode(sessionId)); + mirElement.appendChild(sessionIdElement); + // send soap request + Element mandateIssueResponseElement = sendSOAPRequest(webServiceURL, mirElement); + + // check for error + checkForError(mandateIssueResponseElement); + + // check for session id + NodeList mandateElements = XPathAPI.selectNodeList(mandateIssueResponseElement, "//mis:MandateIssueResponse/mis:Mandates/mis:Mandate", NS_NODE); + + if (mandateElements == null || mandateElements.getLength() == 0) { + throw new MISSimpleClientException("No mandates found in response."); + } + + ArrayList foundMandates = new ArrayList(); + for (int i=0; i<mandateElements.getLength(); i++) { + Element mandate = (Element) mandateElements.item(i); + MISMandate misMandate = new MISMandate(); + if ("true".equalsIgnoreCase(mandate.getAttribute("ProfessionalRepresentative"))) { + misMandate.setProfRep(true); + } + misMandate.setMandate(Base64.decodeBase64(DOMUtils.getText(mandate))); + foundMandates.add(misMandate); + } + return foundMandates; + } catch (ParserConfigurationException e) { + throw new MISSimpleClientException(e); + } catch (DOMException e) { + throw new MISSimpleClientException(e); + } catch (TransformerException e) { + throw new MISSimpleClientException(e); + } + } + + public static MISSessionId sendSessionIdRequest(String webServiceURL, byte[] idl, byte[] cert, String redirectURL, String refValue, String mandateIdentifier[]) throws MISSimpleClientException { + if (webServiceURL == null) { + throw new NullPointerException("Argument webServiceURL must not be null."); + } + if (idl == null) { + throw new NullPointerException("Argument idl must not be null."); + } + if (redirectURL == null) { + throw new NullPointerException("Argument redirectURL must not be null."); + } + if (refValue == null) { + throw new NullPointerException("Argument refValue must not be null."); + } + try { + Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + Element mirElement = doc.createElementNS(MIS_NS, "MandateIssueRequest"); + Element idlElement = doc.createElementNS(MIS_NS, "IdentityLink"); + idlElement.appendChild(doc.createTextNode(Base64.encodeBase64String(idl))); + mirElement.appendChild(idlElement); + if (cert != null && cert.length > 0) { + Element certElement = doc.createElementNS(MIS_NS, "X509SignatureCertificate"); + certElement.appendChild(doc.createTextNode(Base64.encodeBase64String(cert))); + mirElement.appendChild(certElement); + } + Element redirectElement = doc.createElementNS(MIS_NS, "RedirectURL"); + redirectElement.appendChild(doc.createTextNode(redirectURL)); + mirElement.appendChild(redirectElement); + Element refValElement = doc.createElementNS(MIS_NS, "ReferenceValue"); + refValElement.appendChild(doc.createTextNode(refValue)); + mirElement.appendChild(refValElement); + if (mandateIdentifier != null && mandateIdentifier.length > 0) { + Element filtersElement = doc.createElementNS(MIS_NS, "Filters"); + Element mandateIdentifiersElement = doc.createElementNS(MIS_NS, "MandateIdentifiers"); + for (int i=0; i<mandateIdentifier.length; i++) { + Element mandateIdentifierElement = doc.createElementNS(MIS_NS, "MandateIdentifier"); + mandateIdentifierElement.appendChild(doc.createTextNode(mandateIdentifier[i])); + mandateIdentifiersElement.appendChild(mandateIdentifierElement); + } + filtersElement.appendChild(mandateIdentifiersElement); + mirElement.appendChild(filtersElement); + } + // send soap request + Element mandateIssueResponseElement = sendSOAPRequest(webServiceURL, mirElement); + + // check for error + checkForError(mandateIssueResponseElement); + + // check for session id + Node sessionIdNode = ((Node) XPathAPI.selectSingleNode(mandateIssueResponseElement, "//mis:MandateIssueResponse/mis:SessionID/text()", NS_NODE)); + if (sessionIdNode == null) { + throw new MISSimpleClientException("SessionId not found in response."); + } + String sessionId = sessionIdNode.getNodeValue(); + + Node guiRedirectURLNode = ((Node) XPathAPI.selectSingleNode(mandateIssueResponseElement, "//mis:MandateIssueResponse/mis:GuiRedirectURL/text()", NS_NODE)); + if (guiRedirectURLNode == null) { + throw new MISSimpleClientException("GuiRedirectURL not found in response."); + } + String guiRedirectURL = guiRedirectURLNode.getNodeValue(); + + // create return object + MISSessionId msid = new MISSessionId(); + msid.setSessiondId(sessionId); + msid.setRedirectURL(guiRedirectURL); + + return msid; + } catch (ParserConfigurationException e) { + throw new MISSimpleClientException(e); + } catch (DOMException e) { + throw new MISSimpleClientException(e); + } catch (TransformerException e) { + throw new MISSimpleClientException(e); + } + } + + private static void checkForError(Element mandateIssueResponseElement) throws MISSimpleClientException { + if (mandateIssueResponseElement == null) { + throw new NullPointerException("Argument mandateIssueResponseElement must not be null."); + } + try { + Element errorElement = (Element) XPathAPI.selectSingleNode(mandateIssueResponseElement, "/mis:MandateIssueResponse/mis:Error", NS_NODE); + if (errorElement != null) { + String code = ((Node) XPathAPI.selectSingleNode(mandateIssueResponseElement, "/mis:MandateIssueResponse/mis:Error/mis:Code/text()", NS_NODE)).getNodeValue(); + String text = ((Node) XPathAPI.selectSingleNode(mandateIssueResponseElement, "/mis:MandateIssueResponse/mis:Error/mis:Text/text()", NS_NODE)).getNodeValue(); + throw new MISSimpleClientException("Fehler beim Abfragen des Online-Vollmachten Services: " + code + " / " + text); + } + } catch (TransformerException e) { + throw new MISSimpleClientException(e); + } + } + + private static Element sendSOAPRequest(String webServiceURL, Element request) throws MISSimpleClientException { + if (webServiceURL == null) { + throw new NullPointerException("Argument webServiceURL must not be null."); + } + if (request == null) { + throw new NullPointerException("Argument request must not be null."); + } + try { + HttpClient httpclient = new HttpClient(); + PostMethod post = new PostMethod(webServiceURL); + StringRequestEntity re = new StringRequestEntity(DOMUtils.serializeNode(packIntoSOAP(request)),"text/xml", "UTF-8"); + post.setRequestEntity(re); + int responseCode = httpclient.executeMethod(post); + if (responseCode != 200) { + throw new MISSimpleClientException("Invalid HTTP response code " + responseCode); + } + return unpackFromSOAP(DOMUtils.parseXmlNonValidating(post.getResponseBodyAsStream())); + } catch(IOException e) { + throw new MISSimpleClientException(e); + } catch (TransformerException e) { + throw new MISSimpleClientException(e); + } catch (ParserConfigurationException e) { + throw new MISSimpleClientException(e); + } catch (SAXException e) { + throw new MISSimpleClientException(e); + } + } + + private static Element packIntoSOAP(Element element) throws MISSimpleClientException { + try { + Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + Element soapEnvelope = doc.createElement("Envelope"); + soapEnvelope.setAttribute("xmlns", SOAP_NS); + Element soapBody = doc.createElement("Body"); + soapEnvelope.appendChild(soapBody); + soapBody.appendChild(doc.importNode(element, true)); + return soapEnvelope; + } catch(ParserConfigurationException e) { + throw new MISSimpleClientException(e); + } + } + + private static Element unpackFromSOAP(Element element) throws MISSimpleClientException { + try { + return (Element) XPathAPI.selectSingleNode(element, "/soap:Envelope/soap:Body/child::*[position()=1]", NS_NODE); + } catch(TransformerException e) { + throw new MISSimpleClientException(e); + } + } + +}
\ No newline at end of file diff --git a/src/main/java/at/gv/util/client/mis/simple/MISSimpleClientException.java b/src/main/java/at/gv/util/client/mis/simple/MISSimpleClientException.java new file mode 100644 index 0000000..91250d2 --- /dev/null +++ b/src/main/java/at/gv/util/client/mis/simple/MISSimpleClientException.java @@ -0,0 +1,22 @@ +package at.gv.util.client.mis.simple; + +public class MISSimpleClientException extends Exception { + + private static final long serialVersionUID = 1L; + + public MISSimpleClientException() { + } + + public MISSimpleClientException(String message) { + super(message); + } + + public MISSimpleClientException(Throwable cause) { + super(cause); + } + + public MISSimpleClientException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/src/main/java/at/gv/util/client/mis/usp/USPClient.java b/src/main/java/at/gv/util/client/mis/usp/USPClient.java new file mode 100644 index 0000000..ac8315a --- /dev/null +++ b/src/main/java/at/gv/util/client/mis/usp/USPClient.java @@ -0,0 +1,150 @@ +package at.gv.util.client.mis.usp; + +import java.net.URL; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.net.ssl.SSLContext; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.namespace.QName; +import javax.xml.ws.BindingProvider; +import javax.xml.ws.WebServiceContext; +import javax.xml.ws.handler.Handler; + +import org.apache.commons.lang.RandomStringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.util.LaxHostNameVerifier; +import at.gv.util.LoggingHandler; +import at.gv.util.MiscUtil; +import at.gv.util.client.szr.SZRSOAPHandler; +import at.gv.util.config.EgovUtilConfiguration; +import at.gv.util.ex.EgovUtilException; +import at.gv.util.wsdl.mis.usp.GetMandatesPortType; +import at.gv.util.wsdl.mis.usp.GetMandatesService; +import at.gv.util.xsd.mis.usp.GetMandatesRequest; +import at.gv.util.xsd.mis.usp.GetMandatesRequest.MandateFilters; +import at.gv.util.xsd.mis.usp.GetMandatesResponse; +import at.gv.util.xsd.mis.usp.IdentificationType; +import at.gv.util.xsd.szr.pvp.PvpTokenType; + +import com.sun.xml.ws.developer.JAXWSProperties; + +public class USPClient { + + @Resource + WebServiceContext wsContext; + + private EgovUtilConfiguration config = null; + private Logger log = LoggerFactory.getLogger(USPClient.class); + private boolean logEnabled = true; + private GetMandatesPortType uspSuche = null; + + public USPClient(EgovUtilConfiguration config, boolean logEnabled) throws EgovUtilException { + MiscUtil.assertNotNull(config, "config"); + this.config = config; + this.logEnabled = logEnabled; + initialize(); + } + + public GetMandatesResponse getMandates(String bpkType, String bpkValue, List<String> mandateFilters) { + + // assemble request + GetMandatesRequest request = new GetMandatesRequest(); + String requestId = createUSPRequestId(); + log.debug("USP request id: " + requestId); + request.setRequestId(requestId); + Date date = new Date(); + try { + request.setTimestamp(MiscUtil.getXMLGregorianCalendar(date)); + } catch (DatatypeConfigurationException e) { + log.warn("Error initializing USP client.", e); + return null; + } + log.debug("USP time stamp: " + date.toString()); + request.setApplicationId(config.getUSPApplicationId()); + log.debug("USP application id: " + config.getUSPApplicationId()); + + // set identification + IdentificationType idt = new IdentificationType(); + idt.setType(bpkType); + idt.setValue(bpkValue); + request.setIdentification(idt); + + // set filters + if (mandateFilters != null && mandateFilters.size() > 0) { + MandateFilters mf = new MandateFilters(); + mf.getMandateFilter().addAll(mandateFilters); + request.setMandateFilters(mf); + } + + return this.uspSuche.getMandatesOperation(request); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private void initialize() throws EgovUtilException { + URL url = USPClient.class.getResource("/wsdl/mis/usp/mis-usp-1.0.2.wsdl"); + GetMandatesService uspService = null; + String uspURL = null; + uspService = new GetMandatesService(url, new QName("http://reference.e-government.gv.at/namespace/mandates/mis/usp/1.0.2/wsdl", "GetMandatesService")); + uspSuche = uspService.getGetMandatesPort(); + if (config.isUSPTestEnvironment()) { + log.trace("Initializing USP test configuration."); + uspURL = config.getUSPTestEnvironmentURL(); + } else { + log.trace("Initializing USP productive configuration."); + uspURL = config.getUSPProductionEnvironmentURL(); + } + log.trace("USP connection URL: " + uspURL); + BindingProvider bindingProvider = (BindingProvider) uspSuche; + Map<String, Object> requestContext = bindingProvider.getRequestContext(); + requestContext.put( + BindingProvider.ENDPOINT_ADDRESS_PROPERTY, uspURL); + + log.trace("Adding JAX-WS request/response trace handler."); + List<Handler> handlerList = bindingProvider.getBinding().getHandlerChain(); + if (handlerList == null) { + handlerList = new ArrayList(); + } + LoggingHandler loggingHandler = new LoggingHandler(); + if (this.logEnabled) { + handlerList.add(loggingHandler); + } + // PV authentication + log.trace("Adding WS-Security Header handler."); + PvpTokenType pvpToken = config.getURPVPToken(); + SZRSOAPHandler szrSOAPHandler = new SZRSOAPHandler(); + szrSOAPHandler.configure(pvpToken); + handlerList.add(szrSOAPHandler); + bindingProvider.getBinding().setHandlerChain(handlerList); + + + //set HTTP Client Timeout (Default Timeout 60sec) + requestContext.put(JAXWSProperties.CONNECT_TIMEOUT, this.config.getHTTPRequestTimeout()); + + // check for ssl + if (uspURL.toLowerCase().startsWith("https")) { + log.trace("Using ssl for SZR client request."); + SSLContext sslContext = this.config.getUSPsslConfiguration().getSSLContext(false); + if (sslContext == null) { + throw new EgovUtilException("SSL context from configuration is empty. Please configure an SSL context in the configuration first."); + } + requestContext.put(JAXWSProperties.SSL_SOCKET_FACTORY, sslContext.getSocketFactory()); + + // check for lax hostname + if (this.config.getURsslConfiguration().useLaxHostNameVerifier()) { + log.trace("LaxHostnameVerifier enabled. This setting is not recommended to use."); + requestContext.put(JAXWSProperties.HOSTNAME_VERIFIER, new LaxHostNameVerifier()); + } + } + } + + private String createUSPRequestId() { + return RandomStringUtils.randomAlphanumeric(12); + } + +} diff --git a/src/main/java/at/gv/util/client/mis/usp/USPClientException.java b/src/main/java/at/gv/util/client/mis/usp/USPClientException.java new file mode 100644 index 0000000..3c36ccb --- /dev/null +++ b/src/main/java/at/gv/util/client/mis/usp/USPClientException.java @@ -0,0 +1,33 @@ +package at.gv.util.client.mis.usp; + +public class USPClientException extends Exception { + + private static final long serialVersionUID = 5173056345209288701L; + + private int code = -1; + + public USPClientException(int code) { + super(); + this.code = code; + } + + public USPClientException(String message, int code, Throwable cause) { + super(message, cause); + this.code = code; + } + + public USPClientException(String message, int code) { + super(message); + this.code = code; + } + + public USPClientException(int code, Throwable cause) { + super(cause); + this.code = code; + } + + public int getCode() { + return this.code; + } + +} |