diff --git a/CHANGELOG b/CHANGELOG index 493a5fbd27a4164acabd1f07d47e3f9178a7a1d8..f96dba83806fbfd4aa90b7f5d08ebe73756873a9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +minerva (17.1.1) unstable; urgency=medium + * Bug fix: sometimes there was a deadlock when uploading a project due (#2069) + + -- Piotr Gawron <piotr.gawron@uni.lu> Thu, 29 Aug 2024 13:00:00 +0200 + minerva (17.1.0) unstable; urgency=medium * Improvement: downloadModel API call contains strictCutoff parameter (default=true) to allow selecting reaction that cross polygon (#1769) diff --git a/CellDesigner-plugin/pom.xml b/CellDesigner-plugin/pom.xml index 8f07c889ecf60659b46f4e50cd5a8f1767dbb438..6508b076a65158401be488979a4c2b46f01cfdff 100644 --- a/CellDesigner-plugin/pom.xml +++ b/CellDesigner-plugin/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>CellDesigner-plugin</artifactId> <!-- dependency from the MapViewer model --> @@ -50,19 +50,19 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>commons</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter-CellDesigner</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> diff --git a/annotation/pom.xml b/annotation/pom.xml index a4cc3d91cbc366443584e87f85500f7bdfd5e297..67b6180d20da47b708d2aa5037f43b6d52cf2b37 100644 --- a/annotation/pom.xml +++ b/annotation/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>annotation</artifactId> <name>Annotation module</name> @@ -19,7 +19,7 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- dependency from the MapViewer dao --> @@ -27,7 +27,7 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>persist</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- dependency from the MapViewer cell designer parser (we need access @@ -35,13 +35,13 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter-CellDesigner</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- Log4J2 --> diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/TairAnnotatorImpl.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/TairAnnotatorImpl.java index 26ccb290800c8e632942e9afad1ec921746c7757..e00d05a9bdc5e32800304b9248c04ed6b386c7c7 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/TairAnnotatorImpl.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/TairAnnotatorImpl.java @@ -50,7 +50,7 @@ public class TairAnnotatorImpl extends ElementAnnotator implements TairAnnotator private static final Logger logger = LogManager.getLogger(); - private static final String URL_SOURCE_DATABASE = "https://www.arabidopsis.org/api/download-files/download?filePath=Proteins%2FId_conversions%2FArchived%2FTAIR2UniprotMapping-Jul2023.txt"; + private static final String URL_SOURCE_DATABASE = "https://minerva-dev.lcsb.uni.lu/TAIR2UniprotMapping-Jul2023.txt"; private static final int BUFFER_SIZE = 1024; diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/TairAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/TairAnnotatorTest.java index fdd94a21df47de804eca15a861d79efb37ba3a44..d0741fdf9ca83ebc3c6355559ef69b15c3304dfc 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/TairAnnotatorTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/TairAnnotatorTest.java @@ -1,17 +1,5 @@ package lcsb.mapviewer.annotation.services.annotators; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.Collection; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.util.ReflectionTestUtils; - import lcsb.mapviewer.annotation.AnnotationTestFunctions; import lcsb.mapviewer.annotation.cache.GeneralCacheInterface; import lcsb.mapviewer.annotation.cache.WebPageDownloader; @@ -21,6 +9,17 @@ import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.species.GenericProtein; import lcsb.mapviewer.model.map.species.Species; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.util.ReflectionTestUtils; + +import java.util.Collection; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; public class TairAnnotatorTest extends AnnotationTestFunctions { @@ -30,7 +29,7 @@ public class TairAnnotatorTest extends AnnotationTestFunctions { @Autowired private GeneralCacheInterface cache; - private WebPageDownloader webPageDownloader = new WebPageDownloader(); + private final WebPageDownloader webPageDownloader = new WebPageDownloader(); @Before public void setUp() { @@ -88,15 +87,15 @@ public class TairAnnotatorTest extends AnnotationTestFunctions { tairAnnotator.annotateElement(protein); - int cntUniProts = 0; + int countUniprot = 0; for (final MiriamData md : protein.getMiriamData()) { if (md.getDataType().equals(MiriamType.UNIPROT)) { - cntUniProts++; + countUniprot++; } } - assertTrue("No UNIPROT annotation extracted from TAIR annotator", cntUniProts > 1); + assertTrue("No UNIPROT annotation extracted from TAIR annotator", countUniprot > 1); } @Test @@ -140,13 +139,13 @@ public class TairAnnotatorTest extends AnnotationTestFunctions { @Test public void testTairToUniprotFromKEGG() throws Exception { - // TAIR Loci comming from annotators should be ignored by TAIR (only TAIR + // TAIR Loci coming from annotators should be ignored by TAIR (only TAIR // LOCI provided by the human annotator should be considered) Species protein = new GenericProtein("id"); protein.setName("bla"); protein.addMiriamData(new MiriamData(MiriamType.TAIR_LOCUS, "2200427", KeggAnnotator.class)); tairAnnotator.annotateElement(protein); - assertTrue(protein.getMiriamData().size() == 1); + assertEquals(1, protein.getMiriamData().size()); } @Test diff --git a/commons/pom.xml b/commons/pom.xml index ddef5cdbb7a574bf4820c9a96fc1f7d706ad8b84..e6f14fcc11859fefee1f8d900d4d2998cfd81d5f 100644 --- a/commons/pom.xml +++ b/commons/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>commons</artifactId> <name>Mapviewer commons</name> diff --git a/converter-CellDesigner/pom.xml b/converter-CellDesigner/pom.xml index 8f6e65f0f971038e6ca25e0c614142b7f80170b3..f7928409ef236f9587074927e5be3b79dd4b76c1 100644 --- a/converter-CellDesigner/pom.xml +++ b/converter-CellDesigner/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>converter-CellDesigner</artifactId> <name>CellDesigner converter</name> @@ -17,13 +17,13 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- Log4J2 --> diff --git a/converter-SBGNML/pom.xml b/converter-SBGNML/pom.xml index e7c66bcda74245f5f4d6ffdc39ca6d195df549c4..d2afce40115f512de33a34b2cd155a299e654d66 100644 --- a/converter-SBGNML/pom.xml +++ b/converter-SBGNML/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>converter-SBGNML</artifactId> @@ -20,26 +20,26 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>persist</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> <scope>test</scope> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter-CellDesigner</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter-graphics</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> diff --git a/converter-graphics/pom.xml b/converter-graphics/pom.xml index 8b77ca66a71978b529dd1dc3d25da35b7c2d81f9..2f6013be71d07073e782a06b9ea8eb311d3602a2 100644 --- a/converter-graphics/pom.xml +++ b/converter-graphics/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>converter-graphics</artifactId> <name>MapViewer graphics converter</name> @@ -18,13 +18,13 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model-command</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- Log4J2 --> diff --git a/converter-sbml/pom.xml b/converter-sbml/pom.xml index de6b7d476d01a6160547504e06f9bc41e5861122..9c20cb13815a7cb5e638e54644fe213c54e7f89a 100644 --- a/converter-sbml/pom.xml +++ b/converter-sbml/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>converter-sbml</artifactId> <name>converter-sbml</name> @@ -40,22 +40,22 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model-command</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter-CellDesigner</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- Log4J2 --> @@ -167,7 +167,7 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter-graphics</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> <scope>test</scope> </dependency> diff --git a/converter/pom.xml b/converter/pom.xml index d69a4b09124d420ae78e9a8943b584d9a5c8bbae..131e80d7249d91d60446302b150ff13cdb41f738 100644 --- a/converter/pom.xml +++ b/converter/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>converter</artifactId> @@ -15,7 +15,7 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>xerces</groupId> diff --git a/frontend-js/pom.xml b/frontend-js/pom.xml index 5bd97ae4414f22baa716e9c02e26cd8f7c88236e..ec5d8e0a1fd000caea4df38eb5a21c1700e2d4b8 100644 --- a/frontend-js/pom.xml +++ b/frontend-js/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>frontend-js</artifactId> <name>frontend-js</name> diff --git a/model-command/pom.xml b/model-command/pom.xml index 0bb694f02687ab670477188c538472b74c1781ca..c59505c996603cb0452cbe2186ace3a9902403bc 100644 --- a/model-command/pom.xml +++ b/model-command/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>model-command</artifactId> <name>Model commands</name> @@ -16,7 +16,7 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> @@ -24,7 +24,7 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter-CellDesigner</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- Log4J2--> diff --git a/model/pom.xml b/model/pom.xml index e5f15286b35ad29e78b435022f993bc668804e8f..ac6d49db43e964d0d820db4b6c8f8b024916187b 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>model</artifactId> <name>model MapViewer</name> @@ -15,7 +15,7 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>commons</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- Java xml serialization --> diff --git a/pathvisio/pom.xml b/pathvisio/pom.xml index 97ea99b0d414c5d16b5b4b64755fb78878610a0b..e0bb5e020f268a70fabe8d2ec52bae7f8152f099 100644 --- a/pathvisio/pom.xml +++ b/pathvisio/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>pathvisio</artifactId> <name>Pathvisio plugin</name> @@ -77,26 +77,26 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter-CellDesigner</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter-graphics</artifactId> <scope>test</scope> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model-command</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- Log4J2 --> diff --git a/persist/pom.xml b/persist/pom.xml index b7b4648513e72b72eac0b3221c837da62b60ddc3..ab652879069b04c879d0113dd5b102b568e4a0da 100644 --- a/persist/pom.xml +++ b/persist/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>persist</artifactId> @@ -26,7 +26,7 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- Hibernate --> diff --git a/pom.xml b/pom.xml index 3b26d9816004063629dda49cc28d8a9e39fc55cb..84aa63f6e139d5eee0c2e507b8bf51ded992a48e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> <packaging>pom</packaging> <name>parent MapViewer</name> diff --git a/rest-api/pom.xml b/rest-api/pom.xml index 426d2b9dbd316e57391d6ed5b763e64ea6a04d69..ca69ab18bd95921aa64e7922fd17bf4fc691c268 100644 --- a/rest-api/pom.xml +++ b/rest-api/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>rest-api</artifactId> <name>rest-api</name> @@ -19,19 +19,19 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>service</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>pathvisio</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> diff --git a/service/pom.xml b/service/pom.xml index d2b62f9cf1ef27f7340ea4747ddb5e36721e72ed..f18dfa8796b8255173cba04a9dc5e49926ca0fab 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>service</artifactId> @@ -20,7 +20,7 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- dependency from the MapViewer dao --> @@ -28,47 +28,47 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>persist</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>model-command</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>annotation</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- dependency from the MapViewer cell designer parser --> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter-CellDesigner</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- dependency from the MapViewer SBGN-ML parser --> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter-SBGNML</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- dependency from the MapViewer graphics converter --> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter-graphics</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- dependency from the SBML parser --> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>converter-sbml</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <!-- Log4J2 --> diff --git a/service/src/main/java/lcsb/mapviewer/services/impl/MinervaJobService.java b/service/src/main/java/lcsb/mapviewer/services/impl/MinervaJobService.java index c12eced06e5763f9fac5bf94da87eb18a41a2b03..d8d715af1455901dd8d410f916666eadb8befd28 100644 --- a/service/src/main/java/lcsb/mapviewer/services/impl/MinervaJobService.java +++ b/service/src/main/java/lcsb/mapviewer/services/impl/MinervaJobService.java @@ -1,32 +1,5 @@ package lcsb.mapviewer.services.impl; -import java.sql.SQLException; -import java.util.Calendar; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadFactory; - -import javax.annotation.PostConstruct; - -import org.apache.commons.lang3.exception.ExceptionUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringApplication; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.jdbc.datasource.init.ScriptException; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - import lcsb.mapviewer.annotation.cache.CacheQueryMinervaJob; import lcsb.mapviewer.annotation.cache.GeneralCacheInterface; import lcsb.mapviewer.common.MinervaConfigurationHolder; @@ -41,13 +14,38 @@ import lcsb.mapviewer.persist.CustomDatabasePopulator; import lcsb.mapviewer.persist.dao.MinervaJobDao; import lcsb.mapviewer.persist.dao.cache.CacheTypeDao; import lcsb.mapviewer.services.interfaces.IMinervaJobService; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.jdbc.datasource.init.ScriptException; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.PostConstruct; +import java.sql.SQLException; +import java.util.Calendar; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadFactory; @Service public class MinervaJobService implements IMinervaJobService, ApplicationContextAware { private ApplicationContext context; - private Logger logger = LogManager.getLogger(); + private final Logger logger = LogManager.getLogger(); private MinervaJobDao minervaJobDao; @@ -72,7 +70,7 @@ public class MinervaJobService implements IMinervaJobService, ApplicationContext @Autowired public MinervaJobService(final MinervaJobDao minervaJobDao, final GeneralCacheInterface cache, final CacheTypeDao cacheTypeDao, - final CustomDatabasePopulator flyway, final MinervaConfigurationHolder configurationHolder) { + final CustomDatabasePopulator flyway, final MinervaConfigurationHolder configurationHolder) { this.minervaJobDao = minervaJobDao; this.cache = cache; this.cacheTypeDao = cacheTypeDao; diff --git a/service/src/main/java/lcsb/mapviewer/services/impl/ProjectService.java b/service/src/main/java/lcsb/mapviewer/services/impl/ProjectService.java index 986a755f28c646a1236f5dd599c0ee308a8ce89f..7f5decb95b9ec68d675d5d1568966ab83cac02fc 100644 --- a/service/src/main/java/lcsb/mapviewer/services/impl/ProjectService.java +++ b/service/src/main/java/lcsb/mapviewer/services/impl/ProjectService.java @@ -398,18 +398,18 @@ public class ProjectService implements IProjectService { } } - @Override public Project createProject(final CreateProjectParams params) { Project project2 = self.getProjectByProjectId(params.getProjectId()); if (project2 == null) { - logger.error("Project with given id does not exist: " + params.getProjectId()); + logger.error("Project with given id does not exist: {}", params.getProjectId()); return null; } + //noinspection MismatchedReadAndWriteOfArray double[] outOfMemoryBuffer; MinervaLoggerAppender appender = MinervaLoggerAppender.createAppender(); try { UploadedFileEntry file = fileService.getById(params.getProjectFileId()); - logger.debug("Running: " + params.getProjectId() + "; fileId=" + params.getProjectFileId()); + logger.debug("Running: {}; fileId={}", params.getProjectId(), params.getProjectFileId()); outOfMemoryBuffer = new double[OUT_OF_MEMORY_BACKUP_BUFFER_SIZE]; for (int i = 0; i < OUT_OF_MEMORY_BACKUP_BUFFER_SIZE; i++) { outOfMemoryBuffer[i] = Math.random() * OUT_OF_MEMORY_BACKUP_BUFFER_SIZE; @@ -432,14 +432,14 @@ public class ProjectService implements IProjectService { if (params.isCacheModel()) { self.cacheData(params.getProjectId()); } else { - self.createRefreshDrugInfoJobs(params.getProjectId()); - self.createRefreshChemicalInfoJobs(params.getProjectId()); - self.createRefreshMiRnaInfoJobs(params.getProjectId()); + createRefreshDrugInfoJobs(params.getProjectId()); + createRefreshChemicalInfoJobs(params.getProjectId()); + createRefreshMiRnaInfoJobs(params.getProjectId()); } - self.createRefreshMiriamInfoJobs(params.getProjectId()); + createRefreshMiriamInfoJobs(params.getProjectId()); self.updateProjectStatus(params.getProjectId(), ProjectStatus.DONE, IProgressUpdater.MAX_PROGRESS); - if (params.getNotifyEmail() != null && !params.getNotifyEmail().equals("")) { + if (params.getNotifyEmail() != null && !params.getNotifyEmail().isEmpty()) { try { sendSuccesfullEmail(params); } catch (MessagingException e) { @@ -447,13 +447,13 @@ public class ProjectService implements IProjectService { } } - logger.info("Project " + params.getProjectId() + " created successfully."); + logger.info("Project {} created successfully.", params.getProjectId()); } catch (PersistenceException e) { outOfMemoryBuffer = null; logger.error("Problem with database", e); self.projectFailure(params.getProjectId(), ProjectLogEntryType.DATABASE_PROBLEM, "Problem with uploading to database. " - + "You might violated some unhandled constraints or you run out of memory. Underlaying eror:\n" + + "You might violated some unhandled constraints or you run out of memory. Underlying error:\n" + e.getMessage() + "\nMore information can be found in log file.", e); } catch (OutOfMemoryError oome) { @@ -492,69 +492,42 @@ public class ProjectService implements IProjectService { } - @Override public void createRefreshMiriamInfoJobs(final String projectId) { - Project project = self.getProjectByProjectId(projectId, true); - for (ModelData model : project.getModels()) { - for (Element bioEntity : model.getElements()) { - for (MiriamData md : bioEntity.getMiriamData()) { - minervaJobService.addJob(createRefreshMiriamInfoJob(md)); - } - } - for (Reaction bioEntity : model.getReactions()) { - for (MiriamData md : bioEntity.getMiriamData()) { - minervaJobService.addJob(createRefreshMiriamInfoJob(md)); - } - } - for (MiriamData md : model.getMiriamData()) { - minervaJobService.addJob(createRefreshMiriamInfoJob(md)); - } + for (MiriamData miriamData : self.getMiriamForProject(projectId)) { + minervaJobService.addJob(createRefreshMiriamInfoJob(miriamData)); } } - @Override public void createRefreshDrugInfoJobs(final String projectId) { - Project project = self.getProjectByProjectId(projectId, true); - Set<MiriamData> set = new HashSet<>(); - for (ModelData model : project.getModels()) { - for (Element bioEntity : model.getElements()) { - set.addAll(bioEntity.getMiriamData()); - } - for (Reaction bioEntity : model.getReactions()) { - set.addAll(bioEntity.getMiriamData()); - } - } - for (MiriamData miriamData : set) { + for (MiriamData miriamData : self.getMiriamForProject(projectId)) { minervaJobService.addJob(createRefreshDrugInfoJob(miriamData)); } } - @Override public void createRefreshChemicalInfoJobs(final String projectId) { Project project = self.getProjectByProjectId(projectId, true); MiriamData disease = project.getDisease(); if (disease != null) { - - Set<MiriamData> set = new HashSet<>(); - for (ModelData model : project.getModels()) { - for (Element bioEntity : model.getElements()) { - set.addAll(bioEntity.getMiriamData()); - } - for (Reaction bioEntity : model.getReactions()) { - set.addAll(bioEntity.getMiriamData()); - } - } - for (MiriamData miriamData : set) { + for (MiriamData miriamData : self.getMiriamForProject(projectId)) { minervaJobService.addJob(createRefreshChemicalInfoJob(miriamData, disease)); } } } - @Override public void createRefreshMiRnaInfoJobs(final String projectId) { + for (MiriamData miriamData : self.getMiriamForProject(projectId)) { + minervaJobService.addJob(createRefreshMiRnaInfoJob(miriamData)); + } + } + + @Override + public Set<MiriamData> getMiriamForProject(final String projectId) { Project project = self.getProjectByProjectId(projectId, true); Set<MiriamData> set = new HashSet<>(); + for (ModelData model : project.getModels()) { + set.addAll(model.getMiriamData()); + for (Element bioEntity : model.getElements()) { set.addAll(bioEntity.getMiriamData()); } @@ -562,9 +535,7 @@ public class ProjectService implements IProjectService { set.addAll(bioEntity.getMiriamData()); } } - for (MiriamData miriamData : set) { - minervaJobService.addJob(createRefreshMiRnaInfoJob(miriamData)); - } + return set; } private MinervaJob createRefreshDrugInfoJob(final MiriamData md) { diff --git a/service/src/main/java/lcsb/mapviewer/services/interfaces/IProjectService.java b/service/src/main/java/lcsb/mapviewer/services/interfaces/IProjectService.java index d6bb975def0c468a690790efba2682fe9acaac83..3bebb31582068fd70545a6f6ee1d88fe6b912f35 100644 --- a/service/src/main/java/lcsb/mapviewer/services/interfaces/IProjectService.java +++ b/service/src/main/java/lcsb/mapviewer/services/interfaces/IProjectService.java @@ -1,11 +1,5 @@ package lcsb.mapviewer.services.interfaces; -import java.io.IOException; -import java.util.List; -import java.util.Set; - -import org.springframework.transaction.annotation.Transactional; - import lcsb.mapviewer.commands.CommandExecutionException; import lcsb.mapviewer.converter.ConverterException; import lcsb.mapviewer.converter.InvalidInputDataExecption; @@ -17,28 +11,31 @@ import lcsb.mapviewer.model.ProjectStatus; import lcsb.mapviewer.model.cache.UploadedFileEntry; import lcsb.mapviewer.model.job.MinervaJob; import lcsb.mapviewer.model.job.MinervaJobExecutor; +import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.layout.ProjectBackground; import lcsb.mapviewer.model.overlay.InvalidDataOverlayException; import lcsb.mapviewer.model.user.User; import lcsb.mapviewer.model.user.UserAnnotationSchema; import lcsb.mapviewer.services.ObjectNotFoundException; import lcsb.mapviewer.services.utils.CreateProjectParams; +import org.springframework.transaction.annotation.Transactional; + +import java.io.IOException; +import java.util.List; +import java.util.Set; /** * Service that manages projects. - * + * * @author Piotr Gawron - * */ public interface IProjectService extends MinervaJobExecutor { /** - * Returns a project with a give {@link Project#projectId project identifier}. - * - * @param projectId - * {@link Project#projectId project identifier} - * @return project with an identifier given as parameter. Null if such project - * doesn't exist. + * Returns a project with a give {@link Project#getProjectId() project identifier}. + * + * @param projectId {@link Project#getProjectId()} project identifier} + * @return project with an identifier given as parameter. Null if such project doesn't exist. */ @Transactional Project getProjectByProjectId(final String projectId); @@ -47,19 +44,17 @@ public interface IProjectService extends MinervaJobExecutor { Project getProjectByProjectId(final String projectId, final boolean initializeLazy); /** - * Checks if project with a given {@link Project#projectId identifier} exists. - * - * @param projectId - * {@link Project#projectId project identifier} - * @return <code>true</code> if the project with the given name exists, - * <code>false</code> otherwise + * Checks if project with a given {@link Project#getProjectId() identifier} exists. + * + * @param projectId {@link Project#getProjectId()} project identifier} + * @return <code>true</code> if the project with the given name exists, <code>false</code> otherwise */ @Transactional boolean projectExists(final String projectId); /** * Returns list of all projects. - * + * * @return list of all projects. */ @Transactional @@ -70,30 +65,24 @@ public interface IProjectService extends MinervaJobExecutor { /** * Removes project from the system. - * - * @param project - * object to remove + * + * @param project object to remove */ @Transactional MinervaJob submitRemoveProjectJob(final Project project); /** * Creates project using give parameters. See {@link CreateProjectParams}. - * - * @param params - * information about project to create + * + * @param params information about project to create */ @Transactional MinervaJob submitCreateProjectJob(final CreateProjectParams params) throws SecurityException; - @Transactional - Project createProject(final CreateProjectParams params) throws SecurityException; - /** * Method that updates information about raw {@link Project} object. - * - * @param project - * project to update + * + * @param project project to update */ @Transactional void updateProject(final Project project); @@ -148,14 +137,10 @@ public interface IProjectService extends MinervaJobExecutor { /** * This method creates set of images for the model backgrounds. * - * @param params - * configuration parameters including set of backgrounds to generate - * @throws IOException - * thrown when there are problems with generating files - * @throws DrawingException - * thrown when there was a problem with drawing a map - * @throws CommandExecutionException - * thrown when one of the files describing backgrounds is invalid + * @param params configuration parameters including set of backgrounds to generate + * @throws IOException thrown when there are problems with generating files + * @throws DrawingException thrown when there was a problem with drawing a map + * @throws CommandExecutionException thrown when one of the files describing backgrounds is invalid */ @Transactional void createImages(CreateProjectParams params) throws IOException, DrawingException, CommandExecutionException; @@ -166,12 +151,9 @@ public interface IProjectService extends MinervaJobExecutor { /** * Sends email about unsuccessful project creation. * - * @param projectName - * name of the project - * @param email - * email where we want to send information - * @param e - * exception that caused problem + * @param projectName name of the project + * @param email email where we want to send information + * @param e exception that caused problem */ @Transactional void sendUnsuccesfullEmail(String projectName, String email, Throwable e); @@ -179,12 +161,9 @@ public interface IProjectService extends MinervaJobExecutor { /** * Updates status of the generating project. * - * @param projectId - * project that is generated - * @param status - * what is the current status - * @param progress - * what is the progress + * @param projectId project that is generated + * @param status what is the current status + * @param progress what is the progress */ @Transactional void updateProjectStatus(String projectId, ProjectStatus status, double progress); @@ -192,9 +171,6 @@ public interface IProjectService extends MinervaJobExecutor { @Transactional void addLogEntries(String projectId, Set<ProjectLogEntry> createLogEntries); - @Transactional - void createRefreshMiriamInfoJobs(String projectId); - @Transactional void submitArchiveProjectJob(String projectId); @@ -207,12 +183,6 @@ public interface IProjectService extends MinervaJobExecutor { void reviveBackgrounds(String projectId); @Transactional - void createRefreshDrugInfoJobs(String projectId); - - @Transactional - void createRefreshChemicalInfoJobs(String projectId); - - @Transactional - void createRefreshMiRnaInfoJobs(String projectId); + Set<MiriamData> getMiriamForProject(String projectId); } diff --git a/web/pom.xml b/web/pom.xml index bb9c1becabe3029bcb157cc01fbc18a34b177535..e9856a891bf0dc654162832ac162bfe8f3853b98 100644 --- a/web/pom.xml +++ b/web/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>lcsb.mapviewer</groupId> <artifactId>parent</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </parent> <artifactId>web</artifactId> <packaging>jar</packaging> @@ -36,19 +36,19 @@ <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>service</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>rest-api</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency> <groupId>lcsb.mapviewer</groupId> <artifactId>frontend-js</artifactId> - <version>17.1.0</version> + <version>17.1.1</version> </dependency> <dependency>