/* * Geotoolkit - An Open Source Java GIS Toolkit * http://www.geotoolkit.org * * (C) 2008 - 2009, Geomatys * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ package org.geotoolkit.csw.xml.v200; import java.util.Date; import java.util.GregorianCalendar; import java.util.logging.Level; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; import org.geotoolkit.csw.xml.Acknowledgement; import org.apache.sis.util.logging.Logging; /** * * This is a general acknowledgement response message for all requests that may be handled in an asynchronous manner. * * EchoedRequest- Echoes the submitted request message * * RequestId - identifier for polling purposes (if no response handler is available, * or the URL scheme is unsupported) * * * <p>Java class for AcknowledgementType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * <complexType name="AcknowledgementType"> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="EchoedRequest" type="{http://www.opengis.net/cat/csw}EchoedRequestType"/> * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/> * </sequence> * <attribute name="timeStamp" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" /> * </restriction> * </complexContent> * </complexType> * </pre> * * * @module */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AcknowledgementType", propOrder = { "echoedRequest", "requestId" }) public class AcknowledgementType implements Acknowledgement { @XmlElement(name = "EchoedRequest", required = true) private EchoedRequestType echoedRequest; @XmlElement(name = "RequestId") @XmlSchemaType(name = "anyURI") private String requestId; @XmlAttribute(required = true) private XMLGregorianCalendar timeStamp; /** * An empty constructor used by JAXB */ public AcknowledgementType() { } /** * Build a new Anknowledgement message. */ public AcknowledgementType(final String requestId, final EchoedRequestType echoedRequest, final Long timeStamp) { this.requestId = requestId; this.echoedRequest = echoedRequest; if (timeStamp != null) { Date d = new Date(timeStamp); GregorianCalendar cal = new GregorianCalendar(); cal.setTime(d); try { DatatypeFactory factory = DatatypeFactory.newInstance(); this.timeStamp = factory.newXMLGregorianCalendar(cal); } catch (DatatypeConfigurationException ex) { Logging.getLogger("org.geotoolkit.csw.xml.v200").log(Level.SEVERE, null, ex); } } } /** * Gets the value of the echoedRequest property. * */ public EchoedRequestType getEchoedRequest() { return echoedRequest; } /** * Sets the value of the echoedRequest property. * */ public void setEchoedRequest(final EchoedRequestType value) { this.echoedRequest = value; } /** * Gets the value of the requestId property. * */ public String getRequestId() { return requestId; } /** * Sets the value of the requestId property. * */ public void setRequestId(final String value) { this.requestId = value; } /** * Gets the value of the timeStamp property. * */ public XMLGregorianCalendar getTimeStamp() { return timeStamp; } /** * Sets the value of the timeStamp property. * */ public void setTimeStamp(final XMLGregorianCalendar value) { this.timeStamp = value; } }