
ru.paymentgate.engine.webservices.merchant.CustomerDetails Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of abyss-acquiring Show documentation
Show all versions of abyss-acquiring Show documentation
Internet acquiring Web Service client library
The newest version!
/**
* CustomerDetails.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.7.5 Built on : May 06, 2017 (03:45:50 BST)
*/
package ru.paymentgate.engine.webservices.merchant;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axis2.databinding.ADBBean;
import org.apache.axis2.databinding.ADBDataSource;
import org.apache.axis2.databinding.ADBException;
import org.apache.axis2.databinding.utils.BeanUtil;
import org.apache.axis2.databinding.utils.ConverterUtil;
/**
* CustomerDetails bean class
*/
public class CustomerDetails implements ADBBean {
private static final long serialVersionUID = -7322089045109651725L;
/**
* field for Email
*/
protected String localEmail;
/*
* This tracker boolean wil be used to detect whether the user called the
* set method for this attribute. It will be used to determine whether to
* include this field in the serialized XML
*/
protected boolean localEmailTracker = false;
/**
* field for Phone
*/
protected String localPhone;
/*
* This tracker boolean wil be used to detect whether the user called the
* set method for this attribute. It will be used to determine whether to
* include this field in the serialized XML
*/
protected boolean localPhoneTracker = false;
/**
* field for Contact
*/
protected String localContact;
/*
* This tracker boolean wil be used to detect whether the user called the
* set method for this attribute. It will be used to determine whether to
* include this field in the serialized XML
*/
protected boolean localContactTracker = false;
/**
* field for DeliveryInfo
*/
protected DeliveryInfo localDeliveryInfo;
/*
* This tracker boolean wil be used to detect whether the user called the
* set method for this attribute. It will be used to determine whether to
* include this field in the serialized XML
*/
protected boolean localDeliveryInfoTracker = false;
public boolean isEmailSpecified() {
return localEmailTracker;
}
/**
* Auto generated getter method
*
* @return String
*/
public String getEmail() {
return localEmail;
}
/**
* Auto generated setter method
*
* @param param
* Email
*/
public void setEmail(String param) {
localEmailTracker = param != null;
this.localEmail = param;
}
public boolean isPhoneSpecified() {
return localPhoneTracker;
}
/**
* Auto generated getter method
*
* @return String
*/
public String getPhone() {
return localPhone;
}
/**
* Auto generated setter method
*
* @param param
* Phone
*/
public void setPhone(String param) {
localPhoneTracker = param != null;
this.localPhone = param;
}
public boolean isContactSpecified() {
return localContactTracker;
}
/**
* Auto generated getter method
*
* @return String
*/
public String getContact() {
return localContact;
}
/**
* Auto generated setter method
*
* @param param
* Contact
*/
public void setContact(String param) {
localContactTracker = param != null;
this.localContact = param;
}
public boolean isDeliveryInfoSpecified() {
return localDeliveryInfoTracker;
}
/**
* Auto generated getter method
*
* @return DeliveryInfo
*/
public DeliveryInfo getDeliveryInfo() {
return localDeliveryInfo;
}
/**
* Auto generated setter method
*
* @param param
* DeliveryInfo
*/
public void setDeliveryInfo(DeliveryInfo param) {
localDeliveryInfoTracker = param != null;
this.localDeliveryInfo = param;
}
/**
*
* @param parentQName
* @param factory
* @return OMElement
*/
@Override
public OMElement getOMElement(final QName parentQName, final OMFactory factory) throws ADBException {
return factory.createOMElement(new ADBDataSource(this, parentQName));
}
@Override
public void serialize(final QName parentQName, XMLStreamWriter xmlWriter) throws XMLStreamException, ADBException {
serialize(parentQName, xmlWriter, false);
}
@Override
public void serialize(final QName parentQName, XMLStreamWriter xmlWriter, boolean serializeType)
throws XMLStreamException, ADBException {
String prefix = null;
String namespace = null;
prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter);
if (serializeType) {
String namespacePrefix = registerPrefix(xmlWriter, "http://engine.paymentgate.ru/webservices/merchant");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)) {
writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type",
namespacePrefix + ":customerDetails", xmlWriter);
} else {
writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "customerDetails",
xmlWriter);
}
}
if (localEmailTracker) {
namespace = "";
writeStartElement(null, namespace, "email", xmlWriter);
if (localEmail == null) {
// write the nil attribute
throw new ADBException("email cannot be null!!");
} else {
xmlWriter.writeCharacters(localEmail);
}
xmlWriter.writeEndElement();
}
if (localPhoneTracker) {
namespace = "";
writeStartElement(null, namespace, "phone", xmlWriter);
if (localPhone == null) {
// write the nil attribute
throw new ADBException("phone cannot be null!!");
} else {
xmlWriter.writeCharacters(localPhone);
}
xmlWriter.writeEndElement();
}
if (localContactTracker) {
namespace = "";
writeStartElement(null, namespace, "contact", xmlWriter);
if (localContact == null) {
// write the nil attribute
throw new ADBException("contact cannot be null!!");
} else {
xmlWriter.writeCharacters(localContact);
}
xmlWriter.writeEndElement();
}
if (localDeliveryInfoTracker) {
if (localDeliveryInfo == null) {
throw new ADBException("deliveryInfo cannot be null!!");
}
localDeliveryInfo.serialize(new QName("", "deliveryInfo"), xmlWriter);
}
xmlWriter.writeEndElement();
}
private static String generatePrefix(String namespace) {
if (namespace.equals("http://engine.paymentgate.ru/webservices/merchant")) {
return "ns1";
}
return BeanUtil.getUniquePrefix();
}
/**
* Utility method to write an element start tag.
*/
private void writeStartElement(String prefix, String namespace, String localPart, XMLStreamWriter xmlWriter)
throws XMLStreamException {
String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
}
xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
}
/**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(String prefix, String namespace, String attName, String attValue,
XMLStreamWriter xmlWriter) throws XMLStreamException {
String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeAttribute(writerPrefix, namespace, attName, attValue);
} else {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
xmlWriter.writeAttribute(prefix, namespace, attName, attValue);
}
}
/**
* Register a namespace prefix
*/
private String registerPrefix(XMLStreamWriter xmlWriter, String namespace) throws XMLStreamException {
String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
String uri = nsContext.getNamespaceURI(prefix);
if ((uri == null) || (uri.length() == 0)) {
break;
}
prefix = BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
}
/**
* Factory class that keeps the parse method
*/
public static class Factory {
/**
* static method to create the object Precondition: If this object is an
* element, the current or next start element starts this object and any
* intervening reader events are ignorable If this object is not an
* element, it is a complex type and the reader is at the event just
* after the outer start element Postcondition: If this object is an
* element, the reader is positioned at its end element If this object
* is a complex type, the reader is positioned at the end element of its
* outer element
*/
public static CustomerDetails parse(XMLStreamReader reader) throws Exception {
CustomerDetails object = new CustomerDetails();
String nillableValue = null;
try {
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
if (fullTypeName != null) {
String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1) {
nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":"));
}
nsPrefix = (nsPrefix == null) ? "" : nsPrefix;
String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1);
if (!"customerDetails".equals(type)) {
// find namespace for the prefix
String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (CustomerDetails) ExtensionMapper.getTypeObject(nsUri, type, reader);
}
}
}
reader.next();
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if ((reader.isStartElement() && new QName("", "email").equals(reader.getName()))
|| new QName("", "email").equals(reader.getName())) {
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)) {
throw new ADBException("The element: " + "email" + " cannot be null");
}
String content = reader.getElementText();
object.setEmail(ConverterUtil.convertToString(content));
reader.next();
} // End of if for expected property start element
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if ((reader.isStartElement() && new QName("", "phone").equals(reader.getName()))
|| new QName("", "phone").equals(reader.getName())) {
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)) {
throw new ADBException("The element: " + "phone" + " cannot be null");
}
String content = reader.getElementText();
object.setPhone(ConverterUtil.convertToString(content));
reader.next();
} // End of if for expected property start element
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if ((reader.isStartElement() && new QName("", "contact").equals(reader.getName()))
|| new QName("", "contact").equals(reader.getName())) {
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)) {
throw new ADBException("The element: " + "contact" + " cannot be null");
}
String content = reader.getElementText();
object.setContact(ConverterUtil.convertToString(content));
reader.next();
} // End of if for expected property start element
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if ((reader.isStartElement() && new QName("", "deliveryInfo").equals(reader.getName()))
|| new QName("", "deliveryInfo").equals(reader.getName())) {
object.setDeliveryInfo(DeliveryInfo.Factory.parse(reader));
reader.next();
} // End of if for expected property start element
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.isStartElement()) {
// 2 - A start element we are not expecting indicates a
// trailing invalid property
throw new ADBException("Unexpected subelement " + reader.getName());
}
} catch (XMLStreamException e) {
throw new Exception(e);
}
return object;
}
} // end of factory class
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy