Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
11837633
Commit
11837633
authored
Sep 15, 2021
by
Piotr Gawron
Browse files
overriden methods should be grouped together
parent
a065c619
Changes
56
Hide whitespace changes
Inline
Side-by-side
annotation/src/main/java/lcsb/mapviewer/annotation/services/ModelAnnotator.java
View file @
11837633
...
...
@@ -237,6 +237,22 @@ public class ModelAnnotator {
return
defaultAnnotators
;
}
/**
* Returns list of default {@link ElementAnnotator} names that are available for
* class given in the parameter.
*
* @param clazz
* class for which list of default annotators will be returned
* @return annotators names for a given class
*/
public
List
<
AnnotatorData
>
getDefaultAnnotators
(
final
Class
<?>
clazz
)
{
List
<
AnnotatorData
>
result
=
new
ArrayList
<>();
for
(
final
ElementAnnotator
annotator
:
getAvailableDefaultAnnotators
(
clazz
))
{
result
.
add
(
annotator
.
createAnnotatorData
());
}
return
result
;
}
/**
* This method returns list of improper annotations for the model. Improper
* annotation is the annotation of the wrong type for given type of element.
...
...
@@ -411,22 +427,6 @@ public class ModelAnnotator {
return
result
;
}
/**
* Returns list of default {@link ElementAnnotator} names that are available for
* class given in the parameter.
*
* @param clazz
* class for which list of default annotators will be returned
* @return annotators names for a given class
*/
public
List
<
AnnotatorData
>
getDefaultAnnotators
(
final
Class
<?>
clazz
)
{
List
<
AnnotatorData
>
result
=
new
ArrayList
<>();
for
(
final
ElementAnnotator
annotator
:
getAvailableDefaultAnnotators
(
clazz
))
{
result
.
add
(
annotator
.
createAnnotatorData
());
}
return
result
;
}
/**
* Returns list of default {@link ElementAnnotator annotators} that are
* available for class given in the parameter.
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/PubmedParser.java
View file @
11837633
...
...
@@ -284,6 +284,20 @@ public class PubmedParser extends CachableInterface implements IExternalService
return
result
;
}
/**
* Get the summary of the article.
*
* @param id
* pubmed identifier
* @return summary of the article.
* @throws PubmedSearchException
* thrown when there is a problem with accessing information about
* pubmed
*/
public
String
getSummary
(
final
String
id
)
throws
PubmedSearchException
{
return
getSummary
(
Integer
.
valueOf
(
id
));
}
@Override
public
ExternalServiceStatus
getServiceStatus
()
{
ExternalServiceStatus
status
=
new
ExternalServiceStatus
(
"Europe PubMed Central"
,
...
...
@@ -339,20 +353,6 @@ public class PubmedParser extends CachableInterface implements IExternalService
}
}
/**
* Get the summary of the article.
*
* @param id
* pubmed identifier
* @return summary of the article.
* @throws PubmedSearchException
* thrown when there is a problem with accessing information about
* pubmed
*/
public
String
getSummary
(
final
String
id
)
throws
PubmedSearchException
{
return
getSummary
(
Integer
.
valueOf
(
id
));
}
/**
* @return the miriamConnector
* @see #miriamConnector
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java
View file @
11837633
...
...
@@ -181,6 +181,24 @@ public abstract class ElementAnnotator extends CachableInterface {
return
false
;
}
/**
* Returns <code>true</code> if this annotator can annotate the object of
* given class type.
*
* @param clazz
* class to be tested if can be annotated
* @return <code>true</code> if class can be annotated by this annotator,
* <code>false</code> otherwise
*/
public
boolean
isAnnotatable
(
final
Class
<?>
clazz
)
{
for
(
final
Class
<?>
clazz2
:
validClasses
)
{
if
(
clazz2
.
isAssignableFrom
(
clazz
))
{
return
true
;
}
}
return
false
;
}
/**
* Adds a class to list of classes that can be annotated by the annotator.
*
...
...
@@ -235,24 +253,6 @@ public abstract class ElementAnnotator extends CachableInterface {
this
.
paramsDefs
=
paramDefs
;
}
/**
* Returns <code>true</code> if this annotator can annotate the object of
* given class type.
*
* @param clazz
* class to be tested if can be annotated
* @return <code>true</code> if class can be annotated by this annotator,
* <code>false</code> otherwise
*/
public
boolean
isAnnotatable
(
final
Class
<?>
clazz
)
{
for
(
final
Class
<?>
clazz2
:
validClasses
)
{
if
(
clazz2
.
isAssignableFrom
(
clazz
))
{
return
true
;
}
}
return
false
;
}
/**
*
* @return {@link #isDefault}
...
...
@@ -362,6 +362,24 @@ public abstract class ElementAnnotator extends CachableInterface {
}
}
public
void
addMiriamData
(
final
MiriamType
miriamType
,
final
String
resource
)
{
addMiriamData
(
new
MiriamData
(
miriamType
,
resource
));
}
public
void
addMiriamData
(
final
String
generalIdentifier
)
{
MiriamData
md
=
null
;
try
{
md
=
MiriamType
.
getMiriamByUri
(
generalIdentifier
);
}
catch
(
final
InvalidArgumentException
e
)
{
try
{
md
=
MiriamType
.
getMiriamByUri
(
"urn:miriam:"
+
generalIdentifier
);
}
catch
(
final
InvalidArgumentException
e1
)
{
logger
.
warn
(
getLogMarker
(
ProjectLogEntryType
.
INVALID_IDENTIFIER
),
"Unknown miriam uri: "
+
generalIdentifier
);
}
}
addMiriamData
(
md
);
}
public
boolean
contains
(
final
MiriamData
identifier
)
{
MiriamData
copy
=
new
MiriamData
(
identifier
);
copy
.
setAnnotator
(
null
);
...
...
@@ -531,20 +549,6 @@ public abstract class ElementAnnotator extends CachableInterface {
}
}
public
void
addMiriamData
(
final
String
generalIdentifier
)
{
MiriamData
md
=
null
;
try
{
md
=
MiriamType
.
getMiriamByUri
(
generalIdentifier
);
}
catch
(
final
InvalidArgumentException
e
)
{
try
{
md
=
MiriamType
.
getMiriamByUri
(
"urn:miriam:"
+
generalIdentifier
);
}
catch
(
final
InvalidArgumentException
e1
)
{
logger
.
warn
(
getLogMarker
(
ProjectLogEntryType
.
INVALID_IDENTIFIER
),
"Unknown miriam uri: "
+
generalIdentifier
);
}
}
addMiriamData
(
md
);
}
/**
* Sets {@link CellDesignerChemical#inChI}.
*
...
...
@@ -598,10 +602,6 @@ public abstract class ElementAnnotator extends CachableInterface {
}
}
public
void
addMiriamData
(
final
MiriamType
miriamType
,
final
String
resource
)
{
addMiriamData
(
new
MiriamData
(
miriamType
,
resource
));
}
/**
* Sets {@link Species#charge}.
*
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/dapi/DapiConnectorImpl.java
View file @
11837633
...
...
@@ -129,6 +129,11 @@ public class DapiConnectorImpl extends CachableInterface implements DapiConnecto
}
}
@Override
public
String
getAuthenticatedContent
(
final
String
string
)
throws
DapiConnectionException
{
return
getAuthenticatedContent
(
string
,
true
);
}
@Override
public
String
getLatestReleaseUrl
(
final
String
databaseName
)
throws
DapiConnectionException
{
String
release
=
getLatestReleaseAvailable
(
databaseName
);
...
...
@@ -138,11 +143,6 @@ public class DapiConnectorImpl extends CachableInterface implements DapiConnecto
return
DAPI_BASE_URL
+
"database/"
+
databaseName
+
"/releases/"
+
getLatestReleaseAvailable
(
databaseName
)
+
"/"
;
}
@Override
public
String
getAuthenticatedContent
(
final
String
string
)
throws
DapiConnectionException
{
return
getAuthenticatedContent
(
string
,
true
);
}
@Override
public
boolean
isAuthenticated
()
{
Calendar
nowMinus10Minutes
=
Calendar
.
getInstance
();
...
...
@@ -171,10 +171,6 @@ public class DapiConnectorImpl extends CachableInterface implements DapiConnecto
}
}
public
String
getDapiPassword
()
{
return
configurationDao
.
getValueByType
(
ConfigurationElementType
.
DAPI_PASSWORD
);
}
void
login
(
final
String
login
,
final
String
password
)
throws
MalformedURLException
,
IOException
,
ProtocolException
,
DapiConnectionException
{
if
(
login
==
null
||
password
==
null
)
{
...
...
@@ -203,6 +199,10 @@ public class DapiConnectorImpl extends CachableInterface implements DapiConnecto
}
}
public
String
getDapiPassword
()
{
return
configurationDao
.
getValueByType
(
ConfigurationElementType
.
DAPI_PASSWORD
);
}
@Override
public
boolean
isValidConnection
()
{
if
(
getDapiLogin
()
==
null
||
getDapiLogin
().
isEmpty
()
||
getDapiPassword
()
==
null
...
...
checkstyle.xml
View file @
11837633
...
...
@@ -222,15 +222,9 @@
<property
name=
"lineWrappingIndentation"
value=
"4"
/>
<property
name=
"arrayInitIndent"
value=
"2"
/>
</module>
<!-- <module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="1"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF,
PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF"/>
</module>
<module
name=
"OverloadMethodsDeclarationOrder"
/>
<module name="VariableDeclarationUsageDistance"/>
<!--
<module name="VariableDeclarationUsageDistance"/>
<module name="CustomImportOrder">
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="true"/>
...
...
@@ -304,9 +298,17 @@
<module name="CommentsIndentation">
<property name="tokens" value="SINGLE_LINE_COMMENT, BLOCK_COMMENT_BEGIN"/>
</module>
<module name="VisibilityModifier">
<property name="protectedAllowed" value="true"/>
</module> -->
</module>
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="1"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF,
PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF"/>
</module>
-->
</module>
</module>
commons/src/main/java/lcsb/mapviewer/common/Configuration.java
View file @
11837633
...
...
@@ -168,18 +168,6 @@ public final class Configuration {
return
systemBuildVersion
;
}
/**
* @param baseDir
* directory where the system is placed
* @return {@link #systemVersion}
*/
public
static
String
getSystemVersion
(
final
String
baseDir
)
{
if
(
systemVersion
==
null
)
{
loadSystemVersion
(
baseDir
);
}
return
systemVersion
;
}
/**
* @param baseDir
* directory where the system is placed
...
...
@@ -194,6 +182,18 @@ public final class Configuration {
return
getSystemBuildVersion
(
baseDir
);
}
/**
* @param baseDir
* directory where the system is placed
* @return {@link #systemVersion}
*/
public
static
String
getSystemVersion
(
final
String
baseDir
)
{
if
(
systemVersion
==
null
)
{
loadSystemVersion
(
baseDir
);
}
return
systemVersion
;
}
/**
* @param baseDir
* directory where the system is placed
...
...
converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/annotation/RestAnnotationParser.java
View file @
11837633
...
...
@@ -346,6 +346,91 @@ public class RestAnnotationParser {
processNotes
(
notes
,
element
);
}
/**
* Process notes and assign structural information from it.
*
* @param element
* object with notes to be processed
*/
public
void
processNotes
(
final
Element
element
)
{
processNotes
(
element
.
getNotes
(),
element
);
}
/**
* Process notes and assign structural information from it.
*
* @param notes
* notes about element
* @param object
* where the structural data should be put
*/
public
void
processNotes
(
final
String
notes
,
final
Drawable
object
)
{
StringBuilder
annotations
=
new
StringBuilder
();
String
[]
string
=
notes
.
split
(
"\n"
);
StringBuilder
newNotes
=
new
StringBuilder
(
""
);
for
(
final
String
string2
:
string
)
{
boolean
remove
=
false
;
for
(
final
NoteField
field
:
NoteField
.
values
())
{
if
(
string2
.
startsWith
(
field
.
getCommonName
()
+
":"
)
&&
field
.
getClazz
().
isAssignableFrom
(
object
.
getClass
()))
{
remove
=
true
;
}
else
if
(
string2
.
startsWith
(
field
.
getCommonName
()
+
"="
)
&&
field
.
getClazz
().
isAssignableFrom
(
object
.
getClass
()))
{
remove
=
true
;
}
}
if
(
remove
)
{
annotations
.
append
(
string2
+
"\n"
);
}
else
{
newNotes
.
append
(
string2
+
"\n"
);
}
}
String
ann
=
annotations
.
toString
();
setZIndex
(
object
,
ann
);
if
(
object
instanceof
LayerText
)
{
LayerText
layerText
=
(
LayerText
)
object
;
setBackgroundColor
(
layerText
,
ann
);
setBorderColor
(
layerText
,
ann
);
layerText
.
setNotes
(
newNotes
.
toString
().
trim
());
}
if
(
object
instanceof
BioEntity
)
{
BioEntity
bioEntity
=
(
BioEntity
)
object
;
bioEntity
.
setNotes
(
newNotes
.
toString
().
trim
());
setNotes
(
bioEntity
,
ann
);
setSymbol
(
bioEntity
,
ann
);
setSynonyms
(
bioEntity
,
ann
);
setSemanticZoomLevelVisibility
(
bioEntity
,
ann
);
setAbbreviation
(
bioEntity
,
ann
);
setFormula
(
bioEntity
,
ann
);
if
(
object
instanceof
Reaction
)
{
Reaction
reaction
=
(
Reaction
)
object
;
setMechanicalConfidenceScoreToReaction
(
reaction
,
ann
);
setLowerBoundToReaction
(
reaction
,
ann
);
setUpperBoundToReaction
(
reaction
,
ann
);
setSubsystemToReaction
(
reaction
,
ann
);
setGeneProteinReactionToReaction
(
reaction
,
ann
);
}
else
if
(
object
instanceof
Element
)
{
setTransparencyZoomLevelVisibility
((
Element
)
object
,
ann
);
setFullNameToSpecies
((
Element
)
object
,
ann
);
setFormerSymbolsToSpecies
((
Element
)
object
,
ann
);
if
(
object
instanceof
Species
)
{
setCharge
((
Species
)
object
,
ann
);
}
}
else
{
throw
new
NotImplementedException
(
"Don't know how to process class: "
+
object
.
getClass
());
}
try
{
processRdfDescription
(
bioEntity
);
}
catch
(
final
InvalidXmlSchemaException
e
)
{
String
warning
=
elementUtils
.
getElementTag
(
object
)
+
" Problem with processing notes. Invalid RDF node."
;
logger
.
warn
(
warning
);
}
}
}
/**
* Transforms xml node into notes.
*
...
...
@@ -767,81 +852,6 @@ public class RestAnnotationParser {
return
getParamByPrefix
(
annotationString
,
NoteField
.
DESCRIPTION
.
getCommonName
()
+
":"
);
}
/**
* Process notes and assign structural information from it.
*
* @param notes
* notes about element
* @param object
* where the structural data should be put
*/
public
void
processNotes
(
final
String
notes
,
final
Drawable
object
)
{
StringBuilder
annotations
=
new
StringBuilder
();
String
[]
string
=
notes
.
split
(
"\n"
);
StringBuilder
newNotes
=
new
StringBuilder
(
""
);
for
(
final
String
string2
:
string
)
{
boolean
remove
=
false
;
for
(
final
NoteField
field
:
NoteField
.
values
())
{
if
(
string2
.
startsWith
(
field
.
getCommonName
()
+
":"
)
&&
field
.
getClazz
().
isAssignableFrom
(
object
.
getClass
()))
{
remove
=
true
;
}
else
if
(
string2
.
startsWith
(
field
.
getCommonName
()
+
"="
)
&&
field
.
getClazz
().
isAssignableFrom
(
object
.
getClass
()))
{
remove
=
true
;
}
}
if
(
remove
)
{
annotations
.
append
(
string2
+
"\n"
);
}
else
{
newNotes
.
append
(
string2
+
"\n"
);
}
}
String
ann
=
annotations
.
toString
();
setZIndex
(
object
,
ann
);
if
(
object
instanceof
LayerText
)
{
LayerText
layerText
=
(
LayerText
)
object
;
setBackgroundColor
(
layerText
,
ann
);
setBorderColor
(
layerText
,
ann
);
layerText
.
setNotes
(
newNotes
.
toString
().
trim
());
}
if
(
object
instanceof
BioEntity
)
{
BioEntity
bioEntity
=
(
BioEntity
)
object
;
bioEntity
.
setNotes
(
newNotes
.
toString
().
trim
());
setNotes
(
bioEntity
,
ann
);
setSymbol
(
bioEntity
,
ann
);
setSynonyms
(
bioEntity
,
ann
);
setSemanticZoomLevelVisibility
(
bioEntity
,
ann
);
setAbbreviation
(
bioEntity
,
ann
);
setFormula
(
bioEntity
,
ann
);
if
(
object
instanceof
Reaction
)
{
Reaction
reaction
=
(
Reaction
)
object
;
setMechanicalConfidenceScoreToReaction
(
reaction
,
ann
);
setLowerBoundToReaction
(
reaction
,
ann
);
setUpperBoundToReaction
(
reaction
,
ann
);
setSubsystemToReaction
(
reaction
,
ann
);
setGeneProteinReactionToReaction
(
reaction
,
ann
);
}
else
if
(
object
instanceof
Element
)
{
setTransparencyZoomLevelVisibility
((
Element
)
object
,
ann
);
setFullNameToSpecies
((
Element
)
object
,
ann
);
setFormerSymbolsToSpecies
((
Element
)
object
,
ann
);
if
(
object
instanceof
Species
)
{
setCharge
((
Species
)
object
,
ann
);
}
}
else
{
throw
new
NotImplementedException
(
"Don't know how to process class: "
+
object
.
getClass
());
}
try
{
processRdfDescription
(
bioEntity
);
}
catch
(
final
InvalidXmlSchemaException
e
)
{
String
warning
=
elementUtils
.
getElementTag
(
object
)
+
" Problem with processing notes. Invalid RDF node."
;
logger
.
warn
(
warning
);
}
}
}
private
void
setBackgroundColor
(
final
LayerText
layerText
,
final
String
ann
)
{
Color
color
=
getColor
(
ann
,
NoteField
.
BACKGROUND_COLOR
.
getCommonName
());
if
(
color
==
null
)
{
...
...
@@ -907,16 +917,6 @@ public class RestAnnotationParser {
}
}
/**
* Process notes and assign structural information from it.
*
* @param element
* object with notes to be processed
*/
public
void
processNotes
(
final
Element
element
)
{
processNotes
(
element
.
getNotes
(),
element
);
}
boolean
isFieldAnnotated
(
final
NoteField
field
,
final
Class
<?
extends
Annotation
>
annotationClass
)
{
try
{
Field
f
=
field
.
getClass
().
getField
(
field
.
name
());
...
...
converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/geometry/AbstractCellDesignerAliasConverter.java
View file @
11837633
...
...
@@ -129,6 +129,36 @@ public abstract class AbstractCellDesignerAliasConverter<T extends Element> impl
}
}
/**
* This method computes coordinates that should be associated with the angle on
* the border of the alias.
*
* @param alias
* alias to be investigated
* @param angle
* angle on the border of the alias
* @return coordinates on the border of the alias described by the angle
*/
protected
Point2D
getAnchorPointCoordinates
(
final
T
alias
,
final
double
angle
)
{
Point2D
result
=
null
;
if
(
alias
.
getWidth
()
==
0
&&
alias
.
getHeight
()
==
0
)
{
result
=
alias
.
getCenter
();
}
else
{
double
dist
=
Math
.
max
(
alias
.
getWidth
(),
alias
.
getHeight
())
*
2
;
Point2D
startPoint
=
alias
.
getCenter
();
double
x
=
startPoint
.
getX
()
-
Math
.
cos
(
angle
)
*
dist
;
double
y
=
startPoint
.
getY
()
-
Math
.
sin
(
angle
)
*
dist
;
Point2D
endPoint
=
new
Point2D
.
Double
(
x
,
y
);
Line2D
line
=
new
Line2D
.
Double
(
startPoint
,
endPoint
);
result
=
lineTransformation
.
getIntersectionWithPathIterator
(
line
,
getBoundPathIterator
(
alias
));
if
(
result
==
null
)
{
logger
.
warn
(
"Unknown crossing point: "
+
line
.
getP1
()
+
"; "
+
line
.
getP2
());
result
=
alias
.
getCenter
();
}
}
return
result
;
}
/**
* Returns coordinates on the {@link Species} border for given angle for
* residues.
...
...
@@ -250,35 +280,6 @@ public abstract class AbstractCellDesignerAliasConverter<T extends Element> impl
throw
new
NotImplementedException
(
"Not implemented for: "
+
this
.
getClass
());
}
/**
* This method computes coordinates that should be associated with the angle on
* the border of the alias.
*
* @param alias
* alias to be investigated
* @param angle
* angle on the border of the alias
* @return coordinates on the border of the alias described by the angle
*/
protected
Point2D
getAnchorPointCoordinates
(
final
T
alias
,
final
double
angle
)
{
Point2D
result
=
null
;
if
(
alias
.
getWidth
()
==
0
&&
alias
.
getHeight
()
==
0
)
{
result
=
alias
.
getCenter
();
}
else
{
double
dist
=
Math
.
max
(
alias
.
getWidth
(),
alias
.
getHeight
())
*
2
;