Omaha #4486 - Add python serialized FormattedDate

Change-Id: I2b780b7bc705bd678e06580ef46ac98f6143f661

Former-commit-id: 83848a04748bb41249eb1edd47d87a5ea92ab3f8
This commit is contained in:
Richard Peter 2015-09-21 13:36:00 -05:00
parent cf84ca32a2
commit 1798e4f57f
4 changed files with 90 additions and 2 deletions

View file

@ -0,0 +1,46 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
#
# Adapter for FormattedDate
#
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 9/21/2015 4486 rjpeter Initial creation.
#
#
#
from dynamicserialize.dstypes.com.raytheon.uf.common.time import FormattedDate
ClassAdapter = 'com.raytheon.uf.common.time.FormattedDate'
def serialize(context, date):
context.writeI64(date.getTime())
def deserialize(context):
result = FormattedDate()
result.setTime(context.readI64())
return result

View file

@ -32,7 +32,7 @@
# 04/22/13 #1949 rjpeter Added LockTableAdapter # 04/22/13 #1949 rjpeter Added LockTableAdapter
# 02/06/14 #2672 bsteffen Added JTSEnvelopeAdapter # 02/06/14 #2672 bsteffen Added JTSEnvelopeAdapter
# 06/22/2015 #4573 randerso Added JobProgressAdapter # 06/22/2015 #4573 randerso Added JobProgressAdapter
# # 09/21/2015 #4486 rjpeter Added FormattedDateAdapter
# #
__all__ = [ __all__ = [
@ -43,6 +43,7 @@ __all__ = [
'GregorianCalendarAdapter', 'GregorianCalendarAdapter',
'ActiveTableModeAdapter', 'ActiveTableModeAdapter',
'DateAdapter', 'DateAdapter',
'FormattedDateAdapter',
'LocalizationLevelSerializationAdapter', 'LocalizationLevelSerializationAdapter',
'LocalizationTypeSerializationAdapter', 'LocalizationTypeSerializationAdapter',
'GeometryTypeAdapter', 'GeometryTypeAdapter',

View file

@ -0,0 +1,39 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
# ----------------------------------------------------------------------------
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 09/21/2015 4486 rjpeter Initial creation.
#
##
from time import gmtime, strftime
from dynamicserialize.dstypes.java.util import Date
class FormattedDate(Date):
def __init__(self, timeInMillis=None):
super(FormattedDate, self).__init__(timeInMillis)
def __repr__(self):
return strftime("%Y-%m-%d %H:%M:%S.", gmtime(self.time/1000.0)) + '{:03d}'.format(self.time%1000)

View file

@ -22,9 +22,11 @@
__all__ = [ __all__ = [
'DataTime', 'DataTime',
'TimeRange' 'TimeRange',
'FormattedDate'
] ]
from DataTime import DataTime from DataTime import DataTime
from TimeRange import TimeRange from TimeRange import TimeRange
from FormattedDate import FormattedDate