Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Raphael
histream
Commits
e623775c
Commit
e623775c
authored
Aug 24, 2015
by
R.W.Majeed
Browse files
JAXB annotations
parent
f49346d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
histream-core/src/main/java/de/sekmi/histream/impl/ExternalSourceImpl.java
View file @
e623775c
...
...
@@ -2,31 +2,53 @@ package de.sekmi.histream.impl;
import
java.time.Instant
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAttribute
;
import
javax.xml.bind.annotation.adapters.XmlAdapter
;
import
javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter
;
import
de.sekmi.histream.ext.ExternalSourceType
;
@XmlAccessorType
(
XmlAccessType
.
PUBLIC_MEMBER
)
public
class
ExternalSourceImpl
implements
ExternalSourceType
{
protected
Instant
sourceTimestamp
;
protected
String
sourceId
;
private
Instant
timestamp
;
private
String
id
;
public
static
class
Adapter
extends
XmlAdapter
<
String
,
Instant
>{
@Override
public
Instant
unmarshal
(
String
v
)
throws
Exception
{
return
javax
.
xml
.
bind
.
DatatypeConverter
.
parseDateTime
(
v
).
toInstant
();
}
@Override
public
String
marshal
(
Instant
v
)
throws
Exception
{
return
v
.
toString
();
}
}
@XmlAttribute
(
name
=
"timestamp"
)
@XmlJavaTypeAdapter
(
Adapter
.
class
)
@Override
public
Instant
getSourceTimestamp
()
{
return
sourceT
imestamp
;
return
t
imestamp
;
}
@Override
public
void
setSourceTimestamp
(
Instant
instant
)
{
this
.
sourceT
imestamp
=
instant
;
this
.
t
imestamp
=
instant
;
}
@XmlAttribute
(
name
=
"id"
)
@Override
public
String
getSourceId
()
{
return
sourceI
d
;
return
i
d
;
}
@Override
public
void
setSourceId
(
String
sourceSystemId
)
{
this
.
sourceI
d
=
sourceSystemId
;
this
.
i
d
=
sourceSystemId
;
}
}
histream-core/src/main/java/de/sekmi/histream/impl/Meta.java
View file @
e623775c
...
...
@@ -42,11 +42,11 @@ public class Meta {
break
;
case
ObservationSupplier
.
META_SOURCE_ID
:
if
(
source
==
null
)
source
=
new
ExternalSourceImpl
();
source
.
sourceId
=
value
;
source
.
s
etS
ourceId
(
value
)
;
break
;
case
ObservationSupplier
.
META_SOURCE_TIMESTAMP
:
if
(
source
==
null
)
source
=
new
ExternalSourceImpl
();
source
.
sourceTimestamp
=
javax
.
xml
.
bind
.
DatatypeConverter
.
parseDateTime
(
value
).
toInstant
();
source
.
s
etS
ourceTimestamp
(
javax
.
xml
.
bind
.
DatatypeConverter
.
parseDateTime
(
value
).
toInstant
()
)
;
break
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment