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
b306124f
Commit
b306124f
authored
May 16, 2019
by
Piotr Gawron
Browse files
Merge branch 'devel_13.1.x' into tair-fix
parents
829b5269
eef024ad
Pipeline
#10269
failed with stage
in 12 minutes and 30 seconds
Changes
325
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
b306124f
...
...
@@ -268,13 +268,9 @@ test_upgrade_debian_package:
-
version=$(echo $debian_file| cut -f2 -d"_")
-
echo "PUT $debian_file /docker/incoming" | sftp -o StrictHostKeyChecking=no user@debian-repo
-
ssh root@debian-repo /usr/local/sbin/reprepro-import
-
apt-add-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main"
-
apt-key adv --no-tty --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
-
apt-add-repository "deb http://repo-r3lab.uni.lu/debian/ stable main"
-
apt-key adv --no-tty --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xcb185f4e31872412
-
apt-get update
# auto accept oracle license
-
echo debconf shared/accepted-oracle-license-v1-1 select
true
| debconf-set-selections
#hacky way of installing minerva on docker - by default rc-invoke is preventing services changes on docker
-
mv /usr/sbin/policy-rc.d /usr/sbin/policy-rc.d.backup
-
mv gitlab-ci-policy-rc.d /usr/sbin/policy-rc.d
...
...
@@ -315,12 +311,8 @@ test_install_debian_package:
-
debian_file=$(ls debian/*.deb)
-
echo "PUT $debian_file /docker/incoming" | sftp -o StrictHostKeyChecking=no user@debian-repo
-
ssh root@debian-repo /usr/local/sbin/reprepro-import
-
apt-add-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main"
-
apt-key adv --no-tty --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
-
apt-add-repository "deb http://debian-repo/ unstable main"
-
apt-get update
# auto accept oracle license
-
echo debconf shared/accepted-oracle-license-v1-1 select
true
| debconf-set-selections
#hacky way of installing minerva on docker - by default rc-invoke is preventing services changes on docker
-
mv /usr/sbin/policy-rc.d /usr/sbin/policy-rc.d.backup
-
mv gitlab-ci-policy-rc.d /usr/sbin/policy-rc.d
...
...
CHANGELOG
View file @
b306124f
minerva
(
12.3.1
~
beta
.1
)
unstable
;
urgency
=
low
*
Bug
fix
:
tair
locus
identifiers
were
used
improperly
-
instead
of
id
the
*
Bug
fix
:
tair
locus
identifiers
were
used
improperly
-
instead
of
id
the
name
was
used
minerva
(
1
2.3
.0
~
alpha
.0
)
unstable
;
urgency
=
low
minerva
(
1
3.1
.0
~
alpha
.0
)
unstable
;
urgency
=
low
*
Feature
:
annotators
are
more
flexible
-
you
can
define
set
of
input
and
outputs
used
by
annotator
(#
617
)
*
Feature
:
changes
in
admin
panel
doesn
't require saving - they are saved
automatically (#676)
* Feature: elements can have custom glyphs used for visualization (#487)
* Small improvement: all bio entities have z-index associated with them
(#487)
* Small improvement: validation of the organism and disease id on map upload
added (#618)
* Small improvement: added current username next to logout button in admin
...
...
@@ -12,6 +17,8 @@ minerva (12.3.0~alpha.0) unstable; urgency=low
* Small improvement: New comment dialog does not contain content of previous
comment dialog (#680)
* Small improvement: Left logo is configurable (#731)
* Small improvement: list of element types in choose annotator dialog is
sorted (#758)
* Small improvement: Plugin API provides list of overview images (#702)
* Small improvement: Plugin API allows to show/hide overview images (#702)
* Small improvement: Plugin API allows to trigger search on the map (#702)
...
...
@@ -24,6 +31,8 @@ minerva (12.3.0~alpha.0) unstable; urgency=low
whitespace, "_" used as separator (#596)
* Small improvement: list of references in drug panel contains PUBMED prefix
(#666)
* Small improvement: list of projects is auto refreshed every 5 seconds if at
least one of the project is uploading/removing (#610)
* Small improvement: passwords to email account and ldap are not sent over
API (#732)
* Small improvement: reactant/product/modifier specific colors are parsed
...
...
@@ -33,6 +42,21 @@ minerva (12.3.0~alpha.0) unstable; urgency=low
* Small improvement: Info tab provides information about model annotations
and submap tabs provide information about submaps annotations if applicable
(#591)
* Small improvement: uploading sbml file should automatically discover a file
type (#784)
* Small improvement: when plugin listeners crash the system notifies user
about problem with a plugin (#767)
* Small improvement: when exporting reaction and elements there is
possibility to filter by (sub)map (#615)
* Small improvement: during first opening of a map, the zoom level is
automatically computed if no default information is provided (#776)
* Small improvement: when adding new project columns "Root map", "Mapping
file" and "Map type" are merged (#700)
* Small improvement: allow admin to disable CORS check (#802)
* Small improvement: TransparencyZoomLevelVisibility parameter renamed to
SemanticZoomLevelTransparency (#801)
* Small improvement: export/import from SBML support z-index in LAYOUT
extension
* Bug fix: progress bar of gene genome mapping upload is refreshing properly
(#728)
* Bug fix: when editing project Disease and Organism could not be removed
...
...
@@ -41,6 +65,74 @@ minerva (12.3.0~alpha.0) unstable; urgency=low
"Unknown Inhibition"
reactions
(#
664
)
*
Bug
fix
:
"Unknown Catalysis"
and
"Unknown Inhibition"
reaction
end
is
slightly
separated
from
target
phenotype
(#
664
)
*
Bug
fix
:
order
of
genomes
in
admin
panel
doesn
't change after refreshing
list of genomes (#761)
* Bug fix: fixing situation when Molart started with variation overlay not
having the aa change information
* Bug fix: plugin contect element width is adjusted when link to tabs are
wrapped in more than one line (#758)
* Bug fix: export to CellDesigner preserve font size (#803)
* Bug fix: layout data was ignored for some reactions when improting from
SBML (#812)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 7 May 2019 15:00:00 +0200
minerva (13.0.0) stable; urgency=medium
* Bug fix: Since Oracle Java cannot be installed as debian dependency we use
openjdk-8. Due to this dependency minerva can be no longer installed on
Ubuntu-14 (#223)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 6 May 2019 18:00:00 +0200
minerva (12.2.3) stable; urgency=medium
* Bug fix: sorting of entries in "Edit project->overlays" dialog fixed (#790)
* Bug fix: searching of chemicals stopped working due to expired SSL
certificate on https://ctdbase.org/
* Bug fix: remove button is disabled after starting removing of the data
overlay (#791)
* Bug fix: search autocomplete hint could be initially hidden (#793)
* Bug fix: updating terms of use could crash when list of users was removed
in separate tab or by another user (#797)
* Bug fix: name of the checkbox in ADD PROJECT window adjusted (#799)
* Bug fix: when user didn'
t
have
privileges
to
remove
comments
the
button
was
active
on
pages
other
than
page
1
(#
792
)
*
Bug
fix
:
export
of
reaction
to
SBML
didn
't work when lines on the map were
too short (#805)
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 24 Apr 2019 17:00:00 +0200
minerva (12.2.2) stable; urgency=medium
* Bug fix: downloading overlays didn'
t
work
from
admin
panel
when
project
with
different
id
than
default
map
was
accessed
*
Bug
fix
:
change
of
owner
of
the
data
overlay
in
admin
panel
incorrectly
ordered
overlays
(#
777
)
*
Bug
fix
:
chemical
search
didn
't use updated disease identifier, original
disease id from project upload was used instead (#779)
* Bug fix: user login with special characters (like '
@
') could cause
problems in admin panel (#780)
* Bug fix: removing project without full control in the system (but with
enough privileges to remove project) caused "Not enough privileges" error
(#778)
* Bug fix: export of custom properties (like synonyms) are properly encoded
in CellDesigner xml (#785)
* Bug fix: notification about not supported version in IE 11 fixed (#783)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 9 Apr 2019 17:00:00 +0200
minerva (12.2.1) stable; urgency=medium
* Bug fix: export of reaction colorsi in SBML is properly encoded (COPASI can
read colors properly) (#744)
* Bug fix: removing active plugin didn'
t
switch
plugin
tab
to
the
next
loaded
plugin
(#
757
)
*
Bug
fix
:
closed
submap
will
not
be
reopened
after
page
refresh
(#
763
)
*
Bug
fix
:
comment
remove
button
is
disabled
for
users
without
proper
privileges
(#
766
)
*
Bug
fix
:
invalid
pubmed
identifier
could
break
clicking
on
element
containing
it
(#
764
,
#
765
,
#
769
)
*
Bug
fix
:
cache
for
API
queries
is
explicitly
disabled
-
some
queries
could
be
mistakenly
cached
and
the
system
behaviour
might
get
unstable
(#
771
)
--
Piotr
Gawron
<
piotr
.
gawron
@
uni
.
lu
>
Mon
,
1
Apr
2019
17
:
00
:
00
+
0200
minerva
(
12.2.0
)
stable
;
urgency
=
medium
*
Feature
:
bug
report
utility
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/cache/ApplicationLevelCache.java
View file @
b306124f
...
...
@@ -8,7 +8,6 @@ import org.springframework.stereotype.Service;
import
org.w3c.dom.Node
;
import
lcsb.mapviewer.common.Configuration
;
import
lcsb.mapviewer.common.XmlParser
;
import
lcsb.mapviewer.model.cache.CacheType
;
/**
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/cache/CachableInterface.java
View file @
b306124f
...
...
@@ -7,7 +7,6 @@ import org.apache.log4j.Logger;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.w3c.dom.Node
;
import
lcsb.mapviewer.common.XmlParser
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.model.cache.CacheType
;
import
lcsb.mapviewer.persist.dao.cache.CacheTypeDao
;
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java
View file @
b306124f
...
...
@@ -70,18 +70,18 @@ public class ChemicalParser extends CachableInterface implements IExternalServic
/**
* Home page of ctd database.
*/
static
final
String
URL
=
"http
s
://ctdbase.org/"
;
static
final
String
URL
=
"http://ctdbase.org/"
;
/**
* URL to get a list of chemicals by disease id.
*/
public
static
final
String
DISEASE_URL
=
"https://ctdbase.org/
detail.go?6578706f7274=1&d-1332398-e=5&view=chem&"
public
static
final
String
DISEASE_URL
=
URL
+
"
detail.go?6578706f7274=1&d-1332398-e=5&view=chem&"
+
"type=disease&acc=MESH%3A"
;
/**
* URL to get a list of chemicals by gene id.
*/
public
static
final
String
DISEASE_GENE_URL
=
"https://ctdbase.org/
detail.go?slimTerm=all&6578706f7274=1&qid=3464576&"
public
static
final
String
DISEASE_GENE_URL
=
URL
+
"
detail.go?slimTerm=all&6578706f7274=1&qid=3464576&"
+
"d-1332398-e=5&view=disease&type=gene&assnType=curated&acc="
;
/**
...
...
@@ -404,10 +404,10 @@ public class ChemicalParser extends CachableInterface implements IExternalServic
}
if
(
result
!=
null
)
{
MeSH
mesh
=
meshParser
.
getMeSH
(
result
.
getChemicalId
());
if
(
mesh
!=
null
)
{
result
.
addSynonyms
(
mesh
.
getSynonyms
());
if
(
mesh
!=
null
)
{
result
.
addSynonyms
(
mesh
.
getSynonyms
());
}
else
{
logger
.
warn
(
"Problematic mesh id: "
+
result
.
getChemicalId
());
logger
.
warn
(
"Problematic mesh id: "
+
result
.
getChemicalId
());
}
}
...
...
@@ -486,7 +486,7 @@ public class ChemicalParser extends CachableInterface implements IExternalServic
if
(
entrez
==
null
)
{
invalidHgnc
.
add
(
md
);
}
else
{
String
query
=
"https://ctdbase.org/
detail.go?type=gene&view=ixn&chemAcc="
+
chemID
.
getResource
()
+
"&acc="
String
query
=
URL
+
"
detail.go?type=gene&view=ixn&chemAcc="
+
chemID
.
getResource
()
+
"&acc="
+
entrez
.
getResource
();
String
referencesPage
=
getWebPageContent
(
query
);
Matcher
matcher
=
pattern
.
matcher
(
referencesPage
);
...
...
@@ -494,7 +494,7 @@ public class ChemicalParser extends CachableInterface implements IExternalServic
idx
.
add
(
matcher
.
group
(
1
));
}
for
(
String
string
:
idx
)
{
String
query2
=
"https://ctdbase.org/
detail.go?6578706f7274=1&d-1340579-e=5&type=relationship&ixnId="
String
query2
=
URL
+
"
detail.go?6578706f7274=1&d-1340579-e=5&type=relationship&ixnId="
+
string
;
String
referencesPage2
=
getWebPageContent
(
query2
);
String
[]
lines
=
referencesPage2
.
split
(
"\n"
);
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/PubmedParser.java
View file @
b306124f
...
...
@@ -57,7 +57,7 @@ public class PubmedParser extends CachableInterface implements IExternalService
/**
* Version of the remote API that is supported by this connecting class.
*/
static
final
String
SUPPORTED_VERSION
=
"6.
0.3
"
;
static
final
String
SUPPORTED_VERSION
=
"6.
1
"
;
static
final
String
API_URL
=
"https://www.ebi.ac.uk/europepmc/webservices/rest/"
;
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java
View file @
b306124f
...
...
@@ -16,7 +16,6 @@ import lcsb.mapviewer.common.exception.NotImplementedException;
import
lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerChemical
;
import
lcsb.mapviewer.model.map.BioEntity
;
import
lcsb.mapviewer.model.map.MiriamData
;
import
lcsb.mapviewer.model.map.MiriamRelationType
;
import
lcsb.mapviewer.model.map.MiriamType
;
import
lcsb.mapviewer.model.map.reaction.Reaction
;
import
lcsb.mapviewer.model.map.species.Chemical
;
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotator.java
View file @
b306124f
...
...
@@ -46,7 +46,7 @@ public class EnsemblAnnotator extends ElementAnnotator implements IExternalServi
/**
* Version of the rest API that is supported by this annotator.
*/
static
final
String
SUPPORTED_VERSION
=
"
9
.0"
;
static
final
String
SUPPORTED_VERSION
=
"
10
.0"
;
/**
* Url address of ensembl restful service.
...
...
annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotator.java
View file @
b306124f
...
...
@@ -9,10 +9,7 @@ import java.util.HashSet;
import
java.util.List
;
import
java.util.Set
;
import
javax.xml.parsers.DocumentBuilder
;
import
javax.xml.parsers.DocumentBuilderFactory
;
import
lcsb.mapviewer.common.XmlParser
;
import
org.apache.commons.text.StringEscapeUtils
;
import
org.apache.log4j.Logger
;
import
org.springframework.stereotype.Service
;
import
org.w3c.dom.Node
;
...
...
@@ -27,6 +24,7 @@ import lcsb.mapviewer.annotation.services.ExternalServiceStatus;
import
lcsb.mapviewer.annotation.services.ExternalServiceStatusType
;
import
lcsb.mapviewer.annotation.services.IExternalService
;
import
lcsb.mapviewer.annotation.services.WrongResponseCodeIOException
;
import
lcsb.mapviewer.common.XmlParser
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.common.exception.InvalidXmlSchemaException
;
import
lcsb.mapviewer.common.exception.NotImplementedException
;
...
...
@@ -266,7 +264,7 @@ public class EntrezAnnotator extends ElementAnnotator implements IExternalServic
Node
node
=
list
.
item
(
i
);
if
(
node
.
getNodeType
()
==
Node
.
ELEMENT_NODE
)
{
if
(
node
.
getNodeName
().
equals
(
"Gene-ref_syn_E"
))
{
synonyms
.
add
(
node
.
getTextContent
());
synonyms
.
add
(
StringEscapeUtils
.
unescapeHtml4
(
node
.
getTextContent
())
)
;
}
}
}
...
...
annotation/src/test/java/lcsb/mapviewer/annotation/services/DrugbankHTMLParserTest.java
View file @
b306124f
...
...
@@ -156,7 +156,6 @@ public class DrugbankHTMLParserTest extends AnnotationTestFunctions {
assertNotNull
(
drug
);
assertTrue
(
drug
.
getBrandNames
().
contains
(
"PK-Merz"
));
assertTrue
(
drug
.
getBrandNames
().
contains
(
"Symadine"
));
assertTrue
(
drug
.
getBrandNames
().
contains
(
"Symmetrel"
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
...
...
annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotatorTest.java
View file @
b306124f
...
...
@@ -271,6 +271,23 @@ public class EntrezAnnotatorTest extends AnnotationTestFunctions {
}
}
@Test
public
void
testAnnotateElementWithEncodedSynonyms
()
throws
Exception
{
try
{
Species
proteinAlias
=
new
GenericProtein
(
"id"
);
proteinAlias
.
addMiriamData
(
new
MiriamData
(
MiriamType
.
ENTREZ
,
"834106"
));
entrezAnnotator
.
annotateElement
(
proteinAlias
);
for
(
String
synonym
:
proteinAlias
.
getSynonyms
())
{
assertFalse
(
"Invalid character found in synonym: "
+
synonym
,
synonym
.
contains
(
"&"
));
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testParseEntrezResponse
()
throws
Exception
{
WebPageDownloader
downloader
=
entrezAnnotator
.
getWebPageDownloader
();
...
...
commons/src/main/java/lcsb/mapviewer/common/Comparator.java
View file @
b306124f
...
...
@@ -8,7 +8,10 @@ import org.apache.log4j.Logger;
import
lcsb.mapviewer.common.exception.NotImplementedException
;
public
abstract
class
Comparator
<
T
extends
Object
>
implements
java
.
util
.
Comparator
<
T
>
{
Logger
logger
=
Logger
.
getLogger
(
Comparator
.
class
);
/**
* Default class logger.
*/
private
static
Logger
logger
=
Logger
.
getLogger
(
Comparator
.
class
);
private
Class
<
T
>
comparatorClazz
;
private
boolean
exactClassMatch
;
private
List
<
Comparator
<?
extends
T
>>
subClassComparatorList
=
new
ArrayList
<>();
...
...
commons/src/main/java/lcsb/mapviewer/common/Configuration.java
View file @
b306124f
...
...
@@ -151,6 +151,11 @@ public final class Configuration {
*/
private
static
List
<
String
>
xFrametDomain
=
new
ArrayList
<>();
/**
* Should CORS be disabled.
*/
private
static
boolean
disableCors
=
false
;
/**
* Directory where tomcat webapp folder is located. Default value is "." because
* it should be set to proper value when tomcat application is deployed and run.
...
...
@@ -438,4 +443,12 @@ public final class Configuration {
Configuration
.
sessionLength
=
sessionLength
;
}
public
static
boolean
isDisableCors
()
{
return
disableCors
;
}
public
static
void
setDisableCors
(
boolean
disableCors
)
{
Configuration
.
disableCors
=
disableCors
;
}
}
commons/src/main/java/lcsb/mapviewer/common/XmlParser.java
View file @
b306124f
...
...
@@ -2,6 +2,7 @@ package lcsb.mapviewer.common;
import
java.awt.Color
;
import
java.io.BufferedReader
;
import
java.io.ByteArrayInputStream
;
import
java.io.FileReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
...
...
@@ -14,13 +15,18 @@ import javax.xml.parsers.DocumentBuilder;
import
javax.xml.parsers.DocumentBuilderFactory
;
import
javax.xml.parsers.ParserConfigurationException
;
import
javax.xml.transform.OutputKeys
;
import
javax.xml.transform.Result
;
import
javax.xml.transform.Source
;
import
javax.xml.transform.Templates
;
import
javax.xml.transform.Transformer
;
import
javax.xml.transform.TransformerException
;
import
javax.xml.transform.TransformerFactory
;
import
javax.xml.transform.dom.DOMSource
;
import
javax.xml.transform.stream.StreamResult
;
import
javax.xml.transform.stream.StreamSource
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.io.output.ByteArrayOutputStream
;
import
org.apache.commons.text.StringEscapeUtils
;
import
org.apache.log4j.Logger
;
import
org.w3c.dom.Document
;
...
...
@@ -31,6 +37,7 @@ import org.xml.sax.InputSource;
import
org.xml.sax.SAXException
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.common.exception.InvalidStateException
;
import
lcsb.mapviewer.common.exception.InvalidXmlSchemaException
;
/**
...
...
@@ -78,7 +85,8 @@ final public class XmlParser {
}
/**
* private constructor. This class has no state and contains only static utility methods.
* private constructor. This class has no state and contains only static utility
* methods.
*/
private
XmlParser
()
{
}
...
...
@@ -222,7 +230,8 @@ final public class XmlParser {
* @throws InvalidXmlSchemaException
* thrown when there is a problem with xml
*/
public
static
Document
getXmlDocumentFromString
(
final
String
text
,
boolean
validate
)
throws
InvalidXmlSchemaException
{
public
static
Document
getXmlDocumentFromString
(
final
String
text
,
boolean
validate
)
throws
InvalidXmlSchemaException
{
InputSource
is
=
new
InputSource
();
is
.
setCharacterStream
(
new
StringReader
(
text
));
try
{
...
...
@@ -398,4 +407,30 @@ final public class XmlParser {
}
return
result
;
}
public
static
String
lowercaseXmlNames
(
String
inputXml
)
{
try
{
TransformerFactory
factory
=
TransformerFactory
.
newInstance
();
// Use the factory to create a template containing the xsl file
Templates
template
=
factory
.
newTemplates
(
new
StreamSource
(
ClassLoader
.
getSystemResourceAsStream
(
"to_lowercase.xsl"
)));
// Use the template to create a transformer
Transformer
xformer
=
template
.
newTransformer
();
ByteArrayOutputStream
output
=
new
ByteArrayOutputStream
();
// Prepare the input and output files
Source
source
=
new
StreamSource
(
new
ByteArrayInputStream
(
inputXml
.
getBytes
()));
Result
result
=
new
StreamResult
(
output
);
// Apply the xsl file to the source file and write the result
// to the output file
xformer
.
transform
(
source
,
result
);
return
output
.
toString
(
"UTF-8"
);
}
catch
(
Exception
e
)
{
throw
new
InvalidStateException
(
"Problem with translating input xml"
,
e
);
}
}
}
commons/src/main/java/lcsb/mapviewer/common/comparator/CalendarComparator.java
0 → 100644
View file @
b306124f
package
lcsb.mapviewer.common.comparator
;
import
java.util.Calendar
;
import
java.util.Comparator
;
/**
* Comparator implementation for {@link Calendar} class.
*
* @author Piotr Gawron
*
*/
public
class
CalendarComparator
implements
Comparator
<
Calendar
>
{
@Override
public
int
compare
(
Calendar
arg0
,
Calendar
arg1
)
{
if
(
arg0
==
null
)
{
if
(
arg1
==
null
)
{
return
0
;
}
else
{
return
1
;
}
}
else
if
(
arg1
==
null
)
{
return
-
1
;
}
return
((
Long
)
arg0
.
getTimeInMillis
()).
compareTo
(
arg1
.
getTimeInMillis
());
}
}
commons/src/main/java/lcsb/mapviewer/common/comparator/IntegerComparator.java
View file @
b306124f
...
...
@@ -10,18 +10,18 @@ import java.util.Comparator;
*/
public
class
IntegerComparator
implements
Comparator
<
Integer
>
{
@Override
public
int
compare
(
Integer
arg0
,
Integer
arg1
)
{
if
(
arg0
==
null
)
{
if
(
arg1
==
null
)
{
return
0
;
}
else
{
return
1
;
}
}
else
if
(
arg1
==
null
)
{
return
-
1
;
}
return
arg0
.
compareTo
(
arg1
);
}
@Override
public
int
compare
(
Integer
arg0
,
Integer
arg1
)
{
if
(
arg0
==
null
)
{
if
(
arg1
==
null
)
{
return
0
;
}
else
{
return
1
;
}
}
else
if
(
arg1
==
null
)
{
return
-
1
;
}
return
arg0
.
compareTo
(
arg1
);
}
}
commons/src/main/resources/to_lowercase.xsl
0 → 100644
View file @
b306124f
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
version=
"1.0"
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
>
<xsl:variable
name=
"lcase"
>
abcdefghijklmnopqrstuvwxyz
</xsl:variable>
<xsl:variable
name=
"ucase"
>
ABCDEFGHIJKLMNOPQRSTUVWXYZ
</xsl:variable>
<xsl:template
match=
"@*|node()"
>
<xsl:copy>
<xsl:apply-templates
select=
"@*|node()"
/>
</xsl:copy>
</xsl:template>
<xsl:template
match=
"*"
>
<xsl:element
name=
"{translate(local-name(),$ucase,$lcase)}"
>
<xsl:apply-templates
select=
"@*|node()"
/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
commons/src/test/java/lcsb/mapviewer/common/XmlParserTest.java
View file @
b306124f
...
...
@@ -149,7 +149,7 @@ public class XmlParserTest {
}
boolean
threadSucceded
;
@Test
public
void
testConcurrencyParse
()
throws
Exception
{
try
{
...
...
@@ -182,7 +182,6 @@ public class XmlParserTest {
}
@Test
public
void
testInvalidNodeToString
()
throws
Exception
{
try
{
...
...
@@ -451,4 +450,19 @@ public class XmlParserTest {
throw
e
;
}
}
@Test
public
void
testLowercaseXmlNames
()
throws
Exception
{
try
{
String
inputXml
=
"<node><ASD>Test</ASD></node>"
;
String
outputXml
=
XmlParser
.
lowercaseXmlNames
(
inputXml
);
assertTrue
(
outputXml
.
indexOf
(
"asd"
)
>=
0
);
assertTrue
(
outputXml
.
indexOf
(
"Test"
)
>=
0
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
}
converter-CellDesigner/pom.xml
View file @
b306124f
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
...
...
converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerXmlParser.java
View file @
b306124f
...
...
@@ -22,6 +22,7 @@ import lcsb.mapviewer.common.exception.InvalidXmlSchemaException;
import
lcsb.mapviewer.converter.Converter
;
import
lcsb.mapviewer.converter.ConverterParams
;
import
lcsb.mapviewer.converter.InvalidInputDataExecption
;
import
lcsb.mapviewer.converter.ZIndexPopulator
;
import
lcsb.mapviewer.converter.annotation.XmlAnnotationParser
;
import
lcsb.mapviewer.converter.model.celldesigner.alias.AliasCollectionXmlParser
;
import
lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser
;
...
...
@@ -144,7 +145,10 @@ public class CellDesignerXmlParser extends Converter {
}
// we ignore metaid - it's useless and obstruct data model
// model.setMetaId(XmlParser.getNodeAttr("metaId", modelNode));
model
.
setIdModel
(
XmlParser
.
getNodeAttr
(
"id"
,
modelNode
));
String
modelId
=
XmlParser
.
getNodeAttr
(
"id"
,
modelNode
);
if
(
modelId
!=
null
&&
!
modelId
.
isEmpty
())
{
model
.
setIdModel
(
modelId
);
}
Node
compartmentNode
=
XmlParser
.
getNode
(
"listOfCompartments"
,
modelNode
.
getChildNodes
());