Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
2c649f66
Commit
2c649f66
authored
Aug 12, 2021
by
Piotr Gawron
Browse files
Merge branch '566-merge-rest-api-services-into-main-service-module' into 'master'
Resolve "Merge REST API services into main service module" See merge request
!1324
parents
a5b36a0a
0dcca279
Pipeline
#45324
passed with stage
in 19 minutes and 7 seconds
Changes
286
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
2c649f66
minerva
(
16.1.0
~
alpha
.0
)
stable
;
urgency
=
medium
*
Bug
fix
:
api
endpoints
were
exposed
without
'api'
prefix
*
Bug
fix
:
anonymous
user
could
upload
file
using
API
*
Bug
fix
:
when
passing
JSON
in
patch
/
post
methods
contentType
was
not
checked
minerva
(
16.0.0
~
beta
.1
)
stable
;
urgency
=
medium
*
Backward
incompatibility
:
layout
parameter
in
minerva
url
is
not
supported
anymore
...
...
CellDesigner-plugin/pom.xml
View file @
2c649f66
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
lcsb.mapviewer
</groupId>
<artifactId>
parent
</artifactId>
<version>
16.
0
.0~
bet
a.
1
</version>
<version>
16.
1
.0~
alph
a.
0
</version>
</parent>
<artifactId>
CellDesigner-plugin
</artifactId>
<!-- dependency from the MapViewer model -->
...
...
@@ -50,19 +50,19 @@
<dependency>
<groupId>
lcsb.mapviewer
</groupId>
<artifactId>
model
</artifactId>
<version>
16.
0
.0~
bet
a.
1
</version>
<version>
16.
1
.0~
alph
a.
0
</version>
</dependency>
<dependency>
<groupId>
lcsb.mapviewer
</groupId>
<artifactId>
commons
</artifactId>
<version>
16.
0
.0~
bet
a.
1
</version>
<version>
16.
1
.0~
alph
a.
0
</version>
</dependency>
<dependency>
<groupId>
lcsb.mapviewer
</groupId>
<artifactId>
converter-CellDesigner
</artifactId>
<version>
16.
0
.0~
bet
a.
1
</version>
<version>
16.
1
.0~
alph
a.
0
</version>
</dependency>
<dependency>
...
...
annotation/pom.xml
View file @
2c649f66
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
lcsb.mapviewer
</groupId>
<artifactId>
parent
</artifactId>
<version>
16.
0
.0~
bet
a.
1
</version>
<version>
16.
1
.0~
alph
a.
0
</version>
</parent>
<artifactId>
annotation
</artifactId>
<name>
Annotation module
</name>
...
...
@@ -18,7 +18,7 @@
<dependency>
<groupId>
lcsb.mapviewer
</groupId>
<artifactId>
model
</artifactId>
<version>
16.
0
.0~
bet
a.
1
</version>
<version>
16.
1
.0~
alph
a.
0
</version>
</dependency>
<!-- dependency from the MapViewer dao -->
...
...
@@ -26,7 +26,7 @@
<dependency>
<groupId>
lcsb.mapviewer
</groupId>
<artifactId>
persist
</artifactId>
<version>
16.
0
.0~
bet
a.
1
</version>
<version>
16.
1
.0~
alph
a.
0
</version>
</dependency>
<!-- dependency from the MapViewer cell designer parser (we need access
...
...
@@ -34,13 +34,13 @@
<dependency>
<groupId>
lcsb.mapviewer
</groupId>
<artifactId>
converter-CellDesigner
</artifactId>
<version>
16.
0
.0~
bet
a.
1
</version>
<version>
16.
1
.0~
alph
a.
0
</version>
</dependency>
<dependency>
<groupId>
lcsb.mapviewer
</groupId>
<artifactId>
converter
</artifactId>
<version>
16.
0
.0~
bet
a.
1
</version>
<version>
16.
1
.0~
alph
a.
0
</version>
</dependency>
<!-- Log4J2 -->
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/data/Chemical.java
View file @
2c649f66
package
lcsb.mapviewer.annotation.data
;
import
java.io.Serializable
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Comparator
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlRootElement
;
...
...
@@ -315,8 +318,15 @@ public class Chemical implements Serializable, TargettingStructure {
}
public
void
removeTargets
(
Set
<
Target
>
targetsToRemove
)
{
public
void
removeTargets
(
Collection
<
Target
>
targetsToRemove
)
{
this
.
getTargets
().
removeAll
(
targetsToRemove
);
}
@Override
public
void
addTargets
(
List
<?
extends
Target
>
projectTargets
)
{
for
(
Target
target
:
projectTargets
)
{
addTarget
(
target
);
}
}
}
annotation/src/main/java/lcsb/mapviewer/annotation/data/Drug.java
View file @
2c649f66
package
lcsb.mapviewer.annotation.data
;
import
java.io.Serializable
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Comparator
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlRootElement
;
...
...
@@ -9,6 +12,9 @@ import javax.xml.bind.annotation.XmlRootElement;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
lcsb.mapviewer.annotation.data.serializer.DrugSerializer
;
import
lcsb.mapviewer.common.comparator.StringComparator
;
import
lcsb.mapviewer.model.map.MiriamData
;
...
...
@@ -19,6 +25,7 @@ import lcsb.mapviewer.model.map.MiriamData;
*
*/
@XmlRootElement
@JsonSerialize
(
using
=
DrugSerializer
.
class
)
public
class
Drug
implements
Serializable
,
TargettingStructure
{
/**
...
...
@@ -285,7 +292,8 @@ public class Drug implements Serializable, TargettingStructure {
* @param targets2
* list of targets to add
*/
public
void
addTargets
(
List
<
Target
>
targets2
)
{
@Override
public
void
addTargets
(
List
<?
extends
Target
>
targets2
)
{
this
.
targets
.
addAll
(
targets2
);
}
...
...
@@ -332,4 +340,8 @@ public class Drug implements Serializable, TargettingStructure {
public
void
addSynonyms
(
List
<
String
>
synonyms
)
{
this
.
synonyms
.
addAll
(
synonyms
);
}
public
void
removeTargets
(
Collection
<
Target
>
targetsToRemove
)
{
this
.
getTargets
().
removeAll
(
targetsToRemove
);
}
}
\ No newline at end of file
annotation/src/main/java/lcsb/mapviewer/annotation/data/MiRNA.java
View file @
2c649f66
package
lcsb.mapviewer.annotation.data
;
import
java.io.Serializable
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Comparator
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
lcsb.mapviewer.annotation.data.serializer.MiRNASerializer
;
import
lcsb.mapviewer.common.comparator.StringComparator
;
import
lcsb.mapviewer.model.map.MiriamData
;
...
...
@@ -15,6 +21,7 @@ import lcsb.mapviewer.model.map.MiriamData;
*
*/
@XmlRootElement
@JsonSerialize
(
using
=
MiRNASerializer
.
class
)
public
class
MiRNA
implements
Serializable
,
TargettingStructure
{
/**
...
...
@@ -127,4 +134,14 @@ public class MiRNA implements Serializable, TargettingStructure {
}
@Override
public
void
removeTargets
(
Collection
<
Target
>
targets
)
{
this
.
targets
.
removeAll
(
targets
);
}
@Override
public
void
addTargets
(
List
<?
extends
Target
>
projectTargets
)
{
this
.
targets
.
addAll
(
projectTargets
);
}
}
annotation/src/main/java/lcsb/mapviewer/annotation/data/ProjectTarget.java
0 → 100644
View file @
2c649f66
package
lcsb.mapviewer.annotation.data
;
import
java.util.Comparator
;
import
java.util.List
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
lcsb.mapviewer.common.comparator.StringComparator
;
import
lcsb.mapviewer.model.map.BioEntity
;
import
lcsb.mapviewer.modelutils.serializer.model.map.MinifiedBioEntitySerializer
;
public
class
ProjectTarget
extends
Target
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
public
static
final
Comparator
<?
super
ProjectTarget
>
COMPARATOR
=
new
Comparator
<
ProjectTarget
>()
{
@Override
public
int
compare
(
ProjectTarget
o1
,
ProjectTarget
o2
)
{
Integer
size1
=
o1
.
bioEntities
.
size
();
Integer
size2
=
o2
.
bioEntities
.
size
();
if
(
size1
==
size2
)
{
return
new
StringComparator
().
compare
(
o1
.
getName
(),
o2
.
getName
());
}
return
-
size1
.
compareTo
(
size2
);
}
};
@JsonSerialize
(
contentUsing
=
MinifiedBioEntitySerializer
.
class
)
@JsonProperty
(
"targetElements"
)
private
List
<
BioEntity
>
bioEntities
;
public
ProjectTarget
(
Target
target
,
List
<
BioEntity
>
bioEntities
)
{
setSource
(
target
.
getSource
());
setName
(
target
.
getName
());
setOrganism
(
target
.
getOrganism
());
setAssociatedDisease
(
target
.
getAssociatedDisease
());
setGenes
(
target
.
getGenes
());
addReferences
(
target
.
getReferences
());
setType
(
target
.
getType
());
this
.
bioEntities
=
bioEntities
;
}
public
List
<
BioEntity
>
getBioEntities
()
{
return
bioEntities
;
}
public
void
setBioEntites
(
List
<
BioEntity
>
bioEntities
)
{
this
.
bioEntities
=
bioEntities
;
}
}
annotation/src/main/java/lcsb/mapviewer/annotation/data/Target.java
View file @
2c649f66
package
lcsb.mapviewer.annotation.data
;
import
java.io.Serializable
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlElement
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.model.map.MiriamData
;
...
...
@@ -33,33 +38,40 @@ public class Target implements Serializable {
/**
* Database from which target was received.
*/
@JsonIgnore
private
MiriamData
source
;
/**
* Name of the target.
*/
@JsonProperty
(
"name"
)
private
String
name
;
/**
* Organism in which target is located.
*/
@JsonIgnore
private
MiriamData
organism
;
@JsonIgnore
private
MiriamData
associatedDisease
;
/**
* List of genes located in a target.
*/
@JsonProperty
(
"targetParticipants"
)
private
List
<
MiriamData
>
genes
=
new
ArrayList
<>();
/**
* List of references describing target.
*/
@JsonProperty
(
"references"
)
private
List
<
MiriamData
>
references
=
new
ArrayList
<>();
/**
* Type of target.
*/
@JsonIgnore
private
TargetType
type
;
/**
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/data/TargettingStructure.java
View file @
2c649f66
package
lcsb.mapviewer.annotation.data
;
import
java.util.Collection
;
import
java.util.List
;
import
lcsb.mapviewer.model.map.MiriamData
;
...
...
@@ -25,4 +26,8 @@ public interface TargettingStructure {
*/
Collection
<
Target
>
getTargets
();
void
removeTargets
(
Collection
<
Target
>
targets
);
void
addTargets
(
List
<?
extends
Target
>
projectTargets
);
}
annotation/src/main/java/lcsb/mapviewer/annotation/data/serializer/ChemicalSerializer.java
0 → 100644
View file @
2c649f66
package
lcsb.mapviewer.annotation.data.serializer
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.function.Function
;
import
com.fasterxml.jackson.core.JsonGenerator
;
import
com.fasterxml.jackson.databind.JsonSerializer
;
import
com.fasterxml.jackson.databind.SerializerProvider
;
import
com.fasterxml.jackson.databind.ser.FilterProvider
;
import
com.fasterxml.jackson.databind.ser.PropertyFilter
;
import
lcsb.mapviewer.annotation.data.Chemical
;
import
lcsb.mapviewer.annotation.data.MeSH
;
import
lcsb.mapviewer.model.map.MiriamData
;
import
lcsb.mapviewer.modelutils.serializer.CustomExceptFilter
;
public
class
ChemicalSerializer
extends
JsonSerializer
<
Chemical
>
{
private
Function
<
MiriamData
,
MeSH
>
getMesh
;
public
ChemicalSerializer
(
Function
<
MiriamData
,
MeSH
>
getMesh
)
{
this
.
getMesh
=
getMesh
;
}
@Override
public
void
serialize
(
final
Chemical
chemical
,
final
JsonGenerator
gen
,
final
SerializerProvider
serializers
)
throws
IOException
{
PropertyFilter
filter
=
null
;
FilterProvider
provider
=
serializers
.
getConfig
().
getFilterProvider
();
if
(
provider
!=
null
)
{
filter
=
provider
.
findPropertyFilter
(
"chemicalFilter"
,
null
);
}
String
description
=
"Mesh term not available"
;
List
<
String
>
synonyms
=
new
ArrayList
<>();
MeSH
mesh
=
getMesh
.
apply
(
chemical
.
getChemicalId
());
if
(
mesh
!=
null
)
{
description
=
mesh
.
getDescription
();
synonyms
=
mesh
.
getSynonyms
();
}
gen
.
writeStartObject
();
for
(
String
string
:
availableColumns
())
{
String
column
=
string
.
toLowerCase
();
Object
value
=
null
;
switch
(
column
)
{
case
"id"
:
case
"idobject"
:
value
=
chemical
.
getChemicalId
();
break
;
case
"name"
:
value
=
chemical
.
getChemicalName
();
break
;
case
"references"
:
List
<
MiriamData
>
references
=
new
ArrayList
<>();
references
.
add
(
chemical
.
getChemicalId
());
if
(
chemical
.
getCasID
()
!=
null
)
{
references
.
add
(
chemical
.
getCasID
());
}
value
=
references
;
break
;
case
"directevidencereferences"
:
value
=
chemical
.
getDirectEvidencePublication
();
break
;
case
"description"
:
value
=
description
;
break
;
case
"directevidence"
:
if
(
chemical
.
getDirectEvidence
()
!=
null
)
{
value
=
chemical
.
getDirectEvidence
().
getValue
();
}
break
;
case
"synonyms"
:
value
=
synonyms
;
break
;
case
"targets"
:
value
=
chemical
.
getTargets
();
break
;
default
:
value
=
"Unknown column"
;
break
;
}
writeField
(
gen
,
string
,
value
,
filter
);
}
gen
.
writeEndObject
();
}
private
void
writeField
(
JsonGenerator
gen
,
String
field
,
Object
value
,
PropertyFilter
filter
)
throws
IOException
{
if
(
filter
==
null
||
(
filter
instanceof
CustomExceptFilter
&&
((
CustomExceptFilter
)
filter
).
includeField
(
field
)))
{
gen
.
writeObjectField
(
field
,
value
);
}
}
public
static
List
<
String
>
availableColumns
()
{
return
Arrays
.
asList
(
"name"
,
"references"
,
"description"
,
"synonyms"
,
"id"
,
"directEvidenceReferences"
,
"directEvidence"
,
"targets"
);
}
}
\ No newline at end of file
annotation/src/main/java/lcsb/mapviewer/annotation/data/serializer/DrugSerializer.java
0 → 100644
View file @
2c649f66
package
lcsb.mapviewer.annotation.data.serializer
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.List
;
import
com.fasterxml.jackson.core.JsonGenerator
;
import
com.fasterxml.jackson.databind.JsonSerializer
;
import
com.fasterxml.jackson.databind.SerializerProvider
;
import
com.fasterxml.jackson.databind.ser.FilterProvider
;
import
com.fasterxml.jackson.databind.ser.PropertyFilter
;
import
lcsb.mapviewer.annotation.data.Drug
;
import
lcsb.mapviewer.modelutils.serializer.CustomExceptFilter
;
public
class
DrugSerializer
extends
JsonSerializer
<
Drug
>
{
@Override
public
void
serialize
(
final
Drug
drug
,
final
JsonGenerator
gen
,
final
SerializerProvider
serializers
)
throws
IOException
{
PropertyFilter
filter
=
null
;
FilterProvider
provider
=
serializers
.
getConfig
().
getFilterProvider
();
if
(
provider
!=
null
)
{
filter
=
provider
.
findPropertyFilter
(
"drugFilter"
,
null
);
}
gen
.
writeStartObject
();
for
(
String
string
:
availableColumns
())
{
String
column
=
string
.
toLowerCase
();
Object
value
=
null
;
if
(
column
.
equals
(
"id"
)
||
column
.
equals
(
"idobject"
))
{
value
=
drug
.
getName
();
}
else
if
(
column
.
equals
(
"name"
))
{
value
=
drug
.
getName
();
}
else
if
(
column
.
equals
(
"references"
))
{
value
=
drug
.
getSources
();
}
else
if
(
column
.
equals
(
"description"
))
{
value
=
drug
.
getDescription
();
}
else
if
(
column
.
equals
(
"bloodbrainbarrier"
))
{
value
=
drug
.
getBloodBrainBarrier
();
}
else
if
(
column
.
equals
(
"brandnames"
))
{
value
=
drug
.
getBrandNames
();
}
else
if
(
column
.
equals
(
"synonyms"
))
{
value
=
drug
.
getSynonyms
();
}
else
if
(
column
.
equals
(
"targets"
))
{
value
=
drug
.
getTargets
();
}
else
{
value
=
"Unknown column"
;
}
writeField
(
gen
,
string
,
value
,
filter
);
}
gen
.
writeEndObject
();
}
private
void
writeField
(
JsonGenerator
gen
,
String
field
,
Object
value
,
PropertyFilter
filter
)
throws
IOException
{
if
(
filter
==
null
||
(
filter
instanceof
CustomExceptFilter
&&
((
CustomExceptFilter
)
filter
).
includeField
(
field
)))
{
gen
.
writeObjectField
(
field
,
value
);
}
}
public
static
List
<
String
>
availableColumns
()
{
return
Arrays
.
asList
(
"name"
,
"references"
,
"description"
,
"bloodBrainBarrier"
,
"brandNames"
,
"synonyms"
,
"id"
,
"targets"
);
}
}
\ No newline at end of file
annotation/src/main/java/lcsb/mapviewer/annotation/data/serializer/MiRNASerializer.java
0 → 100644
View file @
2c649f66
package
lcsb.mapviewer.annotation.data.serializer
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.List
;
import
com.fasterxml.jackson.core.JsonGenerator
;
import
com.fasterxml.jackson.databind.JsonSerializer
;
import
com.fasterxml.jackson.databind.SerializerProvider
;
import
com.fasterxml.jackson.databind.ser.FilterProvider
;
import
com.fasterxml.jackson.databind.ser.PropertyFilter
;
import
lcsb.mapviewer.annotation.data.MiRNA
;
import
lcsb.mapviewer.modelutils.serializer.CustomExceptFilter
;
public
class
MiRNASerializer
extends
JsonSerializer
<
MiRNA
>
{
@Override
public
void
serialize
(
final
MiRNA
miRna
,
final
JsonGenerator
gen
,
final
SerializerProvider
serializers
)
throws
IOException
{
PropertyFilter
filter
=
null
;
FilterProvider
provider
=
serializers
.
getConfig
().
getFilterProvider
();
if
(
provider
!=
null
)
{
filter
=
provider
.
findPropertyFilter
(
"miRnaFilter"
,
null
);
}
gen
.
writeStartObject
();
for
(
String
string
:
availableColumns
())
{
String
column
=
string
.
toLowerCase
();
Object
value
=
null
;
switch
(
column
)
{
case
"id"
:
case
"idobject"
:
case
"name"
:
value
=
miRna
.
getName
();
break
;
case
"targets"
:
value
=
miRna
.
getTargets
();
break
;
default
:
value
=
"Unknown column"
;
break
;
}
writeField
(
gen
,
string
,
value
,
filter
);
}
gen
.
writeEndObject
();
}
private
void
writeField
(
JsonGenerator
gen
,
String
field
,
Object
value
,
PropertyFilter
filter
)
throws
IOException
{
if
(
filter
==
null
||
(
filter
instanceof
CustomExceptFilter
&&
((
CustomExceptFilter
)
filter
).
includeField
(
field
)))
{
gen
.
writeObjectField
(
field
,
value
);
}
}
public
static
List
<
String
>
availableColumns
()
{
return
Arrays
.
asList
(
"name"
,
"id"
,
"targets"
);
}
}
\ No newline at end of file
annotation/src/main/java/lcsb/mapviewer/annotation/data/serializer/ProjectTargetSerializer.java
0 → 100644
View file @
2c649f66
package
lcsb.mapviewer.annotation.data.serializer
;
import
java.io.IOException
;
import
com.fasterxml.jackson.core.JsonGenerator
;
import
com.fasterxml.jackson.databind.JsonSerializer
;
import
com.fasterxml.jackson.databind.SerializerProvider
;
import
lcsb.mapviewer.annotation.data.ProjectTarget
;