View Javadoc
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   * &lt;element name="GeocodeRequest" type="xls:GeocodeRequestType" 
14   * 		substitutionGroup="xls:_RequestParameters"&gt; 
15   *  &lt;annotation&gt;
16   *      &lt;documentation&gt;Geocode Service Request&lt;/documentation&gt; 
17   *  &lt;/annotation&gt;
18   * &lt;/element&gt; 
19   * 
20   * &lt;complexType name="GeocodeRequestType"&gt; 
21   * &lt;annotation&gt;
22   *      &lt;documentation&gt;Geocode Request.&lt;/documentation&gt; 
23   * &lt;/annotation&gt;
24   * &lt;complexContent&gt; 
25   *  &lt;extension base="xls:AbstractRequestParametersType"&gt;
26   *  &lt;sequence&gt; 
27   *      &lt;element ref="xls:Address" maxOccurs="unbounded"/&gt; 
28   *  &lt;/sequence&gt;
29   *  &lt;attribute name="returnFreeForm" type="boolean" use="optional" default="false"&gt; 
30   *      &lt;annotation&gt; 
31   *          &lt;documentation&gt;Used to request freeform addresses in the response, as 
32   *          opposed to structured adddresses&lt;/documentation&gt; 
33   *      &lt;/annotation&gt; 
34   *  &lt;/attribute&gt; 
35   * &lt;/extension&gt;
36   * &lt;/complexContent&gt;
37   * &lt;/complexType&gt;
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 }