Java tutorial
/* * Copyright 2016 CIRDLES. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * * This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 * See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> * Any modifications to this file will be lost upon recompilation of the source schema. * Generated on: 2016.03.03 at 09:06:25 AM EST * * Additional functionality supporting this class is included. */ package org.geosamples.samples; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; import java.math.BigDecimal; import java.math.BigInteger; import java.nio.charset.Charset; import java.security.KeyManagementException; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.List; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.parsers.ParserConfigurationException; import org.apache.commons.codec.binary.Base64; import org.apache.http.HttpEntity; import org.apache.http.HttpHeaders; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.HttpHostConnectException; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import static org.geosamples.Constants.GEOSAMPLES_COMPLIANT_XML_HEADER_SAMPLES; import static org.geosamples.Constants.GEOSAMPLES_PRODUCTION_SERVER; import static org.geosamples.Constants.GEOSAMPLES_SAMPLE_IGSN_WEBSERVICE_NAME; import static org.geosamples.Constants.GEOSAMPLES_SAMPLE_LIST_PER_USERCODE_WEBSERVICE_NAME; import static org.geosamples.Constants.GEOSAMPLES_SAMPLE_UPDATE_IGSN_WEBSERVICE_NAME; import static org.geosamples.Constants.GEOSAMPLES_SAMPLE_UPLOAD_WEBSERVICE_NAME; import static org.geosamples.Constants.GEOSAMPLES_TEST_FEATURES_SERVER; import static org.geosamples.Constants.GEOSAMPLES_TEST_SAMPLES_SERVER; import org.geosamples.XMLDocumentInterface; import org.geosamples.results.Results; import org.xml.sax.SAXException; /** * <p> * Java class for anonymous complex type. * * <p> * The following schema fragment specifies the expected content contained within * this class. * * <pre> * {@code * <xml> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="sample" maxOccurs="unbounded"> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <all> * <element ref="{http://app.geosamples.org}user_code"/> * <element ref="{http://app.geosamples.org}sample_type"/> * <element ref="{http://app.geosamples.org}name"/> * <element ref="{http://app.geosamples.org}material"/> * <element ref="{http://app.geosamples.org}igsn" minOccurs="0"/> * <element ref="{http://app.geosamples.org}parent_igsn" minOccurs="0"/> * <element ref="{http://app.geosamples.org}is_private" minOccurs="0"/> * <element ref="{http://app.geosamples.org}publish_date" minOccurs="0"/> * <element ref="{http://app.geosamples.org}classification" minOccurs="0"/> * <element ref="{http://app.geosamples.org}classification_comment" minOccurs="0"/> * <element ref="{http://app.geosamples.org}field_name" minOccurs="0"/> * <element ref="{http://app.geosamples.org}description" minOccurs="0"/> * <element ref="{http://app.geosamples.org}age_min" minOccurs="0"/> * <element ref="{http://app.geosamples.org}age_max" minOccurs="0"/> * <element ref="{http://app.geosamples.org}age_unit" minOccurs="0"/> * <element ref="{http://app.geosamples.org}geological_age" minOccurs="0"/> * <element ref="{http://app.geosamples.org}geological_unit" minOccurs="0"/> * <element ref="{http://app.geosamples.org}collection_method" minOccurs="0"/> * <element ref="{http://app.geosamples.org}collection_method_descr" minOccurs="0"/> * <element ref="{http://app.geosamples.org}size" minOccurs="0"/> * <element ref="{http://app.geosamples.org}size_unit" minOccurs="0"/> * <element ref="{http://app.geosamples.org}sample_comment" minOccurs="0"/> * <element ref="{http://app.geosamples.org}purpose" minOccurs="0"/> * <element ref="{http://app.geosamples.org}latitude" minOccurs="0"/> * <element ref="{http://app.geosamples.org}longitude" minOccurs="0"/> * <element ref="{http://app.geosamples.org}latitude_end" minOccurs="0"/> * <element ref="{http://app.geosamples.org}longitude_end" minOccurs="0"/> * <element ref="{http://app.geosamples.org}elevation" minOccurs="0"/> * <element ref="{http://app.geosamples.org}elevation_end" minOccurs="0"/> * <element ref="{http://app.geosamples.org}vertical_datum" minOccurs="0"/> * <element ref="{http://app.geosamples.org}northing" minOccurs="0"/> * <element ref="{http://app.geosamples.org}easting" minOccurs="0"/> * <element ref="{http://app.geosamples.org}zone" minOccurs="0"/> * <element ref="{http://app.geosamples.org}navigation_type" minOccurs="0"/> * <element ref="{http://app.geosamples.org}primary_location_type" minOccurs="0"/> * <element ref="{http://app.geosamples.org}primary_location_name" minOccurs="0"/> * <element ref="{http://app.geosamples.org}location_description" minOccurs="0"/> * <element ref="{http://app.geosamples.org}locality" minOccurs="0"/> * <element ref="{http://app.geosamples.org}locality_description" minOccurs="0"/> * <element ref="{http://app.geosamples.org}country" minOccurs="0"/> * <element ref="{http://app.geosamples.org}province" minOccurs="0"/> * <element ref="{http://app.geosamples.org}county" minOccurs="0"/> * <element ref="{http://app.geosamples.org}city" minOccurs="0"/> * <element ref="{http://app.geosamples.org}cruise_field_prgrm" minOccurs="0"/> * <element ref="{http://app.geosamples.org}platform_type" minOccurs="0"/> * <element ref="{http://app.geosamples.org}platform_name" minOccurs="0"/> * <element ref="{http://app.geosamples.org}platform_descr" minOccurs="0"/> * <element ref="{http://app.geosamples.org}launch_platform_name" minOccurs="0"/> * <element ref="{http://app.geosamples.org}launch_id" minOccurs="0"/> * <element ref="{http://app.geosamples.org}launch_type_name" minOccurs="0"/> * <element ref="{http://app.geosamples.org}collector" minOccurs="0"/> * <element ref="{http://app.geosamples.org}collector_detail" minOccurs="0"/> * <element ref="{http://app.geosamples.org}collection_start_date" minOccurs="0"/> * <element ref="{http://app.geosamples.org}collection_end_date" minOccurs="0"/> * <element ref="{http://app.geosamples.org}collection_date_precision" minOccurs="0"/> * <element ref="{http://app.geosamples.org}current_archive" minOccurs="0"/> * <element ref="{http://app.geosamples.org}current_archive_contact" minOccurs="0"/> * <element ref="{http://app.geosamples.org}original_archive" minOccurs="0"/> * <element ref="{http://app.geosamples.org}original_archive_contact" minOccurs="0"/> * <element ref="{http://app.geosamples.org}depth_min" minOccurs="0"/> * <element ref="{http://app.geosamples.org}depth_max" minOccurs="0"/> * <element ref="{http://app.geosamples.org}depth_scale" minOccurs="0"/> * <element name="sample_other_names" minOccurs="0"> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element ref="{http://app.geosamples.org}sample_other_name" maxOccurs="unbounded"/> * </sequence> * </restriction> * </complexContent> * </complexType> * </element> * <element name="external_urls" minOccurs="0"> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="external_url" maxOccurs="unbounded"> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element ref="{http://app.geosamples.org}url"/> * <element ref="{http://app.geosamples.org}description" minOccurs="0"/> * <element ref="{http://app.geosamples.org}url_type" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> * </complexType> * </element> * </sequence> * </restriction> * </complexContent> * </complexType> * </element> * </all> * </restriction> * </complexContent> * </complexType> * </element> * </sequence> * </restriction> * </complexContent> * </complexType> * </xml> * } * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "sample" }) @XmlRootElement(name = "samples") public class Samples implements XMLDocumentInterface { /** * Constructor */ public Samples() { this.sample = new ArrayList<>(); } /** * Constructor supplying list of individual samples * * @param sampleList */ public Samples(List<Sample> sampleList) { this.sample = sampleList; } /** * Deserializes XML response to query for IGSN sample metadata from * GeoSamples.org, using the * <a href="https://sesardev.geosamples.org/sample/igsn/">Test Service</a>. * * @see <a href="http://www.iedadata.org/services/sesar_api">SESAR REST web * services</a> * @param igsn * @return Samples * @throws org.apache.http.conn.HttpHostConnectException * @throws IOException * @throws JAXBException * @throws javax.xml.parsers.ParserConfigurationException * @throws java.security.NoSuchAlgorithmException * @throws org.xml.sax.SAXException * @throws java.security.KeyStoreException * @throws java.security.KeyManagementException */ public static XMLDocumentInterface downloadSampleMetadataFromTestSesarIGSN(String igsn) throws HttpHostConnectException, IOException, JAXBException, ParserConfigurationException, SAXException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { String testService = GEOSAMPLES_TEST_SAMPLES_SERVER + GEOSAMPLES_SAMPLE_IGSN_WEBSERVICE_NAME; return downloadSampleMetadataFromSesarIGSNWithNoCredentials(testService + igsn); } /** * Deserializes XML response to query for IGSN sample metadata from * GeoSamples.org with username and password using the * <a href="https://sesardev.geosamples.org/sample/igsn/">Test Service</a>. * * @see <a href="http://www.iedadata.org/services/sesar_api">SESAR REST web * services</a> * @param igsn * @param username * @param password * @return Samples * @throws org.apache.http.conn.HttpHostConnectException * @throws IOException * @throws JAXBException * @throws javax.xml.parsers.ParserConfigurationException * @throws java.security.NoSuchAlgorithmException * @throws org.xml.sax.SAXException * @throws java.security.KeyStoreException * @throws java.security.KeyManagementException */ public static XMLDocumentInterface downloadSampleMetadataFromTestSesarIGSN(String igsn, String username, String password) throws HttpHostConnectException, IOException, JAXBException, ParserConfigurationException, SAXException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { String testService = GEOSAMPLES_TEST_SAMPLES_SERVER + GEOSAMPLES_SAMPLE_IGSN_WEBSERVICE_NAME; return downloadSampleMetadataFromSesarIGSNWithCredentials(testService + igsn, username, password); } /** * Deserializes XML response to query for IGSN sample metadata from * GeoSamples.org, using the * <a href="https://sesar3.geosamples.org/sample/igsn/">Test Features * Service</a>. * * @see <a href="http://www.iedadata.org/services/sesar_api">SESAR REST web * services</a> * @param igsn * @return Samples * @throws org.apache.http.conn.HttpHostConnectException * @throws IOException * @throws JAXBException * @throws javax.xml.parsers.ParserConfigurationException * @throws java.security.NoSuchAlgorithmException * @throws org.xml.sax.SAXException * @throws java.security.KeyStoreException * @throws java.security.KeyManagementException */ public static XMLDocumentInterface downloadSampleMetadataFromTestFeaturesServiceSesarIGSN(String igsn) throws HttpHostConnectException, IOException, JAXBException, ParserConfigurationException, SAXException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { String testService = GEOSAMPLES_TEST_FEATURES_SERVER + GEOSAMPLES_SAMPLE_IGSN_WEBSERVICE_NAME; return downloadSampleMetadataFromSesarIGSNWithNoCredentials(testService + igsn); } /** * Deserializes XML response to query for IGSN sample metadata from * GeoSamples.org with username and password using the * <a href="https://sesar3.geosamples.org/sample/igsn/">Test Features * Service</a>. * * @see <a href="http://www.iedadata.org/services/sesar_api">SESAR REST web * services</a> * @param igsn * @param username * @param password * @return Samples * @throws org.apache.http.conn.HttpHostConnectException * @throws IOException * @throws JAXBException * @throws javax.xml.parsers.ParserConfigurationException * @throws java.security.NoSuchAlgorithmException * @throws org.xml.sax.SAXException * @throws java.security.KeyStoreException * @throws java.security.KeyManagementException */ public static XMLDocumentInterface downloadSampleMetadataFromTestFeaturesServiceSesarIGSN(String igsn, String username, String password) throws HttpHostConnectException, IOException, JAXBException, ParserConfigurationException, SAXException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { String testService = GEOSAMPLES_TEST_FEATURES_SERVER + GEOSAMPLES_SAMPLE_IGSN_WEBSERVICE_NAME; return downloadSampleMetadataFromSesarIGSNWithCredentials(testService + igsn, username, password); } /** * Deserializes XML response to query for IGSN sample metadata from * GeoSamples.org, using the * <a href="https://sesardev.geosamples.org/sample/igsn/">Production * Service</a>. * * @see <a href="http://www.iedadata.org/services/sesar_api">SESAR REST web * services</a> * @param igsn * @return Samples * @throws org.apache.http.conn.HttpHostConnectException * @throws IOException * @throws JAXBException * @throws javax.xml.parsers.ParserConfigurationException * @throws java.security.NoSuchAlgorithmException * @throws org.xml.sax.SAXException * @throws java.security.KeyStoreException * @throws java.security.KeyManagementException */ public static XMLDocumentInterface downloadSampleMetadataFromProductionSesarIGSN(String igsn) throws HttpHostConnectException, IOException, JAXBException, ParserConfigurationException, SAXException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { String productionService = GEOSAMPLES_PRODUCTION_SERVER + GEOSAMPLES_SAMPLE_IGSN_WEBSERVICE_NAME; return downloadSampleMetadataFromSesarIGSNWithNoCredentials(productionService + igsn); } /** * Deserializes XML response to query for IGSN sample metadata from * GeoSamples.org with username and password using the * <a href="https://sesardev.geosamples.org/sample/igsn/">Production * Service</a>. * * @see <a href="http://www.iedadata.org/services/sesar_api">SESAR REST web * services</a> * @param igsn * @param username * @param password * @return Samples * @throws org.apache.http.conn.HttpHostConnectException * @throws IOException * @throws JAXBException * @throws javax.xml.parsers.ParserConfigurationException * @throws java.security.NoSuchAlgorithmException * @throws org.xml.sax.SAXException * @throws java.security.KeyStoreException * @throws java.security.KeyManagementException */ public static XMLDocumentInterface downloadSampleMetadataFromProductionSesarIGSN(String igsn, String username, String password) throws HttpHostConnectException, IOException, JAXBException, ParserConfigurationException, SAXException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { String productionService = GEOSAMPLES_PRODUCTION_SERVER + GEOSAMPLES_SAMPLE_IGSN_WEBSERVICE_NAME; return downloadSampleMetadataFromSesarIGSNWithCredentials(productionService + igsn, username, password); } public static XMLDocumentInterface downloadSampleListFromTestSesarPerUsercode(String usercode) throws HttpHostConnectException, IOException, JAXBException, ParserConfigurationException, SAXException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { String testService = GEOSAMPLES_TEST_SAMPLES_SERVER + GEOSAMPLES_SAMPLE_LIST_PER_USERCODE_WEBSERVICE_NAME; return downloadSampleMetadataFromSesarIGSNWithNoCredentials(testService + usercode); } public static XMLDocumentInterface downloadSampleListFromTestFeaturesSesarPerUsercode(String usercode) throws HttpHostConnectException, IOException, JAXBException, ParserConfigurationException, SAXException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { String testService = GEOSAMPLES_TEST_FEATURES_SERVER + GEOSAMPLES_SAMPLE_LIST_PER_USERCODE_WEBSERVICE_NAME; return downloadSampleMetadataFromSesarIGSNWithNoCredentials(testService + usercode); } public static XMLDocumentInterface downloadSampleListFromProductionSesarPerUsercode(String usercode) throws HttpHostConnectException, IOException, JAXBException, ParserConfigurationException, SAXException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { String testService = GEOSAMPLES_PRODUCTION_SERVER + GEOSAMPLES_SAMPLE_LIST_PER_USERCODE_WEBSERVICE_NAME; return downloadSampleMetadataFromSesarIGSNWithNoCredentials(testService + usercode); } /** * * @param serviceUrlWithData * @return * @throws HttpHostConnectException * @throws IOException * @throws JAXBException * @throws ParserConfigurationException * @throws SAXException * @throws NoSuchAlgorithmException * @throws KeyStoreException * @throws KeyManagementException */ private static XMLDocumentInterface downloadSampleMetadataFromSesarIGSNWithNoCredentials( String serviceUrlWithData) throws HttpHostConnectException, IOException, JAXBException, ParserConfigurationException, SAXException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { org.apache.http.client.methods.HttpGet httpGet = new HttpGet(serviceUrlWithData); httpGet.setHeader("accept:", "application/xml"); XMLDocumentInterface responseDocument = downloadSampleMetadataFromSesarIGSN(httpGet); return responseDocument; } /** * * @param serviceUrlWithData * @param username * @param password * @return * @throws HttpHostConnectException * @throws IOException * @throws JAXBException * @throws ParserConfigurationException * @throws SAXException * @throws NoSuchAlgorithmException * @throws KeyStoreException * @throws KeyManagementException */ private static XMLDocumentInterface downloadSampleMetadataFromSesarIGSNWithCredentials( String serviceUrlWithData, String username, String password) throws HttpHostConnectException, IOException, JAXBException, ParserConfigurationException, SAXException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { org.apache.http.client.methods.HttpGet httpGet = new HttpGet(serviceUrlWithData); httpGet.setHeader("accept:", "application/xml"); // thanks to http://www.baeldung.com/httpclient-4-basic-authentication String auth = username + ":" + password; byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName("ISO-8859-1"))); String authHeader = "Basic " + new String(encodedAuth); httpGet.setHeader(HttpHeaders.AUTHORIZATION, authHeader); XMLDocumentInterface responseDocument = downloadSampleMetadataFromSesarIGSN(httpGet); return responseDocument; } /** * Deserializes XML response to query for IGSN sample metadata from * GeoSamples.org, using the specified serviceUrlWithData string. * * @param httpGet the value of httpGet * @throws org.apache.http.conn.HttpHostConnectException * @throws IOException * @throws JAXBException * @throws javax.xml.parsers.ParserConfigurationException * @throws java.security.NoSuchAlgorithmException * @throws org.xml.sax.SAXException * @throws java.security.KeyStoreException * @throws java.security.KeyManagementException * @return the org.geosamples.XMLDocumentInterface */ private static XMLDocumentInterface downloadSampleMetadataFromSesarIGSN(HttpGet httpGet) throws HttpHostConnectException, IOException, JAXBException, ParserConfigurationException, SAXException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { CloseableHttpClient httpClient = org.geosamples.utilities.HTTPClient.clientWithNoSecurityValidation(); XMLDocumentInterface samples = null; try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) { HttpEntity myEntity = httpResponse.getEntity(); InputStream response = myEntity.getContent(); JAXBContext jaxbContext = JAXBContext.newInstance(Samples.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); samples = (XMLDocumentInterface) jaxbUnmarshaller.unmarshal(response); // ensure it is fully consumed EntityUtils.consume(myEntity); httpResponse.close(); } return samples; } /** * Marshalls a Samples object to an XML string. * * @param samples = Samples object * @return XML document as String * @throws JAXBException */ public static String serializeSamplesToCompliantXML(XMLDocumentInterface samples) throws JAXBException { return serializeSamplesToCompliantXMLWithPrettyPrintChoice(samples, false); } /** * Marshalls a Samples object to an XML string formatted for human reading. * * @param samples = Samples object * @return XML document as String * @throws JAXBException */ public static String serializeSamplesToCompliantXMLPrettyPrint(XMLDocumentInterface samples) throws JAXBException { return serializeSamplesToCompliantXMLWithPrettyPrintChoice(samples, true); } /** * Marshalls a Samples object to an XML string. * * @param samples = Samples object * @param prettyPrint = boolean * @return XML document as String * @throws JAXBException */ private static String serializeSamplesToCompliantXMLWithPrettyPrintChoice(XMLDocumentInterface samples, boolean prettyPrint) throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(Samples.class); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, prettyPrint); final StringWriter stringWriter = new StringWriter(); marshaller.marshal(samples, stringWriter); String xmlOutput = stringWriter.toString(); String compliantXmlOutput = xmlOutput.replace("<samples>", GEOSAMPLES_COMPLIANT_XML_HEADER_SAMPLES); return compliantXmlOutput; } /** * * @param samples the value of samples * @param updating the value of updating * @return the boolean */ public static boolean validateSamplesForUpload(Samples samples, boolean updating) { boolean areValid = true; for (Sample sample : samples.getSample()) { areValid = areValid && validateSampleForUpload(sample, updating); } return areValid; } /** * Validates Sample object by checking whether required fields are present, * per GeoSamples March 2016. Required fields are userCode, sampleType, * name, and material. Forbidden fields (produced by download service) are * qrcodeImgSrc, url, parents, siblings, and children. * * @param sample = Sample object * @return boolean */ public static boolean validateSampleForUpload(Sample sample, boolean updating) { boolean isValid = true; if (updating) { isValid = isValid && (sample.getUserCode() == null); } else { isValid = isValid && (sample.getUserCode() != null); } isValid = isValid && checkThatValueIsLegal(SampleType.class, sample.getSampleType(), !updating); isValid = isValid && (updating ? true : sample.getName() != null); isValid = isValid && checkThatValueIsLegal(Material.class, sample.getMaterial(), !updating); // these fields must be empty isValid = isValid && (sample.getQrcodeImgSrc() == null); isValid = isValid && (sample.getUrl() == null); isValid = isValid && (sample.getParents() == null); isValid = isValid && (sample.getSiblings() == null); isValid = isValid && (sample.getChildren() == null); isValid = isValid && (sample.getError() == null); isValid = isValid && (sample.getStatus() == null); return isValid; } private static <T extends Enum<T>> boolean checkThatValueIsLegal(Class<T> enumType, String name, boolean required) { boolean isLegal = (name != null); if (isLegal) { try { Enum.valueOf(enumType, name.toUpperCase()); } catch (IllegalArgumentException e) { isLegal = false; } } else { isLegal = !required; } return isLegal; } /** * * @see * <a href="http://www.iedadata.org/services/sesar_api#SESARRESTWebServiceAPIDocumentation-1.Sampleregistrationwebservice">SESAR * REST web services</a> * @param username * @param password * @param samples * @return * @throws JAXBException * @throws NoSuchAlgorithmException * @throws KeyStoreException * @throws KeyManagementException * @throws IOException */ public static XMLDocumentInterface registerSampleMetaDataWithSesarTestService(String username, String password, XMLDocumentInterface samples) throws JAXBException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { XMLDocumentInterface success = registerSampleMetaDataWithSesar(username, password, samples, GEOSAMPLES_TEST_SAMPLES_SERVER); return success; } /** * * @see * <a href="http://www.iedadata.org/services/sesar_api#SESARRESTWebServiceAPIDocumentation-1.Sampleregistrationwebservice">SESAR * REST web services</a> * @param username * @param password * @param samples * @return * @throws JAXBException * @throws NoSuchAlgorithmException * @throws KeyStoreException * @throws KeyManagementException * @throws IOException */ public static XMLDocumentInterface registerSampleMetaDataWithSesarTestFeatureService(String username, String password, XMLDocumentInterface samples) throws JAXBException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { XMLDocumentInterface success = registerSampleMetaDataWithSesar(username, password, samples, GEOSAMPLES_TEST_FEATURES_SERVER); return success; } /** * * @see * <a href="http://www.iedadata.org/services/sesar_api#SESARRESTWebServiceAPIDocumentation-1.Sampleregistrationwebservice">SESAR * REST web services</a> * @param username * @param password * @param samples * @return * @throws JAXBException * @throws NoSuchAlgorithmException * @throws KeyStoreException * @throws KeyManagementException * @throws IOException */ public static XMLDocumentInterface registerSampleMetaDataWithSesarProductionService(String username, String password, XMLDocumentInterface samples) throws JAXBException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { XMLDocumentInterface success = registerSampleMetaDataWithSesar(username, password, samples, GEOSAMPLES_PRODUCTION_SERVER); return success; } /** * * @see * <a href="http://www.iedadata.org/services/sesar_api#SESARRESTWebServiceAPIDocumentation-1.Sampleregistrationwebservice">SESAR * REST web services</a> * @param username * @param password * @param samples * @param serviceURL * @return * @throws JAXBException * @throws NoSuchAlgorithmException * @throws KeyStoreException * @throws KeyManagementException * @throws IOException */ private static XMLDocumentInterface registerSampleMetaDataWithSesar(String username, String password, XMLDocumentInterface samples, String serverURL) throws JAXBException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { boolean areValid = validateSamplesForUpload((Samples) samples, false); if (areValid) { return uploadSampleMetaDataWithSesar(username, password, samples, serverURL + GEOSAMPLES_SAMPLE_UPLOAD_WEBSERVICE_NAME); } else { throw new JAXBException("Invalid content in sample XML."); } } public static XMLDocumentInterface updateSampleMetaDataWithSesarTestService(String username, String password, XMLDocumentInterface samples) throws JAXBException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { XMLDocumentInterface success = updateSampleMetaDataWithSesar(username, password, samples, GEOSAMPLES_TEST_SAMPLES_SERVER); return success; } public static XMLDocumentInterface updateSampleMetaDataWithSesarTestFeatureService(String username, String password, XMLDocumentInterface samples) throws JAXBException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { XMLDocumentInterface success = updateSampleMetaDataWithSesar(username, password, samples, GEOSAMPLES_TEST_FEATURES_SERVER); return success; } public static XMLDocumentInterface updateSampleMetaDataWithSesarProductionService(String username, String password, XMLDocumentInterface samples) throws JAXBException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { XMLDocumentInterface success = updateSampleMetaDataWithSesar(username, password, samples, GEOSAMPLES_PRODUCTION_SERVER); return success; } private static XMLDocumentInterface updateSampleMetaDataWithSesar(String username, String password, XMLDocumentInterface samples, String serverURL) throws JAXBException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { boolean areValid = validateSamplesForUpload((Samples) samples, true); if (areValid) { return uploadSampleMetaDataWithSesar(username, password, samples, serverURL + GEOSAMPLES_SAMPLE_UPDATE_IGSN_WEBSERVICE_NAME); } else { throw new JAXBException("Invalid content in sample XML."); } } private static XMLDocumentInterface uploadSampleMetaDataWithSesar(String username, String password, XMLDocumentInterface samples, String serviceURL) throws JAXBException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { XMLDocumentInterface success = new Results(); // prepare shipment String serialSamples = serializeSamplesToCompliantXML(samples); List<NameValuePair> nvps = new ArrayList<>(); nvps.add(new BasicNameValuePair("username", username)); nvps.add(new BasicNameValuePair("password", password)); nvps.add(new BasicNameValuePair("content", serialSamples)); // setup service CloseableHttpClient httpClient = org.geosamples.utilities.HTTPClient.clientWithNoSecurityValidation(); HttpPost httpPost = new HttpPost(serviceURL); httpPost.setEntity(new UrlEncodedFormEntity(nvps)); CloseableHttpResponse httpResponse = httpClient.execute(httpPost); //success = httpResponse.getStatusLine().getStatusCode() == 200; HttpEntity myEntity = httpResponse.getEntity(); InputStream response = myEntity.getContent(); JAXBContext jaxbContext = JAXBContext.newInstance(Results.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); success = (XMLDocumentInterface) jaxbUnmarshaller.unmarshal(response); // and ensure it is fully consumed EntityUtils.consume(myEntity); return success; } @XmlElement(required = true) protected List<Samples.Sample> sample; /** * Gets the value of the sample property. * * <p> * This accessor method returns a reference to the live list, not a * snapshot. Therefore any modification you make to the returned list will * be present inside the JAXB object. This is why there is not a * <CODE>set</CODE> method for the sample property. * * <p> * For example, to add a new item, do as follows: * <pre> * getSample().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Samples.Sample } * * * @return */ public List<Samples.Sample> getSample() { if (sample == null) { sample = new ArrayList<>(); } return this.sample; } /** * <p> * Java class for anonymous complex type. * * <p> * The following schema fragment specifies the expected content contained * within this class. * * <pre> * {@code * <xml> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <all> * <element ref="{http://app.geosamples.org}user_code"/> * <element ref="{http://app.geosamples.org}sample_type"/> * <element ref="{http://app.geosamples.org}name"/> * <element ref="{http://app.geosamples.org}material"/> * <element ref="{http://app.geosamples.org}igsn" minOccurs="0"/> * <element ref="{http://app.geosamples.org}parent_igsn" minOccurs="0"/> * <element ref="{http://app.geosamples.org}is_private" minOccurs="0"/> * <element ref="{http://app.geosamples.org}publish_date" minOccurs="0"/> * <element ref="{http://app.geosamples.org}classification" minOccurs="0"/> * <element ref="{http://app.geosamples.org}classification_comment" minOccurs="0"/> * <element ref="{http://app.geosamples.org}field_name" minOccurs="0"/> * <element ref="{http://app.geosamples.org}description" minOccurs="0"/> * <element ref="{http://app.geosamples.org}age_min" minOccurs="0"/> * <element ref="{http://app.geosamples.org}age_max" minOccurs="0"/> * <element ref="{http://app.geosamples.org}age_unit" minOccurs="0"/> * <element ref="{http://app.geosamples.org}geological_age" minOccurs="0"/> * <element ref="{http://app.geosamples.org}geological_unit" minOccurs="0"/> * <element ref="{http://app.geosamples.org}collection_method" minOccurs="0"/> * <element ref="{http://app.geosamples.org}collection_method_descr" minOccurs="0"/> * <element ref="{http://app.geosamples.org}size" minOccurs="0"/> * <element ref="{http://app.geosamples.org}size_unit" minOccurs="0"/> * <element ref="{http://app.geosamples.org}sample_comment" minOccurs="0"/> * <element ref="{http://app.geosamples.org}purpose" minOccurs="0"/> * <element ref="{http://app.geosamples.org}latitude" minOccurs="0"/> * <element ref="{http://app.geosamples.org}longitude" minOccurs="0"/> * <element ref="{http://app.geosamples.org}latitude_end" minOccurs="0"/> * <element ref="{http://app.geosamples.org}longitude_end" minOccurs="0"/> * <element ref="{http://app.geosamples.org}elevation" minOccurs="0"/> * <element ref="{http://app.geosamples.org}elevation_end" minOccurs="0"/> * <element ref="{http://app.geosamples.org}vertical_datum" minOccurs="0"/> * <element ref="{http://app.geosamples.org}northing" minOccurs="0"/> * <element ref="{http://app.geosamples.org}easting" minOccurs="0"/> * <element ref="{http://app.geosamples.org}zone" minOccurs="0"/> * <element ref="{http://app.geosamples.org}navigation_type" minOccurs="0"/> * <element ref="{http://app.geosamples.org}primary_location_type" minOccurs="0"/> * <element ref="{http://app.geosamples.org}primary_location_name" minOccurs="0"/> * <element ref="{http://app.geosamples.org}location_description" minOccurs="0"/> * <element ref="{http://app.geosamples.org}locality" minOccurs="0"/> * <element ref="{http://app.geosamples.org}locality_description" minOccurs="0"/> * <element ref="{http://app.geosamples.org}country" minOccurs="0"/> * <element ref="{http://app.geosamples.org}province" minOccurs="0"/> * <element ref="{http://app.geosamples.org}county" minOccurs="0"/> * <element ref="{http://app.geosamples.org}city" minOccurs="0"/> * <element ref="{http://app.geosamples.org}cruise_field_prgrm" minOccurs="0"/> * <element ref="{http://app.geosamples.org}platform_type" minOccurs="0"/> * <element ref="{http://app.geosamples.org}platform_name" minOccurs="0"/> * <element ref="{http://app.geosamples.org}platform_descr" minOccurs="0"/> * <element ref="{http://app.geosamples.org}launch_platform_name" minOccurs="0"/> * <element ref="{http://app.geosamples.org}launch_id" minOccurs="0"/> * <element ref="{http://app.geosamples.org}launch_type_name" minOccurs="0"/> * <element ref="{http://app.geosamples.org}collector" minOccurs="0"/> * <element ref="{http://app.geosamples.org}collector_detail" minOccurs="0"/> * <element ref="{http://app.geosamples.org}collection_start_date" minOccurs="0"/> * <element ref="{http://app.geosamples.org}collection_end_date" minOccurs="0"/> * <element ref="{http://app.geosamples.org}collection_date_precision" minOccurs="0"/> * <element ref="{http://app.geosamples.org}current_archive" minOccurs="0"/> * <element ref="{http://app.geosamples.org}current_archive_contact" minOccurs="0"/> * <element ref="{http://app.geosamples.org}original_archive" minOccurs="0"/> * <element ref="{http://app.geosamples.org}original_archive_contact" minOccurs="0"/> * <element ref="{http://app.geosamples.org}depth_min" minOccurs="0"/> * <element ref="{http://app.geosamples.org}depth_max" minOccurs="0"/> * <element ref="{http://app.geosamples.org}depth_scale" minOccurs="0"/> * <element name="sample_other_names" minOccurs="0"> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element ref="{http://app.geosamples.org}sample_other_name" maxOccurs="unbounded"/> * </sequence> * </restriction> * </complexContent> * </complexType> * </element> * <element name="external_urls" minOccurs="0"> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="external_url" maxOccurs="unbounded"> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element ref="{http://app.geosamples.org}url"/> * <element ref="{http://app.geosamples.org}description" minOccurs="0"/> * <element ref="{http://app.geosamples.org}url_type" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> * </complexType> * </element> * </sequence> * </restriction> * </complexContent> * </complexType> * </element> * </all> * </restriction> * </complexContent> * </complexType> * </xml> * } * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = {}) public static class Sample { /** * Constructor */ public Sample() { } @XmlElement(name = "user_code", required = true) @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String userCode; @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String igsn; @XmlElement(required = true) @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String name; @XmlElement(name = "sample_type", required = true) @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String sampleType; @XmlElement(required = true) @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String material; @XmlElement(name = "parent_igsn") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String parentIgsn; @XmlElement(name = "is_private", defaultValue = "0") protected BigInteger isPrivate; @XmlElement(name = "publish_date") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String publishDate; protected Classification classification; @XmlElement(name = "classification_comment") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String classificationComment; @XmlElement(name = "field_name") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String fieldName; @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String description; @XmlElement(name = "age_min") protected BigDecimal ageMin; @XmlElement(name = "age_max") protected BigDecimal ageMax; @XmlElement(name = "age_unit") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String ageUnit; @XmlElement(name = "geological_age") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String geologicalAge; @XmlElement(name = "geological_unit") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String geologicalUnit; @XmlElement(name = "collection_method") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String collectionMethod; @XmlElement(name = "collection_method_descr") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String collectionMethodDescr; @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String size; @XmlElement(name = "size_unit") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String sizeUnit; @XmlElement(name = "sample_comment") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String sampleComment; @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String purpose; protected BigDecimal latitude; protected BigDecimal longitude; @XmlElement(name = "latitude_end") protected BigDecimal latitudeEnd; @XmlElement(name = "longitude_end") protected BigDecimal longitudeEnd; protected BigDecimal elevation; @XmlElement(name = "elevation_end") protected BigDecimal elevationEnd; @XmlElement(name = "vertical_datum") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String verticalDatum; protected BigDecimal northing; protected BigDecimal easting; @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String zone; @XmlElement(name = "navigation_type") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String navigationType; @XmlElement(name = "primary_location_type") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String primaryLocationType; @XmlElement(name = "primary_location_name") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String primaryLocationName; @XmlElement(name = "location_description") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String locationDescription; @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String locality; @XmlElement(name = "locality_description") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String localityDescription; @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String country; @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String province; @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String county; @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String city; @XmlElement(name = "cruise_field_prgrm") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String cruiseFieldPrgrm; @XmlElement(name = "platform_type") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String platformType; @XmlElement(name = "platform_name") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String platformName; @XmlElement(name = "platform_descr") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String platformDescr; @XmlElement(name = "launch_platform_name") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String launchPlatformName; @XmlElement(name = "launch_id") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String launchId; @XmlElement(name = "launch_type_name") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String launchTypeName; @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String collector; @XmlElement(name = "collector_detail") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String collectorDetail; @XmlElement(name = "collection_start_date") @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar collectionStartDate; @XmlElement(name = "collection_end_date") @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar collectionEndDate; @XmlElement(name = "collection_date_precision") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String collectionDatePrecision; @XmlElement(name = "current_archive") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String currentArchive; @XmlElement(name = "current_archive_contact") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String currentArchiveContact; @XmlElement(name = "original_archive") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String originalArchive; @XmlElement(name = "original_archive_contact") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String originalArchiveContact; @XmlElement(name = "depth_min") protected BigDecimal depthMin; @XmlElement(name = "depth_max") protected BigDecimal depthMax; @XmlElement(name = "depth_scale") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String depthScale; @XmlElement(name = "sample_other_names") protected Samples.Sample.SampleOtherNames sampleOtherNames; @XmlElement(name = "external_urls") protected Samples.Sample.ExternalUrls externalUrls; // added for download version of schema @XmlElement(name = "parents") protected Samples.Sample.Parents parents; // added for download version of schema @XmlElement(name = "siblings") protected Samples.Sample.Siblings siblings; // added for download version of schema @XmlElement(name = "children") protected Samples.Sample.Children children; // added for download version of schema @XmlElement(name = "qrcode_img_src") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String qrcodeImgSrc; // added for download version of schema @XmlElement(name = "url") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String url; // added for download version of schema @XmlElement(name = "status") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String status; @XmlElement(name = "error") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String error; /** * Gets the value of the userCode property. * * @return possible object is {@link String } * */ public String getUserCode() { return userCode; } /** * Sets the value of the userCode property. * * @param value allowed object is {@link String } * */ public void setUserCode(String value) { this.userCode = value; } /** * Gets the value of the sampleType property. * * @return possible object is {@link String } * */ public String getSampleType() { return sampleType; } /** * Sets the value of the sampleType property. * * @param value allowed object is {@link String } * */ public void setSampleType(String value) { this.sampleType = value; } /** * Gets the value of the name property. * * @return possible object is {@link String } * */ public String getName() { return name; } /** * Sets the value of the name property. * * @param value allowed object is {@link String } * */ public void setName(String value) { this.name = value; } /** * Gets the value of the material property. * * @return possible object is {@link String } * */ public String getMaterial() { return material; } /** * Sets the value of the material property. * * @param value allowed object is {@link String } * */ public void setMaterial(String value) { this.material = value; } /** * Gets the value of the igsn property. * * @return possible object is {@link String } * */ public String getIgsn() { return igsn; } /** * Sets the value of the igsn property. * * @param value allowed object is {@link String } * */ public void setIgsn(String value) { this.igsn = value; } /** * Gets the value of the parentIgsn property. * * @return possible object is {@link String } * */ public String getParentIgsn() { return parentIgsn; } /** * Sets the value of the parentIgsn property. * * @param value allowed object is {@link String } * */ public void setParentIgsn(String value) { this.parentIgsn = value; } /** * Gets the value of the isPrivate property. * * @return possible object is {@link BigInteger } * */ public BigInteger getIsPrivate() { return isPrivate; } /** * Sets the value of the isPrivate property. * * @param value allowed object is {@link BigInteger } * */ public void setIsPrivate(BigInteger value) { this.isPrivate = value; } /** * Gets the value of the publishDate property. * * @return possible object is {@link String } * */ public String getPublishDate() { return publishDate; } /** * Sets the value of the publishDate property. * * @param value allowed object is {@link String } * */ public void setPublishDate(String value) { this.publishDate = value; } /** * Gets the value of the classification property. * * @return possible object is {@link Classification } * */ public Classification getClassification() { return classification; } /** * Sets the value of the classification property. * * @param value allowed object is {@link Classification } * */ public void setClassification(Classification value) { this.classification = value; } /** * Gets the value of the classificationComment property. * * @return possible object is {@link String } * */ public String getClassificationComment() { return classificationComment; } /** * Sets the value of the classificationComment property. * * @param value allowed object is {@link String } * */ public void setClassificationComment(String value) { this.classificationComment = value; } /** * Gets the value of the fieldName property. * * @return possible object is {@link String } * */ public String getFieldName() { return fieldName; } /** * Sets the value of the fieldName property. * * @param value allowed object is {@link String } * */ public void setFieldName(String value) { this.fieldName = value; } /** * Gets the value of the description property. * * @return possible object is {@link String } * */ public String getDescription() { return description; } /** * Sets the value of the description property. * * @param value allowed object is {@link String } * */ public void setDescription(String value) { this.description = value; } /** * Gets the value of the ageMin property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getAgeMin() { return ageMin; } /** * Sets the value of the ageMin property. * * @param value allowed object is {@link BigDecimal } * */ public void setAgeMin(BigDecimal value) { this.ageMin = value; } /** * Gets the value of the ageMax property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getAgeMax() { return ageMax; } /** * Sets the value of the ageMax property. * * @param value allowed object is {@link BigDecimal } * */ public void setAgeMax(BigDecimal value) { this.ageMax = value; } /** * Gets the value of the ageUnit property. * * @return possible object is {@link String } * */ public String getAgeUnit() { return ageUnit; } /** * Sets the value of the ageUnit property. * * @param value allowed object is {@link String } * */ public void setAgeUnit(String value) { this.ageUnit = value; } /** * Gets the value of the geologicalAge property. * * @return possible object is {@link String } * */ public String getGeologicalAge() { return geologicalAge; } /** * Sets the value of the geologicalAge property. * * @param value allowed object is {@link String } * */ public void setGeologicalAge(String value) { this.geologicalAge = value; } /** * Gets the value of the geologicalUnit property. * * @return possible object is {@link String } * */ public String getGeologicalUnit() { return geologicalUnit; } /** * Sets the value of the geologicalUnit property. * * @param value allowed object is {@link String } * */ public void setGeologicalUnit(String value) { this.geologicalUnit = value; } /** * Gets the value of the collectionMethod property. * * @return possible object is {@link String } * */ public String getCollectionMethod() { return collectionMethod; } /** * Sets the value of the collectionMethod property. * * @param value allowed object is {@link String } * */ public void setCollectionMethod(String value) { this.collectionMethod = value; } /** * Gets the value of the collectionMethodDescr property. * * @return possible object is {@link String } * */ public String getCollectionMethodDescr() { return collectionMethodDescr; } /** * Sets the value of the collectionMethodDescr property. * * @param value allowed object is {@link String } * */ public void setCollectionMethodDescr(String value) { this.collectionMethodDescr = value; } /** * Gets the value of the size property. * * @return possible object is {@link String } * */ public String getSize() { return size; } /** * Sets the value of the size property. * * @param value allowed object is {@link String } * */ public void setSize(String value) { this.size = value; } /** * Gets the value of the sizeUnit property. * * @return possible object is {@link String } * */ public String getSizeUnit() { return sizeUnit; } /** * Sets the value of the sizeUnit property. * * @param value allowed object is {@link String } * */ public void setSizeUnit(String value) { this.sizeUnit = value; } /** * Gets the value of the sampleComment property. * * @return possible object is {@link String } * */ public String getSampleComment() { return sampleComment; } /** * Sets the value of the sampleComment property. * * @param value allowed object is {@link String } * */ public void setSampleComment(String value) { this.sampleComment = value; } /** * Gets the value of the purpose property. * * @return possible object is {@link String } * */ public String getPurpose() { return purpose; } /** * Sets the value of the purpose property. * * @param value allowed object is {@link String } * */ public void setPurpose(String value) { this.purpose = value; } /** * Gets the value of the latitude property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getLatitude() { return latitude; } /** * Sets the value of the latitude property. * * @param value allowed object is {@link BigDecimal } * */ public void setLatitude(BigDecimal value) { this.latitude = value; } /** * Gets the value of the longitude property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getLongitude() { return longitude; } /** * Sets the value of the longitude property. * * @param value allowed object is {@link BigDecimal } * */ public void setLongitude(BigDecimal value) { this.longitude = value; } /** * Gets the value of the latitudeEnd property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getLatitudeEnd() { return latitudeEnd; } /** * Sets the value of the latitudeEnd property. * * @param value allowed object is {@link BigDecimal } * */ public void setLatitudeEnd(BigDecimal value) { this.latitudeEnd = value; } /** * Gets the value of the longitudeEnd property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getLongitudeEnd() { return longitudeEnd; } /** * Sets the value of the longitudeEnd property. * * @param value allowed object is {@link BigDecimal } * */ public void setLongitudeEnd(BigDecimal value) { this.longitudeEnd = value; } /** * Gets the value of the elevation property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getElevation() { return elevation; } /** * Sets the value of the elevation property. * * @param value allowed object is {@link BigDecimal } * */ public void setElevation(BigDecimal value) { this.elevation = value; } /** * Gets the value of the elevationEnd property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getElevationEnd() { return elevationEnd; } /** * Sets the value of the elevationEnd property. * * @param value allowed object is {@link BigDecimal } * */ public void setElevationEnd(BigDecimal value) { this.elevationEnd = value; } /** * Gets the value of the verticalDatum property. * * @return possible object is {@link String } * */ public String getVerticalDatum() { return verticalDatum; } /** * Sets the value of the verticalDatum property. * * @param value allowed object is {@link String } * */ public void setVerticalDatum(String value) { this.verticalDatum = value; } /** * Gets the value of the northing property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getNorthing() { return northing; } /** * Sets the value of the northing property. * * @param value allowed object is {@link BigDecimal } * */ public void setNorthing(BigDecimal value) { this.northing = value; } /** * Gets the value of the easting property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getEasting() { return easting; } /** * Sets the value of the easting property. * * @param value allowed object is {@link BigDecimal } * */ public void setEasting(BigDecimal value) { this.easting = value; } /** * Gets the value of the zone property. * * @return possible object is {@link String } * */ public String getZone() { return zone; } /** * Sets the value of the zone property. * * @param value allowed object is {@link String } * */ public void setZone(String value) { this.zone = value; } /** * Gets the value of the navigationType property. * * @return possible object is {@link String } * */ public String getNavigationType() { return navigationType; } /** * Sets the value of the navigationType property. * * @param value allowed object is {@link String } * */ public void setNavigationType(String value) { this.navigationType = value; } /** * Gets the value of the primaryLocationType property. * * @return possible object is {@link String } * */ public String getPrimaryLocationType() { return primaryLocationType; } /** * Sets the value of the primaryLocationType property. * * @param value allowed object is {@link String } * */ public void setPrimaryLocationType(String value) { this.primaryLocationType = value; } /** * Gets the value of the primaryLocationName property. * * @return possible object is {@link String } * */ public String getPrimaryLocationName() { return primaryLocationName; } /** * Sets the value of the primaryLocationName property. * * @param value allowed object is {@link String } * */ public void setPrimaryLocationName(String value) { this.primaryLocationName = value; } /** * Gets the value of the locationDescription property. * * @return possible object is {@link String } * */ public String getLocationDescription() { return locationDescription; } /** * Sets the value of the locationDescription property. * * @param value allowed object is {@link String } * */ public void setLocationDescription(String value) { this.locationDescription = value; } /** * Gets the value of the locality property. * * @return possible object is {@link String } * */ public String getLocality() { return locality; } /** * Sets the value of the locality property. * * @param value allowed object is {@link String } * */ public void setLocality(String value) { this.locality = value; } /** * Gets the value of the localityDescription property. * * @return possible object is {@link String } * */ public String getLocalityDescription() { return localityDescription; } /** * Sets the value of the localityDescription property. * * @param value allowed object is {@link String } * */ public void setLocalityDescription(String value) { this.localityDescription = value; } /** * Gets the value of the country property. * * @return possible object is {@link String } * */ public String getCountry() { return country; } /** * Sets the value of the country property. * * @param value allowed object is {@link String } * */ public void setCountry(String value) { this.country = value; } /** * Gets the value of the province property. * * @return possible object is {@link String } * */ public String getProvince() { return province; } /** * Sets the value of the province property. * * @param value allowed object is {@link String } * */ public void setProvince(String value) { this.province = value; } /** * Gets the value of the county property. * * @return possible object is {@link String } * */ public String getCounty() { return county; } /** * Sets the value of the county property. * * @param value allowed object is {@link String } * */ public void setCounty(String value) { this.county = value; } /** * Gets the value of the city property. * * @return possible object is {@link String } * */ public String getCity() { return city; } /** * Sets the value of the city property. * * @param value allowed object is {@link String } * */ public void setCity(String value) { this.city = value; } /** * Gets the value of the cruiseFieldPrgrm property. * * @return possible object is {@link String } * */ public String getCruiseFieldPrgrm() { return cruiseFieldPrgrm; } /** * Sets the value of the cruiseFieldPrgrm property. * * @param value allowed object is {@link String } * */ public void setCruiseFieldPrgrm(String value) { this.cruiseFieldPrgrm = value; } /** * Gets the value of the platformType property. * * @return possible object is {@link String } * */ public String getPlatformType() { return platformType; } /** * Sets the value of the platformType property. * * @param value allowed object is {@link String } * */ public void setPlatformType(String value) { this.platformType = value; } /** * Gets the value of the platformName property. * * @return possible object is {@link String } * */ public String getPlatformName() { return platformName; } /** * Sets the value of the platformName property. * * @param value allowed object is {@link String } * */ public void setPlatformName(String value) { this.platformName = value; } /** * Gets the value of the platformDescr property. * * @return possible object is {@link String } * */ public String getPlatformDescr() { return platformDescr; } /** * Sets the value of the platformDescr property. * * @param value allowed object is {@link String } * */ public void setPlatformDescr(String value) { this.platformDescr = value; } /** * Gets the value of the launchPlatformName property. * * @return possible object is {@link String } * */ public String getLaunchPlatformName() { return launchPlatformName; } /** * Sets the value of the launchPlatformName property. * * @param value allowed object is {@link String } * */ public void setLaunchPlatformName(String value) { this.launchPlatformName = value; } /** * Gets the value of the launchId property. * * @return possible object is {@link String } * */ public String getLaunchId() { return launchId; } /** * Sets the value of the launchId property. * * @param value allowed object is {@link String } * */ public void setLaunchId(String value) { this.launchId = value; } /** * Gets the value of the launchTypeName property. * * @return possible object is {@link String } * */ public String getLaunchTypeName() { return launchTypeName; } /** * Sets the value of the launchTypeName property. * * @param value allowed object is {@link String } * */ public void setLaunchTypeName(String value) { this.launchTypeName = value; } /** * Gets the value of the collector property. * * @return possible object is {@link String } * */ public String getCollector() { return collector; } /** * Sets the value of the collector property. * * @param value allowed object is {@link String } * */ public void setCollector(String value) { this.collector = value; } /** * Gets the value of the collectorDetail property. * * @return possible object is {@link String } * */ public String getCollectorDetail() { return collectorDetail; } /** * Sets the value of the collectorDetail property. * * @param value allowed object is {@link String } * */ public void setCollectorDetail(String value) { this.collectorDetail = value; } /** * Gets the value of the collectionStartDate property. * * @return possible object is {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getCollectionStartDate() { return collectionStartDate; } /** * Sets the value of the collectionStartDate property. * * @param value allowed object is {@link XMLGregorianCalendar } * */ public void setCollectionStartDate(XMLGregorianCalendar value) { this.collectionStartDate = value; } /** * Gets the value of the collectionEndDate property. * * @return possible object is {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getCollectionEndDate() { return collectionEndDate; } /** * Sets the value of the collectionEndDate property. * * @param value allowed object is {@link XMLGregorianCalendar } * */ public void setCollectionEndDate(XMLGregorianCalendar value) { this.collectionEndDate = value; } /** * Gets the value of the collectionDatePrecision property. * * @return possible object is {@link String } * */ public String getCollectionDatePrecision() { return collectionDatePrecision; } /** * Sets the value of the collectionDatePrecision property. * * @param value allowed object is {@link String } * */ public void setCollectionDatePrecision(String value) { this.collectionDatePrecision = value; } /** * Gets the value of the currentArchive property. * * @return possible object is {@link String } * */ public String getCurrentArchive() { return currentArchive; } /** * Sets the value of the currentArchive property. * * @param value allowed object is {@link String } * */ public void setCurrentArchive(String value) { this.currentArchive = value; } /** * Gets the value of the currentArchiveContact property. * * @return possible object is {@link String } * */ public String getCurrentArchiveContact() { return currentArchiveContact; } /** * Sets the value of the currentArchiveContact property. * * @param value allowed object is {@link String } * */ public void setCurrentArchiveContact(String value) { this.currentArchiveContact = value; } /** * Gets the value of the originalArchive property. * * @return possible object is {@link String } * */ public String getOriginalArchive() { return originalArchive; } /** * Sets the value of the originalArchive property. * * @param value allowed object is {@link String } * */ public void setOriginalArchive(String value) { this.originalArchive = value; } /** * Gets the value of the originalArchiveContact property. * * @return possible object is {@link String } * */ public String getOriginalArchiveContact() { return originalArchiveContact; } /** * Sets the value of the originalArchiveContact property. * * @param value allowed object is {@link String } * */ public void setOriginalArchiveContact(String value) { this.originalArchiveContact = value; } /** * Gets the value of the depthMin property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getDepthMin() { return depthMin; } /** * Sets the value of the depthMin property. * * @param value allowed object is {@link BigDecimal } * */ public void setDepthMin(BigDecimal value) { this.depthMin = value; } /** * Gets the value of the depthMax property. * * @return possible object is {@link BigDecimal } * */ public BigDecimal getDepthMax() { return depthMax; } /** * Sets the value of the depthMax property. * * @param value allowed object is {@link BigDecimal } * */ public void setDepthMax(BigDecimal value) { this.depthMax = value; } /** * Gets the value of the depthScale property. * * @return possible object is {@link String } * */ public String getDepthScale() { return depthScale; } /** * Sets the value of the depthScale property. * * @param value allowed object is {@link String } * */ public void setDepthScale(String value) { this.depthScale = value; } /** * Gets the value of the sampleOtherNames property. * * @return possible object is {@link Samples.Sample.SampleOtherNames } * */ public Samples.Sample.SampleOtherNames getSampleOtherNames() { return sampleOtherNames; } /** * Sets the value of the sampleOtherNames property. * * @param value allowed object is * {@link Samples.Sample.SampleOtherNames } * */ public void setSampleOtherNames(Samples.Sample.SampleOtherNames value) { this.sampleOtherNames = value; } /** * Gets the value of the externalUrls property. * * @return possible object is {@link Samples.Sample.ExternalUrls } * */ public Samples.Sample.ExternalUrls getExternalUrls() { return externalUrls; } /** * Sets the value of the externalUrls property. * * @param value allowed object is {@link Samples.Sample.ExternalUrls } * */ public void setExternalUrls(Samples.Sample.ExternalUrls value) { this.externalUrls = value; } /** * Gets the value of the parents property. * * @return possible object is {@link Samples.Sample.Parents } * */ public Samples.Sample.Parents getParents() { return parents; } /** * Sets the value of the parents property. * * @param parents allowed object is {@link Samples.Sample.Parents } * */ public void setParents(Samples.Sample.Parents parents) { this.parents = parents; } /** * Gets the value of the siblings property. * * @return possible object is {@link Samples.Sample.Siblings } * */ public Siblings getSiblings() { return siblings; } /** * Sets the value of the siblings property. * * @param siblings allowed object is {@link Samples.Sample.Siblings } * */ public void setSiblings(Siblings siblings) { this.siblings = siblings; } /** * Gets the value of the children property. * * @return possible object is {@link Samples.Sample.Children } * */ public Children getChildren() { return children; } /** * Sets the value of the children property. * * @param children allowed object is {@link Samples.Sample.Children } * */ public void setChildren(Children children) { this.children = children; } /** * Gets the value of the qrcodeImgSrc property. * * @return possible object is {@link String } * */ public String getQrcodeImgSrc() { return qrcodeImgSrc; } /** * Sets the value of the qrcodeImgSrc property. * * @param qrcodeImgSrc allowed object is {@link String } * */ public void setQrcodeImgSrc(String qrcodeImgSrc) { this.qrcodeImgSrc = qrcodeImgSrc; } /** * Gets the value of the url property. * * @return possible object is {@link String } * */ public String getUrl() { return url; } /** * Sets the value of the url property. * * @param url allowed object is {@link String } * */ public void setUrl(String url) { this.url = url; } /** * Gets the value of the status property. * * @return possible object is {@link String } * */ public String getStatus() { return status; } /** * Sets the value of the status property. * * @param status allowed object is {@link String } * */ public void setStatus(String status) { this.status = status; } /** * @return the error */ public String getError() { return error; } /** * @param error the error to set */ public void setError(String error) { this.error = error; } /** * <p> * Java class for anonymous complex type. * * <p> * The following schema fragment specifies the expected content * contained within this class. * * <pre> * {@code * <xml> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="external_url" maxOccurs="unbounded"> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element ref="{http://app.geosamples.org}url"/> * <element ref="{http://app.geosamples.org}description" minOccurs="0"/> * <element ref="{http://app.geosamples.org}url_type" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> * </complexType> * </element> * </sequence> * </restriction> * </complexContent> * </complexType> * </xml> * } * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "externalUrl" }) public static class ExternalUrls { @XmlElement(name = "external_url", required = true) protected List<Samples.Sample.ExternalUrls.ExternalUrl> externalUrl; /** * Gets the value of the externalUrl property. * * <p> * This accessor method returns a reference to the live list, not a * snapshot. Therefore any modification you make to the returned * list will be present inside the JAXB object. This is why there is * not a <CODE>set</CODE> method for the externalUrl property. * * <p> * For example, to add a new item, do as follows: * <pre> * getExternalUrl().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Samples.Sample.ExternalUrls.ExternalUrl } * * * @return */ public List<Samples.Sample.ExternalUrls.ExternalUrl> getExternalUrl() { if (externalUrl == null) { externalUrl = new ArrayList<>(); } return this.externalUrl; } /** * <p> * Java class for anonymous complex type. * * <p> * The following schema fragment specifies the expected content * contained within this class. * * <pre> * {@code * <xml> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element ref="{http://app.geosamples.org}url"/> * <element ref="{http://app.geosamples.org}description" minOccurs="0"/> * <element ref="{http://app.geosamples.org}url_type" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> * </complexType> * </xml> * } * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "url", "description", "urlType" }) public static class ExternalUrl { @XmlElement(required = true) protected String url; @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String description; @XmlElement(name = "url_type") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String urlType; /** * Gets the value of the url property. * * @return possible object is {@link String } * */ public String getUrl() { return url; } /** * Sets the value of the url property. * * @param value allowed object is {@link String } * */ public void setUrl(String value) { this.url = value; } /** * Gets the value of the description property. * * @return possible object is {@link String } * */ public String getDescription() { return description; } /** * Sets the value of the description property. * * @param value allowed object is {@link String } * */ public void setDescription(String value) { this.description = value; } /** * Gets the value of the urlType property. * * @return possible object is {@link String } * */ public String getUrlType() { return urlType; } /** * Sets the value of the urlType property. * * @param value allowed object is {@link String } * */ public void setUrlType(String value) { this.urlType = value; } } } /** * <p> * Java class for anonymous complex type. * * <p> * The following schema fragment specifies the expected content * contained within this class. * * <pre> * {@code * <xml> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element ref="{http://app.geosamples.org}sample_other_name" maxOccurs="unbounded"/> * </sequence> * </restriction> * </complexContent> * </complexType> * </xml> * } * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "sampleOtherName" }) public static class SampleOtherNames { @XmlElement(name = "sample_other_name", required = true) @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected List<String> sampleOtherName; /** * Gets the value of the sampleOtherName property. * * <p> * This accessor method returns a reference to the live list, not a * snapshot. Therefore any modification you make to the returned * list will be present inside the JAXB object. This is why there is * not a <CODE>set</CODE> method for the sampleOtherName property. * * <p> * For example, to add a new item, do as follows: * <pre> * getSampleOtherName().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getSampleOtherName() { if (sampleOtherName == null) { sampleOtherName = new ArrayList<>(); } return this.sampleOtherName; } } /** * Schema does not specify, but GeoSamples query returns */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "samples" }) public static class Parents { @XmlElement(name = "samples") protected List<Samples> samples; public List<Samples> getSamples() { if (samples == null) { samples = new ArrayList<>(); } return this.samples; } } /** * Schema does not specify, but GeoSamples query returns */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "samples" }) public static class Siblings { @XmlElement(name = "samples") protected List<Samples> samples; public List<Samples> getSamples() { if (samples == null) { samples = new ArrayList<>(); } return this.samples; } } /** * Schema does not specify, but GeoSamples query returns */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "samples" }) public static class Children { @XmlElement(name = "samples") protected List<Samples> samples; public List<Samples> getSamples() { if (samples == null) { samples = new ArrayList<>(); } return this.samples; } } } public static void main(String[] args) { XMLDocumentInterface mySamples = new Samples(); Sample mySample = new Sample(); mySamples.getSample().add(mySample); // mySample.setUserCode("JFB"); // mySample.setIgsn("JFB000038"); // mySample.setParentIgsn("JFB000030"); // mySample.setName("yes"); // mySample.setSampleType(SampleType.CORE.value()); // mySample.setMaterial(Material.ROCK.value()); // Classification myRockClass = new Classification(); // myRockClass.setRock(new Classification.Rock()); //// myRockClass.getRock().setSedimentary(new Classification.Rock.Sedimentary()); //// myRockClass.getRock().getSedimentary().setSedimentaryType(SedimentaryDetails.EVAPORITE); // // myRockClass.getRock().setIgneous(new IgneousType()); // myRockClass.getRock().getIgneous().setPlutonic(new IgneousType.Plutonic()); // myRockClass.getRock().getIgneous().getPlutonic().setPlutonicType(IgneousDetails.MAFIC); // // mySample.setClassification(myRockClass); // mySample.setCountry("Zambia"); // // XMLDocumentInterface success = null; // try { // success = registerSampleMetaDataWithSesarTestService("bowring@gmail.com", "redux00", mySamples); // System.out.println("HELP"); // } catch (JAXBException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException | IOException ex) { // Logger.getLogger(Samples.class.getName()).log(Level.SEVERE, null, ex); // } // // XMLDocumentInterface gotSamples = null; // try { // gotSamples = downloadSampleMetadataFromTestSesarIGSN("JFB000038");///ODP000002");// this should be a results // } catch (IOException | JAXBException | ParserConfigurationException | SAXException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException iOException) { // } // // try { // System.out.println(serializeSamplesToCompliantXMLPrettyPrint(gotSamples)); // } catch (JAXBException jAXBException) { // } // // System.out.println("+++++++++++++++++++++++"); // XMLDocumentInterface myList = null; // try { // myList = downloadSampleListFromTestSesarPerUsercode("JFB"); // } catch (IOException | JAXBException | ParserConfigurationException | SAXException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException iOException) { // } // try { // System.out.println(serializeSamplesToCompliantXMLPrettyPrint(myList)); // } catch (JAXBException jAXBException) { // } mySamples = new Samples(); mySample = new Sample(); mySamples.getSample().add(mySample); mySample.setIgsn("JFB000031"); mySample.setName("TESTING UPDATE2"); try { updateSampleMetaDataWithSesarTestService("bowring@gmail.com", "redux00", mySamples); } catch (JAXBException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException | IOException jAXBException) { } } }