Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SASC
sentinel-legacy
Commits
cd2dd338
Commit
cd2dd338
authored
Jul 06, 2015
by
bow
Browse files
Move hiddenAttributes to base trait
parent
877cb631
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/scala/nl/lumc/sasc/sentinel/api/SentinelServlet.scala
View file @
cd2dd338
...
...
@@ -25,7 +25,7 @@ import org.scalatra.json.JacksonJsonSupport
import
org.scalatra.swagger.
{
DataType
,
Model
,
SwaggerSupport
}
import
org.slf4j.LoggerFactory
import
nl.lumc.sasc.sentinel.models.
{
ApiMessage
,
RunRecord
}
import
nl.lumc.sasc.sentinel.models.
{
ApiMessage
,
Base
RunRecord
}
import
nl.lumc.sasc.sentinel.utils.
{
SentinelJsonFormats
,
separateObjectIds
,
splitParam
}
/** Base servlet for all Sentinel controllers. */
...
...
@@ -71,7 +71,7 @@ abstract class SentinelServlet extends ScalatraServlet
val
newModel
=
if
(
model
.
id
==
"RunRecord"
)
model
.
copy
(
properties
=
interceptedProp
.
filter
{
case
(
propName
,
prop
)
=>
!
RunRecord
.
hiddenAttributes
.
contains
(
propName
)
case
(
propName
,
prop
)
=>
!
Base
RunRecord
.
hiddenAttributes
.
contains
(
propName
)
})
else
model
.
copy
(
properties
=
interceptedProp
)
...
...
src/main/scala/nl/lumc/sasc/sentinel/models/BaseRunRecord.scala
View file @
cd2dd338
...
...
@@ -49,6 +49,11 @@ import org.bson.types.ObjectId
def
deletionTimeUtc
:
Option
[
Date
]
}
object
BaseRunRecord
{
/** Attributes that is hidden when this object is serialized into JSON. */
val
hiddenAttributes
=
Set
(
"sampleIds"
,
"libIds"
)
}
/**
* Simple implementation of a run record.
*
...
...
@@ -69,8 +74,3 @@ case class RunRecord(
libIds
:
Seq
[
ObjectId
]
=
Seq
(),
refId
:
Option
[
ObjectId
]
=
None
,
annotIds
:
Option
[
Seq
[
ObjectId
]]
=
None
)
extends
BaseRunRecord
object
RunRecord
{
/** Attributes that is hidden when this object is serialized into JSON. */
val
hiddenAttributes
=
Set
(
"sampleIds"
,
"libIds"
)
}
src/main/scala/nl/lumc/sasc/sentinel/utils/package.scala
View file @
cd2dd338
...
...
@@ -28,7 +28,7 @@ import org.bson.types.ObjectId
import
org.json4s._
import
org.scalatra.servlet.FileItem
import
nl.lumc.sasc.sentinel.models.RunRecord
import
nl.lumc.sasc.sentinel.models.
{
Base
RunRecord
,
RunRecord
}
/** General utilities */
package
object
utils
{
...
...
@@ -138,7 +138,7 @@ package object utils {
/** Serializer for outgoing JSON payloads. */
val
RunDocumentSerializer
=
FieldSerializer
[
RunRecord
]({
case
(
attr
,
_
)
if
RunRecord
.
hiddenAttributes
.
contains
(
attr
)
=>
None
},
FieldSerializer
[
Base
RunRecord
]({
case
(
attr
,
_
)
if
Base
RunRecord
.
hiddenAttributes
.
contains
(
attr
)
=>
None
},
{
case
field
=>
field
})
/** JSON format used across the entire package. */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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