Subversion Repositories XServices

Rev

Rev 83 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

/*
 *   Copyright 2011 Brian Rosenberger (Brutex Network)
 *
 *   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.
 */

package net.brutex.xservices.types;

import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;
import java.util.TimeZone;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

import net.brutex.xservices.util.BrutexNamespaces;

/**
 * @author Brian Rosenberger
 * 
 */
@XmlType(namespace=BrutexNamespaces.WS_XSERVICES)
public class DateInfoExtendedType extends DateInfoType {

        private GregorianCalendar date = null;
        private TimeZone zone = null;

        @SuppressWarnings("unused")
        public DateInfoExtendedType() {
                super();
        }

        public DateInfoExtendedType(GregorianCalendar date, TimeZone zone) {
                this.date = date;
                this.zone = zone;
        }

        @XmlElement(name = "format1")
        public String getFormat1() {
                return DateFormatType.DDMMYYYY.format(date.getTime(), null, null);
        }

        /**
         * @return
         */
        @XmlElement(name = "format2")
        public String getFormat2() {
                return DateFormatType.YYYYMMDD.format(date.getTime(), null, null);
        }

        @XmlElement(name = "format3")
        public String getFormat3() {
                String format = "HH:mm:ss";
                SimpleDateFormat f = new SimpleDateFormat(format);
                return f.format(date.getTime());
        }

        // yyyy-MM-dd'T'HH:mm:ssZ
}