1 package nl.mineleni.openls.databinding.openls;
2
3 import java.util.Vector;
4
5 import nl.mineleni.openls.XmlNamespaceConstants;
6
7 /**
8 * OLS GeocodeRequest.
9 * http://schemas.opengis.net/ols/1.2.0/LocationUtilityService.xsd
10 *
11 * <pre>
12 *
13 * <element name="GeocodeRequest" type="xls:GeocodeRequestType"
14 * substitutionGroup="xls:_RequestParameters">
15 * <annotation>
16 * <documentation>Geocode Service Request</documentation>
17 * </annotation>
18 * </element>
19 *
20 * <complexType name="GeocodeRequestType">
21 * <annotation>
22 * <documentation>Geocode Request.</documentation>
23 * </annotation>
24 * <complexContent>
25 * <extension base="xls:AbstractRequestParametersType">
26 * <sequence>
27 * <element ref="xls:Address" maxOccurs="unbounded"/>
28 * </sequence>
29 * <attribute name="returnFreeForm" type="boolean" use="optional" default="false">
30 * <annotation>
31 * <documentation>Used to request freeform addresses in the response, as
32 * opposed to structured adddresses</documentation>
33 * </annotation>
34 * </attribute>
35 * </extension>
36 * </complexContent>
37 * </complexType>
38 *
39 * </pre>
40 *
41 * @author mprins
42 * @since 1.7
43 */
44 public class GeocodeRequest implements XmlNamespaceConstants {
45 /**
46 * serialization id.
47 */
48 private static final long serialVersionUID = -1347583150356760221L;
49 /** interne adres lijst. */
50 private final Vector<Address> addressList = new Vector<>();
51
52 /**
53 * Adds the address.
54 *
55 * @param val
56 * the val
57 */
58 public void addAddress(final Address val) {
59 this.addressList.add(val);
60 }
61
62 /**
63 * Gets the address at.
64 *
65 * @param i
66 * the i
67 * @return the address at
68 */
69 public Address getAddressAt(final int i) {
70 return this.addressList.get(i);
71 }
72
73 /**
74 * Gets the address size.
75 *
76 * @return the address size
77 */
78 public int getAddressSize() {
79 return this.addressList.size();
80 }
81
82 /*
83 * (non-Javadoc)
84 *
85 * @see nl.mineleni.openls.XmlNamespaceConstants#toXML()
86 */
87 @Override
88 public String toXML() {
89 final StringBuilder sb = new StringBuilder("<"
90 + XmlNamespaceConstants.OPENLS_NAMESPACE_PREFIX
91 + ":GeocodeRequest " + "xmlns:"
92 + XmlNamespaceConstants.OPENLS_NAMESPACE_PREFIX + "=\""
93 + XmlNamespaceConstants.OPENLS_NAMESPACE_URI + "\" " + "xmlns:"
94 + XmlNamespaceConstants.OGC_GML_NAMESPACE_PREFIX + "=\""
95 + XmlNamespaceConstants.OGC_GML_NAMESPACE_URI + "\">");
96 for (final Address addrl : this.addressList) {
97 sb.append(addrl.toXML());
98 }
99 sb.append("</" + XmlNamespaceConstants.OPENLS_NAMESPACE_PREFIX
100 + ":GeocodeRequest>");
101 return sb.toString();
102 }
103 }