/********************************************************* begin of preamble
**
** Copyright (C) 2003-2010 Software- und Organisations-Service GmbH.
** All rights reserved.
**
** This file may be used under the terms of either the
**
** GNU General Public License version 2.0 (GPL)
**
** as published by the Free Software Foundation
** http://www.gnu.org/licenses/gpl-2.0.txt and appearing in the file
** LICENSE.GPL included in the packaging of this file.
**
** or the
**
** Agreement for Purchase and Licensing
**
** as offered by Software- und Organisations-Service GmbH
** in the respective terms of supply that ship with this file.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
** IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
** POSSIBILITY OF SUCH DAMAGE.
********************************************************** end of preamble*/
package com.sos.JSHelper.DataElements;
import java.text.ParseException;
import com.sos.JSHelper.Exceptions.FormatPatternException;
/**
* \class JSTimeStampISO
*
* \brief JSTimeStampISO -
*
* \details
*
* \section JSTimeStampISO.java_intro_sec Introduction
*
* \section JSTimeStampISO.java_samples Some Samples
*
* \code
* .... code goes here ...
* \endcode
*
* <p style="text-align:center">
* <br />---------------------------------------------------------------------------
* <br /> APL/Software GmbH - Berlin
* <br />##### generated by ClaviusXPress (http://www.sos-berlin.com) #########
* <br />---------------------------------------------------------------------------
* </p>
* \author eqbfd
* @version $Id: JSDataElementTimeStampISO.java 14731 2011-07-05 20:50:42Z sos $16.06.2009
* \see reference
*
* Created on 16.06.2009 12:16:33
*/
/**
* @author eqbfd
*
*/
public class JSDataElementTimeStampISO extends JSDataElementDate {
private final String conClassName = "JSDataElementTimeStampISO";
JSDataElementTimeStampISO() {
init();
//
}
private void init() {
@SuppressWarnings("unused")
final String conMethodName = conClassName + "::init";
// this.XMLTagName(JSXMLTagNames.conStockLevelTimeStamp);
setParsePattern(JSDateFormat.dfTIMESTAMPS);
setFormatPattern(JSDateFormat.dfISO);
// return void;
} // private void init
/**
* \brief JSTimeStampISO
*
* \details
*
* @param pPstrValue
*/
public JSDataElementTimeStampISO(final String pPstrValue) {
super(pPstrValue);
init();
}
public JSDataElementTimeStampISO(final JSDataElementDate pdteDate) {
this(pdteDate.Value());
}
/**
* \brief JSTimeStampISO
*
* \details
*
* @param pPstrValue
* @param pPstrDescription
*/
public JSDataElementTimeStampISO(final String pPstrValue, final String pPstrDescription) {
super(pPstrValue, pPstrDescription);
init();
}
/**
* \brief JSTimeStampISO
*
* \details
*
* @param pPstrValue
* @param pPstrDescription
* @param pPintSize
* @param pPintPos
* @param pPstrFormatString
* @param pPstrColumnHeader
* @param pPstrXMLTagName
*/
public JSDataElementTimeStampISO(final String pPstrValue, final String pPstrDescription, final int pPintSize, final int pPintPos, final String pPstrFormatString,
final String pPstrColumnHeader, final String pPstrXMLTagName) {
super(pPstrValue, pPstrDescription, pPintSize, pPintPos, pPstrFormatString, pPstrColumnHeader, pPstrXMLTagName);
}
//- <remark who='EQALS' when='Dienstag, 3. November 2009' id='Erweiterung' >
/**
* \change Dienstag, 3. November 2009 EQALS Erweiterung
* ErweiterungISODate
* Mapics liefert den ISO-Code Datum+Uhrzeit.
* �ber den FormatString dfDATE_SHORT l�st sich steuern, dass nur das Datum ben�tigt wird
* Das ist beim Feld ValidFromDate der Fall.
* @throws Exception
*/
//- <newcode>
@Override
public String FormattedValue() {
// final String strT = Value();
// if (FormatString().equals(JSDateFormat.dfDATE.toPattern())
// || FormatString().equals(JSDateFormat.dfDATE_SHORT.toPattern())) {
// strT = strT.substring(0, 9 + 1);
// }
try {
this.Value(ValueISO());
}
catch (final Exception objException) {
/**
* Original-Wert zur�cliefern, wenn es nicht konvertiert werden kann.
*/
}
return this.Value();
}
//- </newcode>
//- </remark> <!-- id=<Erweiterung> -->
public String ValueISO() throws Exception {
final String conMethodName = conClassName + "::Value";
setParsePattern(JSDateFormat.dfTIMESTAMPS);
setFormatPattern(JSDateFormat.dfISO);
try {
getParsePattern().parse(this.Value());
}
catch (final ParseException e) {
throw new FormatPatternException(conMethodName + ": the value '" + this.Value() + "' does not correspond with the pattern " + getParsePattern().toPattern());
}
final JSDateFormat df = new JSDateFormat(JSDateFormat.dfISO.toPattern());
return df.format(getDateObject());
} // public String Value}
}