diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a7e56170549c3552ffb1cd550b2d9b0e211a45bb..67bc8938d2b807f120bbd38134a8889ab6177daa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,6 +14,8 @@ stages: - release - upgrade - clean + - schedule + - scheduled-jobs # Define global variables variables: diff --git a/pom.xml b/pom.xml index b7e4193f119872aebd822232d62398783e634d08..1da8d4e45f67e2436f3cf5a8e6ca7478ad7c670f 100644 --- a/pom.xml +++ b/pom.xml @@ -3,13 +3,13 @@ <parent> <groupId>net.ihe.gazelle.model</groupId> <artifactId>gazelle-model</artifactId> - <version>7.0.1</version> + <version>8.0.0</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm-tools</artifactId> - <version>4.3.3-SNAPSHOT</version> + <version>4.4.0-SNAPSHOT</version> <packaging>ejb</packaging> <name>gazelle-tm-tools</name> @@ -30,7 +30,7 @@ <gazelle.plugins.version>1.60</gazelle.plugins.version> <powermock.version>1.7.1</powermock.version> <mockito.version>1.10.19</mockito.version> - <sso.client.v7.version>4.0.1</sso.client.v7.version> + <sso.client.v7.version>5.0.0</sso.client.v7.version> </properties> <scm> <connection>scm:git:${git.project.url}</connection> @@ -292,7 +292,7 @@ <dependency> <groupId>net.ihe.gazelle.modules</groupId> <artifactId>gazelle-ws-clients</artifactId> - <version>3.2.2</version> + <version>3.2.3</version> </dependency> <dependency> <groupId>uk.com.robust-it</groupId> diff --git a/src/main/java/net/ihe/gazelle/common/application/action/ApplicationCacheManager.java b/src/main/java/net/ihe/gazelle/common/application/action/ApplicationCacheManager.java index d698c81994e8f8db91de15ed937bf9dcc90d9563..8eaf4f49481566c43cffa7c4e800c32889724322 100644 --- a/src/main/java/net/ihe/gazelle/common/application/action/ApplicationCacheManager.java +++ b/src/main/java/net/ihe/gazelle/common/application/action/ApplicationCacheManager.java @@ -41,7 +41,6 @@ import java.util.List; @GenerateInterface("ApplicationCacheManagerLocal") public class ApplicationCacheManager implements ApplicationCacheManagerLocal { private static final KeyValueCacheManager webServicesCache = new KeyValueCacheManager(new MapDbCache(5)); - private static final KeyValueCacheManager userPreferences = new KeyValueCacheManager(new MapDbCache(5)); private static final KeyValueCacheManager applicationPreferencesCache = new KeyValueCacheManager(new MapDbCache(60)); private static List<CacheHolder> caches; @@ -62,17 +61,12 @@ public class ApplicationCacheManager implements ApplicationCacheManagerLocal { return webServicesCache; } - public static KeyValueCacheManager getUserPreferences() { - return userPreferences; - } - private synchronized void createCache() { if (caches == null) { - caches = new ArrayList<CacheHolder>(); + caches = new ArrayList<>(); caches.add(new CacheHolder(webServicesCache, "WebServicesCache")); caches.add(new CacheHolder(applicationPreferencesCache, "ApplicationPreferencesCache")); - caches.add(new CacheHolder(userPreferences, "UserPreferencesCache")); } } @@ -80,21 +74,18 @@ public class ApplicationCacheManager implements ApplicationCacheManagerLocal { public void enableCaches() { webServicesCache.enable(); applicationPreferencesCache.enable(); - userPreferences.enable(); } @Override public void disableCaches() { webServicesCache.disable(); applicationPreferencesCache.disable(); - userPreferences.disable(); } @Override public void clearCaches() { webServicesCache.clearCache(); applicationPreferencesCache.clearCache(); - userPreferences.clearCache(); } @Override diff --git a/src/main/java/net/ihe/gazelle/common/application/action/ApplicationPreferenceManagerImpl.java b/src/main/java/net/ihe/gazelle/common/application/action/ApplicationPreferenceManagerImpl.java index b7a6b6f48854ed1e647b71ab0dff684aec878f1c..362462d92ad594aacff07daa91e66bf6204edd2b 100644 --- a/src/main/java/net/ihe/gazelle/common/application/action/ApplicationPreferenceManagerImpl.java +++ b/src/main/java/net/ihe/gazelle/common/application/action/ApplicationPreferenceManagerImpl.java @@ -830,8 +830,4 @@ public class ApplicationPreferenceManagerImpl implements Serializable, Applicati return getStringValue("link_to_cgu"); } - @Override - public String getGumFrontUrl(){ - return getStringValue("gum_front_url"); - } } diff --git a/src/main/java/net/ihe/gazelle/common/report/ReportRenderer.java b/src/main/java/net/ihe/gazelle/common/report/ReportRenderer.java index 8be5d56d2e7f203775b69772019df1d94eaa3243..4614af33ea8d6c46d7f8476dcb8394ae9ecf9875 100644 --- a/src/main/java/net/ihe/gazelle/common/report/ReportRenderer.java +++ b/src/main/java/net/ihe/gazelle/common/report/ReportRenderer.java @@ -8,7 +8,6 @@ import net.sf.jasperreports.engine.export.JRHtmlExporterParameter; import net.sf.jasperreports.engine.util.JRLoader; import net.sf.jasperreports.engine.util.JRSaver; import net.sf.jasperreports.engine.xml.JRXmlLoader; -import org.apache.commons.io.IOUtils; import org.hibernate.internal.SessionImpl; import org.jboss.seam.Component; import org.slf4j.Logger; @@ -21,7 +20,9 @@ import javax.faces.render.Renderer; import javax.persistence.EntityManager; import javax.servlet.ServletContext; import java.io.*; -import java.util.*; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; public class ReportRenderer extends Renderer { private static Logger log = LoggerFactory.getLogger(ReportRenderer.class); diff --git a/src/main/java/net/ihe/gazelle/object/tools/ObjectManipulation.java b/src/main/java/net/ihe/gazelle/object/tools/ObjectManipulation.java index dc1b91ecf7459d7ebbbc0017a0b0d99e97a9f30a..c90ed697682c631b7947208454ce979cf8b2d0ab 100644 --- a/src/main/java/net/ihe/gazelle/object/tools/ObjectManipulation.java +++ b/src/main/java/net/ihe/gazelle/object/tools/ObjectManipulation.java @@ -158,12 +158,11 @@ public class ObjectManipulation { /** * return list of SIS that can read this object type */ - private List<SystemInSession> getListOfSystemInSessionReaderForObjectType(ObjectType objectType) { + private List<SystemInSession> getListOfSystemInSessionReaderForObjectType(ObjectType objectType, TestingSession selectedTestingSession) { List<SystemInSession> result = new ArrayList<SystemInSession>(); - TestingSession testingSession = TestingSession.getSelectedTestingSession(); if (objectType != null) { EntityManager em = (EntityManager) Component.getInstance("entityManager"); - result = SystemInSession.getSystemInSessionFiltered(em, null, testingSession, null, null, null, null, null, + result = SystemInSession.getSystemInSessionFiltered(em, null, selectedTestingSession, null, null, null, null, null, null, null, null, null, null, null, null, objectType, null, null); } return result; @@ -251,11 +250,11 @@ public class ObjectManipulation { /** * tree of objects added by readers */ - public GazelleTreeNodeImpl<Object> getTreeNodeOfReaderInstanceFile(ObjectInstance inObjectInstance) { + public GazelleTreeNodeImpl<Object> getTreeNodeOfReaderInstanceFile(ObjectInstance inObjectInstance, TestingSession selectedTestingSession) { GazelleTreeNodeImpl<Object> rootNode = new GazelleTreeNodeImpl<Object>(); if (inObjectInstance != null) { List<SystemInSession> list_SISReader = this.getListOfSystemInSessionReaderForObjectType(inObjectInstance - .getObject()); + .getObject(), selectedTestingSession); Collections.sort(list_SISReader); int i = 0; int j; @@ -304,7 +303,7 @@ public class ObjectManipulation { } } - public boolean canEditSampleByCreator(ObjectInstance selectedObjectInstance) { + public boolean canEditSampleByCreator(ObjectInstance selectedObjectInstance, TestingSession selectedTestingSession) { if (selectedObjectInstance != null) { List<ObjectInstanceFile> loif = ObjectInstanceFile.getObjectInstanceFileFiltered(selectedObjectInstance, null, null, "reader", null); @@ -314,7 +313,7 @@ public class ObjectManipulation { } } } - if (TestingSession.getSelectedTestingSession().testingSessionClosedForUser()) { + if (selectedTestingSession.testingSessionClosedForUser()) { return false; } return true; diff --git a/src/main/java/net/ihe/gazelle/tm/financial/FinancialSummary.java b/src/main/java/net/ihe/gazelle/tm/financial/FinancialSummary.java index 6b2231201311eba4c7484dfcec9b5c4a1f3985d7..6e13b203057da0bf96efeb40d5ec2e58aab446a3 100644 --- a/src/main/java/net/ihe/gazelle/tm/financial/FinancialSummary.java +++ b/src/main/java/net/ihe/gazelle/tm/financial/FinancialSummary.java @@ -17,7 +17,6 @@ package net.ihe.gazelle.tm.financial; import net.ihe.gazelle.tm.financial.model.Invoice; import net.ihe.gazelle.tm.systems.model.TestingSession; -import net.ihe.gazelle.users.model.Currency; import net.ihe.gazelle.users.model.Institution; import java.io.Serializable; @@ -179,13 +178,8 @@ public class FinancialSummary implements Serializable { this.totalFeeDue = totalFeeDue; } - private Currency getCurrency() { - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); - return activatedTestingSession.getCurrency(); - } - - public String getFeeAsCurrency() { - String currency = getCurrency().getKeyword(); + public String getFeeAsCurrency(TestingSession selectedTestingSession) { + String currency = selectedTestingSession.getCurrency().getKeyword(); return currency + " " + fee; } @@ -243,39 +237,44 @@ public class FinancialSummary implements Serializable { /** * Returns the VAT amount to pay by the vendor with the currency : eg. EUR 15000.00 * + * @param selectedTestingSession current testing session of the logged user * @return feeVAT : VAT amount to pay */ - public String getFeeVATAsCurrency() { - String currency = getCurrency().getKeyword(); + public String getFeeVATAsCurrency(TestingSession selectedTestingSession) { + String currency = selectedTestingSession.getCurrency().getKeyword(); return currency + " " + feeVAT; } /** * Returns the Discount amount to pay by the vendor with the currency : eg. EUR 15000.00 * + * @param selectedTestingSession current testing session of the logged user * @return feeDiscount : Discount amount to pay */ - public String getFeeDiscountAsCurrency() { - String currency = getCurrency().getKeyword(); + public String getFeeDiscountAsCurrency(TestingSession selectedTestingSession) { + String currency = testingSession.getCurrency().getKeyword(); return currency + " " + feeDiscount; } + /** * Returns the Additional fees to pay by the vendor with the currency : eg. EUR 15000.00 * + * @param selectedTestingSession current testing session of the logged user * @return feeDiscount : Discount amount to pay */ - public String getAdditionalFeeAsCurrency() { - String currency = getCurrency().getKeyword(); + public String getAdditionalFeeAsCurrency(TestingSession selectedTestingSession) { + String currency = selectedTestingSession.getCurrency().getKeyword(); return currency + " " + feeDiscount.negate(); } /** * Returns the total amount to pay by the vendor with the currency : eg. EUR 15000.00 * + * @param selectedTestingSession current testing session of the logged user * @return totalFeeToPay : Amount to pay, with taxes included */ - public String getTotalFeeToPayAsCurrency() { - String currency = getCurrency().getKeyword(); + public String getTotalFeeToPayAsCurrency(TestingSession selectedTestingSession) { + String currency = testingSession.getCurrency().getKeyword(); if (feeVAT == null) { return "Internal Error : feeVAT not calculated"; @@ -294,15 +293,16 @@ public class FinancialSummary implements Serializable { /** * Returns the total amount paid by the vendor with the currency : eg. EUR 15000.00 * + * @param selectedTestingSession current testing session of the logged user * @return totalFeePaid : Amount paid. */ - public String getTotalFeePaidAsCurrency() { - String currency = getCurrency().getKeyword(); + public String getTotalFeePaidAsCurrency(TestingSession selectedTestingSession) { + String currency = selectedTestingSession.getCurrency().getKeyword(); return currency + " " + totalFeePaid; } - public String getSystemsFeesAsCurrency() { - String currency = getCurrency().getKeyword(); + public String getSystemsFeesAsCurrency(TestingSession selectedTestingSession) { + String currency = selectedTestingSession.getCurrency().getKeyword(); BigDecimal res = new BigDecimal(0); for (FinancialSummaryOneSystem financialSummaryOneSystem : getFinancialSummaryOneSystems()) { res = res.add(BigDecimal.valueOf(financialSummaryOneSystem.getSystemFee().intValue())); @@ -310,12 +310,10 @@ public class FinancialSummary implements Serializable { return currency + " " + res.setScale(2); } - public String getParticipantsFeeAsCurrency() { - String currency = getCurrency().getKeyword(); - BigDecimal nbParticipants = BigDecimal.valueOf(getNumberAdditionalParticipant(TestingSession - .getSelectedTestingSession())); - BigDecimal feeParticipant = BigDecimal.valueOf(TestingSession - .getSelectedTestingSession().getFeeParticipant().intValue()); + public String getParticipantsFeeAsCurrency(TestingSession selectedTestingSession) { + String currency = selectedTestingSession.getCurrency().getKeyword(); + BigDecimal nbParticipants = BigDecimal.valueOf(getNumberAdditionalParticipant(selectedTestingSession)); + BigDecimal feeParticipant = BigDecimal.valueOf(selectedTestingSession.getFeeParticipant().intValue()); BigDecimal res = nbParticipants.multiply(feeParticipant); return currency + " " + res.setScale(2); } @@ -323,10 +321,11 @@ public class FinancialSummary implements Serializable { /** * Returns the total amount due by the vendor with the currency : eg. EUR 15000.00 * + * @param selectedTestingSession current testing session of the logged user * @return totalFeeDue : Amount due. */ - public String getTotalFeeDueAsCurrency() { - String currency = getCurrency().getKeyword(); + public String getTotalFeeDueAsCurrency(TestingSession selectedTestingSession) { + String currency = selectedTestingSession.getCurrency().getKeyword(); return currency + " " + totalFeeDue; } diff --git a/src/main/java/net/ihe/gazelle/tm/report/action/ReportManager.java b/src/main/java/net/ihe/gazelle/tm/report/action/ReportManager.java index 3907f1d3e99038c89fbe78cde852369fd65563b3..ecffc0b907f4d15b3b9057ddceb5505978f0278d 100644 --- a/src/main/java/net/ihe/gazelle/tm/report/action/ReportManager.java +++ b/src/main/java/net/ihe/gazelle/tm/report/action/ReportManager.java @@ -21,12 +21,12 @@ import com.google.common.collect.Collections2; import net.ihe.gazelle.common.interfacegenerator.GenerateInterface; import net.ihe.gazelle.common.log.ExceptionLogging; import net.ihe.gazelle.common.report.ReportExporterManager; -import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.ssov7.gum.client.application.User; +import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.tf.model.Actor; import net.ihe.gazelle.tf.model.IntegrationProfile; -import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.tm.systems.model.System; +import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.users.model.Institution; import net.sf.jasperreports.engine.JRException; import org.apache.poi.hssf.usermodel.HSSFCell; @@ -69,25 +69,15 @@ public class ReportManager implements Serializable, ReportManagerLocal { */ private static final long serialVersionUID = -450921436961253710L; - private static Logger log = LoggerFactory.getLogger(ReportManager.class); + private static final Logger log = LoggerFactory.getLogger(ReportManager.class); @In(create = true, value = "gumUserService") private transient UserService userService; - /** - * ActivatedTestingSession object managed my this manager bean - */ - private TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); - @Override - public boolean testingSessionIsClosed() { - return activatedTestingSession.isClosed(); - } - - @Override - public void listTransactionsToSupportForGivenSystemPDF() { + public void listTransactionsToSupportForGivenSystemPDF(TestingSession selectedTestingSession) { Map<String, Object> parameters = new HashMap<String, Object>(); - parameters.put("sessionId", activatedTestingSession.getId()); + parameters.put("sessionId", selectedTestingSession.getId()); try { ReportExporterManager.exportToPDF("listTransactionsToSupportForGivenSystem", "listTransactionsToSupportForGivenSystem.pdf", parameters); @@ -114,9 +104,9 @@ public class ReportManager implements Serializable, ReportManagerLocal { } @Override - public void listSystemsForAllActorIntegrationProfilePDF() { + public void listSystemsForAllActorIntegrationProfilePDF(TestingSession selectedTestingSession) { Map<String, Object> parameters = new HashMap<String, Object>(); - parameters.put("testingSessionId", activatedTestingSession.getId()); + parameters.put("testingSessionId", selectedTestingSession.getId()); try { ReportExporterManager.exportToPDF("listSystemsForAllActorIntegrationProfile", "listSystemsForAllActorIntegrationProfile.pdf", parameters); @@ -129,7 +119,7 @@ public class ReportManager implements Serializable, ReportManagerLocal { } @Override - public void listSystemsSummary() throws IOException { + public void listSystemsSummary(TestingSession selectedTestingSession) throws IOException { HSSFWorkbook workbook = new HSSFWorkbook(); CellStyle style = workbook.createCellStyle(); @@ -145,7 +135,7 @@ public class ReportManager implements Serializable, ReportManagerLocal { HSSFSheet worksheet = workbook.createSheet("Systems summary"); worksheet.createFreezePane(0, 1); - TestingSession activeSession = TestingSession.getSelectedTestingSession(); + TestingSession activeSession = selectedTestingSession; List<Demonstration> listOfDemonstration = Demonstration.getActiveDemonstrationsForSession(activeSession); Collection<IntegrationProfile> listOfIntegrationProfile = activeSession.getIntegrationProfilesUnsorted(); @@ -274,7 +264,8 @@ public class ReportManager implements Serializable, ReportManagerLocal { } @Override - public void listSystemsSummary(List<IntegrationProfile> listOfIntegrationProfile, List<System> systemsList) throws IOException { + public void listSystemsSummary(List<IntegrationProfile> listOfIntegrationProfile, List<System> systemsList, + TestingSession selectedTestingSession) throws IOException { HSSFWorkbook workbook = new HSSFWorkbook(); CellStyle style = workbook.createCellStyle(); @@ -290,8 +281,7 @@ public class ReportManager implements Serializable, ReportManagerLocal { HSSFSheet worksheet = workbook.createSheet("Systems summary"); worksheet.createFreezePane(0, 1); - TestingSession activeSession = TestingSession.getSelectedTestingSession(); - List<Demonstration> listOfDemonstration = Demonstration.getActiveDemonstrationsForSession(activeSession); + List<Demonstration> listOfDemonstration = Demonstration.getActiveDemonstrationsForSession(selectedTestingSession); Collection<IntegrationProfile> ipList = Collections2.filter(listOfIntegrationProfile, new Predicate<IntegrationProfile>() { @Override @@ -329,7 +319,7 @@ public class ReportManager implements Serializable, ReportManagerLocal { rowIndex++; for (System systemInInstitution : systemsList) { - SystemInSession sis = SystemInSession.getSystemInSessionForSession(systemInInstitution, activeSession); + SystemInSession sis = SystemInSession.getSystemInSessionForSession(systemInInstitution, selectedTestingSession); if (sis != null) { Institution currentInstitution = sis.getSystem().getUniqueInstitution(); colIndex = 0;