From 97ec35f7d6cd24cfbf2888c93e5e06d478fda86d Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 17 Jul 2024 14:09:59 +0200 Subject: [PATCH 01/77] Updated pom --- pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index d883c76d3..b295cde8d 100644 --- a/pom.xml +++ b/pom.xml @@ -3,12 +3,12 @@ <parent> <groupId>net.ihe.gazelle.model</groupId> <artifactId>gazelle-model</artifactId> - <version>7.2.0</version> + <version>7.2.1-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm</artifactId> - <version>9.3.2-SNAPSHOT</version> + <version>10.0.0-GZL-5369-SNAPSHOT</version> <packaging>pom</packaging> <modules> @@ -77,13 +77,13 @@ <skipITs>true</skipITs> - <gazelle.tm.tools.version>4.3.0</gazelle.tm.tools.version> + <gazelle.tm.tools.version>4.3.2-SNAPSHOT</gazelle.tm.tools.version> <jacoco.version>0.8.1</jacoco.version> <sonar.maven.plugin>3.7.0.1746</sonar.maven.plugin> <maven.release.plugin.version>2.5.3</maven.release.plugin.version> <nexus.staging.maven.plugin.version>1.6.8</nexus.staging.maven.plugin.version> <gazelle.gdpr.version>1.5.0</gazelle.gdpr.version> - <sso.client.v7.version>4.1.1</sso.client.v7.version> + <sso.client.v7.version>5.0.0-GZL-5369-SNAPSHOT</sso.client.v7.version> <communication-tool-gateway.version>1.0.1</communication-tool-gateway.version> </properties> @@ -284,13 +284,13 @@ <dependency> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm-ejb</artifactId> - <version>9.3.2-SNAPSHOT</version> + <version>10.0.0-GZL-5369-SNAPSHOT</version> <type>ejb</type> </dependency> <dependency> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm-war</artifactId> - <version>9.3.2-SNAPSHOT</version> + <version>10.0.0-GZL-5369-SNAPSHOT</version> <type>war</type> </dependency> <dependency> -- GitLab From 636304136ec53aea55a5bcca4be9cee16a9f936e Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 17 Jul 2024 15:50:23 +0200 Subject: [PATCH 02/77] Updated pom --- gazelle-tm-ear/pom.xml | 2 +- gazelle-tm-ejb/pom.xml | 2 +- gazelle-tm-war/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gazelle-tm-ear/pom.xml b/gazelle-tm-ear/pom.xml index feb8260a7..32652aa33 100644 --- a/gazelle-tm-ear/pom.xml +++ b/gazelle-tm-ear/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm</artifactId> - <version>9.3.2-SNAPSHOT</version> + <version>10.0.0-GZL-5369-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/gazelle-tm-ejb/pom.xml b/gazelle-tm-ejb/pom.xml index 3514ade23..56e2cda1c 100644 --- a/gazelle-tm-ejb/pom.xml +++ b/gazelle-tm-ejb/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm</artifactId> - <version>9.3.2-SNAPSHOT</version> + <version>10.0.0-GZL-5369-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/gazelle-tm-war/pom.xml b/gazelle-tm-war/pom.xml index 2431c7e32..ca1885e53 100644 --- a/gazelle-tm-war/pom.xml +++ b/gazelle-tm-war/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm</artifactId> - <version>9.3.2-SNAPSHOT</version> + <version>10.0.0-GZL-5369-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/pom.xml b/pom.xml index b295cde8d..ca31be50c 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>net.ihe.gazelle.model</groupId> <artifactId>gazelle-model</artifactId> - <version>7.2.1-SNAPSHOT</version> + <version>7.2.1-GZL-5369-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>net.ihe.gazelle.tm</groupId> -- GitLab From 44c26e995ad9312cc8fe00f683768dcb5f9645de Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 17 Jul 2024 15:50:47 +0200 Subject: [PATCH 03/77] Removed file --- gazelle-tm-war/src/main/webapp/userPhoto.xhtml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 gazelle-tm-war/src/main/webapp/userPhoto.xhtml diff --git a/gazelle-tm-war/src/main/webapp/userPhoto.xhtml b/gazelle-tm-war/src/main/webapp/userPhoto.xhtml deleted file mode 100644 index 7c89b545c..000000000 --- a/gazelle-tm-war/src/main/webapp/userPhoto.xhtml +++ /dev/null @@ -1 +0,0 @@ -<div></div> -- GitLab From 0af2c0ff32e2f0304e482a6a390054d33aeca6e2 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 17 Jul 2024 15:51:22 +0200 Subject: [PATCH 04/77] Updated file in favour of sso v7 --- .../src/main/webapp/WEB-INF/pages.xml | 2 +- .../src/main/webapp/layout/menu/_menu.xhtml | 19 ------------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/gazelle-tm-war/src/main/webapp/WEB-INF/pages.xml b/gazelle-tm-war/src/main/webapp/WEB-INF/pages.xml index 6deed3947..d8b97b768 100644 --- a/gazelle-tm-war/src/main/webapp/WEB-INF/pages.xml +++ b/gazelle-tm-war/src/main/webapp/WEB-INF/pages.xml @@ -58,7 +58,7 @@ <page view-id="/testSequenceDiagram.xhtml" action="#{testSequenceManager.getSequenceDiagram()}"/> <page view-id="/testInstanceSequenceDiagram.xhtml" action="#{testSequenceManager.getTISequenceDiagram()}"/> <page view-id="/testDescriptionImage.xhtml" action="#{testSequenceManager.getTestDescriptionImage()}"/> - <page view-id="/userPhoto.xhtml" action="#{userManagerExtra.getUserPhoto()}"/> + <page view-id="/userPhoto.xhtml" action="#{gumUserProfilePictureBean.getUserProfilePicture()}"/> <page view-id="/isSnapshot.xhtml" action="#{prManager.getIsSnapshot()}"/> <page view-id="/pki.xhtml"> <action execute="#{facesContext.externalContext.redirect(gazelleDAO.getSelectedTestingSession().getCertificatesUrl())}"/> diff --git a/gazelle-tm-war/src/main/webapp/layout/menu/_menu.xhtml b/gazelle-tm-war/src/main/webapp/layout/menu/_menu.xhtml index c7f7460be..2f226bdba 100644 --- a/gazelle-tm-war/src/main/webapp/layout/menu/_menu.xhtml +++ b/gazelle-tm-war/src/main/webapp/layout/menu/_menu.xhtml @@ -116,25 +116,6 @@ </h:panelGroup> <!-- Login menu from cas-client-ui-v7 --> <ui:decorate template="/layout/_login_menu.xhtml"> - <ui:define name="loggedInPrefix"> - <h:panelGroup> - <!-- User image --> - <s:span id="userPicMin" title="#{identity.firstName} #{identity.lastName}"> - <h:graphicImage class="gzl-menu-image img-rounded" - value="#{userPreferencesManager.userPreferences.photoUrlSmall}"/> - </s:span> - </h:panelGroup> - </ui:define> - <ui:define name="loggedInMenuExtension"> - <!-- User preferences --> - <li> - <h:outputLink - value="/#{applicationPreferenceManager.getApplicationUrlBaseName()}/users/user/userPreferences.seam"> - <h:outputText value="#{messages['net.ihe.gazelle.tm.Preferences']}"/> - </h:outputLink> - </li> - <li class="divider"/> - </ui:define> </ui:decorate> </ui:define> </ui:decorate> -- GitLab From 1f86652702c62dea956c43c1bcf4d14e3a840839 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 22 Jul 2024 14:24:50 +0200 Subject: [PATCH 05/77] Removed usage of UserPreferencesManager --- .../users/action/UserPreferencesManager.java | 677 ------------------ .../src/main/webapp/WEB-INF/components.xml | 2 - .../main/webapp/monitors/monitorInfo.xhtml | 22 +- .../testing/test/test/TestInstance.xhtml | 2 +- .../testingITB/test/test/TestInstance.xhtml | 2 +- .../src/main/webapp/users/user/showUser.xhtml | 8 +- .../src/main/webapp/users/userInfo.xhtml | 19 +- 7 files changed, 21 insertions(+), 711 deletions(-) delete mode 100644 gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserPreferencesManager.java diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserPreferencesManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserPreferencesManager.java deleted file mode 100644 index c2ff34a58..000000000 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserPreferencesManager.java +++ /dev/null @@ -1,677 +0,0 @@ -package net.ihe.gazelle.tm.users.action; - -import net.ihe.gazelle.common.filecache.FileCache; -import net.ihe.gazelle.common.fineuploader.FineuploaderListener; -import net.ihe.gazelle.common.interfacegenerator.GenerateInterface; -import net.ihe.gazelle.hql.HQLQueryBuilder; -import net.ihe.gazelle.hql.providers.EntityManagerService; -import net.ihe.gazelle.menu.GazelleMenu; -import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; -import net.ihe.gazelle.ssov7.gum.client.application.User; -import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; -import net.ihe.gazelle.ssov7.gum.client.interlay.client.utils.UserSearchParams; -import net.ihe.gazelle.ssov7.gum.client.interlay.exception.GumSsoClientHttpErrorException; -import net.ihe.gazelle.tm.organization.OrganizationServiceDAO; -import net.ihe.gazelle.tm.users.model.UserPhoto; -import net.ihe.gazelle.tm.users.model.UserPreferences; -import net.ihe.gazelle.users.model.Institution; -import net.ihe.gazelle.util.ThumbnailCreator; -import org.jboss.seam.ScopeType; -import org.jboss.seam.annotations.*; -import org.jboss.seam.contexts.Contexts; -import org.jboss.seam.faces.FacesMessages; -import org.jboss.seam.international.LocaleSelector; -import org.jboss.seam.international.StatusMessage; -import org.jboss.seam.international.StatusMessages; -import org.slf4j.LoggerFactory; - -import javax.faces.context.FacesContext; -import javax.faces.model.SelectItem; -import javax.imageio.ImageIO; -import javax.persistence.EntityManager; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.Serializable; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -@Name("userPreferencesManager") -@Scope(ScopeType.SESSION) -@GenerateInterface("UserPreferencesManagerLocal") -public class UserPreferencesManager implements Serializable, FineuploaderListener, UserPreferencesManagerLocal { - - private static final long serialVersionUID = -7614265382910976890L; - - private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(UserPreferencesManager.class); - - private User selectedUser; - private User userResourceForUpdate; - private UserPreferences userPreferences; - private boolean displayLanguageSelection; - private boolean editUser; - private String selectedLanguage; - private List<SelectItem> languageList; - private boolean displayLangMenu; - private boolean displayFileUpload; - - // locale language codes - private List<String> spokenLanguages; - private boolean viewUser; - - // iso2 language codes - not used in JSF - - private List<String> selectedLanguages; - - @In - private GazelleIdentity identity; - @In(value = "gumUserService") - private transient UserService userService; - @In(value = "organizationServiceDAO", create = true) - private transient OrganizationServiceDAO organizationServiceDAO; - - @Override - public User getSelectedUser() { - if (LOG.isDebugEnabled()) { - LOG.debug("getSelectedUser"); - } - return selectedUser; - } - - @Override - public void setSelectedUser(User selectedUser) { - if (LOG.isDebugEnabled()) { - LOG.debug("setSelectedUser"); - } - this.selectedUser = selectedUser; - } - - - public User getUserResourceForUpdate() { - return userResourceForUpdate; - } - - public void setUserResourceForUpdate(User userResourceForUpdate) { - this.userResourceForUpdate = userResourceForUpdate; - } - - @Override - public String getInstitutionName() { - if (LOG.isDebugEnabled()) { - LOG.debug("getInstitutionName"); - } - String organizationId = this.selectedUser.getOrganizationId(); - try { - Institution institution = organizationServiceDAO.getInstitutionWithKeyword(organizationId); - return institution.getName(); - }catch (NoSuchElementException e){ - return organizationId; - } - } - - @Override - public UserPreferences getUserPreferences() { - if (LOG.isDebugEnabled()) { - LOG.debug("getUserPreferences"); - } - if (userPreferences == null) { - if (selectedUser == null || selectedUser.getId().equals(identity.getUsername())) { - initialize(); - } else { - initializeOther(); - } - } - return userPreferences; - } - - @Override - public void setUserPreferences(UserPreferences userPreferences) { - if (LOG.isDebugEnabled()) { - LOG.debug("setUserPreferences"); - } - this.userPreferences = userPreferences; - } - - @Override - public boolean getDisplayLanguageSelection() { - if (LOG.isDebugEnabled()) { - LOG.debug("getDisplayLanguageSelection"); - } - return displayLanguageSelection; - } - - @Override - public void setDisplayLanguageSelection(boolean displayLanguageSelection) { - if (LOG.isDebugEnabled()) { - LOG.debug("setDisplayLanguageSelection"); - } - this.displayLanguageSelection = displayLanguageSelection; - } - - @Override - public boolean getEditUser() { - if (LOG.isDebugEnabled()) { - LOG.debug("getEditUser"); - } - return editUser; - } - - @Override - public void setEditUser(boolean editUser) { - if (LOG.isDebugEnabled()) { - LOG.debug("setEditUser"); - } - this.editUser = editUser; - } - - @Override - public boolean getViewUser() { - if (LOG.isDebugEnabled()) { - LOG.debug("getViewUser"); - } - return viewUser; - } - - @Override - public void setViewUser(boolean viewUser) { - if (LOG.isDebugEnabled()) { - LOG.debug("setViewUser"); - } - this.viewUser = viewUser; - } - - @Override - public String getSelectedLanguage() { - if (LOG.isDebugEnabled()) { - LOG.debug("getSelectedLanguage"); - } - return selectedLanguage; - } - - @Override - public void setSelectedLanguage(String selectedLanguage) { - if (LOG.isDebugEnabled()) { - LOG.debug("setSelectedLanguage"); - } - this.selectedLanguage = selectedLanguage; - } - - @Override - public List<String> getSpokenLanguages() { - if (LOG.isDebugEnabled()) { - LOG.debug("getSpokenLanguages"); - } - return spokenLanguages; - } - - @Override - public void setSpokenLanguages(List<String> spokenLanguages) { - if (LOG.isDebugEnabled()) { - LOG.debug("setSpokenLanguages"); - } - this.spokenLanguages = spokenLanguages; - } - - @Override - public List<SelectItem> getLanguageList() { - if (LOG.isDebugEnabled()) { - LOG.debug("getLanguageList"); - } - return languageList; - } - - @Override - public void setLanguageList(List<SelectItem> languageList) { - if (LOG.isDebugEnabled()) { - LOG.debug("setLanguageList"); - } - this.languageList = languageList; - } - - @Override - public boolean getDisplayLangMenu() { - if (LOG.isDebugEnabled()) { - LOG.debug("getDisplayLangMenu"); - } - return displayLangMenu; - } - - @Override - public void setDisplayLangMenu(boolean displayLangMenu) { - if (LOG.isDebugEnabled()) { - LOG.debug("setDisplayLangMenu"); - } - this.displayLangMenu = displayLangMenu; - } - - @Override - public boolean getDisplayFileUpload() { - if (LOG.isDebugEnabled()) { - LOG.debug("getDisplayFileUpload"); - } - return displayFileUpload; - } - - @Override - public void setDisplayFileUpload(boolean displayFileUpload) { - if (LOG.isDebugEnabled()) { - LOG.debug("setDisplayFileUpload"); - } - this.displayFileUpload = displayFileUpload; - } - - @Override - public void initialize() { - if (LOG.isDebugEnabled()) { - LOG.debug("initialize"); - } - try { - userService.removeUserCache(identity.getUsername()); - selectedUser = userService.getUserById(identity.getUsername()); - userResourceForUpdate = new User(selectedUser); - } catch (Exception e) { - LOG.warn(String.format("Unable to get user %s", identity.getUsername()), e); - selectedUser = null; - } - userPreferences = UserPreferences.getPreferencesForUser(identity.getUsername()); - displayFileUpload = false; - displayLangMenu = false; - viewPreferences(); - } - - @Override - public void initializeOther() { - if (LOG.isDebugEnabled()) { - LOG.debug("initializeOther"); - } - - selectedUser = new User((User) Contexts.getSessionContext().get("userForPreferences")); - userResourceForUpdate = new User((User) Contexts.getSessionContext().get("userForUpdateForPreferences")); - userPreferences = UserPreferences.getPreferencesForUser(selectedUser.getId()); - if (userPreferences == null) { - // Create user preferences - userPreferences = new UserPreferences(); - userPreferences.setShowSequenceDiagram(true); - userPreferences.setUsername(selectedUser.getId()); - userPreferences.setDisplayEmail(false); - userPreferences.setEmailNotification(true); - userPreferences.setNumberOfResultsPerPage(UserPreferences.DEFAULT_NUMBER_OF_RESULTS_PER_PAGE); - EntityManager entityManager = EntityManagerService.provideEntityManager(); - userPreferences = entityManager.merge(userPreferences); - entityManager.flush(); - } - displayFileUpload = false; - displayLangMenu = false; - editPreferences(); - } - - private void listSpokenLanguages() { - if ((userPreferences != null) && (userPreferences.getSpokenLanguages() != null) - && !userPreferences.getSpokenLanguages().isEmpty()) { - String[] languages = userPreferences.getSpokenLanguages().split(","); - spokenLanguages = new ArrayList<String>(); - - for (String lang : languages) { - Locale locale = new Locale(lang); - spokenLanguages.add(locale.getDisplayLanguage(LocaleSelector.instance().getLocale())); - } - } else { - spokenLanguages = new ArrayList<String>(); - } - } - - @Override - public void editPreferences() { - if (LOG.isDebugEnabled()) { - LOG.debug("editPreferences"); - } - editUser = true; - viewUser = false; - listSpokenLanguages(); - createLanguageList(); - } - - @Override - public void viewPreferences() { - if (LOG.isDebugEnabled()) { - LOG.debug("viewPreferences"); - } - editUser = false; - viewUser = true; - selectedLanguage = null; - listSpokenLanguages(); - } - - @Override - public void savePreferences() { - if (LOG.isDebugEnabled()) { - LOG.debug("savePreferences"); - } - if (userPreferences != null) { - if ((selectedLanguages != null) && !selectedLanguages.isEmpty()) { - userPreferences.setSpokenLanguages(asCommaSeparated(selectedLanguages)); - } - if (isUserEmailUpdate() && !isEmailUnique(selectedUser)) { - FacesMessages.instance().add(StatusMessage.Severity.ERROR, "This email is already used !"); - return; - } - EntityManager em = EntityManagerService.provideEntityManager(); - userPreferences = em.merge(userPreferences); - em.flush(); - updateUserFromClient(); - } else { - FacesMessages.instance().add(StatusMessage.Severity.ERROR, selectedUser.getFirstNameAndLastName() + " preferences are not saved !"); - LOG.error("The user preferences are null"); - } - viewPreferences(); - GazelleMenu.getInstance().refreshMenu(); - } - - private void updateUserFromClient() { - LOG.trace("updateUserFromClient"); - User patchedUser = prepareUpdateUser(selectedUser, userResourceForUpdate); - if (!isUserEmailAvailable(patchedUser.getEmail())) { - return; - } - try { - User checkUpdate = userService.editUser(userResourceForUpdate.getId(), patchedUser); - userService.removeUserCache(userResourceForUpdate.getId()); - FacesMessages.instance().add(StatusMessage.Severity.INFO, checkUpdate.getFirstNameAndLastName() + " preferences are saved !"); - if (isUserEmailUpdate()) { - FacesMessages.instance().add(StatusMessage.Severity.INFO, "An activation code has been sent to: " + checkUpdate.getEmail() + " !"); - } - } catch (GumSsoClientHttpErrorException e) { - LOG.error("Can't update user!"); - StatusMessages.instance().addFromResourceBundle(StatusMessage.Severity.ERROR, "Problem updating user"); - } - } - - private User prepareUpdateUser(User selectedUser, User userResourceForUpdate) { - User userToUpdate = new User(); - if (!selectedUser.getFirstName().equals(userResourceForUpdate.getFirstName())) { - userToUpdate.setFirstName(userResourceForUpdate.getFirstName()); - } - if (!selectedUser.getLastName().equals(userResourceForUpdate.getLastName())) { - userToUpdate.setLastName(userResourceForUpdate.getLastName()); - } - if (!selectedUser.getEmail().equals(userResourceForUpdate.getEmail())) { - userToUpdate.setEmail(userResourceForUpdate.getEmail()); - } - return userToUpdate; - } - - private boolean isUserEmailAvailable(String newEmail) { - if (LOG.isDebugEnabled()) { - LOG.debug("isUserEmailAvailable"); - } - boolean emailAvailable = true; - - if (newEmail != null) { - if (!checkEmailFormat(newEmail)) { - emailAvailable = false; - } else { - UserSearchParams userSearchParams = new UserSearchParams().setEmail(newEmail.toLowerCase()); - List<User> userList = userService.searchAndFilter(userSearchParams).getUsers(); - - if (!userList.isEmpty()) { - emailAvailable = false; - StatusMessages. - instance(). - addToControlFromResourceBundleOrDefault( - "userEmail", StatusMessage.Severity.ERROR, - "gazelle.validator.users.user.email.alreadyExists", - "A user with that email address already exists. Please choose another email address..."); - } - } - } - return emailAvailable; - } - - private boolean checkEmailFormat(String email) { - Pattern pattern = Pattern.compile("^\\b[\\w.%-]+@[-.\\w]+\\.[A-Za-z]{2,4}\\b$"); - Matcher matcher = pattern.matcher(email); - boolean matchFound = matcher.find(); - if (!matchFound) { - StatusMessages.instance().addToControlFromResourceBundleOrDefault("userEmail", StatusMessage.Severity.ERROR, "gazelle.validator.users.user.email.badFormatEmail", "Please enter a valid email address."); - } - return matchFound; - } - - private String asCommaSeparated(List<String> selectedLangs) { - String languages = ""; - for (String lang : selectedLangs) { - if (languages.length() == 0) { - languages = lang; - } else { - languages = languages.concat(",").concat(lang); - } - } - return languages; - } - - private boolean isEmailUnique(User userToUpdate) { - if (LOG.isDebugEnabled()) { - LOG.debug("isEmailUnique"); - } - String email = userToUpdate.getEmail(); - boolean emailAvailable = true; - if (email != null) { - UserSearchParams userSearchParams = new UserSearchParams().setEmail(email); - List<User> userList = userService.searchAndFilter(userSearchParams).getUsers(); - if (!userList.isEmpty()) { - emailAvailable = false; - StatusMessages.instance().addToControlFromResourceBundleOrDefault("emailEdit", StatusMessage.Severity.ERROR, "gazelle.validator.users.user.email.alreadyExists", "A user with that email address already exists. Please choose another email address..."); - } - } - StatusMessages.instance(). - addToControlFromResourceBundleOrDefault("emailEdit", - StatusMessage.Severity.INFO, - "gazelle.validator.users.user.email.updateEmailUser", - "By changing your email, your account will be deactivated. \n" + - "You will receive an activation code via the new email address."); - return emailAvailable; - } - - private boolean isUserEmailUpdate() { - String actualEmail = userService.getUserById(selectedUser.getId()).getEmail(); - return !selectedUser.getEmail().equals(actualEmail); - } - - @Transactional - public void uploadedFile(File tmpFile, String filename, String id, String param) throws IOException { - if (LOG.isDebugEnabled()) { - LOG.debug("uploadedFile"); - } - if ("userPhoto".equals(id)) { - BufferedImage image = ImageIO.read(new FileInputStream(tmpFile)); - if (image == null) { - if (tmpFile.delete()) { - LOG.info("tmpFile deleted"); - } else { - LOG.error("Failed to delete tmpFile"); - } - throw new IOException("Not a valid image"); - } - saveUserPhoto(tmpFile); - if (tmpFile.delete()) { - LOG.info("tmpFile deleted"); - } else { - LOG.error("Failed to delete tmpFile"); - } - } - } - - @Transactional - protected void saveUserPhoto(File tmpFile) throws IOException { - byte[] bytes = ThumbnailCreator.createThumbnailPNG(new FileInputStream(tmpFile)); - - EntityManager em = EntityManagerService.provideEntityManager(); - - reloadUserPreferences(); - - UserPhoto userPhoto = userPreferences.getUserPhoto(); - if (userPhoto == null) { - userPhoto = new UserPhoto(); - userPhoto = em.merge(userPhoto); - userPreferences.setUserPhoto(userPhoto); - } - - userPhoto.setPhotoBytes(bytes); - FileCache.resetCache("UserPhoto_" + userPhoto.getId()); - FileCache.resetCache("UserPhoto_" + userPhoto.getId() + "_XS"); - userPreferences = em.merge(userPreferences); - em.flush(); - } - - private void reloadUserPreferences() { - HQLQueryBuilder<UserPreferences> queryBuilder = new HQLQueryBuilder<UserPreferences>(UserPreferences.class); - queryBuilder.addEq("id", userPreferences.getId()); - List<UserPreferences> list = queryBuilder.getList(); - if (list.size() > 0) { - userPreferences = list.get(0); - } - } - - /** - * @return - */ - private void createLanguageList() { - List<String> list = Arrays.asList(Locale.getISOLanguages()); - languageList = new ArrayList<SelectItem>(); - selectedLanguages = new ArrayList<String>(); - - if (userPreferences != null) { - if ((userPreferences.getSpokenLanguages() != null) && !userPreferences.getSpokenLanguages().isEmpty()) { - for (String lang : userPreferences.getSpokenLanguages().split(",")) { - selectedLanguages.add(lang); - } - } - } - - for (String language : list) { - Locale locale = new Locale(language); - languageList - .add(new SelectItem(language, locale.getDisplayLanguage(LocaleSelector.instance().getLocale()))); - } - - Collections.sort(languageList, new Comparator<SelectItem>() { - @Override - public int compare(SelectItem o1, SelectItem o2) { - if (LOG.isDebugEnabled()) { - LOG.debug("compare"); - } - return o1.getLabel().compareTo(o2.getLabel()); - } - }); - - } - - @Override - public void addSpokenLanguage() { - if (LOG.isDebugEnabled()) { - LOG.debug("addSpokenLanguage"); - } - if ((selectedLanguage != null) && !selectedLanguages.contains(selectedLanguage)) { - selectedLanguages.add(selectedLanguage); - Locale locale = new Locale(selectedLanguage); - spokenLanguages.add(locale.getDisplayLanguage(LocaleSelector.instance().getLocale())); - } - } - - /** - * @param selectedLanguage - */ - @Override - public void removeSpokenLanguage(String selectedLanguage) { - if (LOG.isDebugEnabled()) { - LOG.debug("removeSpokenLanguage"); - } - spokenLanguages.remove(selectedLanguage); - for (String lang : selectedLanguages) { - Locale locale = new Locale(lang); - if (!spokenLanguages.contains(locale.getDisplayLanguage(LocaleSelector.instance().getLocale()))) { - selectedLanguages.remove(lang); - break; - } else { - continue; - } - } - } - - @Override - public void saveNumberOfResultsPerPage() { - if (LOG.isDebugEnabled()) { - LOG.debug("saveNumberOfResultsPerPage"); - } - if (userPreferences != null) { - EntityManager em = EntityManagerService.provideEntityManager(); - userPreferences = em.merge(userPreferences); - em.flush(); - } else { - return; - } - } - - @Override - public void removePhoto() { - if (LOG.isDebugEnabled()) { - LOG.debug("removePhoto"); - } - reloadUserPreferences(); - if (userPreferences != null) { - UserPhoto userPhoto = userPreferences.getUserPhoto(); - if (userPhoto != null && userPhoto.getPhotoBytes() != null) { - userPhoto.setPhotoBytes(null); - FileCache.resetCache("UserPhoto_" + userPhoto.getId()); - FileCache.resetCache("UserPhoto_" + userPhoto.getId() + "_XS"); - EntityManager em = EntityManagerService.provideEntityManager(); - em.merge(userPhoto); - userPreferences = em.merge(userPreferences); - em.flush(); - } else { - LOG.error("try to remove photo for user " + selectedUser.getFirstName() + " " + selectedUser.getLastName() + " but no path to image found"); - } - } - } - - @Override - @Destroy - - public void destroy() { - if (LOG.isDebugEnabled()) { - LOG.debug("destroy"); - } - - } - - @Override - public UserPreferences getPreferencesForUser(User inUser) { - LOG.trace("getPreferencesForUser"); - return UserPreferences.getPreferencesForUser(inUser.getId()); - } - - @Override - public List<String> getSpokenLanguagesAsList(String languages) { - if (LOG.isDebugEnabled()) { - LOG.debug("getSpokenLanguagesAsList"); - } - return UserPreferences.getSpokenLanguagesAsList(languages); - } - - @Override - public boolean displaySequenceDiagram() { - LOG.trace("displaySequenceDiagram"); - return UserPreferences.displaySequenceDiagram(identity.getUsername()); - } - - public String displayPreviousPage() { - String urlFrom = FacesContext.getCurrentInstance().getViewRoot().getViewId(); - if (urlFrom.equals("/users/user/userPreferences.xhtml")) { - return "/users/user/userPreferences.seam"; - } else { - return "/users/user/listUsersInstitution.seam"; - } - } - -} diff --git a/gazelle-tm-war/src/main/webapp/WEB-INF/components.xml b/gazelle-tm-war/src/main/webapp/WEB-INF/components.xml index f5c3b1364..0bfd7d775 100644 --- a/gazelle-tm-war/src/main/webapp/WEB-INF/components.xml +++ b/gazelle-tm-war/src/main/webapp/WEB-INF/components.xml @@ -9,8 +9,6 @@ xsi:schemaLocation="http://jboss.org/schema/seam/core http://jboss.org/schema/seam/core-2.3.xsd http://jboss.org/schema/seam/persistence http://jboss.org/schema/seam/persistence-2.3.xsd http://jboss.org/schema/seam/async http://jboss.org/schema/seam/async-2.3.xsd http://jboss.org/schema/seam/mail http://jboss.org/schema/seam/mail-2.3.xsd http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd http://jboss.org/schema/seam/pdf http://jboss.org/schema/seam/pdf-2.3.xsd http://jboss.org/schema/seam/document http://jboss.org/schema/seam/document-2.3.xsd http://jboss.org/schema/seam/document http://jboss.org/schema/seam/web-2.3.xsd http://jboss.org/schema/seam/web http://jboss.org/schema/seam/web-2.3.xsd"> <!--<cache:eh-cache-provider/>--> <cache:jboss-cache-provider/> - <component class="net.ihe.gazelle.tm.users.action.UserPreferencesManager" - jndi-name="java:app/gazelle-tm-ejb/UserPreferencesManager"/> <component class="net.ihe.gazelle.tm.users.action.UserManagerExtra" jndi-name="java:app/gazelle-tm-ejb/UserManagerExtra"/> <component class="net.ihe.gazelle.tm.users.action.InstitutionManagerTM" diff --git a/gazelle-tm-war/src/main/webapp/monitors/monitorInfo.xhtml b/gazelle-tm-war/src/main/webapp/monitors/monitorInfo.xhtml index e3b7c4b83..d2d6da6bb 100644 --- a/gazelle-tm-war/src/main/webapp/monitors/monitorInfo.xhtml +++ b/gazelle-tm-war/src/main/webapp/monitors/monitorInfo.xhtml @@ -6,12 +6,12 @@ <ui:decorate template="/layout/panels/_panel_title.xhtml"> <ui:define name="panel_title">#{monitorUser.user.firstName} #{monitorUser.user.lastName}</ui:define> <ui:param name="styleClass" value="panel-default monitorPanelStyle"/> - <c:set var="monitorPref" value="${userPreferencesManager.getPreferencesForUser(monitorUser.user)}"/> + <c:set var="monitorPref" value="${gumUserPreferenceBean.getUserPreferenceByUserId(monitorUser.user.id)}"/> <div class="row"> <div class="col-md-3 col-sm-3"> <div class="thumbnail"> <h:graphicImage library="img" - value="#{monitorPref.photoUrl}" + value="#{gumUserProfilePictureBean.getUserProfilePictureUri(monitorUser.user.id)}" id="monitorPhoto"/> </div> </div> @@ -22,7 +22,7 @@ <h:outputText value="#{monitorUser.user.getFirstNameAndLastName()}"/> </s:decorate> <s:decorate id="emailDecorationView" template="/layout/display/_display.xhtml" - rendered="#{userPreferencesManagerBean.getPreferencesForUser(monitorUser.user).displayEmail == true || s:hasRole('admin_role') || s:hasRole('testing_session_admin_role') || userManagerBean.canViewEmailAddress(monitorUser.user)}"> + rendered="#{ s:hasRole('admin_role') || s:hasRole('testing_session_admin_role') || userManagerBean.canViewEmailAddress(monitorUser.user)}"> <ui:define name="label">#{messages['gazelle.users.registration.Email']}</ui:define> <h:outputText id="emailView" value="#{monitorUser.user.email}"/> </s:decorate> @@ -30,20 +30,14 @@ <ui:define name="label">#{messages['gazelle.users.user.UserInstitution']}</ui:define> <h:outputText id="instituionView" value="#{monitorUser.user.organizationId}"/> </s:decorate> - <s:decorate id="skypeDecorationView" template="/layout/display/_display.xhtml" - rendered="#{monitorPref.skype != null}"> - <ui:define name="label">#{messages['gazelle.tm.users.SkypeAccount']}</ui:define> - <h:outputText id="skypeAccount" - value="#{monitorPref.skype}"/> - </s:decorate> <s:decorate id="tableDecorationView" template="/layout/display/_display.xhtml" - rendered="#{monitorPref.connectathonTable != null and (!s:hasRole('admin_role') and !s:hasRole('testing_session_admin_role'))}"> + rendered="#{monitorPref.tableLabel != null and (!s:hasRole('admin_role') and !s:hasRole('testing_session_admin_role'))}"> <ui:define name="label">#{messages['gazelle.tm.users.TableLabel']}</ui:define> <h:outputText id="table" - value="#{monitorPref.connectathonTable}"/> + value="#{monitorPref.tableLabel}"/> </s:decorate> <s:decorate id="tableDecorationView2" template="/layout/display/_display.xhtml" - rendered="#{monitorPref.connectathonTable != null and (s:hasRole('admin_role') || s:hasRole('testing_session_admin_role'))}"> + rendered="#{monitorPref.tableLabel != null and (s:hasRole('admin_role') || s:hasRole('testing_session_admin_role'))}"> <ui:define name="label">#{messages['gazelle.tm.users.TableLabel']}</ui:define> <rich:inplaceInput id="tableEdit" value="#{monitorPref.connectathonTable}" @@ -53,10 +47,10 @@ </rich:inplaceInput> </s:decorate> <s:decorate id="langDecorate" template="/layout/display/_display.xhtml" - rendered="#{not empty monitorPref.spokenLanguages}"> + rendered="#{not empty monitorPref.languagesSpoken}"> <ui:define name="label">#{messages['gazelle.tm.users.SpokenLanguages']}</ui:define> <rich:list var="language" type="unordered" - value="#{userPreferencesManager.getSpokenLanguagesAsList(monitorPref.spokenLanguages)}"> + value="#{monitorPref.languagesSpoken}"> <h:outputText value="#{language}"/> </rich:list> </s:decorate> diff --git a/gazelle-tm-war/src/main/webapp/testing/test/test/TestInstance.xhtml b/gazelle-tm-war/src/main/webapp/testing/test/test/TestInstance.xhtml index 60cc8024c..9cbbf7123 100644 --- a/gazelle-tm-war/src/main/webapp/testing/test/test/TestInstance.xhtml +++ b/gazelle-tm-war/src/main/webapp/testing/test/test/TestInstance.xhtml @@ -394,7 +394,7 @@ <br/> <s:div id="sequenceDiagramDiv" - rendered="#{testInstanceManager.canViewSequenceDiagram() and userPreferencesManager.displaySequenceDiagram()}"> + rendered="#{testInstanceManager.canViewSequenceDiagram()}"> <center> <h:graphicImage library="img" value="#{testInstanceManager.selectedTestInstance.sequenceDiagramAsUrl}" diff --git a/gazelle-tm-war/src/main/webapp/testingITB/test/test/TestInstance.xhtml b/gazelle-tm-war/src/main/webapp/testingITB/test/test/TestInstance.xhtml index 3348f49d5..6db41eb42 100644 --- a/gazelle-tm-war/src/main/webapp/testingITB/test/test/TestInstance.xhtml +++ b/gazelle-tm-war/src/main/webapp/testingITB/test/test/TestInstance.xhtml @@ -331,7 +331,7 @@ <br/> <s:div id="sequenceDiagramDiv" - rendered="#{testInstanceManager.canViewSequenceDiagram() and userPreferencesManager.displaySequenceDiagram()}"> + rendered="#{testInstanceManager.canViewSequenceDiagram()}"> <center> <h:graphicImage library="img" value="#{testInstanceManager.selectedTestInstance.sequenceDiagramAsUrl}" diff --git a/gazelle-tm-war/src/main/webapp/users/user/showUser.xhtml b/gazelle-tm-war/src/main/webapp/users/user/showUser.xhtml index a383b670c..3f2e3f919 100644 --- a/gazelle-tm-war/src/main/webapp/users/user/showUser.xhtml +++ b/gazelle-tm-war/src/main/webapp/users/user/showUser.xhtml @@ -11,10 +11,10 @@ value="#{messages['net.ihe.gazelle.tm.User']} #{userManager.selectedUser.firstName} #{userManager.selectedUser.lastName}"/> </ui:define> <div class="row"> -<!-- <div class="col-lg-6">--> -<!-- <h:graphicImage library="img"--> -<!-- value="#{userPreferencesManager.getPreferencesForUser(userManager.selectedUser).photoUrl}"/>--> -<!-- </div>--> + <div class="col-lg-6"> + <h:graphicImage library="img" + value="#{gumUserProfilePictureBean.getUserProfilePictureUri(userManager.selectedUser.id)}"/> + </div> <div class="col-lg-6"> <dl class="dl-horizontal"> <s:decorate id="id" template="/layout/display/_data_list_item.xhtml"> diff --git a/gazelle-tm-war/src/main/webapp/users/userInfo.xhtml b/gazelle-tm-war/src/main/webapp/users/userInfo.xhtml index d87e65446..3d59aec5d 100644 --- a/gazelle-tm-war/src/main/webapp/users/userInfo.xhtml +++ b/gazelle-tm-war/src/main/webapp/users/userInfo.xhtml @@ -6,7 +6,7 @@ <div class="row"> <div class="col-lg-6 col-lg-offset-3"> - <ui:param name="preferences" value="#{userPreferencesManager.getPreferencesForUser(user)}"/> + <ui:param name="preferences" value="#{gumUserProfilePictureBean.getUserProfilePictureUri(user.id)}"/> <h:outputText rendered="#{user == null}"> #{messages['gazelle.tm.users.noUserWithId']} </h:outputText> @@ -15,7 +15,7 @@ <ui:define name="panel_title">#{user.firstName} #{user.lastName}</ui:define> <div class="row"> <div class="col-lg-6"> - <h:graphicImage library="img" value="#{preferences.photoUrl}" id="monitorPhoto"/> + <h:graphicImage library="img" value="#{gumUserProfilePictureBean.getUserProfilePictureUri(user.id)}" id="monitorPhoto"/> </div> <div class="col-lg-6"> <s:decorate id="username" template="/layout/display/_display.xhtml"> @@ -23,7 +23,7 @@ <h:outputText value="#{user.firstName} #{user.lastName}"/> </s:decorate> <s:decorate id="emailDecorationView" template="/layout/display/_display.xhtml" - rendered="#{preferences.displayEmail == true || s:hasRole('admin_role')}"> + rendered="#{s:hasRole('admin_role')}"> <ui:define name="label">#{messages['gazelle.users.registration.Email']}</ui:define> <h:outputText id="emailView" value="#{user.email}"/> </s:decorate> @@ -31,21 +31,16 @@ <ui:define name="label">#{messages['gazelle.users.user.UserInstitution']}</ui:define> <h:outputText id="instituionView" value="#{user.organizationId}"/> </s:decorate> - <s:decorate id="skypeDecorationView" template="/layout/display/_display.xhtml" - rendered="#{preferences.skype != null}"> - <ui:define name="label">#{messages['gazelle.tm.users.SkypeAccount']}</ui:define> - <h:outputText id="skypeAccount" value="#{preferences.skype}"/> - </s:decorate> <s:decorate id="tableDecorationView" template="/layout/display/_display.xhtml" - rendered="#{preferences.connectathonTable != null}"> + rendered="#{preferences.tableLabel != null}"> <ui:define name="label">#{messages['gazelle.tm.users.TableLabel']}</ui:define> - <h:outputText id="table" value="#{preferences.connectathonTable}"/> + <h:outputText id="table" value="#{preferences.tableLabel}"/> </s:decorate> <s:decorate id="langDecorate" template="/layout/display/_display.xhtml" - rendered="#{not empty preferences.spokenLanguages}"> + rendered="#{not empty preferences.languagesSpoken}"> <ui:define name="label">#{messages['gazelle.tm.users.SpokenLanguages']}</ui:define> <rich:list - value="#{userPreferencesManager.getSpokenLanguagesAsList(preferences.spokenLanguages)}" + value="#{preferences.spokenLanguages}" var="v" type="unordered"> <h:outputText value="#{v}"/> </rich:list> -- GitLab From 732650e050b975dea10f4a88b1c00200b31742a4 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 22 Jul 2024 14:42:48 +0200 Subject: [PATCH 06/77] Removed users preferences pages --- .../users/user/editOtherUserPreferences.xhtml | 20 -- .../users/user/editUserPreferences.xhtml | 214 ------------------ .../webapp/users/user/userPreferences.xhtml | 20 -- .../users/user/viewUserPreferences.xhtml | 118 ---------- 4 files changed, 372 deletions(-) delete mode 100644 gazelle-tm-war/src/main/webapp/users/user/editOtherUserPreferences.xhtml delete mode 100644 gazelle-tm-war/src/main/webapp/users/user/editUserPreferences.xhtml delete mode 100644 gazelle-tm-war/src/main/webapp/users/user/userPreferences.xhtml delete mode 100644 gazelle-tm-war/src/main/webapp/users/user/viewUserPreferences.xhtml diff --git a/gazelle-tm-war/src/main/webapp/users/user/editOtherUserPreferences.xhtml b/gazelle-tm-war/src/main/webapp/users/user/editOtherUserPreferences.xhtml deleted file mode 100644 index ef4e77ebf..000000000 --- a/gazelle-tm-war/src/main/webapp/users/user/editOtherUserPreferences.xhtml +++ /dev/null @@ -1,20 +0,0 @@ -<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" - xmlns:h="http://java.sun.com/jsf/html" - xmlns:s="http://jboss.org/schema/seam/taglib" - xmlns:f="http://java.sun.com/jsf/core" - xmlns="http://www.w3.org/1999/xhtml" template="/layout/template.xhtml"> - <ui:param name="pageNameTitle" value="#{messages['gazelle.users.common.MyAccount']}"/> - <ui:define name="body"> - <h:outputScript library="jscript" name="jsf_updated.js" target="head"/> - #{userPreferencesManager.initializeOther()} - - <s:div id="globalDiv"> - <f:subview id="subview_23"> - <ui:include id="include4Edit" src="editUserPreferences.xhtml"/> - </f:subview> - <f:subview id="subview_24"> - <ui:include id="include4View" src="viewUserPreferences.xhtml"/> - </f:subview> - </s:div> - </ui:define> -</ui:composition> diff --git a/gazelle-tm-war/src/main/webapp/users/user/editUserPreferences.xhtml b/gazelle-tm-war/src/main/webapp/users/user/editUserPreferences.xhtml deleted file mode 100644 index b3c4d9454..000000000 --- a/gazelle-tm-war/src/main/webapp/users/user/editUserPreferences.xhtml +++ /dev/null @@ -1,214 +0,0 @@ -<s:div xmlns:a4j="http://richfaces.org/a4j" xmlns:ui="http://java.sun.com/jsf/facelets" - xmlns:h="http://java.sun.com/jsf/html" - xmlns:rich="http://richfaces.org/rich" xmlns:s="http://jboss.org/schema/seam/taglib" - xmlns:f="http://java.sun.com/jsf/core" - xmlns="http://www.w3.org/1999/xhtml" template="/layout/template.xhtml"> - <h:panelGroup rendered="#{userPreferencesManager.editUser}"> - <h:form id="g" styleClass="form-horizontal"> - <s:token allowMultiplePosts="true"/> - <div class="row"> - <div class="col-lg-8 col-lg-offset-2"> - <div class="row"> - <div class="col-lg-8"> - <ui:decorate template="/layout/panels/_panel.xhtml"> - <s:decorate id="fn" - template="/layout/form/_form_field_horizontal_4-8.xhtml"> - <ui:param name="id" value="firstNameEdit"/> - <ui:define name="label">#{messages['gazelle.users.registration.FirstName']} - </ui:define> - <h:outputText styleClass="form-control-static" id="firsNameReadOnly" - rendered="#{userPreferencesManager.userResourceForUpdate.delegated}" - value="#{userPreferencesManager.userResourceForUpdate.firstName}"/> - <h:inputText styleClass="form-control" id="firstNameEdit" - rendered="#{not userPreferencesManager.userResourceForUpdate.delegated}" - value="#{userPreferencesManager.userResourceForUpdate.firstName}"/> - </s:decorate> - <s:decorate id="ln" - template="/layout/form/_form_field_horizontal_4-8.xhtml"> - <ui:param name="id" value="lastNameEdit"/> - <ui:define name="label">#{messages['gazelle.users.registration.LastName']} - </ui:define> - <h:outputText styleClass="form-control-static" id="lastNameReadOnly" - rendered="#{userPreferencesManager.userResourceForUpdate.delegated}" - value="#{userPreferencesManager.userResourceForUpdate.lastName}"/> - <h:inputText styleClass="form-control" id="lastNameEdit" - rendered="#{not userPreferencesManager.userResourceForUpdate.delegated}" - value="#{userPreferencesManager.userResourceForUpdate.lastName}"/> - </s:decorate> - <s:decorate id="e" - template="/layout/form/_form_field_horizontal_4-8.xhtml"> - <ui:param name="id" value="emailEdit"/> - <ui:define name="label">#{messages['gazelle.users.registration.Email']}</ui:define> - <h:outputText styleClass="form-control-static" id="emailReadOnly" - rendered="#{userPreferencesManager.userResourceForUpdate.delegated}" - value="#{userPreferencesManager.userResourceForUpdate.email}"/> - <h:inputText styleClass=" form-control" id="emailEdit" - rendered="#{not userPreferencesManager.userResourceForUpdate.delegated}" - value="#{userPreferencesManager.userResourceForUpdate.email}"/> - </s:decorate> - <s:decorate id="i" - template="/layout/form/_form_field_horizontal_4-8.xhtml"> - <ui:param name="id" value="institutionEdit"/> - <ui:define name="label">#{messages['gazelle.users.user.UserInstitution']} - </ui:define> - <p class="form-control-static"> - <h:outputText id="institutionEdit" - value="#{userPreferencesManager.getInstitutionName()}"/> - </p> - </s:decorate> - <s:decorate id="s" - template="/layout/form/_form_field_horizontal_4-8.xhtml"> - <ui:param name="id" value="skypeAccount"/> - <ui:define name="label">#{messages['gazelle.tm.users.SkypeAccount']}</ui:define> - <h:inputText styleClass=" form-control" id="skypeAccount" - value="#{userPreferencesManager.userPreferences.skype}"/> - </s:decorate> - <s:decorate id="t" - template="/layout/form/_form_field_horizontal_4-8.xhtml"> - <ui:param name="id" value="tableLabel"/> - <ui:define name="label">#{messages['gazelle.tm.users.TableLabel']}</ui:define> - <h:inputText styleClass=" form-control" id="tableLabel" - value="#{userPreferencesManager.userPreferences.connectathonTable}"/> - </s:decorate> - - - <s:decorate id="seq" template="/layout/form/_form_field_horizontal_4-8.xhtml"> - <ui:param name="id" value="sequenceDiagram"/> - <ui:define name="label">#{messages['gazelle.tm.users.DisplaySequenceDiagram']} - </ui:define> - <h:selectBooleanCheckbox styleClass="form-control-static" id="sequenceDiagram" - value="#{userPreferencesManager.userPreferences.showSequenceDiagram}"/> - </s:decorate> - <s:decorate id="de" - template="/layout/form/_form_field_horizontal_4-8.xhtml"> - <ui:param name="id" value="displayEmail"/> - <ui:define name="label">#{messages['gazelle.tm.users.DisplayEmail']}</ui:define> - <h:selectBooleanCheckbox styleClass="form-control-static" id="displayEmail" - value="#{userPreferencesManager.userPreferences.displayEmail}"/> - </s:decorate> - - <s:decorate id="dt" template="/layout/form/_form_field_horizontal_4-8.xhtml"> - <ui:param name="id" value="displayTooltips"/> - <ui:define name="label">#{messages['net.ihe.gazelle.tm.DisplayTooltips']} - </ui:define> - <h:selectBooleanCheckbox styleClass="form-control-static" id="displayTooltips" - value="#{userPreferencesManager.userPreferences.displayTooltips}"/> - </s:decorate> - - <s:decorate id="notifEmail" template="/layout/form/_form_field_horizontal_4-8.xhtml"> - <ui:param name="id" value="sendNotificationByEmail"/> - <ui:define name="label">#{messages['net.ihe.gazelle.tm.SendNotificationByEmail']} - </ui:define> - <h:selectBooleanCheckbox styleClass="form-control-static" id="displayTooltips" - value="#{userPreferencesManager.userPreferences.emailNotification}"/> - </s:decorate> - <s:decorate id="num" - template="/layout/form/_form_field_horizontal_4-8.xhtml"> - <ui:define name="label">#{messages['gazelle.common.ResultsPerPage']}</ui:define> - <h:selectOneMenu styleClass="form-control gzl-form-control" - id="numberOfResultsPerPageList" - value="#{userPreferencesManager.userPreferences.numberOfResultsPerPage}"> - <s:selectItems value="#{dataScrollerMemory.getAllNumberOfResultsPerPage()}" - var="pageNumber" label="#{pageNumber}" - noSelectionLabel="#{messages['gazelle.common.PleaseSelect']}"/> - </h:selectOneMenu> - </s:decorate> - - <s:decorate id="spokenLanguageSelection" - template="/layout/form/_form_field_horizontal_4-8.xhtml"> - <ui:define name="label">#{messages['gazelle.tm.users.SpokenLanguages']}</ui:define> - <rich:list value="#{userPreferencesManager.spokenLanguages}" - rendered="#{not empty userPreferencesManager.spokenLanguages}" - var="sl" - type="unordered" id="editLangList"> - - <a4j:commandLink onRowMouseOver="this.style.cursor='pointer'" - actionListener="#{userPreferencesManager.removeSpokenLanguage(sl)}" - execute="@this" render="spokenLanguageSelection"> - <span class="gzl-icon-trash-o"/> - </a4j:commandLink> - <h:outputText value="#{sl}"/> - - </rich:list> - <a4j:commandLink title="#{messages['gazelle.tm.users.AddLanguage']}" - actionListener="#{userPreferencesManager.setDisplayLangMenu(true)}" - onRowMouseOver="this.style.cursor='pointer'" execute="@this" - rendered="#{not userPreferencesManager.displayLangMenu}" - render="spokenLanguageSelection"> - <span class="gzl-icon-plus"/> - </a4j:commandLink> - <h:selectOneMenu styleClass="form-control gzl-form-control" - id="spokenLanguageMenuSelection" - value="#{userPreferencesManager.selectedLanguage}" - rendered="#{userPreferencesManager.displayLangMenu}"> - <f:selectItems value="#{userPreferencesManager.languageList}"/> - <a4j:ajax event="change" render="spokenLanguageSelection" - listener="#{userPreferencesManager.addSpokenLanguage()}"/> - </h:selectOneMenu> - <a4j:commandButton styleClass="gzl-btn-green" - value="#{messages['gazelle.common.button.Finish']}" - actionListener="#{userPreferencesManager.setDisplayLangMenu(false)}" - rendered="#{userPreferencesManager.displayLangMenu}" - render="spokenLanguageSelection"/> - </s:decorate> - </ui:decorate> - </div> - - <div class="col-lg-4"> - - <ui:decorate template="/layout/panels/_panel_id.xhtml"> - <ui:param name="panel_id" value="photoDiv"/> - <div class="row"> - - <a4j:commandLink title="#{messages['gazelle.common.button.Refresh']}" - oncomplete="location.reload()"> - <span class="fa fa-refresh"/> - </a4j:commandLink> - - <h:graphicImage library="img" id="userPhotoImage" - style="max-width:100%;max-height:100%;" - value="#{userPreferencesManager.userPreferences.photoUrlNoCache}"/> - - <ui:include src="/fineupload.xhtml"> - <ui:param name="id" value="userPhoto"/> - <ui:param name="idToRerender" value="userPhotoImage"/> - <ui:param name="beanName" value="userPreferencesManager"/> - <ui:param name="multiple" value="false"/> - </ui:include> - - <a4j:commandButton styleClass="gzl-btn-red" - value="#{messages['gazelle.tm.users.removePhoto']}" - actionListener="#{userPreferencesManager.removePhoto()}" - render="photoDiv"/> - - - </div> - </ui:decorate> - </div> - </div> - <div class="col-md-12"> - <s:div styleClass="gzl-alert gzl-alert-orange" rendered="#{userPreferencesManager.userResourceForUpdate.delegated}"> - <span class="gzl-icon-exclamation-triangle"/> - <h:outputText value="#{messages['net.ihe.gazelle.tm.ThisUserIsDelegated']} - #{messages['net.ihe.gazelle.tm.AttributesAreReadyOnly']}"/> - </s:div> - <s:div styleClass="col-md-6 gzl-alert gzl-alert-orange" rendered="#{not userPreferencesManager.userResourceForUpdate.delegated}"> - <span class="gzl-icon-exclamation-triangle"/> - <h:outputText value="#{messages['net.ihe.gazelle.tm.users.user.InfoUpdateNextLogin']}"/> - </s:div> - </div> - <div> - <a4j:commandButton styleClass="gzl-btn-green" - value="#{messages['gazelle.common.button.Save']}" - actionListener="#{userPreferencesManager.savePreferences()}" - render="globalDiv"/> - <a4j:commandButton styleClass="gzl-btn" value="#{messages['gazelle.common.button.Cancel']}" - action="#{userPreferencesManager.displayPreviousPage()}" immediate="true" - bypassUpdates="true" - execute="@this"/> - </div> - </div> - </div> - </h:form> - </h:panelGroup> -</s:div> diff --git a/gazelle-tm-war/src/main/webapp/users/user/userPreferences.xhtml b/gazelle-tm-war/src/main/webapp/users/user/userPreferences.xhtml deleted file mode 100644 index e092296f9..000000000 --- a/gazelle-tm-war/src/main/webapp/users/user/userPreferences.xhtml +++ /dev/null @@ -1,20 +0,0 @@ -<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" - xmlns:s="http://jboss.org/schema/seam/taglib" - xmlns:f="http://java.sun.com/jsf/core" - xmlns:h="http://java.sun.com/jsf/html" - xmlns="http://www.w3.org/1999/xhtml" template="/layout/template.xhtml"> - <ui:param name="pageNameTitle" value="#{messages['gazelle.users.common.MyAccount']}"/> - <ui:define name="body"> - <h:outputScript library="jscript" name="jsf_updated.js" target="head"/> - #{userPreferencesManager.initialize()} - - <s:div id="globalDiv"> - <f:subview id="subview_26"> - <ui:include id="include4Edit" src="editUserPreferences.xhtml"/> - </f:subview> - <f:subview id="subview_27"> - <ui:include id="include4View" src="viewUserPreferences.xhtml"/> - </f:subview> - </s:div> - </ui:define> -</ui:composition> diff --git a/gazelle-tm-war/src/main/webapp/users/user/viewUserPreferences.xhtml b/gazelle-tm-war/src/main/webapp/users/user/viewUserPreferences.xhtml deleted file mode 100644 index c38b0577a..000000000 --- a/gazelle-tm-war/src/main/webapp/users/user/viewUserPreferences.xhtml +++ /dev/null @@ -1,118 +0,0 @@ -<s:div xmlns:a4j="http://richfaces.org/a4j" xmlns:ui="http://java.sun.com/jsf/facelets" - xmlns:h="http://java.sun.com/jsf/html" - xmlns:rich="http://richfaces.org/rich" xmlns:s="http://jboss.org/schema/seam/taglib" - xmlns="http://www.w3.org/1999/xhtml" template="/layout/template.xhtml"> - <h:panelGroup rendered="#{userPreferencesManager.viewUser}"> - <h:form id="g" styleClass="form-horizontal"> - <s:token allowMultiplePosts="true"/> - <div class="row"> - <div class="col-lg-8 col-lg-offset-2"> - <div class="row"> - <ui:decorate template="/layout/panels/_panel.xhtml"> - <div class="col-lg-9"> - <dl class="dl-horizontal"> - <s:decorate id="firstNameDecorationView" - template="/layout/display/_data_list_item.xhtml"> - <ui:define name="label">#{messages['gazelle.users.registration.FirstName']} - </ui:define> - #{userPreferencesManager.userResourceForUpdate.firstName} - </s:decorate> - <s:decorate id="lastNameDecorationView" - template="/layout/display/_data_list_item.xhtml"> - <ui:define name="label">#{messages['gazelle.users.registration.LastName']} - </ui:define> - #{userPreferencesManager.userResourceForUpdate.lastName} - </s:decorate> - <s:decorate id="emailDecorationView" - template="/layout/display/_data_list_item.xhtml"> - <ui:define name="label">#{messages['gazelle.users.registration.Email']} - </ui:define> - #{userPreferencesManager.userResourceForUpdate.email} - </s:decorate> - <s:decorate id="institutionDecorationView" - template="/layout/display/_data_list_item.xhtml"> - <ui:define name="label">#{messages['gazelle.users.user.UserInstitution']} - </ui:define> - #{userPreferencesManager.getInstitutionName()} - </s:decorate> - <s:decorate id="skypeDecorationView" - template="/layout/display/_data_list_item.xhtml"> - <ui:define name="label">#{messages['gazelle.tm.users.SkypeAccount']}</ui:define> - #{userPreferencesManager.userPreferences.skype} - </s:decorate> - <s:decorate id="tableDecorationView" - template="/layout/display/_data_list_item.xhtml"> - <ui:define name="label">#{messages['gazelle.tm.users.TableLabel']}</ui:define> - #{userPreferencesManager.userPreferences.connectathonTable} - </s:decorate> - <s:decorate id="langDecorate" - template="/layout/display/_data_list_item.xhtml"> - <ui:define name="label">#{messages['gazelle.tm.users.SpokenLanguages']} - </ui:define> - <rich:list value="#{userPreferencesManager.spokenLanguages}" - rendered="#{not empty userPreferencesManager.spokenLanguages}" - var="v" - type="unordered"> - <h:outputText value="#{v}"/> - </rich:list> - </s:decorate> - <s:decorate id="displaySequenceDiagramView" - template="/layout/display/_data_list_item.xhtml"> - <ui:define name="label"> - #{messages['gazelle.tm.users.DisplaySequenceDiagramInfo']} - </ui:define> - <h:outputText id="sequenceDiagramTrue" - rendered="#{userPreferencesManager.userPreferences.showSequenceDiagram}" - value="#{messages['gazelle.tm.users.diagramSequenceShown']}"/> - <h:outputText id="sequenceDiagramFalse" - rendered="#{not userPreferencesManager.userPreferences.showSequenceDiagram}" - value="#{messages['gazelle.tm.users.diagramSequenceHidden']}"/> - </s:decorate> - <s:decorate id="displayEmailView" - template="/layout/display/_data_list_item.xhtml"> - <ui:define name="label">#{messages['gazelle.tm.users.EmailOption']}</ui:define> - <h:outputText id="EmailTrue" - rendered="#{userPreferencesManager.userPreferences.displayEmail}" - value="#{messages['gazelle.tm.users.DisplayEmailYes']}"/> - <h:outputText id="EmailFalse" - rendered="#{not userPreferencesManager.userPreferences.displayEmail}" - value="#{messages['gazelle.tm.users.DisplayEmailNo']}"/> - </s:decorate> - <s:decorate id="notificationMailView" - template="/layout/display/_data_list_item.xhtml"> - <ui:define name="label">#{messages['net.ihe.gazelle.tm.NotificationOption']}</ui:define> - <h:outputText id="EmailTrue" - rendered="#{userPreferencesManager.userPreferences.emailNotification}" - value="#{messages['net.ihe.gazelle.tm.NotificationWillBeSendByEmailIfTheTestingSession']}"/> - <h:outputText id="EmailFalse" - rendered="#{not userPreferencesManager.userPreferences.emailNotification}" - value="#{messages['net.ihe.gazelle.tm.NotificationWillNotBeSendByEmail']}"/> - </s:decorate> - <s:decorate id="NumberOfResultsPerPage" - template="/layout/display/_data_list_item.xhtml"> - <ui:define name="label">#{messages['gazelle.common.ResultsPerPage']}</ui:define> - - #{userPreferencesManager.userPreferences.numberOfResultsPerPage} - </s:decorate> - </dl> - </div> - <div class="col-lg-3"> - <h:graphicImage library="img" style="max-width:100%;max-height:100%;" - value="#{userPreferencesManager.userPreferences.photoUrlNoCache}" - id="monitorPhoto"/> - </div> - </ui:decorate> - </div> - <a4j:commandButton styleClass="gzl-btn-blue" value="#{messages['gazelle.common.button.Edit']}" - actionListener="#{userPreferencesManager.editPreferences()}" - render="globalDiv"/> - <h:outputLink styleClass="gzl-btn" - rendered="#{not userPreferencesManager.userResourceForUpdate.delegated}" - value="#{userManager.redirectToKeycloakResetPassword()}"> - <h:outputText value="#{messages['gazelle.users.user.ResetPassword']}"/> - </h:outputLink> - </div> - </div> - </h:form> - </h:panelGroup> -</s:div> -- GitLab From 94aa10af16e2dd0a82d974c374eda0c2d74569f5 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 22 Jul 2024 16:34:23 +0200 Subject: [PATCH 07/77] Removed users preferences pages reference --- gazelle-tm-war/src/main/webapp/users/user/listUser.xhtml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/gazelle-tm-war/src/main/webapp/users/user/listUser.xhtml b/gazelle-tm-war/src/main/webapp/users/user/listUser.xhtml index a14b6de52..a6215afd7 100644 --- a/gazelle-tm-war/src/main/webapp/users/user/listUser.xhtml +++ b/gazelle-tm-war/src/main/webapp/users/user/listUser.xhtml @@ -170,15 +170,6 @@ <span class="gzl-icon-pencil"/> </a4j:commandLink> </h:panelGroup> - <h:panelGroup rendered="#{s:hasRole('admin_role')}"> - <a4j:commandLink event="click" target="edit user preferences" - action="#{userManager.editUserPreferences(user)}" - title="#{messages['net.ihe.gazelle.modules.EditUserPreferences']}" - execute="@this" - render="formToEditUser,formToEditUser"> - <span class="gzl-icon-preferences"/> - </a4j:commandLink> - </h:panelGroup> <h:panelGroup rendered="#{userManager.displayDeactivateButton(user) and not user.delegated}"> <a4j:commandLink event="click" render="DisableConfirmationModalPanel, :formForModalPanels" -- GitLab From 1511e0fc4a28984c8e73c3db58d56b34f09e0949 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 22 Jul 2024 16:48:35 +0200 Subject: [PATCH 08/77] Updated gitlab ci --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ebcffd8ed..81b3ae768 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ include: - project: "${GITLAB_CI_TEMPLATES_PATH}" file: "${GITLAB_CI_TEMPLATES_FILE}" - ref: "1.1.0" + ref: "1.2.0" # Define stages stages: -- GitLab From db651b181e5147a505e708b086ecfa591b38f8f2 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 24 Jul 2024 09:01:05 +0200 Subject: [PATCH 09/77] Updated page to update table label --- .../tm/monitor/gui/MonitorInfoBeanGui.java | 73 +++++++++++++++++++ .../main/webapp/monitors/monitorInfo.xhtml | 13 ++-- 2 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java new file mode 100644 index 000000000..4c0b2913e --- /dev/null +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java @@ -0,0 +1,73 @@ +package net.ihe.gazelle.tm.monitor.gui; + + +import net.ihe.gazelle.ssov7.gum.client.application.UserPreference; +import net.ihe.gazelle.ssov7.gum.client.application.service.UserPreferencesService; +import org.jboss.seam.ScopeType; +import org.jboss.seam.annotations.AutoCreate; +import org.jboss.seam.annotations.In; +import org.jboss.seam.annotations.Name; +import org.jboss.seam.annotations.Scope; +import org.jboss.seam.contexts.Contexts; +import org.jboss.seam.international.LocaleSelector; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +@AutoCreate +@Name(value = "monitorInfoBeanGui") +@Scope(ScopeType.EVENT) +public class MonitorInfoBeanGui { + + private static final Logger LOG = LoggerFactory.getLogger(MonitorInfoBeanGui.class); + + @In(value = "gumUserPreferencesService") + UserPreferencesService userPreferencesService; + + UserPreference userPreference; + + String tableLabel; + + public String getTableLabel() { + return userPreference.getTableLabel(); + } + + public UserPreference getUserPreferenceByUserId(String userId) { + userPreference = userPreferencesService.getUserPreferencesByUserId(userId); + List<String> languagesSpokenDisplayLabel = getLanguagesSpokenDisplayLabel(userPreference); + userPreference.setLanguagesSpoken(languagesSpokenDisplayLabel); + return userPreference; + } + + public UserPreference getUserPreference() { + return userPreference; + } + + + public void setTableLabel(String tableLabel) { + LOG.error("setTableLabel {} for user {}", tableLabel, userPreference.getUserId()); + userPreference.setTableLabel(tableLabel); + userPreferencesService.updateUserPreferences(userPreference.getUserId(), userPreference); + } + + private List<String> getLanguagesSpokenDisplayLabel(UserPreference userPreference) { + List<String> languagesSpokenDisplayLabel = new ArrayList<>(); + for (String languages : userPreference.getLanguagesSpoken()) { + Locale locale = new Locale(languages); + languagesSpokenDisplayLabel.add(locale.getDisplayLanguage(getLocale())); + } + return languagesSpokenDisplayLabel; + } + + public static Locale getLocale() { + if (Contexts.isSessionContextActive()) { + LocaleSelector selector = LocaleSelector.instance(); + return selector.getLocale(); + } else { + return Locale.getDefault(); + } + } +} diff --git a/gazelle-tm-war/src/main/webapp/monitors/monitorInfo.xhtml b/gazelle-tm-war/src/main/webapp/monitors/monitorInfo.xhtml index d2d6da6bb..cddc5c3da 100644 --- a/gazelle-tm-war/src/main/webapp/monitors/monitorInfo.xhtml +++ b/gazelle-tm-war/src/main/webapp/monitors/monitorInfo.xhtml @@ -6,7 +6,7 @@ <ui:decorate template="/layout/panels/_panel_title.xhtml"> <ui:define name="panel_title">#{monitorUser.user.firstName} #{monitorUser.user.lastName}</ui:define> <ui:param name="styleClass" value="panel-default monitorPanelStyle"/> - <c:set var="monitorPref" value="${gumUserPreferenceBean.getUserPreferenceByUserId(monitorUser.user.id)}"/> + <c:set var="monitorPref" value="${monitorInfoBeanGui.getUserPreferenceByUserId(monitorUser.user.id)}"/> <div class="row"> <div class="col-md-3 col-sm-3"> <div class="thumbnail"> @@ -40,18 +40,17 @@ rendered="#{monitorPref.tableLabel != null and (s:hasRole('admin_role') || s:hasRole('testing_session_admin_role'))}"> <ui:define name="label">#{messages['gazelle.tm.users.TableLabel']}</ui:define> <rich:inplaceInput id="tableEdit" - value="#{monitorPref.connectathonTable}" - showControls="true" inputWidth="600"> - <a4j:ajax event="change" render="tableDecorationView2" - listener="#{userPreferencesManager.savePreferences()}"/> + value="#{monitorInfoBeanGui.tableLabel}" + showControls="true" inputWidth="100"> + <a4j:ajax event="change" render="tableDecorationView2"/> </rich:inplaceInput> </s:decorate> <s:decorate id="langDecorate" template="/layout/display/_display.xhtml" rendered="#{not empty monitorPref.languagesSpoken}"> <ui:define name="label">#{messages['gazelle.tm.users.SpokenLanguages']}</ui:define> <rich:list var="language" type="unordered" - value="#{monitorPref.languagesSpoken}"> - <h:outputText value="#{language}"/> + value="#{monitorPref.languagesSpoken}"> + <h:outputText value="#{language}"/> </rich:list> </s:decorate> <a4j:commandLink -- GitLab From 690125cec5f309c1b93a6b11916f8071acb213ab Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 24 Jul 2024 09:17:32 +0200 Subject: [PATCH 10/77] Removed displayTooltips method as it does not exist anymore as a preference --- .../action/ApplicationManager.java | 1478 ++++++++--------- .../src/main/webapp/layout/template.xhtml | 2 +- 2 files changed, 731 insertions(+), 749 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/ApplicationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/ApplicationManager.java index 0b799f1a8..6221aae51 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/ApplicationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/ApplicationManager.java @@ -29,8 +29,6 @@ import net.ihe.gazelle.common.session.GazelleSessionListener; import net.ihe.gazelle.common.session.GazelleSessionListener.HttpSessionUser; import net.ihe.gazelle.menu.GazelleMenu; import net.ihe.gazelle.menu.Pages; -import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; -import net.ihe.gazelle.ssov7.authn.interlay.adapter.GazelleIdentityImpl; import net.ihe.gazelle.ssov7.gum.client.application.User; import net.ihe.gazelle.tm.gazelletest.action.TestInstanceTokenService; import net.ihe.gazelle.tm.gazelletest.action.TokenNotFoundException; @@ -39,9 +37,7 @@ import net.ihe.gazelle.tm.gazelletest.bean.PartnersStatisticsBuilder; import net.ihe.gazelle.tm.skin.SkinBean; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.systems.model.TestingSessionQuery; -import net.ihe.gazelle.tm.users.action.UserManagerExtra; import net.ihe.gazelle.tm.users.action.UserManagerExtraLocal; -import net.ihe.gazelle.tm.users.model.UserPreferences; import net.ihe.gazelle.users.action.EmailManagerLocal; import net.ihe.gazelle.users.action.EmailType; import org.apache.commons.io.FileUtils; @@ -87,756 +83,742 @@ import java.util.*; @GenerateInterface("ApplicationManagerLocal") public class ApplicationManager implements Serializable, ApplicationManagerLocal { - // 30s - public static final long SCHEDULE_CHECK_INTERVAL_30_seconds = 1000 * 30L; - private static final String UPDATE_CONNECTATHON_RESULTS = "updateConnectathonResults"; - private static final Integer PING_TIME = 60; - private static final long SCHEDULE_CHECK_INTERVAL_24_HOURS = 1000 * 86400L; - - /** - * Serial ID version of this object - */ - private static final long serialVersionUID = -7034446058820515371L; - private static final Logger LOG = LoggerFactory.getLogger(ApplicationManager.class); - private static Map<Integer, Date> lastPartnersUpdate = Collections.synchronizedMap(new HashMap<Integer, Date>()); - - @In(create = true, value = "testInstanceTokenService") - private TestInstanceTokenService testInstanceTokenService; - - @In - private ApplicationPreferenceManager applicationPreferenceManager = new ApplicationPreferenceManagerImpl(); - - /** - * Variable corresponding to the name of the property used to get the Invoices path used for Gazelle, retrieved the - * database through the ApplicationPreference entity - */ - private String gazelleInvoicesPathName = "invoices_path"; - /** - * Variable corresponding to the name of the property used to get the Contracts path used for Gazelle, retrieved the - * database through the ApplicationPreference entity - */ - private String gazelleContractsPathName = "contracts_path"; - /** - * Variable corresponding to the name of the property used to get the Objects path used for Gazelle, retrieved the - * database through the ApplicationPreference entity - */ - private String gazelleObjectsPathName = "objects_path"; - /** - * Variable corresponding to the name of the property used to get the Log Returns path used for Gazelle, retrieved - * the database through the ApplicationPreference entity - */ - private String gazelleLogReturnPathName = "log_return_path"; - private Map<Date, Usage> usages; - private String email = ""; - private String firstName = ""; - private String lastName = ""; - - public ApplicationManager() { - - } - - public static ApplicationManager instance() { - if (LOG.isDebugEnabled()) { - LOG.debug("ApplicationManager instance"); - } - return (ApplicationManager) Component - .getInstance("applicationManager"); - } - - public String getEmail() { - if (LOG.isDebugEnabled()) { - LOG.debug("getEmail"); - } - return email; - } - - public void setEmail(String email) { - if (LOG.isDebugEnabled()) { - LOG.debug("setEmail"); - } - this.email = email.trim(); - } - - public String getFirstName() { - if (LOG.isDebugEnabled()) { - LOG.debug("getFirstName"); - } - return firstName; - } - - public void setFirstName(String firstName) { - if (LOG.isDebugEnabled()) { - LOG.debug("setFirstName"); - } - this.firstName = firstName; - } - - public String getLastName() { - if (LOG.isDebugEnabled()) { - LOG.debug("getLastName"); - } - return lastName; - } - - public void setLastName(String lastName) { - if (LOG.isDebugEnabled()) { - LOG.debug("setLastName"); - } - this.lastName = lastName; - } - - @Override - @Observer("org.jboss.seam.postInitialization") - @Transactional - public void initializeApplication() { - if (LOG.isDebugEnabled()) { - LOG.debug("initializeApplication"); - } - QuartzDispatcher.instance().scheduleTimedEvent(UPDATE_CONNECTATHON_RESULTS, - new TimerSchedule(SCHEDULE_CHECK_INTERVAL_30_seconds)); - QuartzDispatcher.instance().scheduleTimedEvent("updatePartners", - new TimerSchedule(SCHEDULE_CHECK_INTERVAL_30_seconds)); - - // wait for 2 minutes - Long duration = 1000 * 120L; - - // execute every 30 secs - Long intervalDuration = SCHEDULE_CHECK_INTERVAL_30_seconds; - Schedule schedule = new TimerSchedule(duration, intervalDuration); - QuartzDispatcher.instance().scheduleTimedEvent("deployEARTimer", schedule); - - QuartzDispatcher.instance() - .scheduleTimedEvent("deleteExpiredTokens", new TimerSchedule(duration, SCHEDULE_CHECK_INTERVAL_24_HOURS)); - - QuartzDispatcher.instance().scheduleTimedEvent("addUsage", new TimerSchedule(1000L, 10000L)); - } - - @Override - @Observer("addUsage") - public void addUsage() { - if (LOG.isDebugEnabled()) { - LOG.debug("addUsage"); - } - if (usages == null) { - // 1 day - usages = Collections.synchronizedMap(new org.apache.commons.collections.map.LRUMap(3600 * 24)); - } - try { - usages.put(new Date(), new Usage()); - } catch (Exception e) { - LOG.error("Failed to add usage", e); - } - } - - @Override - public Map<Date, Usage> getUsages() { - if (LOG.isDebugEnabled()) { - LOG.debug("getUsages"); - } - if (usages == null) { - return null; - } - synchronized (usages) { - return new TreeMap<>(usages); - } - } - - - @Override - @Observer("deleteExpiredTokens") - @Transactional - public void deleteExpiredTokens() throws TokenNotFoundException { - if (LOG.isDebugEnabled()) { - LOG.debug("deleteExpiredTokens"); - } - LOG.info("The delete of the expired tokens starts"); - testInstanceTokenService.deleteExpiredTokens(); - LOG.info("The delete of the expired tokens is finished"); - } - - - @Override - @Observer("deployEARTimer") - public void deployEARTimer() { - if (LOG.isDebugEnabled()) { - LOG.debug("deployEARTimer"); - } - if (applicationPreferenceManager.isDeployScheduled()) { - Date deployTime = applicationPreferenceManager.getDeployTime(); - if (deployTime != null) { - long now = new Date().getTime(); - long scheduledDeploy = deployTime.getTime(); - long diff = scheduledDeploy - now; - // deploy interval ? - if ((diff > 0) && (diff < SCHEDULE_CHECK_INTERVAL_30_seconds)) { - QuartzDispatcher.instance().scheduleTimedEvent("deployEARPerform", new TimerSchedule(diff)); + // 30s + public static final long SCHEDULE_CHECK_INTERVAL_30_seconds = 1000 * 30L; + private static final String UPDATE_CONNECTATHON_RESULTS = "updateConnectathonResults"; + private static final Integer PING_TIME = 60; + private static final long SCHEDULE_CHECK_INTERVAL_24_HOURS = 1000 * 86400L; + + /** + * Serial ID version of this object + */ + private static final long serialVersionUID = -7034446058820515371L; + private static final Logger LOG = LoggerFactory.getLogger(ApplicationManager.class); + private static Map<Integer, Date> lastPartnersUpdate = Collections.synchronizedMap(new HashMap<Integer, Date>()); + + @In(create = true, value = "testInstanceTokenService") + private TestInstanceTokenService testInstanceTokenService; + + @In + private ApplicationPreferenceManager applicationPreferenceManager = new ApplicationPreferenceManagerImpl(); + + /** + * Variable corresponding to the name of the property used to get the Invoices path used for Gazelle, retrieved the + * database through the ApplicationPreference entity + */ + private String gazelleInvoicesPathName = "invoices_path"; + /** + * Variable corresponding to the name of the property used to get the Contracts path used for Gazelle, retrieved the + * database through the ApplicationPreference entity + */ + private String gazelleContractsPathName = "contracts_path"; + /** + * Variable corresponding to the name of the property used to get the Objects path used for Gazelle, retrieved the + * database through the ApplicationPreference entity + */ + private String gazelleObjectsPathName = "objects_path"; + /** + * Variable corresponding to the name of the property used to get the Log Returns path used for Gazelle, retrieved + * the database through the ApplicationPreference entity + */ + private String gazelleLogReturnPathName = "log_return_path"; + private Map<Date, Usage> usages; + private String email = ""; + private String firstName = ""; + private String lastName = ""; + + public ApplicationManager() { + + } + + public static ApplicationManager instance() { + if (LOG.isDebugEnabled()) { + LOG.debug("ApplicationManager instance"); + } + return (ApplicationManager) Component + .getInstance("applicationManager"); + } + + public String getEmail() { + if (LOG.isDebugEnabled()) { + LOG.debug("getEmail"); + } + return email; + } + + public void setEmail(String email) { + if (LOG.isDebugEnabled()) { + LOG.debug("setEmail"); + } + this.email = email.trim(); + } + + public String getFirstName() { + if (LOG.isDebugEnabled()) { + LOG.debug("getFirstName"); + } + return firstName; + } + + public void setFirstName(String firstName) { + if (LOG.isDebugEnabled()) { + LOG.debug("setFirstName"); + } + this.firstName = firstName; + } + + public String getLastName() { + if (LOG.isDebugEnabled()) { + LOG.debug("getLastName"); + } + return lastName; + } + + public void setLastName(String lastName) { + if (LOG.isDebugEnabled()) { + LOG.debug("setLastName"); + } + this.lastName = lastName; + } + + @Override + @Observer("org.jboss.seam.postInitialization") + @Transactional + public void initializeApplication() { + if (LOG.isDebugEnabled()) { + LOG.debug("initializeApplication"); + } + QuartzDispatcher.instance().scheduleTimedEvent(UPDATE_CONNECTATHON_RESULTS, + new TimerSchedule(SCHEDULE_CHECK_INTERVAL_30_seconds)); + QuartzDispatcher.instance().scheduleTimedEvent("updatePartners", + new TimerSchedule(SCHEDULE_CHECK_INTERVAL_30_seconds)); + + // wait for 2 minutes + Long duration = 1000 * 120L; + + // execute every 30 secs + Long intervalDuration = SCHEDULE_CHECK_INTERVAL_30_seconds; + Schedule schedule = new TimerSchedule(duration, intervalDuration); + QuartzDispatcher.instance().scheduleTimedEvent("deployEARTimer", schedule); + + QuartzDispatcher.instance() + .scheduleTimedEvent("deleteExpiredTokens", new TimerSchedule(duration, SCHEDULE_CHECK_INTERVAL_24_HOURS)); + + QuartzDispatcher.instance().scheduleTimedEvent("addUsage", new TimerSchedule(1000L, 10000L)); + } + + @Override + @Observer("addUsage") + public void addUsage() { + if (LOG.isDebugEnabled()) { + LOG.debug("addUsage"); + } + if (usages == null) { + // 1 day + usages = Collections.synchronizedMap(new org.apache.commons.collections.map.LRUMap(3600 * 24)); + } + try { + usages.put(new Date(), new Usage()); + } catch (Exception e) { + LOG.error("Failed to add usage", e); + } + } + + @Override + public Map<Date, Usage> getUsages() { + if (LOG.isDebugEnabled()) { + LOG.debug("getUsages"); + } + if (usages == null) { + return null; + } + synchronized (usages) { + return new TreeMap<>(usages); + } + } + + + @Override + @Observer("deleteExpiredTokens") + @Transactional + public void deleteExpiredTokens() throws TokenNotFoundException { + if (LOG.isDebugEnabled()) { + LOG.debug("deleteExpiredTokens"); + } + LOG.info("The delete of the expired tokens starts"); + testInstanceTokenService.deleteExpiredTokens(); + LOG.info("The delete of the expired tokens is finished"); + } + + + @Override + @Observer("deployEARTimer") + public void deployEARTimer() { + if (LOG.isDebugEnabled()) { + LOG.debug("deployEARTimer"); + } + if (applicationPreferenceManager.isDeployScheduled()) { + Date deployTime = applicationPreferenceManager.getDeployTime(); + if (deployTime != null) { + long now = new Date().getTime(); + long scheduledDeploy = deployTime.getTime(); + long diff = scheduledDeploy - now; + // deploy interval ? + if ((diff > 0) && (diff < SCHEDULE_CHECK_INTERVAL_30_seconds)) { + QuartzDispatcher.instance().scheduleTimedEvent("deployEARPerform", new TimerSchedule(diff)); + } } - } - } - } - - @Override - @Observer("deployEARPerform") - public void deployEARPerform() { - if (LOG.isDebugEnabled()) { - LOG.debug("deployEARPerform"); - } - startDeploy(applicationPreferenceManager.getDeploySource(), applicationPreferenceManager - .getDeployTarget()); - } - - private void startDeploy(String deploySource, String deployTarget) { - if ((deploySource != null) && (deployTarget != null)) { - File srcFile = new File(deploySource); - File destFile = new File(deployTarget); - try { - if (srcFile.exists()) { - FileUtils.copyFile(srcFile, destFile); - } else { - throw new IOException(deploySource + " doesn't exist!"); + } + } + + @Override + @Observer("deployEARPerform") + public void deployEARPerform() { + if (LOG.isDebugEnabled()) { + LOG.debug("deployEARPerform"); + } + startDeploy(applicationPreferenceManager.getDeploySource(), applicationPreferenceManager + .getDeployTarget()); + } + + private void startDeploy(String deploySource, String deployTarget) { + if ((deploySource != null) && (deployTarget != null)) { + File srcFile = new File(deploySource); + File destFile = new File(deployTarget); + try { + if (srcFile.exists()) { + FileUtils.copyFile(srcFile, destFile); + } else { + throw new IOException(deploySource + " doesn't exist!"); + } + } catch (IOException e) { + LOG.error("Failed to perform deploy", e); } - } catch (IOException e) { - LOG.error("Failed to perform deploy", e); - } - } - } - - protected boolean performUpdate(Integer testingSessionId) { - boolean performUpdate = false; - - List<HttpSessionUser> httpSessions = new ArrayList<>(GazelleSessionListener.getSessions() - .values()); - for (HttpSessionUser httpSession : httpSessions) { - if (!performUpdate) { - Object testingSessionObject = httpSession.getSession().getAttribute("selectedTestingSession"); - if (testingSessionObject instanceof TestingSession) { - Integer userTestingSessionId = ((TestingSession) testingSessionObject).getId(); - if ((userTestingSessionId != null) && userTestingSessionId.equals(testingSessionId)) { - performUpdate = true; - } + } + } + + protected boolean performUpdate(Integer testingSessionId) { + boolean performUpdate = false; + + List<HttpSessionUser> httpSessions = new ArrayList<>(GazelleSessionListener.getSessions() + .values()); + for (HttpSessionUser httpSession : httpSessions) { + if (!performUpdate) { + Object testingSessionObject = httpSession.getSession().getAttribute("selectedTestingSession"); + if (testingSessionObject instanceof TestingSession) { + Integer userTestingSessionId = ((TestingSession) testingSessionObject).getId(); + if ((userTestingSessionId != null) && userTestingSessionId.equals(testingSessionId)) { + performUpdate = true; + } + } } - } - } - return performUpdate; - } - - @Override - @Observer(UPDATE_CONNECTATHON_RESULTS) - public void updateConnectathonResults() { - if (LOG.isDebugEnabled()) { - LOG.debug("updateConnectathonResults"); - } - if (isTestManagement() && applicationPreferenceManager.getBooleanValue("auto_update_results")) { - TestingSessionQuery testingSessionQuery = new TestingSessionQuery(); - testingSessionQuery.disableAutoResults().neq(true); - List<Integer> testingSessionIds = testingSessionQuery.id().getListDistinct(); - - QuartzDispatcher.instance().scheduleAsynchronousEvent("updateConnectathonResultsList", testingSessionIds); - } else { - QuartzDispatcher.instance().scheduleTimedEvent(UPDATE_CONNECTATHON_RESULTS, - new TimerSchedule(Long.valueOf(applicationPreferenceManager.getCATResultCheckInterval()))); - } - } - - @Override - @Observer("updateConnectathonResultsList") - @Transactional - public void updateConnectathonResultsList(List<Integer> testingSessionIds) { - if (LOG.isDebugEnabled()) { - LOG.debug("updateConnectathonResultsList"); - } - if (!testingSessionIds.isEmpty()) { - Integer testingSessionId = testingSessionIds.remove(0); - if (performUpdate(testingSessionId)) { + } + return performUpdate; + } + + @Override + @Observer(UPDATE_CONNECTATHON_RESULTS) + public void updateConnectathonResults() { + if (LOG.isDebugEnabled()) { + LOG.debug("updateConnectathonResults"); + } + if (isTestManagement() && applicationPreferenceManager.getBooleanValue("auto_update_results")) { TestingSessionQuery testingSessionQuery = new TestingSessionQuery(); - testingSessionQuery.id().eq(testingSessionId); - TestingSession testingSession = testingSessionQuery.getUniqueResult(); - try { - - ConnectathonStatisticsBuilder connectathonStatisticsBuilder = new ConnectathonStatisticsBuilder( - testingSession); - connectathonStatisticsBuilder.updateStatistics(); - } catch (Exception e) { - LOG.warn("Failed to update session " + testingSession.getDescription(), e); + testingSessionQuery.disableAutoResults().neq(true); + List<Integer> testingSessionIds = testingSessionQuery.id().getListDistinct(); + + QuartzDispatcher.instance().scheduleAsynchronousEvent("updateConnectathonResultsList", testingSessionIds); + } else { + QuartzDispatcher.instance().scheduleTimedEvent(UPDATE_CONNECTATHON_RESULTS, + new TimerSchedule(Long.valueOf(applicationPreferenceManager.getCATResultCheckInterval()))); + } + } + + @Override + @Observer("updateConnectathonResultsList") + @Transactional + public void updateConnectathonResultsList(List<Integer> testingSessionIds) { + if (LOG.isDebugEnabled()) { + LOG.debug("updateConnectathonResultsList"); + } + if (!testingSessionIds.isEmpty()) { + Integer testingSessionId = testingSessionIds.remove(0); + if (performUpdate(testingSessionId)) { + TestingSessionQuery testingSessionQuery = new TestingSessionQuery(); + testingSessionQuery.id().eq(testingSessionId); + TestingSession testingSession = testingSessionQuery.getUniqueResult(); + try { + + ConnectathonStatisticsBuilder connectathonStatisticsBuilder = new ConnectathonStatisticsBuilder( + testingSession); + connectathonStatisticsBuilder.updateStatistics(); + } catch (Exception e) { + LOG.warn("Failed to update session " + testingSession.getDescription(), e); + } } - } - QuartzDispatcher.instance().scheduleAsynchronousEvent("updateConnectathonResultsList", testingSessionIds); - } else { - QuartzDispatcher.instance().scheduleTimedEvent(UPDATE_CONNECTATHON_RESULTS, - new TimerSchedule(Long.valueOf(applicationPreferenceManager.getCATResultCheckInterval()))); - } - } - - @Override - @Observer("updatePartners") - public void updatePartners() { - if (LOG.isDebugEnabled()) { - LOG.debug("updatePartners"); - } - if (isTestManagement()) { - TestingSessionQuery testingSessionQuery = new TestingSessionQuery(); - List<TestingSession> list = testingSessionQuery.getList(); - for (TestingSession testingSession : list) { - if (performUpdate(testingSession.getId())) { - try { - - PartnersStatisticsBuilder.update(testingSession); - lastPartnersUpdate.put(testingSession.getId(), new Date()); - } catch (Exception e) { - LOG.warn("Failed to update partners", e); - } + QuartzDispatcher.instance().scheduleAsynchronousEvent("updateConnectathonResultsList", testingSessionIds); + } else { + QuartzDispatcher.instance().scheduleTimedEvent(UPDATE_CONNECTATHON_RESULTS, + new TimerSchedule(Long.valueOf(applicationPreferenceManager.getCATResultCheckInterval()))); + } + } + + @Override + @Observer("updatePartners") + public void updatePartners() { + if (LOG.isDebugEnabled()) { + LOG.debug("updatePartners"); + } + if (isTestManagement()) { + TestingSessionQuery testingSessionQuery = new TestingSessionQuery(); + List<TestingSession> list = testingSessionQuery.getList(); + for (TestingSession testingSession : list) { + if (performUpdate(testingSession.getId())) { + try { + + PartnersStatisticsBuilder.update(testingSession); + lastPartnersUpdate.put(testingSession.getId(), new Date()); + } catch (Exception e) { + LOG.warn("Failed to update partners", e); + } + } + } + } + QuartzDispatcher.instance().scheduleTimedEvent("updatePartners", + new TimerSchedule(Long.valueOf(applicationPreferenceManager.getPartnersCheckInterval()))); + } + + @Override + public Date getLastPartnersUpdate(Integer testingSessionId) { + if (LOG.isDebugEnabled()) { + LOG.debug("getLastPartnersUpdate"); + } + return lastPartnersUpdate.get(testingSessionId); + } + + /** + * Get the Invoices path. Returns absolute path for Invoices directory depending on the Gazelle Data Path. + * Example if + * Gazelle data is /opt/gazelle/data, it returns : /opt/gazelle/data/invoices + * + * @return String : absolute path for Invoices directory : eg /opt/gazelle/data/invoices + */ + @Override + public String getGazelleInvoicesPath() { + if (LOG.isDebugEnabled()) { + LOG.debug("getGazelleInvoicesPath"); + } + return applicationPreferenceManager.getGazelleDataPath() + File.separatorChar + + applicationPreferenceManager.getStringValue(gazelleInvoicesPathName); + } + + /** + * Get the Contracts path. Returns absolute path for Contracts directory depending on the Gazelle Data Path. Example + * if Gazelle data is /opt/gazelle/data, it returns : /opt/gazelle/data/contracts + * + * @return String : absolute path for Contracts directory : eg /opt/gazelle/data/contracts + */ + @Override + public String getGazelleContractsPath() { + if (LOG.isDebugEnabled()) { + LOG.debug("getGazelleContractsPath"); + } + return applicationPreferenceManager.getGazelleDataPath() + File.separatorChar + + applicationPreferenceManager.getStringValue(gazelleContractsPathName); + } + + /** + * Get the LOG return path. Returns absolute path for Log return directory depending on the Gazelle Data Path. + * Example if Gazelle data is /opt/gazelle/data, it returns : /opt/gazelle/data/logReturns + * + * @return String : absolute path for Log Returns directory : eg /opt/gazelle/data/logReturns + */ + @Override + public String getGazelleLogReturnPath() { + if (LOG.isDebugEnabled()) { + LOG.debug("getGazelleLogReturnPath"); + } + return applicationPreferenceManager.getGazelleDataPath() + File.separatorChar + + applicationPreferenceManager.getStringValue(gazelleLogReturnPathName); + } + + /** + * Get the Objects path. Returns absolute path for Objects directory depending on the Gazelle Data Path. Example if + * Gazelle data is /opt/gazelle/data, it returns : /opt/gazelle/data/objects + * + * @return String : absolute path for Objects directory : eg /opt/gazelle/data/objects + */ + @Override + public String getObjectsPath() { + if (LOG.isDebugEnabled()) { + LOG.debug("getObjectsPath"); + } + return applicationPreferenceManager.getGazelleDataPath() + File.separatorChar + + applicationPreferenceManager.getStringValue(gazelleObjectsPathName); + } + + @Override + public boolean isMasterModel() { + LOG.trace("isMasterModel"); + return Boolean.TRUE.equals(applicationPreferenceManager.getBooleanValue("is_master_model")); + } + + @Override + public boolean isTestManagement() { + LOG.trace("isTestManagement"); + return Boolean.TRUE.equals(applicationPreferenceManager.getBooleanValue("is_test_management")); + } + + @Override + public boolean isProductRegistry() { + LOG.trace("isProductRegistry"); + return Boolean.TRUE.equals(applicationPreferenceManager.getBooleanValue("is_product_registry")); + } + + @Override + public String getCertificatesUrl() { + if (LOG.isDebugEnabled()) { + LOG.debug("getCertificatesUrl"); + } + return applicationPreferenceManager.getStringValue("certificates_url"); + } + + @Override + public String getTlsUrl() { + if (LOG.isDebugEnabled()) { + LOG.debug("getTlsUrl"); + } + return applicationPreferenceManager.getStringValue("tls_url"); + } + + @Override + public String getTlsName() { + if (LOG.isDebugEnabled()) { + LOG.debug("getTlsName"); + } + + String name = applicationPreferenceManager.getStringValue("tls_url"); + int index = name.lastIndexOf("/") + 1; + name = name.substring(index, name.length()); + return name; + } + + @Override + public boolean isAssertionEnabled() { + LOG.trace("isAssertionEnabled"); + return Boolean.TRUE.equals(applicationPreferenceManager.getBooleanValue("use_assertions")); + } + + @Override + public String getAssertionRestApi() { + if (LOG.isDebugEnabled()) { + LOG.debug("getAssertionRestApi"); + } + return applicationPreferenceManager.getStringValue("assertions_manager_rest_api"); + } + + @Override + public String getJiraUrl() { + if (LOG.isDebugEnabled()) { + LOG.debug("getJiraUrl"); + } + return applicationPreferenceManager.getStringValue("jira_base_url"); + } + + @Override + public String getJiraTestIssueProject() { + if (LOG.isDebugEnabled()) { + LOG.debug("getJiraTestIssueProject"); + } + return applicationPreferenceManager.getStringValue("jira_test_issue_project"); + } + + @Override + public String getJiraReportTestIssueProject() { + if (LOG.isDebugEnabled()) { + LOG.debug("getJiraReportTestIssueProject"); + } + return applicationPreferenceManager.getStringValue("jira_report_test_issue_project"); + } + + @Override + public boolean isJiraActivated() { + LOG.trace("IsJiraActivated"); + return Boolean.TRUE.equals(applicationPreferenceManager.getBooleanValue("use_jira_test_issues")); + } + + public boolean isJiraSetup() { + LOG.trace("isJiraSetup"); + return !("".equals(ApplicationManager.instance().getJiraUrl()) || + "".equals(ApplicationManager.instance().getJiraReportTestIssueProject())); + } + + @Override + public boolean isTestsDisplayAsNotLoggedIn() { + LOG.trace("isTestsDisplayAsNotLoggedIn"); + return Boolean.TRUE.equals(applicationPreferenceManager.getBooleanValue("is_tests_display_as_not_logged_in")); + } + + @Override + public void getOpenSearchDescription() { + if (LOG.isDebugEnabled()) { + LOG.debug("getOpenSearchDescription"); + } + try { + FileCache.getFile("OpenSearchDescription", applicationPreferenceManager.getApplicationUrl(), + new FileCacheRenderer() { + + @Override + public void render(OutputStream out, String value) throws Exception { + if (LOG.isDebugEnabled()) { + LOG.debug("render"); + } + StringBuilder xml = getXmlOpenSearchDescription(); + out.write(xml.toString().getBytes(StandardCharsets.UTF_8.name())); + } + + @Override + public String getContentType() { + if (LOG.isDebugEnabled()) { + LOG.debug("getContentType"); + } + return "text/xml"; + } + }); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private StringBuilder getXmlOpenSearchDescription() { + StringBuilder xml = new StringBuilder(); + xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); + xml.append("<OpenSearchDescription xmlns=\"http://a9.com/-/spec/opensearch/1.1/\" " + + "xmlns:moz=\"http://www.mozilla.org/2006/browser/search/\" >"); + xml.append(" <ShortName>Gazelle</ShortName>"); + xml.append(" <Description>Search in Gazelle</Description>"); + xml.append(" <Tags>Gazelle</Tags>"); + xml.append(" <Image height=\"16\" width=\"16\">data:image/x-icon;base64,"); + xml.append("AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAD5pfT" + + "/+KH0//ic8//4mPP/+JPy//iP8f/4ivH/+Ibw//eB7//3fu+w/4T/BL5CgRO/Q4Nqv0ODhb9Dgzm/Q4MB+KH0//id8/" + + "/4mPP/+JTy//iP8f/4i/H/+Ibw//iC8P/3fe//93nv0+5u3Bm+Q4KPv0OD/L9Dg/+/Q4PYv0ODN/ic8//4mPP/+JTy/" + + "/iP8f/4i/H/+Ibw//iC8P/3fe//93nu//d179/dXbw6vkOC2b9Dg/+/Q4P/v0OD/79Dg4D4mPP/+JTy//iP8f/4i/H/" + + "+Ibw//iC8P/3fe//93nu//d07v/3ce7Y4V3DKr9DgsW/Q4P/v0OD/79Dg/i/Q4Nl+JPy//iP8f/4i/H/+Ibw//iC8P/" + + "3fe//93nu//d17v/3cO3/923tuP9x/ge/Q4JHv0ODxr9Dg9u/Q4OLv0ODEfiP8f/4i/H/+Ibw//iC8P/3fe//93nu//" + + "d17v/3cO3/92zs/vdp7HAAAAAAAAAAAL9DgxC/Q4MZv0ODBQAAAAD4ivH/+Ibw//iC8P/3fe//93nu//d17v/3cO3/9" + + "2zs//do7Mr3Z+0bAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+Ibw//iC8P/3fe//93nu//d17v/3cO3/92zs//do7N73" + + "Zu1AnTVlFaY6ciimOnIMAAAAAAAAAAAAAAAAAAAAAPiC8P33fe//93nu//d07v/3cO3/92zt+Pdo7Lr5Z/A4pTlwSKY" + + "6ctGmOnLqpjpyrKY6chwAAAAAAAAAAAAAAAD3fu9h93rvk/h28Kz4cu+q923tjPdq7E37afIOojhsC6Y6cr6mOnL/pj" + + "py/6Y6cv+mOnJzAAAAAAAAAAAAAAAAAAAAAJEzZgiWN20mlzduHZY1bQIAAAAAAAAAAKY6chCmOnLLpjpy/6Y6cv+mO" + + "nL/pjpygQAAAAAAAAAAAAAAAIwxYBGMMWCTjDFg5YwxYNaMMWBbAAAAAAAAAAAAAAAApjpycqY6cvSmOnL/pjpy2aY6" + + "cjQAAAAAAAAAAAAAAACMMWBgjDFg+IwxYP+MMWD/jDFg04wxYBgAAAAAAAAAAKY6cgimOnJDpjpyX6Y6ciqmOnIBAAA" + + "AAAAAAAAAAAAAjDFgcYwxYP2MMWD/jDFg/4wxYOGMMWAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + + "AAAAAAAIwxYCiMMWDIjDFg/owxYPmMMWCOjDFgBQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + + "AAAAAAAjDFgKIwxYG+MMWBbjDFgEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADsA" + + "AAAhAAAAIAAAACEAAAAxAAAAfwAAAH8AAAD/AAABjwAAhw8AAP8HAACPjwAAh/8AAIf/AACH/wAA//8AAA=="); + xml.append("</Image>"); + xml.append(" <Url type=\"application/x-suggestions+json\""); + xml.append(" rel=\"suggestions\" template=\"").append(applicationPreferenceManager.getApplicationUrl()) + .append("search/searchJSON.seam?q={searchTerms}\" />"); + xml.append(" <Url type=\"text/html\""); + xml.append(" template=\"").append(applicationPreferenceManager.getApplicationUrl()) + .append("search/search.seam?q={searchTerms}\" />"); + xml.append(" <moz:SearchForm>").append(applicationPreferenceManager.getApplicationUrl()) + .append("search/search.seam</moz:SearchForm>"); + xml.append("</OpenSearchDescription>"); + return xml; + } + + @Override + @Factory(value = "applicationDefaultColor") + public String getDefaultColor() { + if (LOG.isDebugEnabled()) { + LOG.debug("getDefaultColor"); + } + String result = applicationPreferenceManager.getStringValue("default_color"); + if (result == null) { + applicationPreferenceManager.setValue(PreferenceType.STRING, "default_color", SkinBean.DEFAULT_COLOR_HTML); + } + return result; + } + + @Override + // @Factory(value = "gazelleMenu") + public Menu getMenu() { + if (LOG.isDebugEnabled()) { + LOG.debug("getMenu"); + } + return GazelleMenu.getInstance().getMenu(); + } + + @Override + public boolean isShowHelp() { + LOG.trace("isShowHelp"); + return getHelpUrl() != null; + } + + @Override + public String getHelpUrl() { + if (LOG.isDebugEnabled()) { + LOG.debug("getHelpUrl"); + } + if (Boolean.TRUE.equals(applicationPreferenceManager.getBooleanValue("help_show"))) { + HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext() + .getRequest(); + String servletPath = request.getServletPath(); + String servletPathXHTML = servletPath.replace(".seam", ".xhtml"); + Pages[] pages = Pages.values(); + for (Page page : pages) { + if (page.getLink().startsWith(servletPathXHTML)) { + return applicationPreferenceManager.getStringValue("help_url") + page.getId(); + } } - } - } - QuartzDispatcher.instance().scheduleTimedEvent("updatePartners", - new TimerSchedule(Long.valueOf(applicationPreferenceManager.getPartnersCheckInterval()))); - } - - @Override - public Date getLastPartnersUpdate(Integer testingSessionId) { - if (LOG.isDebugEnabled()) { - LOG.debug("getLastPartnersUpdate"); - } - return lastPartnersUpdate.get(testingSessionId); - } - - /** - * Get the Invoices path. Returns absolute path for Invoices directory depending on the Gazelle Data Path. - * Example if - * Gazelle data is /opt/gazelle/data, it returns : /opt/gazelle/data/invoices - * - * @return String : absolute path for Invoices directory : eg /opt/gazelle/data/invoices - */ - @Override - public String getGazelleInvoicesPath() { - if (LOG.isDebugEnabled()) { - LOG.debug("getGazelleInvoicesPath"); - } - return applicationPreferenceManager.getGazelleDataPath() + File.separatorChar - + applicationPreferenceManager.getStringValue(gazelleInvoicesPathName); - } - - /** - * Get the Contracts path. Returns absolute path for Contracts directory depending on the Gazelle Data Path. Example - * if Gazelle data is /opt/gazelle/data, it returns : /opt/gazelle/data/contracts - * - * @return String : absolute path for Contracts directory : eg /opt/gazelle/data/contracts - */ - @Override - public String getGazelleContractsPath() { - if (LOG.isDebugEnabled()) { - LOG.debug("getGazelleContractsPath"); - } - return applicationPreferenceManager.getGazelleDataPath() + File.separatorChar - + applicationPreferenceManager.getStringValue(gazelleContractsPathName); - } - - /** - * Get the LOG return path. Returns absolute path for Log return directory depending on the Gazelle Data Path. - * Example if Gazelle data is /opt/gazelle/data, it returns : /opt/gazelle/data/logReturns - * - * @return String : absolute path for Log Returns directory : eg /opt/gazelle/data/logReturns - */ - @Override - public String getGazelleLogReturnPath() { - if (LOG.isDebugEnabled()) { - LOG.debug("getGazelleLogReturnPath"); - } - return applicationPreferenceManager.getGazelleDataPath() + File.separatorChar - + applicationPreferenceManager.getStringValue(gazelleLogReturnPathName); - } - - /** - * Get the Objects path. Returns absolute path for Objects directory depending on the Gazelle Data Path. Example if - * Gazelle data is /opt/gazelle/data, it returns : /opt/gazelle/data/objects - * - * @return String : absolute path for Objects directory : eg /opt/gazelle/data/objects - */ - @Override - public String getObjectsPath() { - if (LOG.isDebugEnabled()) { - LOG.debug("getObjectsPath"); - } - return applicationPreferenceManager.getGazelleDataPath() + File.separatorChar - + applicationPreferenceManager.getStringValue(gazelleObjectsPathName); - } - - @Override - public boolean isMasterModel() { - LOG.trace("isMasterModel"); - return Boolean.TRUE.equals(applicationPreferenceManager.getBooleanValue("is_master_model")); - } - - @Override - public boolean isTestManagement() { - LOG.trace("isTestManagement"); - return Boolean.TRUE.equals(applicationPreferenceManager.getBooleanValue("is_test_management")); - } - - @Override - public boolean isProductRegistry() { - LOG.trace("isProductRegistry"); - return Boolean.TRUE.equals(applicationPreferenceManager.getBooleanValue("is_product_registry")); - } - - @Override - public String getCertificatesUrl() { - if (LOG.isDebugEnabled()) { - LOG.debug("getCertificatesUrl"); - } - return applicationPreferenceManager.getStringValue("certificates_url"); - } - - @Override - public String getTlsUrl() { - if (LOG.isDebugEnabled()) { - LOG.debug("getTlsUrl"); - } - return applicationPreferenceManager.getStringValue("tls_url"); - } - - @Override - public String getTlsName() { - if (LOG.isDebugEnabled()) { - LOG.debug("getTlsName"); - } - - String name = applicationPreferenceManager.getStringValue("tls_url"); - int index = name.lastIndexOf("/") + 1; - name = name.substring(index, name.length()); - return name; - } - - @Override - public boolean isAssertionEnabled() { - LOG.trace("isAssertionEnabled"); - return Boolean.TRUE.equals(applicationPreferenceManager.getBooleanValue("use_assertions")); - } - - @Override - public String getAssertionRestApi() { - if (LOG.isDebugEnabled()) { - LOG.debug("getAssertionRestApi"); - } - return applicationPreferenceManager.getStringValue("assertions_manager_rest_api"); - } - - @Override - public String getJiraUrl() { - if (LOG.isDebugEnabled()) { - LOG.debug("getJiraUrl"); - } - return applicationPreferenceManager.getStringValue("jira_base_url"); - } - - @Override - public String getJiraTestIssueProject() { - if (LOG.isDebugEnabled()) { - LOG.debug("getJiraTestIssueProject"); - } - return applicationPreferenceManager.getStringValue("jira_test_issue_project"); - } - - @Override - public String getJiraReportTestIssueProject() { - if (LOG.isDebugEnabled()) { - LOG.debug("getJiraReportTestIssueProject"); - } - return applicationPreferenceManager.getStringValue("jira_report_test_issue_project"); - } - - @Override - public boolean isJiraActivated() { - LOG.trace("IsJiraActivated"); - return Boolean.TRUE.equals(applicationPreferenceManager.getBooleanValue("use_jira_test_issues")); - } - - public boolean isJiraSetup() { - LOG.trace("isJiraSetup"); - return !("".equals(ApplicationManager.instance().getJiraUrl()) || - "".equals(ApplicationManager.instance().getJiraReportTestIssueProject())); - } - - @Override - public boolean isTestsDisplayAsNotLoggedIn() { - LOG.trace("isTestsDisplayAsNotLoggedIn"); - return Boolean.TRUE.equals(applicationPreferenceManager.getBooleanValue("is_tests_display_as_not_logged_in")); - } - - @Override - public void getOpenSearchDescription() { - if (LOG.isDebugEnabled()) { - LOG.debug("getOpenSearchDescription"); - } - try { - FileCache.getFile("OpenSearchDescription", applicationPreferenceManager.getApplicationUrl(), - new FileCacheRenderer() { - - @Override - public void render(OutputStream out, String value) throws Exception { - if (LOG.isDebugEnabled()) { - LOG.debug("render"); - } - StringBuilder xml = getXmlOpenSearchDescription(); - out.write(xml.toString().getBytes(StandardCharsets.UTF_8.name())); - } - - @Override - public String getContentType() { - if (LOG.isDebugEnabled()) { - LOG.debug("getContentType"); - } - return "text/xml"; - } - }); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private StringBuilder getXmlOpenSearchDescription() { - StringBuilder xml = new StringBuilder(); - xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); - xml.append("<OpenSearchDescription xmlns=\"http://a9.com/-/spec/opensearch/1.1/\" " - + "xmlns:moz=\"http://www.mozilla.org/2006/browser/search/\" >"); - xml.append(" <ShortName>Gazelle</ShortName>"); - xml.append(" <Description>Search in Gazelle</Description>"); - xml.append(" <Tags>Gazelle</Tags>"); - xml.append(" <Image height=\"16\" width=\"16\">data:image/x-icon;base64,"); - xml.append("AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAD5pfT" - + "/+KH0//ic8//4mPP/+JPy//iP8f/4ivH/+Ibw//eB7//3fu+w/4T/BL5CgRO/Q4Nqv0ODhb9Dgzm/Q4MB+KH0//id8/" - + "/4mPP/+JTy//iP8f/4i/H/+Ibw//iC8P/3fe//93nv0+5u3Bm+Q4KPv0OD/L9Dg/+/Q4PYv0ODN/ic8//4mPP/+JTy/" - + "/iP8f/4i/H/+Ibw//iC8P/3fe//93nu//d179/dXbw6vkOC2b9Dg/+/Q4P/v0OD/79Dg4D4mPP/+JTy//iP8f/4i/H/" - + "+Ibw//iC8P/3fe//93nu//d07v/3ce7Y4V3DKr9DgsW/Q4P/v0OD/79Dg/i/Q4Nl+JPy//iP8f/4i/H/+Ibw//iC8P/" - + "3fe//93nu//d17v/3cO3/923tuP9x/ge/Q4JHv0ODxr9Dg9u/Q4OLv0ODEfiP8f/4i/H/+Ibw//iC8P/3fe//93nu//" - + "d17v/3cO3/92zs/vdp7HAAAAAAAAAAAL9DgxC/Q4MZv0ODBQAAAAD4ivH/+Ibw//iC8P/3fe//93nu//d17v/3cO3/9" - + "2zs//do7Mr3Z+0bAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+Ibw//iC8P/3fe//93nu//d17v/3cO3/92zs//do7N73" - + "Zu1AnTVlFaY6ciimOnIMAAAAAAAAAAAAAAAAAAAAAPiC8P33fe//93nu//d07v/3cO3/92zt+Pdo7Lr5Z/A4pTlwSKY" - + "6ctGmOnLqpjpyrKY6chwAAAAAAAAAAAAAAAD3fu9h93rvk/h28Kz4cu+q923tjPdq7E37afIOojhsC6Y6cr6mOnL/pj" - + "py/6Y6cv+mOnJzAAAAAAAAAAAAAAAAAAAAAJEzZgiWN20mlzduHZY1bQIAAAAAAAAAAKY6chCmOnLLpjpy/6Y6cv+mO" - + "nL/pjpygQAAAAAAAAAAAAAAAIwxYBGMMWCTjDFg5YwxYNaMMWBbAAAAAAAAAAAAAAAApjpycqY6cvSmOnL/pjpy2aY6" - + "cjQAAAAAAAAAAAAAAACMMWBgjDFg+IwxYP+MMWD/jDFg04wxYBgAAAAAAAAAAKY6cgimOnJDpjpyX6Y6ciqmOnIBAAA" - + "AAAAAAAAAAAAAjDFgcYwxYP2MMWD/jDFg/4wxYOGMMWAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - + "AAAAAAAIwxYCiMMWDIjDFg/owxYPmMMWCOjDFgBQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - + "AAAAAAAjDFgKIwxYG+MMWBbjDFgEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADsA" - + "AAAhAAAAIAAAACEAAAAxAAAAfwAAAH8AAAD/AAABjwAAhw8AAP8HAACPjwAAh/8AAIf/AACH/wAA//8AAA=="); - xml.append("</Image>"); - xml.append(" <Url type=\"application/x-suggestions+json\""); - xml.append(" rel=\"suggestions\" template=\"").append(applicationPreferenceManager.getApplicationUrl()) - .append("search/searchJSON.seam?q={searchTerms}\" />"); - xml.append(" <Url type=\"text/html\""); - xml.append(" template=\"").append(applicationPreferenceManager.getApplicationUrl()) - .append("search/search.seam?q={searchTerms}\" />"); - xml.append(" <moz:SearchForm>").append(applicationPreferenceManager.getApplicationUrl()) - .append("search/search.seam</moz:SearchForm>"); - xml.append("</OpenSearchDescription>"); - return xml; - } - - @Override - @Factory(value = "applicationDefaultColor") - public String getDefaultColor() { - if (LOG.isDebugEnabled()) { - LOG.debug("getDefaultColor"); - } - String result = applicationPreferenceManager.getStringValue("default_color"); - if (result == null) { - applicationPreferenceManager.setValue(PreferenceType.STRING, "default_color", SkinBean.DEFAULT_COLOR_HTML); - } - return result; - } - - @Override - // @Factory(value = "gazelleMenu") - public Menu getMenu() { - if (LOG.isDebugEnabled()) { - LOG.debug("getMenu"); - } - return GazelleMenu.getInstance().getMenu(); - } - - @Override - public boolean isShowHelp() { - LOG.trace("isShowHelp"); - return getHelpUrl() != null; - } - - @Override - public String getHelpUrl() { - if (LOG.isDebugEnabled()) { - LOG.debug("getHelpUrl"); - } - if (Boolean.TRUE.equals(applicationPreferenceManager.getBooleanValue("help_show"))) { - HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext() - .getRequest(); - String servletPath = request.getServletPath(); - String servletPathXHTML = servletPath.replace(".seam", ".xhtml"); - Pages[] pages = Pages.values(); - for (Page page : pages) { - if (page.getLink().startsWith(servletPathXHTML)) { - return applicationPreferenceManager.getStringValue("help_url") + page.getId(); + } + return null; + } + + @Override + public long getPingTime() { + LOG.trace("getPingTime"); + Integer result = applicationPreferenceManager.getIntegerValue("ping_time"); + if (result == null) { + result = PING_TIME; + applicationPreferenceManager.setValue(PreferenceType.INTEGER, "ping_time", result); + } + return result; + } + + @Override + public boolean isPingEnabled() { + Boolean value = applicationPreferenceManager.getBooleanValue("ping_enabled"); + if (value == null) { + value = false; + applicationPreferenceManager.setValue(PreferenceType.BOOLEAN, "ping_enabled", value); + } + return value; + } + + @Override + public boolean isSendEmailsToAllAdmins() { + Boolean value = applicationPreferenceManager.getBooleanValue("send_emails_to_all_admins"); + if (value == null) { + value = false; + applicationPreferenceManager.setValue(PreferenceType.BOOLEAN, "send_emails_to_all_admins", value); + } + return value; + } + + @Override + public String getViewId() { + LOG.trace("getViewId"); + return FacesContext.getCurrentInstance().getViewRoot().getViewId(); + } + + @Override + public void ping() { + LOG.trace("ping"); + FacesContext fc = FacesContext.getCurrentInstance(); + Map<String, String> requestParameterMap = fc.getExternalContext().getRequestParameterMap(); + String offset = requestParameterMap.get("offset"); + + HttpServletRequest request = (HttpServletRequest) fc.getExternalContext().getRequest(); + HttpSession session = request.getSession(); + Object jsTimezoneOffset = session.getAttribute("jsTimezoneOffset"); + if (offset != null && !offset.equals(jsTimezoneOffset)) { + session.setAttribute("jsTimezoneOffset", offset); + } + + StringBuilder response = new StringBuilder(); + + UserManagerExtraLocal userManagerExtra = (UserManagerExtraLocal) Component + .getInstance("userManagerExtra"); + ApplicationPreferenceManager preferenceManager = (ApplicationPreferenceManager) Component + .getInstance("applicationPreferenceManager"); + long logoutDateTime = userManagerExtra.getLogoutDateTime(); + long serverDateTime = preferenceManager.getServerDateTime(); + + if ((request.getMethod() == null) || !"HEAD".equalsIgnoreCase(request.getMethod())) { + response.append("startCountDownLogOut(") + .append(logoutDateTime).append(", ") + .append(serverDateTime).append(");\n"); + + if (preferenceManager.isDeployScheduled()) { + long deployDateTime = preferenceManager.getDeployDateTime(); + response.append("startCountDown(") + .append(deployDateTime).append(", ") + .append(serverDateTime).append(");\n"); + } else { + response.append("stopCountDown();"); } - } - } - return null; - } - - @Override - public long getPingTime() { - LOG.trace("getPingTime"); - Integer result = applicationPreferenceManager.getIntegerValue("ping_time"); - if (result == null) { - result = PING_TIME; - applicationPreferenceManager.setValue(PreferenceType.INTEGER, "ping_time", result); - } - return result; - } - - @Override - public boolean isPingEnabled() { - Boolean value = applicationPreferenceManager.getBooleanValue("ping_enabled"); - if (value == null) { - value = false; - applicationPreferenceManager.setValue(PreferenceType.BOOLEAN, "ping_enabled", value); - } - return value; - } - - @Override - public boolean isSendEmailsToAllAdmins() { - Boolean value = applicationPreferenceManager.getBooleanValue("send_emails_to_all_admins"); - if (value == null) { - value = false; - applicationPreferenceManager.setValue(PreferenceType.BOOLEAN, "send_emails_to_all_admins", value); - } - return value; - } - - @Override - public String getViewId() { - LOG.trace("getViewId"); - return FacesContext.getCurrentInstance().getViewRoot().getViewId(); - } - - @Override - public void ping() { - LOG.trace("ping"); - FacesContext fc = FacesContext.getCurrentInstance(); - Map<String, String> requestParameterMap = fc.getExternalContext().getRequestParameterMap(); - String offset = requestParameterMap.get("offset"); - - HttpServletRequest request = (HttpServletRequest) fc.getExternalContext().getRequest(); - HttpSession session = request.getSession(); - Object jsTimezoneOffset = session.getAttribute("jsTimezoneOffset"); - if (offset != null && !offset.equals(jsTimezoneOffset)) { - session.setAttribute("jsTimezoneOffset", offset); - } - - StringBuilder response = new StringBuilder(); - - UserManagerExtraLocal userManagerExtra = (UserManagerExtraLocal) Component - .getInstance("userManagerExtra"); - ApplicationPreferenceManager preferenceManager = (ApplicationPreferenceManager) Component - .getInstance("applicationPreferenceManager"); - long logoutDateTime = userManagerExtra.getLogoutDateTime(); - long serverDateTime = preferenceManager.getServerDateTime(); - - if ((request.getMethod() == null) || !"HEAD".equalsIgnoreCase(request.getMethod())) { - response.append("startCountDownLogOut(") - .append(logoutDateTime).append(", ") - .append(serverDateTime).append(");\n"); - - if (preferenceManager.isDeployScheduled()) { - long deployDateTime = preferenceManager.getDeployDateTime(); - response.append("startCountDown(") - .append(deployDateTime).append(", ") - .append(serverDateTime).append(");\n"); - } else { - response.append("stopCountDown();"); - } - } - - writeContentToFaceContext(fc, response); - } - - @Override - public boolean isIncompatibleBrowser() { - if (LOG.isDebugEnabled()) { - LOG.debug("isIncompatibleBrowser"); - } - ExternalContext ex = FacesContext.getCurrentInstance().getExternalContext(); - HttpServletRequest request = (HttpServletRequest) ex.getRequest(); - HttpSession session = request.getSession(); - Boolean isCompatible = (Boolean) session.getAttribute("isCompatible"); - if (isCompatible != null) { - return isCompatible; - } - isCompatible = false; - try { - String browserInfo = request.getHeader("user-agent"); - if (browserInfo != null) { - UserAgent userAgent = UserAgent.parseUserAgentString(browserInfo); - Browser browser = userAgent.getBrowser().getGroup(); - if ((browser != Browser.SAFARI) && (browser != Browser.CHROME) && (browser != Browser.FIREFOX)) { - isCompatible = true; + } + + writeContentToFaceContext(fc, response); + } + + @Override + public boolean isIncompatibleBrowser() { + if (LOG.isDebugEnabled()) { + LOG.debug("isIncompatibleBrowser"); + } + ExternalContext ex = FacesContext.getCurrentInstance().getExternalContext(); + HttpServletRequest request = (HttpServletRequest) ex.getRequest(); + HttpSession session = request.getSession(); + Boolean isCompatible = (Boolean) session.getAttribute("isCompatible"); + if (isCompatible != null) { + return isCompatible; + } + isCompatible = false; + try { + String browserInfo = request.getHeader("user-agent"); + if (browserInfo != null) { + UserAgent userAgent = UserAgent.parseUserAgentString(browserInfo); + Browser browser = userAgent.getBrowser().getGroup(); + if ((browser != Browser.SAFARI) && (browser != Browser.CHROME) && (browser != Browser.FIREFOX)) { + isCompatible = true; + } } - } - } catch (Exception e) { - isCompatible = false; - } - session.setAttribute("isCompatible", isCompatible); - return isCompatible; - } - - @Override - public boolean displayToolTips() { - LOG.trace("displayToolTips"); - GazelleIdentity identity = GazelleIdentityImpl.instance(); - if (identity != null && identity.isLoggedIn()) { - UserManagerExtra um = (UserManagerExtra) Component.getInstance("userManagerExtra"); - UserPreferences preferences = um.getLoggedInUserPreferences(); - if (preferences != null) { - return preferences.getDisplayTooltips(); - } - } - return true; - } - - @Override - public void testEmail() { - if (LOG.isDebugEnabled()) { - LOG.debug("testEmail"); - } - EmailManagerLocal emailManager = (EmailManagerLocal) Component.getInstance("emailManager"); - User recipient = new User(); - recipient.setEmail(getEmail()); - recipient.setFirstName(getFirstName()); - recipient.setLastName(getLastName()); - try { - emailManager.setRecipient(recipient); - emailManager.sendEmail(EmailType.TO_ADMIN_TO_TEST_EMAIL); - FacesMessages.instance().add(StatusMessage.Severity.INFO, - "Email sent to " + recipient.getFirstName() + " " + recipient.getLastName()); - } catch (Exception e) { - FacesMessages.instance().add(StatusMessage.Severity.ERROR, "Failed to send email !\n" + e); - } - } - - @Override - public String getCguLink() { - return applicationPreferenceManager.getCguLink(); - } - - private void writeContentToFaceContext(FacesContext fc, StringBuilder response) { - String result = response.toString(); - try { - HttpServletResponse catalinaResponse = (HttpServletResponse) fc.getExternalContext().getResponse(); - catalinaResponse.setContentType("text/javascript"); - catalinaResponse.getOutputStream().write(result.getBytes(StandardCharsets.UTF_8.name())); - - fc.responseComplete(); - } catch (Exception e) { - LOG.error(e.getMessage(), e); - } - } + } catch (Exception e) { + isCompatible = false; + } + session.setAttribute("isCompatible", isCompatible); + return isCompatible; + } + + @Override + public void testEmail() { + if (LOG.isDebugEnabled()) { + LOG.debug("testEmail"); + } + EmailManagerLocal emailManager = (EmailManagerLocal) Component.getInstance("emailManager"); + User recipient = new User(); + recipient.setEmail(getEmail()); + recipient.setFirstName(getFirstName()); + recipient.setLastName(getLastName()); + try { + emailManager.setRecipient(recipient); + emailManager.sendEmail(EmailType.TO_ADMIN_TO_TEST_EMAIL); + FacesMessages.instance().add(StatusMessage.Severity.INFO, + "Email sent to " + recipient.getFirstName() + " " + recipient.getLastName()); + } catch (Exception e) { + FacesMessages.instance().add(StatusMessage.Severity.ERROR, "Failed to send email !\n" + e); + } + } + + @Override + public String getCguLink() { + return applicationPreferenceManager.getCguLink(); + } + + private void writeContentToFaceContext(FacesContext fc, StringBuilder response) { + String result = response.toString(); + try { + HttpServletResponse catalinaResponse = (HttpServletResponse) fc.getExternalContext().getResponse(); + catalinaResponse.setContentType("text/javascript"); + catalinaResponse.getOutputStream().write(result.getBytes(StandardCharsets.UTF_8.name())); + + fc.responseComplete(); + } catch (Exception e) { + LOG.error(e.getMessage(), e); + } + } } diff --git a/gazelle-tm-war/src/main/webapp/layout/template.xhtml b/gazelle-tm-war/src/main/webapp/layout/template.xhtml index 8a99daf61..0e5b0d2a3 100644 --- a/gazelle-tm-war/src/main/webapp/layout/template.xhtml +++ b/gazelle-tm-war/src/main/webapp/layout/template.xhtml @@ -35,7 +35,7 @@ <!--<h:outputStylesheet library="stylesheet" name="summernote.css"/>--> <!--<h:outputStylesheet library="stylesheet" name="status.css"/>--> - <h:outputStylesheet rendered="#{identity.loggedIn and applicationManager.displayToolTips()}" + <h:outputStylesheet rendered="#{identity.loggedIn}" library="stylesheet" name="tooltip.css"/> -- GitLab From 44068e3dfcc32760a8149aaefa95a689dba84bb4 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 24 Jul 2024 09:26:02 +0200 Subject: [PATCH 11/77] Updated to use new UserPreferences --- .../tm/messages/EmailNotificationManager.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java index 62f276ac2..d50a6040e 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java @@ -1,15 +1,18 @@ package net.ihe.gazelle.tm.messages; import net.ihe.gazelle.ssov7.gum.client.application.User; +import net.ihe.gazelle.ssov7.gum.client.application.UserPreference; +import net.ihe.gazelle.ssov7.gum.client.application.service.UserPreferencesService; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.tm.messages.model.Message; import net.ihe.gazelle.tm.messages.model.MessageUser; import net.ihe.gazelle.tm.systems.model.TestingSession; -import net.ihe.gazelle.tm.users.model.UserPreferences; import net.ihe.gazelle.users.action.EmailManagerLocal; import net.ihe.gazelle.users.action.EmailType; import org.jboss.seam.Component; +import org.jboss.seam.annotations.In; +import java.io.IOException; import java.io.Serializable; /** @@ -23,6 +26,9 @@ public class EmailNotificationManager implements Serializable, NotificationListe this.messageFormatter = messageFormatter; } + @In("gumUserPreferencesService") + transient UserPreferencesService userPreferencesService; + /** * Send notification by email to all concerned user * @param message message to send @@ -37,7 +43,8 @@ public class EmailNotificationManager implements Serializable, NotificationListe User author = userService.getUserById(message.getAuthor()); for (MessageUser recipientId : message.getUsers()) { User recipient = userService.getUserById(recipientId.getUserId()); - if (UserPreferences.getPreferencesForUser(recipient.getId()) != null && UserPreferences.getPreferencesForUser(recipient.getId()).isEmailNotification()) { + UserPreference userPreference = userPreferencesService.getUserPreferencesByUserId(recipientId.getUserId()); + if (userPreference != null && userPreference.isNotifiedByEmail()) { emailManager.setConcerned(author); emailManager.setRecipient(recipient); emailManager.setMessage(messageFormatter.getPreferredLangFormattedMessage(message)); @@ -52,4 +59,18 @@ public class EmailNotificationManager implements Serializable, NotificationListe } } } + + /** + * Reload userPreferencesService in case of deserialization. + * + * @param inputStream InputStream of the UserValueFormatter. + * + * @throws IOException + * @throws ClassNotFoundException + * @see Serializable + */ + private void readObject(java.io.ObjectInputStream inputStream) throws IOException, ClassNotFoundException { + inputStream.defaultReadObject(); + this.userPreferencesService = (UserPreferencesService) Component.getInstance("gumUserPreferencesService"); + } } -- GitLab From 6cd1249a14f9e581f7bc06f0e2adb57dc1788513 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 24 Jul 2024 10:04:39 +0200 Subject: [PATCH 12/77] Updated tm-tools version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ca31be50c..21a9aa7cb 100644 --- a/pom.xml +++ b/pom.xml @@ -77,7 +77,7 @@ <skipITs>true</skipITs> - <gazelle.tm.tools.version>4.3.2-SNAPSHOT</gazelle.tm.tools.version> + <gazelle.tm.tools.version>4.3.2-GZL-5369-SNAPSHOT</gazelle.tm.tools.version> <jacoco.version>0.8.1</jacoco.version> <sonar.maven.plugin>3.7.0.1746</sonar.maven.plugin> <maven.release.plugin.version>2.5.3</maven.release.plugin.version> -- GitLab From 3a77b4ca43fd5ae16bf52218f7106227fc79d12a Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 24 Jul 2024 10:15:25 +0200 Subject: [PATCH 13/77] Removed links to user preferences --- gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Pages.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Pages.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Pages.java index 110ef6b65..bdb3ea8e6 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Pages.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Pages.java @@ -38,8 +38,6 @@ public enum Pages implements Page { "gazelle.common.menu.ChangeTestingSession", Authorizations .LOGGED, Authorizations.TM), - USER_PREFERENCES("/users/user/userPreferences.xhtml", Icons.USER_PREFERENCES, "gazelle.users.common.MyAccount", - Authorizations.LOGGED), REGISTRATION("", Icons.REGISTRATION, "gazelle.common.menu.Registration", Authorizations.VENDOR, Authorizations.VENDOR_ADMIN, Authorizations.NOT_ONLY_GMM), @@ -657,8 +655,6 @@ public enum Pages implements Page { USERS_USER("/users/user.xhtml", null, null, Authorizations.LOGGED), - USERS_USER_EDITOTHERUSERPREFERENCES("/users/user/editOtherUserPreferences.xhtml", null, null, Authorizations.ADMIN), - OBJECTS_SAMPLESSUMMARY("/objects/samplesSummary.xhtml", null, null, Authorizations.LOGGED), FINANCIAL_GAZELLEEXTRACTINVOICEREPORT("/financial/GazelleExtractInvoiceReport.xhtml", null, null, -- GitLab From 582df4893343e0b309e3efe5857d145bdee83df3 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 24 Jul 2024 10:27:21 +0200 Subject: [PATCH 14/77] Removed links to user preferences --- .../src/main/java/net/ihe/gazelle/menu/GazelleMenu.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/GazelleMenu.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/GazelleMenu.java index 989da168f..375fad594 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/GazelleMenu.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/GazelleMenu.java @@ -176,11 +176,6 @@ public class GazelleMenu { private Menu getHome() { List<Menu> children = new ArrayList<Menu>(); - - - - children.add(new MenuEntry(Pages.USER_PREFERENCES)); - return new MenuGroup(Pages.HOME, children); } -- GitLab From d1e467f35d8289c56b624297ef281d890d029d9c Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 24 Jul 2024 11:56:01 +0200 Subject: [PATCH 15/77] Removed code referencing UserPreference. --- .../action/GazellePreferenceProvider.java | 33 +------------------ 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java index d334c52da..111ac46b3 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java @@ -8,16 +8,12 @@ import net.ihe.gazelle.common.servletfilter.IEHeaderFilter; import net.ihe.gazelle.common.util.DateDisplayUtil; import net.ihe.gazelle.geoip.GeoIP; import net.ihe.gazelle.geoip.result.Location; -import net.ihe.gazelle.hql.providers.EntityManagerService; import net.ihe.gazelle.preferences.PreferenceProvider; import net.ihe.gazelle.tm.systems.model.TestingSession; -import net.ihe.gazelle.tm.users.action.UserManagerExtra; import net.ihe.gazelle.tm.users.action.UserManagerExtraLocal; -import net.ihe.gazelle.tm.users.model.UserPreferences; import org.apache.commons.lang.StringUtils; import org.jboss.seam.Component; import org.jboss.seam.contexts.Contexts; -import org.jboss.seam.security.Identity; import org.jboss.seam.web.MultipartFilter; import org.kohsuke.MetaInfServices; import org.slf4j.Logger; @@ -32,10 +28,10 @@ import java.util.TimeZone; @MetaInfServices(PreferenceProvider.class) public class GazellePreferenceProvider implements PreferenceProvider { - private static final String NUMBER_OF_ITEMS_PER_PAGE = "NUMBER_OF_ITEMS_PER_PAGE"; private static final String CACHE_REQUEST = "cacheRequest"; private static final Logger LOG = LoggerFactory.getLogger(GazellePreferenceProvider.class); private final ApplicationPreferenceManager applicationPreferenceManager = new ApplicationPreferenceManagerImpl(); + @Override public String getString(String key) { if (LOG.isDebugEnabled()) { @@ -129,23 +125,6 @@ public class GazellePreferenceProvider implements PreferenceProvider { if (LOG.isDebugEnabled()) { LOG.debug("getInteger"); } - if (NUMBER_OF_ITEMS_PER_PAGE.equals(key)) { - CacheRequest cacheRequest = (CacheRequest) Component.getInstance(CACHE_REQUEST); - Object result = cacheRequest.getValueUpdater(NUMBER_OF_ITEMS_PER_PAGE, new CacheUpdater() { - @Override - public Integer getValue(String key, Object parameter) { - if (LOG.isDebugEnabled()) { - LOG.debug("getValue"); - } - UserManagerExtraLocal userManager = (UserManagerExtraLocal) Component.getInstance("userManagerExtra"); - if (userManager != null) { - return userManager.getLoggedInUserPreferences().getNumberOfResultsPerPage(); - } - return UserManagerExtra.DEFAULT_NUMBER_OF_RESULTS_PER_PAGE; - } - }, null); - return (Integer) result; - } if ("upload_max_size".equals(key)) { MultipartFilter multipartFilter = (MultipartFilter) Component.getInstance(MultipartFilter.class); return multipartFilter.getMaxRequestSize(); @@ -224,16 +203,6 @@ public class GazellePreferenceProvider implements PreferenceProvider { if (LOG.isDebugEnabled()) { LOG.debug("setInteger"); } - if (NUMBER_OF_ITEMS_PER_PAGE.equals(key) && (Identity.instance().isLoggedIn())) { - UserManagerExtraLocal userManager = (UserManagerExtraLocal) Component.getInstance("userManagerExtra"); - if (userManager != null) { - UserPreferences userPreferences = userManager.getLoggedInUserPreferences(); - userPreferences.setNumberOfResultsPerPage(value); - EntityManagerService.provideEntityManager().merge(userPreferences); - CacheRequest cacheRequest = (CacheRequest) Component.getInstance(CACHE_REQUEST); - cacheRequest.removeValue(NUMBER_OF_ITEMS_PER_PAGE); - } - } } -- GitLab From 80d000f1546befd86af098406960b238107d86d4 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 24 Jul 2024 12:01:47 +0200 Subject: [PATCH 16/77] Removed userPreference creation as it is not TM to do it now --- .../ihe/gazelle/users/action/UserManager.java | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/users/action/UserManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/users/action/UserManager.java index 8be1d73e5..f724c53c3 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/users/action/UserManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/users/action/UserManager.java @@ -25,7 +25,6 @@ import net.ihe.gazelle.common.filter.list.NoHQLDataModel; import net.ihe.gazelle.common.interfacegenerator.GenerateInterface; import net.ihe.gazelle.common.log.ExceptionLogging; import net.ihe.gazelle.common.util.DataScrollerMemory; -import net.ihe.gazelle.hql.providers.EntityManagerService; import net.ihe.gazelle.menu.Pages; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.configuration.domain.CasConfigurationService; @@ -40,9 +39,7 @@ import net.ihe.gazelle.ssov7.gum.client.interlay.model.entity.ActivationResource import net.ihe.gazelle.tm.organization.OrganizationService; import net.ihe.gazelle.tm.organization.OrganizationServiceDAO; import net.ihe.gazelle.tm.organization.dao.OrganizationServiceDAOImpl; -import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.users.filter.UserFilterImpl; -import net.ihe.gazelle.tm.users.model.UserPreferences; import net.ihe.gazelle.users.model.Institution; import net.ihe.gazelle.util.Pair; import org.hibernate.exception.ConstraintViolationException; @@ -59,7 +56,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.faces.context.FacesContext; -import javax.persistence.EntityManager; import java.io.Serializable; import java.util.*; import java.util.regex.Matcher; @@ -533,18 +529,6 @@ public class UserManager implements Serializable, UserManagerLocal { } } - private void createUserPreferences(User user, TestingSession testingSession, EntityManager entityManager) { - UserPreferences userPreferences = new UserPreferences(); - userPreferences.setShowSequenceDiagram(true); - userPreferences.setUsername(user.getId()); - userPreferences.setDisplayEmail(false); - userPreferences.setNumberOfResultsPerPage(UserPreferences.DEFAULT_NUMBER_OF_RESULTS_PER_PAGE); - userPreferences.setEmailNotification(true); - userPreferences.setSelectedTestingSession(testingSession); - entityManager.persist(userPreferences); - entityManager.flush(); - } - public void setUpdateRole(Pair<Boolean, Role> currentRole) { LOGGER.trace("setUpdateRole"); List<String> currentRoles = userResourceForUpdate.getRoles(); @@ -580,12 +564,6 @@ public class UserManager implements Serializable, UserManagerLocal { try { updateUserFromClient(patchedUser); - UserPreferences userPref = UserPreferences.getPreferencesForUser(selectedUser.getId()); - if (userPref == null) { - // Create user preferences - EntityManager entityManager = EntityManagerService.provideEntityManager(); - createUserPreferences(selectedUser, TestingSession.getDefault(), entityManager); - } closeViewOrEditPanelsAndOpenList(); } catch (Exception e) { LOG.error("Unable to update user.", e); -- GitLab From f018ce6189b45af3678da20d11057f34e8a79ac6 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 26 Jul 2024 15:14:35 +0200 Subject: [PATCH 17/77] Testing Session moved from userPreference to cookie --- .../action/GazellePreferenceProvider.java | 14 ++-- .../gazelletest/action/MesaTestManager.java | 7 +- .../tm/session/TestingSessionService.java | 20 +++--- .../tm/session/TestingSessionServiceImpl.java | 52 ++++++++++---- .../tm/session/bean/TestSessionBean.java | 39 ++++++++++ .../dao/TestingSessionServiceDAOImpl.java | 7 +- .../systems/action/TestingSessionManager.java | 44 ++++++------ .../tm/users/action/UserManagerExtra.java | 72 +------------------ .../webapp/administration/listSessions.xhtml | 4 +- .../session/changeSessionInclude.xhtml | 6 +- .../MetaTestInstanceDataTableByAIPO2.xhtml | 2 +- .../test/TestInstanceDataTableByAIPO3.xhtml | 2 +- 12 files changed, 136 insertions(+), 133 deletions(-) create mode 100644 gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/bean/TestSessionBean.java diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java index 111ac46b3..1bb435cc1 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java @@ -6,11 +6,11 @@ import net.ihe.gazelle.common.application.action.ApplicationPreferenceManager; import net.ihe.gazelle.common.application.action.ApplicationPreferenceManagerImpl; import net.ihe.gazelle.common.servletfilter.IEHeaderFilter; import net.ihe.gazelle.common.util.DateDisplayUtil; +import net.ihe.gazelle.common.util.GazelleCookie; import net.ihe.gazelle.geoip.GeoIP; import net.ihe.gazelle.geoip.result.Location; import net.ihe.gazelle.preferences.PreferenceProvider; import net.ihe.gazelle.tm.systems.model.TestingSession; -import net.ihe.gazelle.tm.users.action.UserManagerExtraLocal; import org.apache.commons.lang.StringUtils; import org.jboss.seam.Component; import org.jboss.seam.contexts.Contexts; @@ -161,21 +161,19 @@ public class GazellePreferenceProvider implements PreferenceProvider { } if ("user_testing_session".equals(key)) { CacheRequest cacheRequest = (CacheRequest) Component.getInstance(CACHE_REQUEST); - Object result = cacheRequest.getValueUpdater("user_testing_session", new CacheUpdater() { + return cacheRequest.getValueUpdater("user_testing_session", new CacheUpdater() { @Override public Object getValue(String key, Object parameter) { if (LOG.isDebugEnabled()) { LOG.debug("getValue"); } - UserManagerExtraLocal userManager = (UserManagerExtraLocal) Component.getInstance("userManagerExtra"); - if (userManager != null) { - TestingSession selectedTestingSession = userManager.getSelectedTestingSession(); - return selectedTestingSession; + String sessionId = GazelleCookie.getCookie("GZL_CURRENT_TESTING_SESSION_ID"); + if (sessionId != null) { + return TestingSession.getSessionById(Integer.valueOf(sessionId)); } - return null; + return TestingSession.getDefaultTestingSession(); } }, null); - return result; } return null; } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MesaTestManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MesaTestManager.java index 719a186de..7993ebfa4 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MesaTestManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MesaTestManager.java @@ -28,9 +28,9 @@ import net.ihe.gazelle.tm.gazelletest.model.reversed.AIPO; import net.ihe.gazelle.tm.gazelletest.model.reversed.AIPOQuery; import net.ihe.gazelle.tm.messages.NotificationService; import net.ihe.gazelle.tm.messages.TestInstanceParticipantCommentMessageSource; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; -import net.ihe.gazelle.tm.users.action.UserManagerExtra; import net.ihe.gazelle.users.model.Institution; import net.ihe.gazelle.util.Pair; import org.apache.commons.httpclient.URIException; @@ -70,6 +70,7 @@ public class MesaTestManager extends ValidationForTIP implements MesaTestManager private static final String MESA_AUTOMATIC_VALIDATION = "mesa_test_automatic_validation"; private static final String MESA_SEND_MAIL = "send_mail_mesa_notification"; private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(MesaTestManager.class); + private static final long serialVersionUID = -5444073280396740867L; private static String MESA_PAGE_VALIDATE_MESA_TEST = "/testing/test/mesa/validateMesaTest.seam"; private static String MESA_PAGE_LIST_OF_PRECONNECTATHON_TEST = "/testing/test/mesa/listOfPreconnectathonTests.seam"; private static String MESA_PAGE_LOG_RETURN = "/testing/test/mesa/logReturnForMesaTest.seam"; @@ -148,8 +149,8 @@ public class MesaTestManager extends ValidationForTIP implements MesaTestManager LOG.trace("modifyQuery"); SystemInSessionQuery query = new SystemInSessionQuery(); if (!identity.hasRole(Role.ADMIN)) { - UserManagerExtra uma = (UserManagerExtra) Component.getInstance("userManagerExtra"); - queryBuilder.addRestriction(query.testingSession().eqRestriction(uma.getSelectedTestingSession())); + TestingSessionService testingSessionService= (TestingSessionService) Component.getInstance("testingSessionService"); + queryBuilder.addRestriction(query.testingSession().eqRestriction(testingSessionService.getCurrentTestingSession())); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java index b1ed1780e..99df197e3 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java @@ -11,12 +11,12 @@ public interface TestingSessionService { /** * Get current testing session, based on HTTP session + * * @return TestingSession */ TestingSession getCurrentTestingSession(); /** - * * @param testingSession testing session object * @return boolean * @throws IllegalArgumentException if testing session is null @@ -25,7 +25,6 @@ public interface TestingSessionService { boolean isTestingSessionRunning(TestingSession testingSession); /** - * * @param testingSession testing session object * @return boolean * @throws IllegalArgumentException if testing session is null @@ -35,7 +34,6 @@ public interface TestingSessionService { /** - * * @param testingSession testing session object * @return boolean * @throws IllegalArgumentException if testing session is null @@ -43,7 +41,6 @@ public interface TestingSessionService { boolean isBeforeSessionStart(TestingSession testingSession); /** - * * @param testingSession testing session object * @return boolean * @throws IllegalArgumentException if testing session is null @@ -52,7 +49,6 @@ public interface TestingSessionService { /** - * * @param testingSession testing session object * @return boolean * @throws IllegalArgumentException if testing session is null @@ -60,7 +56,6 @@ public interface TestingSessionService { List<String> getTestingSessionManagers(TestingSession testingSession); /** - * * @param testingSession testing session object * @return boolean * @throws IllegalArgumentException if testing session is null @@ -70,7 +65,6 @@ public interface TestingSessionService { /** - * * @param testingSession testing session object * @return boolean * @throws IllegalArgumentException if testing session is null @@ -80,12 +74,22 @@ public interface TestingSessionService { boolean isContinuousSession(TestingSession testingSession); boolean isPrecatTestsEnabled(TestingSession testingSession); + List<TestType> getListTestType(); /** - * * @return Return the list of TestType as SelectItems */ List<SelectItem> getListTestTypeAsSelectItems(); + + /** + * Set in cookie the currentTestingSession of the logged user. + * If the service cannot find a session, it will use the default one. + * + * @param testingSession the current session + */ + void setCurrentTestingSession(TestingSession testingSession); + + } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java index e652938a0..69fbbe1a4 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java @@ -1,15 +1,22 @@ package net.ihe.gazelle.tm.session; +import net.ihe.gazelle.common.action.CacheRequest; +import net.ihe.gazelle.common.util.GazelleCookie; +import net.ihe.gazelle.hql.providers.EntityManagerService; +import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.tm.gazelletest.model.definition.TestType; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.systems.model.TestingSessionAdmin; +import org.jboss.seam.Component; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; +import org.jboss.seam.contexts.Contexts; import javax.faces.model.SelectItem; +import javax.persistence.EntityManager; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -26,6 +33,9 @@ public class TestingSessionServiceImpl implements TestingSessionService { @In(value = "gumUserService") private UserService userService; + @In + private GazelleIdentity identity; + @Override public TestingSession getCurrentTestingSession() { return testingSessionServiceDAO.getCurrentTestingSession(); @@ -33,11 +43,11 @@ public class TestingSessionServiceImpl implements TestingSessionService { @Override public boolean isTestingSessionRunning(TestingSession testingSession) { - if(testingSession == null){ + if (testingSession == null) { return false; } - if(testingSession.getBeginningSession() == null - || testingSession.getEndingSession() == null){ + if (testingSession.getBeginningSession() == null + || testingSession.getEndingSession() == null) { return testingSession.getContinuousSession(); } Date now = new Date(); @@ -47,10 +57,10 @@ public class TestingSessionServiceImpl implements TestingSessionService { @Override public boolean isBeforeSessionStart(TestingSession testingSession) { - if(testingSession == null){ + if (testingSession == null) { throw new IllegalArgumentException(TESTING_SESSION_MUST_BE_DEFINED); } - if(testingSession.getBeginningSession() == null){ + if (testingSession.getBeginningSession() == null) { return testingSession.getContinuousSession(); } Date now = new Date(); @@ -59,10 +69,10 @@ public class TestingSessionServiceImpl implements TestingSessionService { @Override public boolean isAfterSessionEnd(TestingSession testingSession) { - if(testingSession == null){ + if (testingSession == null) { throw new IllegalArgumentException(TESTING_SESSION_MUST_BE_DEFINED); } - if(testingSession.getEndingSession() == null){ + if (testingSession.getEndingSession() == null) { return testingSession.getContinuousSession(); } Date now = new Date(); @@ -71,7 +81,7 @@ public class TestingSessionServiceImpl implements TestingSessionService { @Override public boolean isRegistrationOpen(TestingSession testingSession) { - if(testingSession == null){ + if (testingSession == null) { throw new IllegalArgumentException(TESTING_SESSION_MUST_BE_DEFINED); } return testingSession.isRegistrationOpened(); @@ -88,7 +98,7 @@ public class TestingSessionServiceImpl implements TestingSessionService { @Override public boolean isTestingSessionOpen(TestingSession testingSession) { - if(testingSession == null){ + if (testingSession == null) { throw new IllegalArgumentException(TESTING_SESSION_MUST_BE_DEFINED); } return !testingSession.isClosed(); @@ -96,7 +106,7 @@ public class TestingSessionServiceImpl implements TestingSessionService { @Override public List<String> getTestingSessionManagers(TestingSession testingSession) { - if(testingSession == null){ + if (testingSession == null) { throw new IllegalArgumentException(TESTING_SESSION_MUST_BE_DEFINED); } List<TestingSessionAdmin> testingSessionAdmins = testingSession.getTestingSessionAdmins(); @@ -119,13 +129,13 @@ public class TestingSessionServiceImpl implements TestingSessionService { } @Override - public List<TestType> getListTestType(){ + public List<TestType> getListTestType() { return getCurrentTestingSession().getTestTypes(); } @Override - public List<SelectItem> getListTestTypeAsSelectItems(){ - List<TestType> list= getCurrentTestingSession().getTestTypes(); + public List<SelectItem> getListTestTypeAsSelectItems() { + List<TestType> list = getCurrentTestingSession().getTestTypes(); List<SelectItem> result = new ArrayList<>(); String label = org.jboss.seam.core.ResourceBundle.instance().getString("gazelle.tests.testInstance.allOptions"); result.add(new SelectItem("All", label)); @@ -134,4 +144,20 @@ public class TestingSessionServiceImpl implements TestingSessionService { } return result; } + + @Override + public void setCurrentTestingSession(TestingSession testingSession) { + if (testingSession != null) { + EntityManager entityManager = EntityManagerService.provideEntityManager(); + TestingSession refreshedTestingSession = entityManager.find(TestingSession.class, testingSession.getId()); + Contexts.getSessionContext().set("selectedTestingSession", refreshedTestingSession); + + GazelleCookie.setCookie("GZL_CURRENT_TESTING_SESSION_ID", String.valueOf(testingSession.getId())); + + + Contexts.getSessionContext().set("selectedUser", userService.getUserById(identity.getUsername())); + CacheRequest cacheRequest = (CacheRequest) Component.getInstance("cacheRequest"); + cacheRequest.removeValue("user_testing_session"); + } + } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/bean/TestSessionBean.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/bean/TestSessionBean.java new file mode 100644 index 000000000..3318e861f --- /dev/null +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/bean/TestSessionBean.java @@ -0,0 +1,39 @@ +package net.ihe.gazelle.tm.session.bean; + +import net.ihe.gazelle.menu.GazelleMenu; +import net.ihe.gazelle.tm.session.TestingSessionService; +import net.ihe.gazelle.tm.systems.model.TestingSession; +import org.jboss.seam.ScopeType; +import org.jboss.seam.annotations.AutoCreate; +import org.jboss.seam.annotations.In; +import org.jboss.seam.annotations.Name; +import org.jboss.seam.annotations.Scope; + +import javax.faces.context.FacesContext; + +@Name("testSessionBean") +@Scope(ScopeType.EVENT) +@AutoCreate +public class TestSessionBean { + + @In(value = "testingSessionService", create = true) + TestingSessionService testingSessionService; + + public TestingSession getSelectedTestingSession() { + return testingSessionService.getCurrentTestingSession(); + } + + public void setSelectedTestingSession(TestingSession selectedTestingSession) { + + testingSessionService.setCurrentTestingSession(selectedTestingSession); + //need to refresh the Menu once testing Session change is successful + GazelleMenu.getInstance().refreshMenu(); + + // Invalidate bean to refresh the aipo list when session is changed. + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("userManagerExtra", null); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("aipoSelector", null); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("reportManagerBean", null); + } + + +} diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java index e66f37721..7d8250603 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java @@ -1,5 +1,6 @@ package net.ihe.gazelle.tm.session.dao; +import net.ihe.gazelle.common.util.GazelleCookie; import net.ihe.gazelle.tm.session.TestingSessionServiceDAO; import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.ScopeType; @@ -13,6 +14,10 @@ public class TestingSessionServiceDAOImpl implements TestingSessionServiceDAO { @Override public TestingSession getCurrentTestingSession() { - return TestingSession.getSelectedTestingSession(); + String sessionId = GazelleCookie.getCookie("GZL_CURRENT_TESTING_SESSION_ID"); + if (sessionId != null) { + return TestingSession.getSessionById(Integer.valueOf(sessionId)); + } + return TestingSession.getDefaultTestingSession(); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java index a4aca88c9..d4fd35e72 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java @@ -36,7 +36,6 @@ import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.skin.SkinBean; import net.ihe.gazelle.tm.systems.ProfileInTestingSessionService; import net.ihe.gazelle.tm.systems.model.*; -import net.ihe.gazelle.tm.users.action.UserManagerExtra; import net.ihe.gazelle.users.model.Address; import net.ihe.gazelle.users.model.Institution; import net.ihe.gazelle.users.model.Iso3166CountryCode; @@ -103,7 +102,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin @In(value = "testingSessionService", create = true) private TestingSessionService testingSessionService; - @In(value="profileInTestingSessionService") + @In(value = "profileInTestingSessionService") private ProfileInTestingSessionService profileInTestingSessionService; /** * List of all testingSession objects to be managed by this manager bean @@ -156,7 +155,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin this.internetTesting = internetTesting; } - public boolean enableAllStatusForVendors(){ + public boolean enableAllStatusForVendors() { if (LOG.isDebugEnabled()) { LOG.debug("enableAllStatusForVendors"); } @@ -302,7 +301,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin if (selectedTestingSession != null) { if ((selectedTestingSession.getRegistrationDeadlineDate() == null || selectedTestingSession.getBeginningSession() == null - || selectedTestingSession.getEndingSession() == null)&& Boolean.FALSE.equals(selectedTestingSession.getContinuousSession())) { + || selectedTestingSession.getEndingSession() == null) && Boolean.FALSE.equals(selectedTestingSession.getContinuousSession())) { LOG.error("A non continuous testing session must have a registration deadline, a beginning date and an ending date "); FacesMessages.instance().add(StatusMessage.Severity.ERROR, "A non continuous testing session must have a registration deadline, a beginning date and an ending date"); return ""; @@ -337,7 +336,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin selectedTestingSession = TestingSession.mergeTestingSession(selectedTestingSession, entityManager); addProfileInTestingSessionForSelectedTestingSession(selectedTestingSession); - profileInTestingSessionService.setTestabilityRemovedFromSession(selectedTestingSession.getIntegrationProfiles(),selectedTestingSession); + profileInTestingSessionService.setTestabilityRemovedFromSession(selectedTestingSession.getIntegrationProfiles(), selectedTestingSession); LOG.warn("{} {} has updated testing session {}", identity.getFirstName(), identity.getLastName(), selectedTestingSession.getName()); @@ -358,10 +357,10 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin } private void addProfileInTestingSessionForSelectedTestingSession(TestingSession selectedTestingSession) { - for (Domain domain : selectedTestingSession.getDomains()){ - for (IntegrationProfile integrationProfile : domain.getIntegrationProfilesForDP()){ + for (Domain domain : selectedTestingSession.getDomains()) { + for (IntegrationProfile integrationProfile : domain.getIntegrationProfilesForDP()) { if (selectedTestingSession.getIntegrationProfiles().contains(integrationProfile)) { - profileInTestingSessionService.saveProfileInTestingSession(domain, integrationProfile,selectedTestingSession); + profileInTestingSessionService.saveProfileInTestingSession(domain, integrationProfile, selectedTestingSession); } } } @@ -462,8 +461,8 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin private void initPossibleAdmins() { possibleAdminIds = new ArrayList<>(); UserSearchParams userSearchParams = new UserSearchParams() - .setRole(Role.TESTING_SESSION_ADMIN) - .setActivated(true); + .setRole(Role.TESTING_SESSION_ADMIN) + .setActivated(true); List<User> admins = userService.searchNoLimit(userSearchParams); for (User admin : admins) { @@ -493,6 +492,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin } address = null; } + /** * Create a new testingSession. This method is used by a Java client This operation is allowed for some granted users (check the security.drl) * @@ -623,7 +623,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin public boolean isRegistrationDeadlineExpired() { LOG.trace("isRegistrationDeadlineExpired"); return !TestingSession.getSelectedTestingSession().isRegistrationOpened() && - !identity.hasRole(Role.VENDOR_LATE_REGISTRATION); + !identity.hasRole(Role.VENDOR_LATE_REGISTRATION); } public boolean reuseSystemsForThisSession() { @@ -898,7 +898,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin if (selectedTestingSession != null) { selectedTestingSession.getIntegrationProfilesUnsorted().clear(); LOG.warn("{} {} has remove all Integration Profiles from {}", identity.getFirstName(), - identity.getLastName(), selectedTestingSession.getName()); + identity.getLastName(), selectedTestingSession.getName()); } } @@ -928,7 +928,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin } public List<String> getPossibleAdminIds() { - return possibleAdminIds; + return possibleAdminIds; } public List<String> getSelectedAdminIds() { @@ -1064,8 +1064,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin } public boolean isUserAdminOfCurrentTestingSession(TestingSession currentTestingSession) { - UserManagerExtra userManagerExtra = (UserManagerExtra) Component.getInstance("userManagerExtra"); - TestingSession testingSession = userManagerExtra.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); if (testingSession != null && testingSession.getId().equals(currentTestingSession.getId())) { return Authorizations.TESTING_SESSION_ADMIN_OF_CURRENT_TESTING_SESSION.isGranted(); } @@ -1075,28 +1074,29 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin /** * get the status of the preference access sample + * * @return boolean */ - public boolean isAllowedToAccessToAllSamples(){ + public boolean isAllowedToAccessToAllSamples() { return Authorizations.SAMPLE_SEARCH.isGranted(); } - public boolean isOngoingRegistrationSession(TestingSession testingSession){ - if(testingSession == null){ + public boolean isOngoingRegistrationSession(TestingSession testingSession) { + if (testingSession == null) { return false; } - if(testingSession.getRegistrationDeadlineDate() == null){ + if (testingSession.getRegistrationDeadlineDate() == null) { return false; } Date now = new Date(); return now.compareTo(testingSession.getRegistrationDeadlineDate()) <= 0; } - public boolean isOngoingTestingPhaseSession(TestingSession testingSession){ - if(testingSession == null){ + public boolean isOngoingTestingPhaseSession(TestingSession testingSession) { + if (testingSession == null) { return false; } - if (testingSession.getEndingSession() == null || testingSession.getBeginningSession() == null){ + if (testingSession.getEndingSession() == null || testingSession.getBeginningSession() == null) { return testingSession.getContinuousSession(); } Date now = new Date(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserManagerExtra.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserManagerExtra.java index 758e2f531..aa520d336 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserManagerExtra.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserManagerExtra.java @@ -21,7 +21,6 @@ import net.ihe.gazelle.common.filecache.FileCache; import net.ihe.gazelle.common.filecache.FileCacheRenderer; import net.ihe.gazelle.common.interfacegenerator.GenerateInterface; import net.ihe.gazelle.hql.providers.EntityManagerService; -import net.ihe.gazelle.menu.GazelleMenu; import net.ihe.gazelle.preferences.PreferenceService; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.Role; @@ -96,6 +95,7 @@ public class UserManagerExtra implements Serializable, UserManagerExtraLocal { * Field SYSTEM. */ public static final String SYSTEM = "system"; + private static final String GZL_CURRENT_TESTING_SESSION_ID = "GZL_CURRENT_TESTING_SESSION_ID"; /** * Flag indicating if we belonging to a owner to delete, variable used between business and presentation layer @@ -113,7 +113,6 @@ public class UserManagerExtra implements Serializable, UserManagerExtraLocal { private boolean selectedUserForDeleteIsMonitor; private Boolean selectNewVendorAdmin; private Date lastUserAction; - private TestingSession newTestingSessionSelected; private String fakedPasswordField; public static final String EMAIL_REGEX = "^\\b[\\w.%-]+@[-.\\w]+\\.[A-Za-z]{2,4}\\b$"; @@ -184,43 +183,6 @@ public class UserManagerExtra implements Serializable, UserManagerExtraLocal { this.selectedUserForDeleteIsMonitor = selectedUserForDeleteIsMonitor; } - @Override - public TestingSession getSelectedTestingSession() { - if (LOG.isDebugEnabled()) { - LOG.debug("getSelectedTestingSession"); - } - UserPreferences selectedUserPreferences = getLoggedInUserPreferences(); - if (selectedUserPreferences != null) { - return selectedUserPreferences.getSelectedTestingSession(); - } else { - return null; - } - } - - @Override - public void setSelectedTestingSession(TestingSession selectedTestingSession) { - if (LOG.isDebugEnabled()) { - LOG.debug("setSelectedTestingSession"); - } - setContextSelectedTestingSession(selectedTestingSession); - //need to refresh the Menu once testing Session change is successful - GazelleMenu.getInstance().refreshMenu(); - - // Invalidate bean to refresh the aipo list when session is changed. - FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("userManagerExtra", null); - FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("aipoSelector", null); - FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("reportManagerBean", null); - } - - @Override - public void setSelectedTestingSession() { - if (LOG.isDebugEnabled()) { - LOG.debug("setSelectedTestingSession"); - } - setContextSelectedTestingSession(getNewTestingSessionSelected()); - //need to refresh the Menu once testing Session change is successful - GazelleMenu.getInstance().refreshMenu(); - } @Override public boolean displayToolTips() { @@ -529,25 +491,6 @@ public class UserManagerExtra implements Serializable, UserManagerExtraLocal { Contexts.getSessionContext().set("selectedUser", selectedUser); } - private void setContextSelectedTestingSession(TestingSession selectedTestingSession) { - if (LOG.isDebugEnabled()) { - LOG.debug("persistSelectedTestingSession"); - } - if (selectedTestingSession != null) { - EntityManager entityManager = EntityManagerService.provideEntityManager(); - TestingSession refreshedTestingSession = entityManager.find(TestingSession.class, selectedTestingSession.getId()); - Contexts.getSessionContext().set("selectedTestingSession", refreshedTestingSession); - - UserPreferences userPreferencesFound = UserPreferences.getPreferencesForUser(identity.getUsername()); - userPreferencesFound.setSelectedTestingSession(refreshedTestingSession); - entityManager.merge(userPreferencesFound); - entityManager.flush(); - - Contexts.getSessionContext().set("selectedUser", userService.getUserById(identity.getUsername())); - CacheRequest cacheRequest = (CacheRequest) Component.getInstance("cacheRequest"); - cacheRequest.removeValue("user_testing_session"); - } - } @Override public void getUserPhoto() throws Exception { @@ -620,19 +563,6 @@ public class UserManagerExtra implements Serializable, UserManagerExtraLocal { return "/home.seam"; } - public TestingSession getNewTestingSessionSelected() { - if (LOG.isDebugEnabled()) { - LOG.debug("getNewTestingSessionSelected"); - } - return newTestingSessionSelected; - } - - public void setNewTestingSessionSelected(TestingSession newTestingSessionSelected) { - if (LOG.isDebugEnabled()) { - LOG.debug("setNewTestingSessionSelected"); - } - this.newTestingSessionSelected = newTestingSessionSelected; - } public String getFakedPasswordField() { if (LOG.isDebugEnabled()) { diff --git a/gazelle-tm-war/src/main/webapp/administration/listSessions.xhtml b/gazelle-tm-war/src/main/webapp/administration/listSessions.xhtml index 0e3c1c664..47d202894 100644 --- a/gazelle-tm-war/src/main/webapp/administration/listSessions.xhtml +++ b/gazelle-tm-war/src/main/webapp/administration/listSessions.xhtml @@ -73,9 +73,9 @@ id="descriptionColumn"> <ui:define name="header">#{messages['gazelle.systems.session.Description']}</ui:define> <h:outputText value="#{currentTestingSession.description}" style="font-weight:bold;" - rendered="#{userManagerExtra.selectedTestingSession.id == currentTestingSession.id}"/> + rendered="#{testSessionBean.selectedTestingSession.id == currentTestingSession.id}"/> <h:outputText value="#{currentTestingSession.description}" - rendered="#{userManagerExtra.selectedTestingSession.id != currentTestingSession.id}"/> + rendered="#{testSessionBean.selectedTestingSession.id != currentTestingSession.id}"/> <h:outputText value=" (#{messages['net.ihe.gazelle.tm.Default_2']})" style="font-weight:bold;" rendered="#{currentTestingSession.isDefaultTestingSession}"/> diff --git a/gazelle-tm-war/src/main/webapp/systems/session/changeSessionInclude.xhtml b/gazelle-tm-war/src/main/webapp/systems/session/changeSessionInclude.xhtml index 7fe22d610..3e3942c85 100644 --- a/gazelle-tm-war/src/main/webapp/systems/session/changeSessionInclude.xhtml +++ b/gazelle-tm-war/src/main/webapp/systems/session/changeSessionInclude.xhtml @@ -61,13 +61,13 @@ <a4j:commandLink id="onRowClick" action="/home.seam" - actionListener="#{userManagerExtra.setSelectedTestingSession(currentTestingSession)}" + actionListener="#{testSessionBean.setSelectedTestingSession(currentTestingSession)}" render="testingSessionMPForm,topbarToolbarGroupTitleSpan"> <s:span styleClass="gzl-icon-circle-green" - rendered="#{userManagerExtra.selectedTestingSession.id == currentTestingSession.id}"/> + rendered="#{testSessionBean.selectedTestingSession.id == currentTestingSession.id}"/> <s:span styleClass="gzl-icon-not-checked" - rendered="#{userManagerExtra.selectedTestingSession.id != currentTestingSession.id}"/> + rendered="#{testSessionBean.selectedTestingSession.id != currentTestingSession.id}"/> </a4j:commandLink> diff --git a/gazelle-tm-war/src/main/webapp/testing/test/test/MetaTestInstanceDataTableByAIPO2.xhtml b/gazelle-tm-war/src/main/webapp/testing/test/test/MetaTestInstanceDataTableByAIPO2.xhtml index fb25cf684..e813c08bb 100644 --- a/gazelle-tm-war/src/main/webapp/testing/test/test/MetaTestInstanceDataTableByAIPO2.xhtml +++ b/gazelle-tm-war/src/main/webapp/testing/test/test/MetaTestInstanceDataTableByAIPO2.xhtml @@ -13,7 +13,7 @@ <s:div style="text-align: right;" styleClass="rich-panel-body"> <h:outputText value="#{messages['net.ihe.gazelle.tm.LastUpdateOfPartnersCounters']} : "/> <g:date tooltip="true" - value="#{applicationManager.getLastPartnersUpdate(userManagerExtra.selectedTestingSession.id)}"/> + value="#{applicationManager.getLastPartnersUpdate(testSessionBean.selectedTestingSession.id)}"/> </s:div> </h:panelGrid> <rich:dataTable cellspacing="0" width="700" border="0" diff --git a/gazelle-tm-war/src/main/webapp/testing/test/test/TestInstanceDataTableByAIPO3.xhtml b/gazelle-tm-war/src/main/webapp/testing/test/test/TestInstanceDataTableByAIPO3.xhtml index 2186764b6..178bcb32e 100644 --- a/gazelle-tm-war/src/main/webapp/testing/test/test/TestInstanceDataTableByAIPO3.xhtml +++ b/gazelle-tm-war/src/main/webapp/testing/test/test/TestInstanceDataTableByAIPO3.xhtml @@ -11,7 +11,7 @@ </s:div> <s:div> <h:outputText value="#{messages['net.ihe.gazelle.tm.LastUpdateOfPartnersCounters']} : "/> - <g:date tooltip="true" value="#{userManagerExtra.selectedTestingSession.resultsCompute}"/> + <g:date tooltip="true" value="#{testSessionBean.selectedTestingSession.resultsCompute}"/> </s:div> </h:panelGrid> <rich:dataTable id="testTable" -- GitLab From 0c15f362d2df6a1a2402625e8caf029a3fd65964 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 29 Jul 2024 11:17:29 +0200 Subject: [PATCH 18/77] Removed call to user preferences and clean code --- .../tm/users/action/UserManagerExtra.java | 86 ------------------- 1 file changed, 86 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserManagerExtra.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserManagerExtra.java index aa520d336..f6d248b25 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserManagerExtra.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserManagerExtra.java @@ -15,8 +15,6 @@ */ package net.ihe.gazelle.tm.users.action; -import net.ihe.gazelle.common.action.CacheRequest; -import net.ihe.gazelle.common.action.CacheUpdater; import net.ihe.gazelle.common.filecache.FileCache; import net.ihe.gazelle.common.filecache.FileCacheRenderer; import net.ihe.gazelle.common.interfacegenerator.GenerateInterface; @@ -31,14 +29,11 @@ import net.ihe.gazelle.ssov7.gum.client.interlay.exception.GumSsoClientHttpError import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.SystemQuery; -import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.users.model.UserPhoto; import net.ihe.gazelle.tm.users.model.UserPhotoQuery; -import net.ihe.gazelle.tm.users.model.UserPreferences; import net.ihe.gazelle.util.ThumbnailCreator; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.jboss.seam.Component; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.*; import org.jboss.seam.contexts.Contexts; @@ -95,7 +90,6 @@ public class UserManagerExtra implements Serializable, UserManagerExtraLocal { * Field SYSTEM. */ public static final String SYSTEM = "system"; - private static final String GZL_CURRENT_TESTING_SESSION_ID = "GZL_CURRENT_TESTING_SESSION_ID"; /** * Flag indicating if we belonging to a owner to delete, variable used between business and presentation layer @@ -122,13 +116,6 @@ public class UserManagerExtra implements Serializable, UserManagerExtraLocal { @In(value = "gumUserService") private transient UserService userService; - private static UserPreferences getDefaultUserPreferences() { - UserPreferences defaultUserPreferences = new UserPreferences(); - defaultUserPreferences.setNumberOfResultsPerPage(DEFAULT_NUMBER_OF_RESULTS_PER_PAGE); - defaultUserPreferences.setShowSequenceDiagram(true); - return defaultUserPreferences; - } - @Override public void userDoneAction() { if (LOG.isDebugEnabled()) { @@ -184,62 +171,6 @@ public class UserManagerExtra implements Serializable, UserManagerExtraLocal { } - @Override - public boolean displayToolTips() { - return getLoggedInUserPreferences().getDisplayTooltips(); - } - - @Override - public UserPreferences getLoggedInUserPreferences() { - LOG.trace("getLoggedInUserPreferences"); - CacheRequest cacheRequest = (CacheRequest) Component.getInstance("cacheRequest"); - UserPreferences userPreferences = (UserPreferences) cacheRequest.getValueUpdater("getLoggedInUserPreferences", new CacheUpdater() { - @Override - public Object getValue(String key, Object parameter) { - LOG.trace("getValue"); - if (!identity.isLoggedIn()) { - return getDefaultUserPreferences(); - } - EntityManager em = EntityManagerService.provideEntityManager(); - - UserPreferences userPreferences = UserPreferences.getPreferencesForUser(identity.getUsername()); - - if (userPreferences == null) { - userPreferences = getDefaultUserPreferences(); - userPreferences.setUsername(identity.getUsername()); - userPreferences.setEmailNotification(true); - em.persist(userPreferences); - em.flush(); - } - - if (userPreferences.getNumberOfResultsPerPage() == null) { - userPreferences.setNumberOfResultsPerPage(UserPreferences.DEFAULT_NUMBER_OF_RESULTS_PER_PAGE); - em.merge(userPreferences); - em.flush(); - } - - if (userPreferences.getSelectedTestingSession() != null && !userPreferences.getSelectedTestingSession().getActiveSession()) { - userPreferences.setSelectedTestingSession(null); - } - - if (userPreferences.getSelectedTestingSession() == null) { - TestingSession defaultTestingSession = TestingSession.getDefaultTestingSession(); - userPreferences.setSelectedTestingSession(defaultTestingSession); - em.merge(userPreferences); - em.flush(); - } - - return userPreferences; - } - }, null); - - if (userPreferences.getSelectedTestingSession() != null) { - Contexts.getSessionContext().set("selectedTestingSession", userPreferences.getSelectedTestingSession()); - } - - return userPreferences; - } - @Override public User getSelectedUser() { LOG.trace("getSelectedUser"); @@ -374,18 +305,6 @@ public class UserManagerExtra implements Serializable, UserManagerExtraLocal { } } - /** - * Get the UserPreferences object of the logged in User and set in in global variable - */ - @Override - public void saveShowSequenceDiagram() { - if (LOG.isDebugEnabled()) { - LOG.debug("saveShowSequenceDiagram"); - } - EntityManager em = EntityManagerService.provideEntityManager(); - em.merge(getLoggedInUserPreferences()); - em.flush(); - } /** * Set the new owner of the current system to reassign. @@ -577,9 +496,4 @@ public class UserManagerExtra implements Serializable, UserManagerExtraLocal { } this.fakedPasswordField = fakedPasswordField; } - - private static void getErrorMessage(String key, String name, String organizationId, String systemName) { - StatusMessages.instance().addFromResourceBundleOrDefault(StatusMessage.Severity.ERROR, - key, name, organizationId, systemName); - } } \ No newline at end of file -- GitLab From 43cc81dd3968f1bc33380b31ad8b8ce2079a8794 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 29 Jul 2024 17:16:06 +0200 Subject: [PATCH 19/77] Updated Dao --- .../tm/session/TestingSessionServiceDAO.java | 3 ++- .../dao/TestingSessionServiceDAOImpl.java | 27 +++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceDAO.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceDAO.java index 6cfc86841..f26e18b98 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceDAO.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceDAO.java @@ -2,7 +2,6 @@ package net.ihe.gazelle.tm.session; import net.ihe.gazelle.tm.systems.model.TestingSession; -import java.util.List; public interface TestingSessionServiceDAO { @@ -14,5 +13,7 @@ public interface TestingSessionServiceDAO { TestingSession getCurrentTestingSession(); + void setCurrentTestingSession(TestingSession testingSession); + TestingSession getDefaultTestingSession(); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java index 7d8250603..97300369c 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java @@ -7,17 +7,40 @@ import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; +import javax.faces.context.FacesContext; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletResponse; + @Name("testingSessionServiceDAO") @Scope(ScopeType.STATELESS) public class TestingSessionServiceDAOImpl implements TestingSessionServiceDAO { + private static final String GZL_CURRENT_TESTING_SESSION_ID = "GZL_CURRENT_TESTING_SESSION_ID"; + @Override public TestingSession getCurrentTestingSession() { - String sessionId = GazelleCookie.getCookie("GZL_CURRENT_TESTING_SESSION_ID"); + String sessionId = GazelleCookie.getCookie(GZL_CURRENT_TESTING_SESSION_ID); if (sessionId != null) { return TestingSession.getSessionById(Integer.valueOf(sessionId)); } - return TestingSession.getDefaultTestingSession(); + + TestingSession defaultTestingSession = getDefaultTestingSession(); + setCurrentTestingSession(defaultTestingSession); + return defaultTestingSession; + } + + @Override + public void setCurrentTestingSession(TestingSession testingSession) { + FacesContext context = FacesContext.getCurrentInstance(); + HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse(); + Cookie cookie = new Cookie(GZL_CURRENT_TESTING_SESSION_ID, testingSession.getId().toString()); + cookie.setPath("/"); + response.addCookie(cookie); + } + + @Override + public TestingSession getDefaultTestingSession() { + return TestingSession.getDefaultTestingSession(); } } -- GitLab From 77215d10d0f142b87a2aa2416fe0c0d43e8062e2 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 29 Jul 2024 17:53:14 +0200 Subject: [PATCH 20/77] Updated logic of testing session retrieval --- .../tm/session/TestingSessionServiceImpl.java | 40 ++++++++++--------- .../dao/TestingSessionServiceDAOImpl.java | 22 ++++++---- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java index 69fbbe1a4..713e1ab0e 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java @@ -1,8 +1,6 @@ package net.ihe.gazelle.tm.session; import net.ihe.gazelle.common.action.CacheRequest; -import net.ihe.gazelle.common.util.GazelleCookie; -import net.ihe.gazelle.hql.providers.EntityManagerService; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.tm.gazelletest.model.definition.TestType; @@ -10,18 +8,19 @@ import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.systems.model.TestingSessionAdmin; import org.jboss.seam.Component; import org.jboss.seam.ScopeType; +import org.jboss.seam.annotations.AutoCreate; import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.contexts.Contexts; import javax.faces.model.SelectItem; -import javax.persistence.EntityManager; import java.util.ArrayList; import java.util.Date; import java.util.List; @Name("testingSessionService") +@AutoCreate @Scope(ScopeType.STATELESS) public class TestingSessionServiceImpl implements TestingSessionService { @@ -38,7 +37,25 @@ public class TestingSessionServiceImpl implements TestingSessionService { @Override public TestingSession getCurrentTestingSession() { - return testingSessionServiceDAO.getCurrentTestingSession(); + TestingSession currentTestingSession = testingSessionServiceDAO.getCurrentTestingSession(); + if (currentTestingSession != null) { + return currentTestingSession; + } else { + TestingSession defaultTestingSession = testingSessionServiceDAO.getDefaultTestingSession(); + testingSessionServiceDAO.setCurrentTestingSession(defaultTestingSession); + return defaultTestingSession; + } + } + + @Override + public void setCurrentTestingSession(TestingSession testingSession) { + if (testingSession != null) { + testingSessionServiceDAO.setCurrentTestingSession(testingSession); + + Contexts.getSessionContext().set("selectedUser", userService.getUserById(identity.getUsername())); + CacheRequest cacheRequest = (CacheRequest) Component.getInstance("cacheRequest"); + cacheRequest.removeValue("user_testing_session"); + } } @Override @@ -145,19 +162,4 @@ public class TestingSessionServiceImpl implements TestingSessionService { return result; } - @Override - public void setCurrentTestingSession(TestingSession testingSession) { - if (testingSession != null) { - EntityManager entityManager = EntityManagerService.provideEntityManager(); - TestingSession refreshedTestingSession = entityManager.find(TestingSession.class, testingSession.getId()); - Contexts.getSessionContext().set("selectedTestingSession", refreshedTestingSession); - - GazelleCookie.setCookie("GZL_CURRENT_TESTING_SESSION_ID", String.valueOf(testingSession.getId())); - - - Contexts.getSessionContext().set("selectedUser", userService.getUserById(identity.getUsername())); - CacheRequest cacheRequest = (CacheRequest) Component.getInstance("cacheRequest"); - cacheRequest.removeValue("user_testing_session"); - } - } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java index 97300369c..59b64e096 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java @@ -1,13 +1,17 @@ package net.ihe.gazelle.tm.session.dao; import net.ihe.gazelle.common.util.GazelleCookie; +import net.ihe.gazelle.hql.providers.EntityManagerService; import net.ihe.gazelle.tm.session.TestingSessionServiceDAO; import net.ihe.gazelle.tm.systems.model.TestingSession; +import net.ihe.gazelle.tm.systems.model.TestingSessionQuery; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; +import org.jboss.seam.contexts.Contexts; import javax.faces.context.FacesContext; +import javax.persistence.EntityManager; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; @@ -17,21 +21,23 @@ import javax.servlet.http.HttpServletResponse; public class TestingSessionServiceDAOImpl implements TestingSessionServiceDAO { private static final String GZL_CURRENT_TESTING_SESSION_ID = "GZL_CURRENT_TESTING_SESSION_ID"; + private final EntityManager entityManager = EntityManagerService.provideEntityManager(); @Override public TestingSession getCurrentTestingSession() { String sessionId = GazelleCookie.getCookie(GZL_CURRENT_TESTING_SESSION_ID); - if (sessionId != null) { - return TestingSession.getSessionById(Integer.valueOf(sessionId)); + try { + return entityManager.find(TestingSession.class, Integer.valueOf(sessionId)); + } catch (NumberFormatException e) { + return null; } - - TestingSession defaultTestingSession = getDefaultTestingSession(); - setCurrentTestingSession(defaultTestingSession); - return defaultTestingSession; } @Override public void setCurrentTestingSession(TestingSession testingSession) { + TestingSession refreshedTestingSession = entityManager.find(TestingSession.class, testingSession.getId()); + Contexts.getSessionContext().set("selectedTestingSession", refreshedTestingSession); + FacesContext context = FacesContext.getCurrentInstance(); HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse(); Cookie cookie = new Cookie(GZL_CURRENT_TESTING_SESSION_ID, testingSession.getId().toString()); @@ -41,6 +47,8 @@ public class TestingSessionServiceDAOImpl implements TestingSessionServiceDAO { @Override public TestingSession getDefaultTestingSession() { - return TestingSession.getDefaultTestingSession(); + TestingSessionQuery testingSessionQuery = new TestingSessionQuery(); + testingSessionQuery.isDefaultTestingSession().eq(true); + return testingSessionQuery.getUniqueResult(); } } -- GitLab From 11d986d5bad88a4b043ae9ae33ae9e078151e291 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 30 Jul 2024 14:11:45 +0200 Subject: [PATCH 21/77] Using testing session service --- .../application/action/GazellePreferenceProvider.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java index 1bb435cc1..bf5f4a163 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java @@ -6,11 +6,10 @@ import net.ihe.gazelle.common.application.action.ApplicationPreferenceManager; import net.ihe.gazelle.common.application.action.ApplicationPreferenceManagerImpl; import net.ihe.gazelle.common.servletfilter.IEHeaderFilter; import net.ihe.gazelle.common.util.DateDisplayUtil; -import net.ihe.gazelle.common.util.GazelleCookie; import net.ihe.gazelle.geoip.GeoIP; import net.ihe.gazelle.geoip.result.Location; import net.ihe.gazelle.preferences.PreferenceProvider; -import net.ihe.gazelle.tm.systems.model.TestingSession; +import net.ihe.gazelle.tm.session.TestingSessionService; import org.apache.commons.lang.StringUtils; import org.jboss.seam.Component; import org.jboss.seam.contexts.Contexts; @@ -32,6 +31,8 @@ public class GazellePreferenceProvider implements PreferenceProvider { private static final Logger LOG = LoggerFactory.getLogger(GazellePreferenceProvider.class); private final ApplicationPreferenceManager applicationPreferenceManager = new ApplicationPreferenceManagerImpl(); + private final TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + @Override public String getString(String key) { if (LOG.isDebugEnabled()) { @@ -167,11 +168,7 @@ public class GazellePreferenceProvider implements PreferenceProvider { if (LOG.isDebugEnabled()) { LOG.debug("getValue"); } - String sessionId = GazelleCookie.getCookie("GZL_CURRENT_TESTING_SESSION_ID"); - if (sessionId != null) { - return TestingSession.getSessionById(Integer.valueOf(sessionId)); - } - return TestingSession.getDefaultTestingSession(); + return testingSessionService.getCurrentTestingSession(); } }, null); } -- GitLab From 4935425096ac6f34516fadac79efc27b629b997d Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 30 Jul 2024 14:21:09 +0200 Subject: [PATCH 22/77] Cleaned code and remove userPreference references --- .../tm/session/TestingSessionService.java | 18 +++--- .../tm/session/TestingSessionServiceDAO.java | 14 ++++- .../tm/users/action/UserManagerExtra.java | 61 ------------------- .../ihe/gazelle/users/action/UserManager.java | 27 +------- 4 files changed, 22 insertions(+), 98 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java index 99df197e3..f44eba364 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java @@ -16,6 +16,14 @@ public interface TestingSessionService { */ TestingSession getCurrentTestingSession(); + /** + * Set in cookie the currentTestingSession of the logged user. + * If the service cannot find a session, it will use the default one. + * + * @param testingSession the current session + */ + void setCurrentTestingSession(TestingSession testingSession); + /** * @param testingSession testing session object * @return boolean @@ -82,14 +90,4 @@ public interface TestingSessionService { */ List<SelectItem> getListTestTypeAsSelectItems(); - - /** - * Set in cookie the currentTestingSession of the logged user. - * If the service cannot find a session, it will use the default one. - * - * @param testingSession the current session - */ - void setCurrentTestingSession(TestingSession testingSession); - - } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceDAO.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceDAO.java index f26e18b98..5bd485fbb 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceDAO.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceDAO.java @@ -8,12 +8,24 @@ public interface TestingSessionServiceDAO { /** * Return the current testing session based on the HTTP Session - * @return {@link TestingSession} + * + * @return {@link TestingSession} or null if not found */ TestingSession getCurrentTestingSession(); + /** + * Sets current testing session in a session cookie. + * + * @param testingSession the new current {@link TestingSession} + */ void setCurrentTestingSession(TestingSession testingSession); + + /** + * Gets default testing session. + * + * @return the default {@link TestingSession} + */ TestingSession getDefaultTestingSession(); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserManagerExtra.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserManagerExtra.java index f6d248b25..5b05a7f5b 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserManagerExtra.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/UserManagerExtra.java @@ -15,8 +15,6 @@ */ package net.ihe.gazelle.tm.users.action; -import net.ihe.gazelle.common.filecache.FileCache; -import net.ihe.gazelle.common.filecache.FileCacheRenderer; import net.ihe.gazelle.common.interfacegenerator.GenerateInterface; import net.ihe.gazelle.hql.providers.EntityManagerService; import net.ihe.gazelle.preferences.PreferenceService; @@ -29,11 +27,6 @@ import net.ihe.gazelle.ssov7.gum.client.interlay.exception.GumSsoClientHttpError import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.SystemQuery; -import net.ihe.gazelle.tm.users.model.UserPhoto; -import net.ihe.gazelle.tm.users.model.UserPhotoQuery; -import net.ihe.gazelle.util.ThumbnailCreator; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.*; import org.jboss.seam.contexts.Contexts; @@ -47,13 +40,10 @@ import javax.faces.context.FacesContext; import javax.persistence.EntityManager; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; -import java.io.InputStream; -import java.io.OutputStream; import java.io.Serializable; import java.util.Calendar; import java.util.Date; import java.util.List; -import java.util.Map; /** * <b>Class Description : </b>UserManagerTM<br> @@ -410,57 +400,6 @@ public class UserManagerExtra implements Serializable, UserManagerExtraLocal { Contexts.getSessionContext().set("selectedUser", selectedUser); } - - @Override - public void getUserPhoto() throws Exception { - if (LOG.isDebugEnabled()) { - LOG.debug("getUserPhoto"); - } - Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); - final int photoId = Integer.parseInt(params.get("id")); - - String sizeString = StringUtils.trimToEmpty(params.get("size")); - if (!sizeString.isEmpty()) { - sizeString = "_XS"; - } - - FileCache.getFile("UserPhoto_" + photoId + sizeString, sizeString, new FileCacheRenderer() { - - @Override - public void render(OutputStream out, String value) throws Exception { - LOG.trace("render"); - UserPhotoQuery photoQuery = new UserPhotoQuery(); - photoQuery.id().eq(photoId); - UserPhoto userPhoto = photoQuery.getUniqueResult(); - byte[] bytes = null; - if (userPhoto != null) { - bytes = userPhoto.getPhotoBytes(); - } - if (bytes == null) { - try (InputStream resourceAsStream = this.getClass().getResourceAsStream("/nophoto.png")) { - if (resourceAsStream != null) { - bytes = IOUtils.toByteArray(resourceAsStream); - } - } - } - if (bytes != null) { - if ("_XS".equals(value)) { - bytes = ThumbnailCreator.createThumbnailPNG(bytes, 20); - } - out.write(bytes); - } - } - - @Override - public String getContentType() { - if (LOG.isDebugEnabled()) { - LOG.debug("getContentType"); - } - return "image/png"; - } - }); - } - /** * Destroy the Manager bean when the session is over. */ diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/users/action/UserManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/users/action/UserManager.java index f724c53c3..705d409f2 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/users/action/UserManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/users/action/UserManager.java @@ -465,20 +465,6 @@ public class UserManager implements Serializable, UserManagerLocal { openViewPanel(); } - /** - * Method editUserPreferences. - * - * @param inSelectedUser GumUser - * @return String - */ - @Override - @Restrict("#{s:hasPermission('UserManager', 'editUser', null)}") - public String editUserPreferences(User inSelectedUser) { - LOG.trace("editUserPreferences"); - Contexts.getSessionContext().set("userForPreferences", inSelectedUser); - Contexts.getSessionContext().set("userForUpdateForPreferences", new User(inSelectedUser)); - return "/users/user/editOtherUserPreferences.seam"; - } @Override @Restrict("#{s:hasPermission('UserManager', 'editUser', null)}") @@ -783,18 +769,7 @@ public class UserManager implements Serializable, UserManagerLocal { } } - /** - * Method editAccount. - * - * @return String - * @see net.ihe.gazelle.users.action.UserManagerLocal#editAccount() - */ - @Override - public String editAccount() { - LOG.trace("editAccount"); - selectedUser = userService.getUserById(identity.getUsername()); - return "/users/user/userPreferences.seam"; - } + /** -- GitLab From 6307def245f3da7c720b176e05aae246a084b9cc Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 30 Jul 2024 15:31:36 +0200 Subject: [PATCH 23/77] Fixed performance problem --- .../net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java index 4c0b2913e..be7b1827d 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java @@ -36,6 +36,9 @@ public class MonitorInfoBeanGui { } public UserPreference getUserPreferenceByUserId(String userId) { + if (userPreference!=null && userPreference.getUserId().equals(userId)) + return userPreference; + userPreference = userPreferencesService.getUserPreferencesByUserId(userId); List<String> languagesSpokenDisplayLabel = getLanguagesSpokenDisplayLabel(userPreference); userPreference.setLanguagesSpoken(languagesSpokenDisplayLabel); -- GitLab From d07f5a25d1a7be55061d0e4e541d4549ae0105d0 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 31 Jul 2024 10:15:37 +0200 Subject: [PATCH 24/77] Updated preference service name --- .../net/ihe/gazelle/tm/messages/EmailNotificationManager.java | 4 ++-- .../net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java index d50a6040e..7bb0ba215 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java @@ -26,7 +26,7 @@ public class EmailNotificationManager implements Serializable, NotificationListe this.messageFormatter = messageFormatter; } - @In("gumUserPreferencesService") + @In(value = "userPreferencesService") transient UserPreferencesService userPreferencesService; /** @@ -71,6 +71,6 @@ public class EmailNotificationManager implements Serializable, NotificationListe */ private void readObject(java.io.ObjectInputStream inputStream) throws IOException, ClassNotFoundException { inputStream.defaultReadObject(); - this.userPreferencesService = (UserPreferencesService) Component.getInstance("gumUserPreferencesService"); + this.userPreferencesService = (UserPreferencesService) Component.getInstance("userPreferencesService"); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java index be7b1827d..187f170e5 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java @@ -24,7 +24,7 @@ public class MonitorInfoBeanGui { private static final Logger LOG = LoggerFactory.getLogger(MonitorInfoBeanGui.class); - @In(value = "gumUserPreferencesService") + @In(value = "userPreferencesService") UserPreferencesService userPreferencesService; UserPreference userPreference; -- GitLab From 97963a1d7c818f1ef4269476d424efcc3f5d0937 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 31 Jul 2024 11:52:41 +0200 Subject: [PATCH 25/77] Refactored TestingSessionService and DAO --- .../tm/session/TestingSessionServiceDAO.java | 22 ++++++------ .../tm/session/TestingSessionServiceImpl.java | 25 ++++++++----- .../dao/TestingSessionServiceDAOImpl.java | 35 +++++-------------- 3 files changed, 37 insertions(+), 45 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceDAO.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceDAO.java index 5bd485fbb..4704742e8 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceDAO.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceDAO.java @@ -7,25 +7,25 @@ public interface TestingSessionServiceDAO { /** - * Return the current testing session based on the HTTP Session + * Gets default testing session. * - * @return {@link TestingSession} or null if not found + * @return the default {@link TestingSession} */ - TestingSession getCurrentTestingSession(); - + TestingSession getDefaultTestingSession(); /** - * Sets current testing session in a session cookie. + * Check if testing session exist. * - * @param testingSession the new current {@link TestingSession} + * @param testingSessionId the {@link TestingSession} id + * @return true if it exists, otherwise false */ - void setCurrentTestingSession(TestingSession testingSession); - + boolean isTestingSessionExisting(Integer testingSessionId); /** - * Gets default testing session. + * Gets testing session by id. * - * @return the default {@link TestingSession} + * @param testingSessionId the testing session id + * @return the {@link TestingSession} */ - TestingSession getDefaultTestingSession(); + TestingSession getTestingSessionById(Integer testingSessionId); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java index 713e1ab0e..6719cf098 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java @@ -2,7 +2,9 @@ package net.ihe.gazelle.tm.session; import net.ihe.gazelle.common.action.CacheRequest; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; +import net.ihe.gazelle.ssov7.gum.client.application.service.UserPreferencesService; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; +import net.ihe.gazelle.ssov7.gum.client.interlay.factory.UserPreferenceServiceFactory; import net.ihe.gazelle.tm.gazelletest.model.definition.TestType; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.systems.model.TestingSessionAdmin; @@ -32,25 +34,32 @@ public class TestingSessionServiceImpl implements TestingSessionService { @In(value = "gumUserService") private UserService userService; + private UserPreferencesService userPreferencesService = UserPreferenceServiceFactory.getUserService(); + @In private GazelleIdentity identity; @Override public TestingSession getCurrentTestingSession() { - TestingSession currentTestingSession = testingSessionServiceDAO.getCurrentTestingSession(); - if (currentTestingSession != null) { - return currentTestingSession; - } else { - TestingSession defaultTestingSession = testingSessionServiceDAO.getDefaultTestingSession(); - testingSessionServiceDAO.setCurrentTestingSession(defaultTestingSession); - return defaultTestingSession; + Integer testingSessionId = userPreferencesService.getSelectedTestingSessionId(); + + boolean testingSessionExisting = testingSessionId != null && testingSessionId != -1 && testingSessionServiceDAO.isTestingSessionExisting(testingSessionId); + if (!testingSessionExisting) { + testingSessionId = testingSessionServiceDAO.getDefaultTestingSession().getId(); + userPreferencesService.setSelectedTestingSessionId(testingSessionId); } + + return testingSessionServiceDAO.getTestingSessionById(testingSessionId); } @Override public void setCurrentTestingSession(TestingSession testingSession) { if (testingSession != null) { - testingSessionServiceDAO.setCurrentTestingSession(testingSession); + + TestingSession refreshedTestingSession = testingSessionServiceDAO.getTestingSessionById(testingSession.getId()); + Contexts.getSessionContext().set("selectedTestingSession", refreshedTestingSession); + + userPreferencesService.setSelectedTestingSessionId(refreshedTestingSession.getId()); Contexts.getSessionContext().set("selectedUser", userService.getUserById(identity.getUsername())); CacheRequest cacheRequest = (CacheRequest) Component.getInstance("cacheRequest"); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java index 59b64e096..c7b14e414 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java @@ -1,6 +1,5 @@ package net.ihe.gazelle.tm.session.dao; -import net.ihe.gazelle.common.util.GazelleCookie; import net.ihe.gazelle.hql.providers.EntityManagerService; import net.ihe.gazelle.tm.session.TestingSessionServiceDAO; import net.ihe.gazelle.tm.systems.model.TestingSession; @@ -8,47 +7,31 @@ import net.ihe.gazelle.tm.systems.model.TestingSessionQuery; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; -import org.jboss.seam.contexts.Contexts; -import javax.faces.context.FacesContext; import javax.persistence.EntityManager; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletResponse; @Name("testingSessionServiceDAO") @Scope(ScopeType.STATELESS) public class TestingSessionServiceDAOImpl implements TestingSessionServiceDAO { - private static final String GZL_CURRENT_TESTING_SESSION_ID = "GZL_CURRENT_TESTING_SESSION_ID"; private final EntityManager entityManager = EntityManagerService.provideEntityManager(); + @Override - public TestingSession getCurrentTestingSession() { - String sessionId = GazelleCookie.getCookie(GZL_CURRENT_TESTING_SESSION_ID); - try { - return entityManager.find(TestingSession.class, Integer.valueOf(sessionId)); - } catch (NumberFormatException e) { - return null; - } + public TestingSession getDefaultTestingSession() { + TestingSessionQuery testingSessionQuery = new TestingSessionQuery(); + testingSessionQuery.isDefaultTestingSession().eq(true); + return testingSessionQuery.getUniqueResult(); } @Override - public void setCurrentTestingSession(TestingSession testingSession) { - TestingSession refreshedTestingSession = entityManager.find(TestingSession.class, testingSession.getId()); - Contexts.getSessionContext().set("selectedTestingSession", refreshedTestingSession); - - FacesContext context = FacesContext.getCurrentInstance(); - HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse(); - Cookie cookie = new Cookie(GZL_CURRENT_TESTING_SESSION_ID, testingSession.getId().toString()); - cookie.setPath("/"); - response.addCookie(cookie); + public boolean isTestingSessionExisting(Integer testingSessionId) { + return entityManager.find(TestingSession.class, testingSessionId) != null; } @Override - public TestingSession getDefaultTestingSession() { - TestingSessionQuery testingSessionQuery = new TestingSessionQuery(); - testingSessionQuery.isDefaultTestingSession().eq(true); - return testingSessionQuery.getUniqueResult(); + public TestingSession getTestingSessionById(Integer testingSessionId) { + return entityManager.find(TestingSession.class, testingSessionId); } } -- GitLab From 4c549655ea9b528c0b9f9fa7315f84a84ca3eea8 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 31 Jul 2024 15:47:19 +0200 Subject: [PATCH 26/77] Fixed initialization of GazellePreferenceProvider --- .../application/action/GazellePreferenceProvider.java | 8 +++++++- .../gazelle/tm/session/TestingSessionServiceImpl.java | 10 +++++++++- .../tm/session/dao/TestingSessionServiceDAOImpl.java | 5 +++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java index bf5f4a163..4e236864a 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java @@ -10,6 +10,8 @@ import net.ihe.gazelle.geoip.GeoIP; import net.ihe.gazelle.geoip.result.Location; import net.ihe.gazelle.preferences.PreferenceProvider; import net.ihe.gazelle.tm.session.TestingSessionService; +import net.ihe.gazelle.tm.session.TestingSessionServiceImpl; +import net.ihe.gazelle.tm.session.dao.TestingSessionServiceDAOImpl; import org.apache.commons.lang.StringUtils; import org.jboss.seam.Component; import org.jboss.seam.contexts.Contexts; @@ -31,7 +33,11 @@ public class GazellePreferenceProvider implements PreferenceProvider { private static final Logger LOG = LoggerFactory.getLogger(GazellePreferenceProvider.class); private final ApplicationPreferenceManager applicationPreferenceManager = new ApplicationPreferenceManagerImpl(); - private final TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + private final TestingSessionService testingSessionService; + + public GazellePreferenceProvider() { + testingSessionService = new TestingSessionServiceImpl(new TestingSessionServiceDAOImpl()); + } @Override public String getString(String key) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java index 6719cf098..cba5f8ebe 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java @@ -34,11 +34,19 @@ public class TestingSessionServiceImpl implements TestingSessionService { @In(value = "gumUserService") private UserService userService; - private UserPreferencesService userPreferencesService = UserPreferenceServiceFactory.getUserService(); + private final UserPreferencesService userPreferencesService = UserPreferenceServiceFactory.getUserPreferenceService(); @In private GazelleIdentity identity; + public TestingSessionServiceImpl() { + //For CDI + } + + public TestingSessionServiceImpl(TestingSessionServiceDAO testingSessionServiceDAO) { + this.testingSessionServiceDAO = testingSessionServiceDAO; + } + @Override public TestingSession getCurrentTestingSession() { Integer testingSessionId = userPreferencesService.getSelectedTestingSessionId(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java index c7b14e414..84a87b70f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/dao/TestingSessionServiceDAOImpl.java @@ -15,8 +15,7 @@ import javax.persistence.EntityManager; @Scope(ScopeType.STATELESS) public class TestingSessionServiceDAOImpl implements TestingSessionServiceDAO { - private final EntityManager entityManager = EntityManagerService.provideEntityManager(); - + private EntityManager entityManager; @Override public TestingSession getDefaultTestingSession() { @@ -27,11 +26,13 @@ public class TestingSessionServiceDAOImpl implements TestingSessionServiceDAO { @Override public boolean isTestingSessionExisting(Integer testingSessionId) { + entityManager = EntityManagerService.provideEntityManager(); return entityManager.find(TestingSession.class, testingSessionId) != null; } @Override public TestingSession getTestingSessionById(Integer testingSessionId) { + entityManager = EntityManagerService.provideEntityManager(); return entityManager.find(TestingSession.class, testingSessionId); } } -- GitLab From 2460d74b4424e4c190db80956a38e07fe8820fe6 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 2 Aug 2024 09:20:59 +0200 Subject: [PATCH 27/77] Updated to work with TestingSessionService --- .../action/GazellePreferenceProvider.java | 2 +- .../tm/messages/EmailNotificationManager.java | 16 ++++++++++++++-- .../ihe/gazelle/tm/messages/MessageManager.java | 10 ++++++++++ .../tm/session/TestingSessionServiceImpl.java | 13 ++++++++----- .../tm/messages/NotificationServiceTest.java | 5 +++-- .../src/main/webapp/users/messages.xhtml | 4 ++-- 6 files changed, 38 insertions(+), 12 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java index 4e236864a..232c6ef7c 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java @@ -36,7 +36,7 @@ public class GazellePreferenceProvider implements PreferenceProvider { private final TestingSessionService testingSessionService; public GazellePreferenceProvider() { - testingSessionService = new TestingSessionServiceImpl(new TestingSessionServiceDAOImpl()); + testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); } @Override diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java index 7bb0ba215..8d41550e4 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java @@ -1,5 +1,6 @@ package net.ihe.gazelle.tm.messages; +import net.ihe.gazelle.preferences.PreferenceService; import net.ihe.gazelle.ssov7.gum.client.application.User; import net.ihe.gazelle.ssov7.gum.client.application.UserPreference; import net.ihe.gazelle.ssov7.gum.client.application.service.UserPreferencesService; @@ -22,6 +23,7 @@ public class EmailNotificationManager implements Serializable, NotificationListe private static final long serialVersionUID = 1621387439421020188L; private final MessageFormatter messageFormatter; + public EmailNotificationManager(MessageFormatter messageFormatter) { this.messageFormatter = messageFormatter; } @@ -31,6 +33,7 @@ public class EmailNotificationManager implements Serializable, NotificationListe /** * Send notification by email to all concerned user + * * @param message message to send */ @Override @@ -49,7 +52,7 @@ public class EmailNotificationManager implements Serializable, NotificationListe emailManager.setRecipient(recipient); emailManager.setMessage(messageFormatter.getPreferredLangFormattedMessage(message)); emailManager.setTestingSession(testingSession); - emailManager.setLink(message.getFormattedLink()); + emailManager.setLink(getFormattedLink(message)); try { emailManager.sendEmail(EmailType.TO_USER_NOTIFICATION); } catch (Exception e) { @@ -60,11 +63,20 @@ public class EmailNotificationManager implements Serializable, NotificationListe } } + private String getFormattedLink(Message message) { + String link = message.getLink(); + if (link != null && link.toLowerCase().startsWith("http")) { + return link; + } else { + return PreferenceService.getString("application_url") + link; + } + } + + /** * Reload userPreferencesService in case of deserialization. * * @param inputStream InputStream of the UserValueFormatter. - * * @throws IOException * @throws ClassNotFoundException * @see Serializable diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/MessageManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/MessageManager.java index 148fb41d3..ed9a3654f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/MessageManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/MessageManager.java @@ -2,6 +2,7 @@ package net.ihe.gazelle.tm.messages; import net.ihe.gazelle.common.application.action.ApplicationPreferenceManager; import net.ihe.gazelle.common.util.GazelleCookie; +import net.ihe.gazelle.preferences.PreferenceService; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.tm.application.action.ApplicationManager; import net.ihe.gazelle.tm.messages.model.Message; @@ -96,6 +97,15 @@ public class MessageManager { return messageFormatter.getFormattedMessage(message); } + public String getFormattedLink(Message message) { + String link = message.getLink(); + if (link != null && link.toLowerCase().startsWith("http")) { + return link; + } else { + return PreferenceService.getString("application_url") + link; + } + } + private Date getCookieDate(String cookieName) { String stringDate = GazelleCookie.getCookie(cookieName); if (stringDate != null && !stringDate.trim().isEmpty()) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java index cba5f8ebe..442bd51dc 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java @@ -4,7 +4,6 @@ import net.ihe.gazelle.common.action.CacheRequest; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.service.UserPreferencesService; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; -import net.ihe.gazelle.ssov7.gum.client.interlay.factory.UserPreferenceServiceFactory; import net.ihe.gazelle.tm.gazelletest.model.definition.TestType; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.systems.model.TestingSessionAdmin; @@ -23,7 +22,7 @@ import java.util.List; @Name("testingSessionService") @AutoCreate -@Scope(ScopeType.STATELESS) +@Scope(ScopeType.EVENT) public class TestingSessionServiceImpl implements TestingSessionService { private static final String TESTING_SESSION_MUST_BE_DEFINED = "TestingSession must be defined"; @@ -34,17 +33,21 @@ public class TestingSessionServiceImpl implements TestingSessionService { @In(value = "gumUserService") private UserService userService; - private final UserPreferencesService userPreferencesService = UserPreferenceServiceFactory.getUserPreferenceService(); + @In(value = "userPreferencesService") + private UserPreferencesService userPreferencesService; @In private GazelleIdentity identity; public TestingSessionServiceImpl() { - //For CDI + //For seam } - public TestingSessionServiceImpl(TestingSessionServiceDAO testingSessionServiceDAO) { + public TestingSessionServiceImpl(TestingSessionServiceDAO testingSessionServiceDAO, UserService userService, UserPreferencesService userPreferencesService, GazelleIdentity identity) { this.testingSessionServiceDAO = testingSessionServiceDAO; + this.userService = userService; + this.userPreferencesService = userPreferencesService; + this.identity = identity; } @Override diff --git a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/messages/NotificationServiceTest.java b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/messages/NotificationServiceTest.java index b99c8596c..48625811b 100644 --- a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/messages/NotificationServiceTest.java +++ b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/messages/NotificationServiceTest.java @@ -1,8 +1,8 @@ package net.ihe.gazelle.tm.messages; +import net.ihe.gazelle.ssov7.gum.client.application.User; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.ssov7.gum.client.interlay.client.SSOGumUserClient; -import net.ihe.gazelle.ssov7.gum.client.application.User; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; import net.ihe.gazelle.tm.messages.model.Message; import org.junit.Assert; @@ -13,6 +13,7 @@ import java.util.List; public class NotificationServiceTest { + @Test public void createMessageTest() { UserService userService = new SSOGumUserClient(); @@ -34,6 +35,6 @@ public class NotificationServiceTest { Assert.assertEquals(concernedUsers.size(), message.getUsers().size()); Assert.assertEquals("gazelle.message.testinstance.status", message.getType()); Assert.assertEquals("testInstance.seam?id=1", message.getLink()); - Assert.assertEquals("nulltestInstance.seam?id=1", message.getFormattedLink()); } + } diff --git a/gazelle-tm-war/src/main/webapp/users/messages.xhtml b/gazelle-tm-war/src/main/webapp/users/messages.xhtml index 73cf0f0cd..0ae150539 100644 --- a/gazelle-tm-war/src/main/webapp/users/messages.xhtml +++ b/gazelle-tm-war/src/main/webapp/users/messages.xhtml @@ -6,7 +6,7 @@ xmlns:f="http://java.sun.com/jsf/core" xmlns="http://www.w3.org/1999/xhtml"> <h:outputStylesheet library="stylesheet" name="gazelle-theme.css"/> -<h:outputStylesheet rendered="#{userManagerExtra.displayToolTips()}" library="stylesheet" +<h:outputStylesheet library="stylesheet" name="tooltip.css"/> <h:head> <title>#{messages['gazelle.common.messages.Messages']}</title> @@ -42,7 +42,7 @@ </g:column> <g:column> <ui:define name="header">#{messages['gazelle.tm.Link']}</ui:define> - <h:outputLink value="#{message.getFormattedLink()}" target="_blank"> + <h:outputLink value="#{messageManager.getFormattedLink(message)}" target="_blank"> <h:outputText value="#{messages['gazelle.tm.Link']}"/> </h:outputLink> </g:column> -- GitLab From 08a868a6602d0d458c6f1a77ccab9117ed0c913f Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 2 Aug 2024 15:58:59 +0200 Subject: [PATCH 28/77] [WIP] Updated to work with TestingSessionService --- .../tm/application/gui/HomeBeanGui.java | 23 +++--- .../gui/SessionProgressBeanGui.java | 2 +- .../action/ConfigurationsAdminChecks.java | 8 +- .../configurations/action/LdifGenerator.java | 9 ++- .../action/NetworkConfigurationManager.java | 24 +++--- .../tm/configurations/action/OIDManager.java | 9 ++- .../tm/filter/SystemInSessionFilter1.java | 8 +- .../valueprovider/TestingSessionFixer.java | 11 ++- .../TestingSessionInitiator.java | 10 ++- .../action/ConnectathonReport.java | 7 +- .../action/ConnectathonResult.java | 17 +++-- .../action/ConnectathonResultDataModel.java | 10 ++- .../tm/gazelletest/action/KpiDisplay.java | 5 +- .../tm/gazelletest/action/KpiSystems.java | 2 +- .../gazelletest/action/MesaTestManager.java | 4 +- .../action/MetaTestAdministrationManager.java | 8 +- ...MonitorInSessionAdministrationManager.java | 18 +++-- .../gazelletest/action/StartTestInstance.java | 30 +++++--- .../action/SystemInSessionOverview.java | 8 +- .../action/TestInstanceManager.java | 20 +++-- .../tm/session/TestingSessionService.java | 6 +- .../systems/action/DemonstrationManager.java | 7 +- .../action/SystemInSessionBuilder.java | 8 +- .../action/SystemInSessionCreator.java | 39 +++++----- .../action/SystemInSessionListManager.java | 8 +- .../systems/action/TestingSessionManager.java | 16 ++-- .../gui/TestExecutionBeanGUI.java | 5 +- .../ConnectathonParticipantManager.java | 73 ++++++++++--------- .../tm/users/action/InstitutionManagerTM.java | 7 +- 29 files changed, 244 insertions(+), 158 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/HomeBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/HomeBeanGui.java index 183f7e65b..811599e48 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/HomeBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/HomeBeanGui.java @@ -1,15 +1,12 @@ package net.ihe.gazelle.tm.application.gui; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; -import com.pixelmed.slf4j.Logger; -import com.pixelmed.slf4j.LoggerFactory; import net.ihe.gazelle.ssov7.gum.client.application.Role; import net.ihe.gazelle.tm.application.action.ApplicationManager; import net.ihe.gazelle.tm.application.action.SectionsTypePage; import net.ihe.gazelle.tm.application.model.Section; import net.ihe.gazelle.tm.application.services.SectionService; import net.ihe.gazelle.tm.session.TestingSessionService; -import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Name; @@ -29,7 +26,6 @@ import java.util.List; public class HomeBeanGui implements Serializable { - private Logger log = LoggerFactory.getLogger(HomeBeanGui.class); private static final long serialVersionUID = 5931436677551756972L; public SectionService getSectionService() { @@ -86,12 +82,12 @@ public class HomeBeanGui implements Serializable { } } if (identity.isLoggedIn() && applicationManager.isTestManagement()) { - if (testingSessionService.isTestingSessionRunning(TestingSession.getSelectedTestingSession())) { - return filterSectionForRoles(sectionsWithoutToolIndex, SectionsTypePage.ANNOUNCEMENT, - Role.MONITOR, Role.ADMIN, Role.TESTING_SESSION_ADMIN, Role.VENDOR, Role.VENDOR_ADMIN); + if (testingSessionService.isTestingSessionRunning(testingSessionService.getCurrentTestingSession())) { + return filterSectionForRoles(sectionsWithoutToolIndex, SectionsTypePage.ANNOUNCEMENT, + Role.MONITOR, Role.ADMIN, Role.TESTING_SESSION_ADMIN, Role.VENDOR, Role.VENDOR_ADMIN); } - if (testingSessionService.isAfterSessionEnd(TestingSession.getSelectedTestingSession())) { + if (testingSessionService.isAfterSessionEnd(testingSessionService.getCurrentTestingSession())) { return filterSectionForRoles(sectionsWithoutToolIndex, SectionsTypePage.ANNOUNCEMENT, Role.ADMIN, Role.TESTING_SESSION_ADMIN, Role.VENDOR, Role.VENDOR_ADMIN); } @@ -103,11 +99,11 @@ public class HomeBeanGui implements Serializable { Role.VENDOR, Role.VENDOR_ADMIN, Role.ADMIN, Role.TESTING_SESSION_ADMIN); } - public boolean isTestManager(){ + public boolean isTestManager() { return applicationManager.isTestManagement(); } - public boolean showAnnouncement(){ + public boolean showAnnouncement() { return (!applicationManager.isTestManagement() && identity.isLoggedIn()); } @@ -219,16 +215,17 @@ public class HomeBeanGui implements Serializable { return filtered; } - public String getAnnouncementContent(){ + public String getAnnouncementContent() { Section announcement = getAnnouncementSection(); - if(announcement == null) { + if (announcement == null) { return ""; } return announcement.getContent(); } - public void setAnnouncementContent(String content){ + public void setAnnouncementContent(String content) { getAnnouncementSection().setContent(content); } + } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/SessionProgressBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/SessionProgressBeanGui.java index dc34f0af0..cbf9c3a27 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/SessionProgressBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/SessionProgressBeanGui.java @@ -284,7 +284,7 @@ public class SessionProgressBeanGui implements Serializable { public boolean showEvaluationPhase() { if (identity.isLoggedIn() && identity.hasRole(Role.MONITOR) && - testingSessionService.isTestingSessionRunning(TestingSession.getSelectedTestingSession())) { + testingSessionService.isTestingSessionRunning(testingSessionService.getCurrentTestingSession())) { return false; } return isTestingSessionAfterEnd && !isContinuousSession; diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsAdminChecks.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsAdminChecks.java index a6854fa85..d63daaf3a 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsAdminChecks.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsAdminChecks.java @@ -7,8 +7,10 @@ import net.ihe.gazelle.tm.configurations.model.AbstractConfigurationQuery; import net.ihe.gazelle.tm.configurations.model.Host; import net.ihe.gazelle.tm.configurations.model.HostQuery; import net.ihe.gazelle.tm.configurations.model.interfaces.ServerConfiguration; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.ScopeType; +import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.slf4j.Logger; @@ -31,6 +33,8 @@ public class ConfigurationsAdminChecks { private List<Host> hostsAvailable = new ArrayList<>(); private List<Host> duplicatesIpsList; private List<ServerConfiguration> duplicatesConfsList; + @In(value = "testingSessionService") + private TestingSessionService testingSessionService; public List<Host> getDuplicatesIpsList() { return duplicatesIpsList; @@ -70,7 +74,7 @@ public class ConfigurationsAdminChecks { private boolean isIPAvailable(String ipToTest) { HostQuery q = new HostQuery(); - q.testingSession().eq(TestingSession.getSelectedTestingSession()); + q.testingSession().eq(testingSessionService.getCurrentTestingSession()); q.ip().eq(ipToTest); hostsAvailable = q.getListNullIfEmpty(); return hostsAvailable == null; @@ -78,7 +82,7 @@ public class ConfigurationsAdminChecks { public void checkIpIsUniqueInCurrentTestingSession() { HostQuery query = new HostQuery(); - query.testingSession().eq(TestingSession.getSelectedTestingSession()); + query.testingSession().eq(testingSessionService.getCurrentTestingSession()); List<Host> hosts = query.getList(); List<Host> duplicateHosts = new ArrayList<>(); Map<Host, String> ipsList = new HashMap<>(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/LdifGenerator.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/LdifGenerator.java index 73233a026..696af88cb 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/LdifGenerator.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/LdifGenerator.java @@ -21,8 +21,10 @@ import net.ihe.gazelle.tm.configurations.ldap.model.LDAPDevice; import net.ihe.gazelle.tm.configurations.ldap.model.LDAPNetworkAE; import net.ihe.gazelle.tm.configurations.ldap.model.LDAPNetworkConnection; import net.ihe.gazelle.tm.configurations.model.DICOM.*; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.TestingSession; import org.apache.commons.lang.StringUtils; +import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Name; import org.slf4j.LoggerFactory; @@ -50,13 +52,16 @@ public class LdifGenerator implements Serializable, LdifGeneratorLocal { private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(LdifGenerator.class); private static final String LDIF_FILENAME = "confs.ldif"; - + + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + @Override public void generateLDIFFile() { Integer sessionId; Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); if ((params.get(SESSION_ID) == null) || (params.get(SESSION_ID).isEmpty())) { - sessionId = TestingSession.getSelectedTestingSession().getId(); + sessionId = testingSessionService.getCurrentTestingSession().getId(); } else { sessionId = Integer.parseInt(params.get(SESSION_ID)); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/NetworkConfigurationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/NetworkConfigurationManager.java index 69c94a8e7..2a2f1dfce 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/NetworkConfigurationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/NetworkConfigurationManager.java @@ -27,6 +27,7 @@ import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.Role; import net.ihe.gazelle.tm.configurations.model.*; import net.ihe.gazelle.tm.filter.TMCriterions; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.users.model.Institution; @@ -94,6 +95,9 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL @In private GazelleIdentity identity; + @In(value = "testingSessionService") + private TestingSessionService testingSessionService; + public TestingSession getSelectedTestingSession() { return selectedTestingSession; } @@ -298,7 +302,7 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL } EntityManager entityManager = EntityManagerService.provideEntityManager(); - TestingSession.getSelectedTestingSession(); + // inNetworkConfiguration Host h = entityManager.find(Host.class, inNetworkConfiguration.getId()); @@ -313,7 +317,6 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL LOG.debug("deleteCurrentNetworkConfiguration"); } EntityManager entityManager = EntityManagerService.provideEntityManager(); - TestingSession.getSelectedTestingSession(); // inNetworkConfiguration Host h = entityManager.find(Host.class, selectedNetworkConfiguration.getId()); @@ -360,7 +363,7 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL if (!validateIP(selectedNetworkConfiguration.getIp())) { return null; } else { - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); HostQuery hostQuery = new HostQuery(); hostQuery.testingSession().eq(activatedTestingSession); @@ -454,7 +457,7 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL String hostname = host.getHostname(); HostQuery q = new HostQuery(); - q.testingSession().id().eq(TestingSession.getSelectedTestingSession().getId()); + q.testingSession().id().eq(testingSessionService.getCurrentTestingSession().getId()); q.hostname().eq(hostname); if (host.getId() != null) { q.id().neq(host.getId()); @@ -614,11 +617,6 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL if (LOG.isDebugEnabled()) { LOG.debug("cancelAction"); } - if (selectedNetworkConfiguration != null) { - if (selectedNetworkConfiguration.getIp() != null) { - TestingSession.getSelectedTestingSession(); - } - } if (identity.hasRole(Role.ADMIN)) { return "/configuration/NETWORK/list/listAllHostsForAdmin.xhtml"; @@ -661,7 +659,7 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL } entityManager.flush(); - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); LinkedList<String> availableIPs = NetworkConfigurationForTestingSession .getAvailableIPs(activatedTestingSession); @@ -683,7 +681,7 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL } entityManager.flush(); - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); LinkedList<String> availableIPs = NetworkConfigurationForTestingSession .getAvailableIPs(activatedTestingSession); @@ -716,7 +714,7 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL LOG.debug("generateIP"); } EntityManager entityManager = EntityManagerService.provideEntityManager(); - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); LinkedList<String> availableIPs = NetworkConfigurationForTestingSession.getAvailableIPs(activatedTestingSession); if (availableIPs.isEmpty()) { FacesMessages.instance().add(StatusMessage.Severity.ERROR, "No more IP's available " + @@ -735,7 +733,7 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL if (LOG.isDebugEnabled()) { LOG.debug("generateIP"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); LinkedList<String> availableIPs = NetworkConfigurationForTestingSession.getAvailableIPs(activatedTestingSession); if (availableIPs.isEmpty()) { FacesMessages.instance().add(StatusMessage.Severity.ERROR, "No more IP's available " + diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OIDManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OIDManager.java index db89cffac..e99f85de3 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OIDManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OIDManager.java @@ -15,11 +15,14 @@ import net.ihe.gazelle.tf.action.TFPersistenceManager; import net.ihe.gazelle.tf.model.*; import net.ihe.gazelle.tm.configurations.action.converter.OIDRootDefinitionToXmlConverter; import net.ihe.gazelle.tm.configurations.model.*; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemActorProfiles; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; +import org.jboss.seam.Component; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Destroy; +import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.faces.FacesMessages; @@ -70,6 +73,8 @@ public class OIDManager implements Serializable, OIDManagerLocal { private OIDRootDefinitionIE oidRootDefinitionToImport; private boolean reviewBeforeSaving = true; + private final transient TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + /** * Getter for the reviewBeforeSaving property. * @@ -484,7 +489,7 @@ public class OIDManager implements Serializable, OIDManagerLocal { private void deleteAllOIDSystemAssignment1() { List<OIDSystemAssignment> losa = OIDSystemAssignment.getOIDSystemAssignmentFiltered(null, null, - TestingSession.getSelectedTestingSession(), null); + testingSessionService.getCurrentTestingSession(), null); EntityManager em = EntityManagerService.provideEntityManager(); if (losa != null) { for (OIDSystemAssignment oidSystemAssignment : losa) { @@ -551,7 +556,7 @@ public class OIDManager implements Serializable, OIDManagerLocal { List<OIDRequirement> lor = OIDRequirement.getAllOIDRequirement(); for (OIDRequirement oidRequirement : lor) { List<SystemInSession> lsis = SystemInSession.getSystemInSessionFiltered(em, null, - TestingSession.getSelectedTestingSession(), null, null, null, null, null, null, null, null, null, + testingSessionService.getCurrentTestingSession(), null, null, null, null, null, null, null, null, null, null); for (SystemInSession systemInSession : lsis) { List<SystemActorProfiles> lsap = SystemActorProfiles.getSystemActorProfilesFiltered(em, null, diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/SystemInSessionFilter1.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/SystemInSessionFilter1.java index e024022f8..bc38db0fb 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/SystemInSessionFilter1.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/SystemInSessionFilter1.java @@ -7,10 +7,12 @@ import net.ihe.gazelle.hql.criterion.QueryModifier; import net.ihe.gazelle.hql.restrictions.HQLRestrictions; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.Role; +import net.ihe.gazelle.ssov7.gum.client.application.service.UserPreferencesService; import net.ihe.gazelle.tm.filter.modifier.TestMatchingTestingSession; import net.ihe.gazelle.tm.filter.modifier.TestParticipantTested; import net.ihe.gazelle.tm.gazelletest.model.definition.Test; import net.ihe.gazelle.tm.gazelletest.model.definition.TestEntity; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.SystemInSessionQuery; import net.ihe.gazelle.tm.systems.model.SystemInSessionRegistrationStatus; @@ -24,11 +26,13 @@ public class SystemInSessionFilter1 extends Filter<SystemInSession> implements Q private static final long serialVersionUID = -6659360202016280689L; private static final Logger LOG = LoggerFactory.getLogger(SystemInSessionFilter1.class); private final GazelleIdentity identity; + private final TestingSessionService testingSessionService; - public SystemInSessionFilter1(GazelleIdentity identity, Map<String, String> requestParameterMap) { + public SystemInSessionFilter1(GazelleIdentity identity, Map<String, String> requestParameterMap, TestingSessionService testingSessionService) { super(getHQLCriterions(identity), requestParameterMap); queryModifiers.add(this); this.identity = identity; + this.testingSessionService = testingSessionService; } private static HQLCriterionsForFilter<SystemInSession> getHQLCriterions(GazelleIdentity identity) { @@ -67,7 +71,7 @@ public class SystemInSessionFilter1 extends Filter<SystemInSession> implements Q .registrationStatus().isNullRestriction())); if (!identity.hasRole(Role.ADMIN)) { queryBuilder.addRestriction(query.system().systemsInSession().testingSession() - .eqRestriction(TestingSession.getSelectedTestingSession())); + .eqRestriction(testingSessionService.getCurrentTestingSession())); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionFixer.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionFixer.java index 837f0ba21..98d05ca16 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionFixer.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionFixer.java @@ -2,7 +2,8 @@ package net.ihe.gazelle.tm.filter.valueprovider; import net.ihe.gazelle.hql.criterion.ValueProvider; import net.ihe.gazelle.menu.Authorizations; -import net.ihe.gazelle.tm.systems.model.TestingSession; +import net.ihe.gazelle.tm.session.TestingSessionService; +import org.jboss.seam.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -12,6 +13,12 @@ public class TestingSessionFixer implements ValueProvider { private static final long serialVersionUID = 1467097923877807016L; private static final Logger LOG = LoggerFactory.getLogger(TestingSessionFixer.class); + private final transient TestingSessionService testingSessionService; + + public TestingSessionFixer() { + testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + } + @Override public Object getValue() { if (LOG.isDebugEnabled()) { @@ -21,7 +28,7 @@ public class TestingSessionFixer implements ValueProvider { .TESTING_SESSION_ADMIN_OF_CURRENT_TESTING_SESSION.isGranted()) { return null; } - return TestingSession.getSelectedTestingSession(); + return testingSessionService.getCurrentTestingSession(); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionInitiator.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionInitiator.java index 62734b712..b20f9d255 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionInitiator.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionInitiator.java @@ -1,7 +1,8 @@ package net.ihe.gazelle.tm.filter.valueprovider; import net.ihe.gazelle.hql.criterion.ValueProvider; -import net.ihe.gazelle.tm.systems.model.TestingSession; +import net.ihe.gazelle.tm.session.TestingSessionService; +import org.jboss.seam.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -10,13 +11,18 @@ public class TestingSessionInitiator implements ValueProvider { public static final TestingSessionInitiator INSTANCE = new TestingSessionInitiator(); private static final Logger LOG = LoggerFactory.getLogger(TestingSessionInitiator.class); private static final long serialVersionUID = -8047544369456796713L; + private final transient TestingSessionService testingSessionService; + + public TestingSessionInitiator() { + testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + } @Override public Object getValue() { if (LOG.isDebugEnabled()) { LOG.debug("getValue"); } - return TestingSession.getSelectedTestingSession(); + return testingSessionService.getCurrentTestingSession(); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonReport.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonReport.java index a86e1ccac..8a0aa8cc7 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonReport.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonReport.java @@ -17,6 +17,7 @@ import net.ihe.gazelle.tf.model.IntegrationProfile; import net.ihe.gazelle.tm.gazelletest.bean.SAPResultDetailItem; import net.ihe.gazelle.tm.gazelletest.model.definition.TestType; import net.ihe.gazelle.tm.gazelletest.model.instance.*; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.SystemQuery; @@ -77,6 +78,8 @@ public class ConnectathonReport implements Serializable, UserAttributeCommon { private GazelleIdentity identity; @In(value = "gumUserService") private UserService userService; + @In(value = "testingSessionService") + private TestingSessionService testingSessionService; @Create public void initializeDocument() { @@ -94,7 +97,7 @@ public class ConnectathonReport implements Serializable, UserAttributeCommon { return; } } else { - selectedTestingSession = TestingSession.getSelectedTestingSession(); + selectedTestingSession = testingSessionService.getCurrentTestingSession(); } if (urlParams.containsKey("institution")) { Integer institutionId = Integer.parseInt(urlParams.get("institution")); @@ -445,7 +448,7 @@ public class ConnectathonReport implements Serializable, UserAttributeCommon { if (LOG.isDebugEnabled()) { LOG.debug("getReportUrlForVendor"); } - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); return getReportUrl(testingSession, Institution.findInstitutionWithKeyword(identity.getOrganisationKeyword()), null); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResult.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResult.java index c104747ae..650731a0a 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResult.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResult.java @@ -21,6 +21,7 @@ import net.ihe.gazelle.tm.gazelletest.model.definition.TestRoles; import net.ihe.gazelle.tm.gazelletest.model.definition.TestRolesQuery; import net.ihe.gazelle.tm.gazelletest.model.definition.TestType; import net.ihe.gazelle.tm.gazelletest.model.instance.*; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.users.model.Institution; @@ -31,6 +32,7 @@ import org.apache.poi.hssf.util.CellReference; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.util.CellRangeAddress; +import org.jboss.seam.Component; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Create; import org.jboss.seam.annotations.In; @@ -77,6 +79,7 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP private String testTypeToKeep = "all"; @In private GazelleIdentity identity; + private TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); public String getSelectedTestType() { return selectedTestType; @@ -96,7 +99,7 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP public List<String> getAllTestsTypesStringFromSession(){ List<String> testTypesStringValues = new ArrayList<>(); - List<TestType> testTypes = TestingSession.getSelectedTestingSession().getTestTypes(); + List<TestType> testTypes = testingSessionService.getCurrentTestingSession().getTestTypes(); for (TestType testType : testTypes){ testTypesStringValues.add(testType.getKeyword()); } @@ -145,7 +148,7 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP public boolean isDisplayedAdmin(){ - return ((Identity.instance().hasRole("admin_role") && !TestingSession.getSelectedTestingSession().isAllowReportDownload()) || ((Identity.instance().hasRole("vendor_admin_role") || Identity.instance().hasRole("vendor_role") || Identity.instance().hasRole("admin_role")) && TestingSession.getSelectedTestingSession().isAllowReportDownload())); + return ((Identity.instance().hasRole("admin_role") && !testingSessionService.getCurrentTestingSession().isAllowReportDownload()) || ((Identity.instance().hasRole("vendor_admin_role") || Identity.instance().hasRole("vendor_role") || Identity.instance().hasRole("admin_role")) && testingSessionService.getCurrentTestingSession().isAllowReportDownload())); } @Create @@ -495,7 +498,7 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP List<TestType> testTypes = new ArrayList<TestType>(systemAIPOResult.getTestSession().getTestTypes()); LOG.debug(systemAIPOResult.getTestSession().getDescription() + systemAIPOResult.getTestSession().getId() + "getTestRoles " + testTypes.toString()); - if (isInteroperability && TestingSession.getSelectedTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { tipQuery.testInstance().test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { if (testTypes.contains(TestType.getTYPE_INTEROPERABILITY())) { @@ -550,7 +553,7 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP List<TestType> testTypes = new ArrayList<TestType>(systemAIPOResult.getTestSession().getTestTypes()); LOG.debug(systemAIPOResult.getTestSession().getDescription() + systemAIPOResult.getTestSession().getId() + " getTestRolesWithMetaTests " + testTypes.toString()); - if (isInteroperability && TestingSession.getSelectedTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { trQuery.test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { if (testTypes.contains(TestType.getTYPE_INTEROPERABILITY())) { @@ -589,7 +592,7 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP List<TestType> testTypes = new ArrayList<TestType>(systemAIPOResult.getTestSession().getTestTypes()); LOG.debug(systemAIPOResult.getTestSession().getDescription() + systemAIPOResult.getTestSession().getId() + " getTestRolesWithTests " + testTypes.toString()); - if (isInteroperability && TestingSession.getSelectedTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { trQuery.test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { if (testTypes.contains(TestType.getTYPE_INTEROPERABILITY())) { @@ -631,7 +634,7 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP + " getTestRoles " + testTypes.toString()); trQuery.test().testStatus().keyword().eq("ready"); - if (isInteroperability && TestingSession.getSelectedTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { trQuery.test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { if (testTypes.contains(TestType.getTYPE_INTEROPERABILITY())) { @@ -701,7 +704,7 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP query.addRestriction(query.systemActorProfile().system().systemsInSession().acceptedToSession() .eqRestriction(true)); query.addRestriction(query.systemActorProfile().system().systemsInSession().testingSession() - .eqRestriction(TestingSession.getSelectedTestingSession())); + .eqRestriction(testingSessionService.getCurrentTestingSession())); query.addRestriction(enabledRestriction); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResultDataModel.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResultDataModel.java index b44922bf4..df248ce18 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResultDataModel.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResultDataModel.java @@ -5,7 +5,11 @@ import net.ihe.gazelle.common.filter.FilterDataModel; import net.ihe.gazelle.hql.HQLQueryBuilder; import net.ihe.gazelle.tm.gazelletest.model.instance.SystemAIPOResultForATestingSession; import net.ihe.gazelle.tm.gazelletest.model.instance.SystemAIPOResultForATestingSessionQuery; +import net.ihe.gazelle.tm.session.TestingSessionService; +import net.ihe.gazelle.tm.session.TestingSessionServiceImpl; +import net.ihe.gazelle.tm.session.dao.TestingSessionServiceDAOImpl; import net.ihe.gazelle.tm.systems.model.TestingSession; +import org.jboss.seam.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -16,9 +20,13 @@ public class ConnectathonResultDataModel extends FilterDataModel<SystemAIPOResul private static final Logger LOG = LoggerFactory.getLogger(ConnectathonResultDataModel.class); private Integer selectedTestPeerTypeId; + private final transient TestingSessionService testingSessionService; + + public ConnectathonResultDataModel(Filter<SystemAIPOResultForATestingSession> filter) { super(filter); + testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); } public Integer getSelectedTestPeerTypeId() { @@ -47,7 +55,7 @@ public class ConnectathonResultDataModel extends FilterDataModel<SystemAIPOResul .test().testStatus().keyword().eqRestriction("ready")); queryBuilder.addRestriction(query.systemActorProfile().aipo().testParticipants().roleInTest().testRoles() - .test().testType().inRestriction(TestingSession.getSelectedTestingSession().getTestTypes())); + .test().testType().inRestriction(testingSessionService.getCurrentTestingSession().getTestTypes())); queryBuilder.addRestriction(query.systemActorProfile().aipo().testParticipants().roleInTest().testRoles() .test().testPeerType().id().eqRestriction(selectedTestPeerTypeId)); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiDisplay.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiDisplay.java index 8aa4cc953..7e240388b 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiDisplay.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiDisplay.java @@ -17,10 +17,12 @@ import net.ihe.gazelle.tm.gazelletest.model.definition.Test; import net.ihe.gazelle.tm.gazelletest.model.definition.TestParticipants; import net.ihe.gazelle.tm.gazelletest.model.definition.TestRoles; import net.ihe.gazelle.tm.gazelletest.model.instance.*; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.SystemInSessionQuery; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.users.filter.UserFilterImpl; +import org.jboss.seam.Component; import org.jboss.seam.annotations.In; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,6 +43,7 @@ public class KpiDisplay<T> { @In(value = "gumUserService") protected UserService userService; + protected final TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); public static <E> List<E> removeDuplicate(List<E> list) { Set<E> testParticipants = new HashSet<>(); @@ -117,7 +120,7 @@ public class KpiDisplay<T> { for (Object o : list) { if (o instanceof String) { String userId = (String) o; - MonitorInSession monitorInSession = MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(TestingSession.getSelectedTestingSession(), userId); + MonitorInSession monitorInSession = MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(testingSessionService.getCurrentTestingSession(), userId); monitors.add(monitorInSession); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiSystems.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiSystems.java index 3200155f7..ab3521b88 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiSystems.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiSystems.java @@ -99,7 +99,7 @@ public class KpiSystems extends KpiDisplay<SystemInSession> implements Serializa .neqRestriction(SystemInSessionRegistrationStatus.DROPPED), query.system().systemsInSession() .registrationStatus().isNullRestriction())); queryBuilder.addRestriction(query.system().systemsInSession().testingSession() - .eqRestriction(TestingSession.getSelectedTestingSession())); + .eqRestriction(testingSessionService.getCurrentTestingSession())); // GZL-4405: Exclude pre-connectathon tests from count List<TestType> testTypes = TestType.getTestTypesWithoutMESA(); TestEntity<Test> testEntity = query.systemInSessionUsers().testInstanceParticipants().testInstance().test(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MesaTestManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MesaTestManager.java index 7993ebfa4..4b7f8165b 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MesaTestManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MesaTestManager.java @@ -99,6 +99,8 @@ public class MesaTestManager extends ValidationForTIP implements MesaTestManager @In private GazelleIdentity identity; + @In(value = "testingSessionService") + private TestingSessionService testingSessionService; // getter and setter ////////////////////////////////////////// @@ -558,7 +560,7 @@ public class MesaTestManager extends ValidationForTIP implements MesaTestManager private String generateAMesaTestInstance_(TestRoles inCurrentTestRole) { TestInstance currentTestInstance = new TestInstance(); currentTestInstance.setTest(inCurrentTestRole.getTest()); - currentTestInstance.setTestingSession(TestingSession.getSelectedTestingSession()); + currentTestInstance.setTestingSession(testingSessionService.getCurrentTestingSession()); currentTestInstanceParticipants = new TestInstanceParticipants(); currentTestInstanceParticipants.setTestInstance(currentTestInstance); currentTestInstanceParticipants.setRoleInTest(inCurrentTestRole.getRoleInTest()); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MetaTestAdministrationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MetaTestAdministrationManager.java index e92c2c5f8..d104bd330 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MetaTestAdministrationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MetaTestAdministrationManager.java @@ -12,6 +12,7 @@ import net.ihe.gazelle.tf.model.Domain; import net.ihe.gazelle.tf.model.IntegrationProfile; import net.ihe.gazelle.tm.gazelletest.model.definition.*; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.Component; @@ -72,6 +73,7 @@ public class MetaTestAdministrationManager implements MetaTestAdministrationMana @In(value = "gumUserService") private transient UserService userService; + private TestingSessionService testingSessionService; @Override public TestRoles getSelectedTestRole() { @@ -510,7 +512,7 @@ public class MetaTestAdministrationManager implements MetaTestAdministrationMana .createQuery("SELECT DISTINCT mIs FROM MonitorInSession mIs JOIN mIs.testList test, MetaTest mt JOIN mt.testRolesList testRoles" + " WHERE testRoles.test=test AND mt=:inMetaTest AND mis.testingSession=:inTestingSession"); query.setParameter("inMetaTest", inMetaTest); - query.setParameter("inTestingSession", TestingSession.getSelectedTestingSession()); + query.setParameter("inTestingSession", testingSessionService.getCurrentTestingSession()); List<MonitorInSession> list = query.getResultList(); return list; } @@ -534,7 +536,7 @@ public class MetaTestAdministrationManager implements MetaTestAdministrationMana + "AND sIs.testingSession=:inTestingSession"); query.setParameter("inMetaTest", inMetaTest); query.setParameter("inTestOption", TestOption.getTEST_OPTION_REQUIRED()); - query.setParameter("inTestingSession", TestingSession.getSelectedTestingSession()); + query.setParameter("inTestingSession", testingSessionService.getCurrentTestingSession()); List<SystemInSession> list = query.getResultList(); return list; } @@ -556,7 +558,7 @@ public class MetaTestAdministrationManager implements MetaTestAdministrationMana + "AND tr.testOption=:inTestOption " + "AND testRoles=tr " + "AND mt=:inMetaTest " + "AND sIs.testingSession=:inTestingSession"); query.setParameter("inMetaTest", inMetaTest); - query.setParameter("inTestingSession", TestingSession.getSelectedTestingSession()); + query.setParameter("inTestingSession", testingSessionService.getCurrentTestingSession()); query.setParameter("inTestOption", TestOption.getTEST_OPTION_REQUIRED()); return ((Long) query.getSingleResult()).intValue(); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorInSessionAdministrationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorInSessionAdministrationManager.java index b21a6a0fb..bc5bdae0e 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorInSessionAdministrationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorInSessionAdministrationManager.java @@ -24,6 +24,7 @@ import net.ihe.gazelle.tm.datamodel.MonitorUser; import net.ihe.gazelle.tm.gazelletest.model.definition.*; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSessionQuery; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.users.model.Institution; import net.sf.jasperreports.engine.JRException; @@ -74,6 +75,8 @@ public class MonitorInSessionAdministrationManager implements Serializable, Quer private GazelleIdentity identity; @In(value = "gumUserService") private transient UserService userService; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; public Institution getSelectedInstitution() { if (LOG.isDebugEnabled()) { @@ -109,8 +112,8 @@ public class MonitorInSessionAdministrationManager implements Serializable, Quer return new GazelleListDataModel<>(monitorUsers); } - private static List<MonitorInSession> getMonitorInSessions() { - return MonitorInSession.getAllActivatedMonitorsForATestingSession(TestingSession.getSelectedTestingSession()); + private List<MonitorInSession> getMonitorInSessions() { + return MonitorInSession.getAllActivatedMonitorsForATestingSession(testingSessionService.getCurrentTestingSession()); } public Filter<MonitorInSession> getFilter() { @@ -406,7 +409,7 @@ public class MonitorInSessionAdministrationManager implements Serializable, Quer monitorsMap.put(user.getId(), user); } } - List<MonitorInSession> monitorInSessionList = MonitorInSession.getAllActivatedMonitorsForATestingSession(TestingSession.getSelectedTestingSession()); + List<MonitorInSession> monitorInSessionList = MonitorInSession.getAllActivatedMonitorsForATestingSession(testingSessionService.getCurrentTestingSession()); if (monitorInSessionList != null) { for (MonitorInSession monitorInSession : monitorInSessionList) { monitorsMap.remove(monitorInSession.getUserId()); @@ -483,7 +486,7 @@ public class MonitorInSessionAdministrationManager implements Serializable, Quer private void updateMonitorInSessionListStatus() { List<MonitorInSession> monitorInSessionList = MonitorInSession - .getAllActivatedMonitorsForATestingSession(TestingSession.getSelectedTestingSession()); + .getAllActivatedMonitorsForATestingSession(testingSessionService.getCurrentTestingSession()); if (monitorInSessionList != null) { EntityManager entityManager = EntityManagerService.provideEntityManager(); for (MonitorInSession monitorInSession : monitorInSessionList) { @@ -505,15 +508,16 @@ public class MonitorInSessionAdministrationManager implements Serializable, Quer EntityManager entityManager = EntityManagerService.provideEntityManager(); for (String userId : selectedMonitors) { MonitorInSession monitorInSession; + TestingSession currentTestingSession = testingSessionService.getCurrentTestingSession(); List<MonitorInSession> disactivatedMonitorInSessionList = MonitorInSession .getDisactivatedMonitorInSessionForATestingSessionByUser( - TestingSession.getSelectedTestingSession(), userId); + currentTestingSession, userId); if ((disactivatedMonitorInSessionList != null) && (disactivatedMonitorInSessionList.size() == 1)) { monitorInSession = disactivatedMonitorInSessionList.get(0); monitorInSession.setActivated(true); } else { List<Test> testList = new ArrayList<>(); - monitorInSession = new MonitorInSession(userId, testList, true, TestingSession.getSelectedTestingSession()); + monitorInSession = new MonitorInSession(userId, testList, true, currentTestingSession); } entityManager.merge(monitorInSession); } @@ -803,7 +807,7 @@ public class MonitorInSessionAdministrationManager implements Serializable, Quer LOG.debug("modifyQuery"); } MonitorInSessionQuery query = new MonitorInSessionQuery(); - hqlQueryBuilder.addRestriction(query.testingSession().eqRestriction(TestingSession.getSelectedTestingSession())); + hqlQueryBuilder.addRestriction(query.testingSession().eqRestriction(testingSessionService.getCurrentTestingSession())); hqlQueryBuilder.addRestriction(query.isActivated().eqRestriction(true)); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/StartTestInstance.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/StartTestInstance.java index fe550fb01..58d18e8de 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/StartTestInstance.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/StartTestInstance.java @@ -30,6 +30,7 @@ import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstanceParticipants; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstanceParticipantsStatus; import net.ihe.gazelle.tm.gazelletest.model.instance.TestStepsInstance; import net.ihe.gazelle.tm.gazelletest.model.instance.TestStepsInstanceStatus; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.Simulator; import net.ihe.gazelle.tm.systems.model.SimulatorInSession; import net.ihe.gazelle.tm.systems.model.SimulatorInSessionQuery; @@ -100,6 +101,9 @@ public class StartTestInstance implements Serializable { @In(value = "gumUserService") private transient UserService userService; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + public SystemInSession getSelectedSystemInSession() { if (LOG.isDebugEnabled()) { LOG.debug("getSelectedSystemInSession"); @@ -312,8 +316,9 @@ public class StartTestInstance implements Serializable { } if (selectedTestInstanceParticipants != null) { selectedTestInstance = selectedTestInstanceParticipants.getTestInstance(); - selectedTestInstance.setProxyUsed(TestingSession.getSelectedTestingSession().getIsProxyUseEnabled()); - selectedTestInstance.setTestingSession(TestingSession.getSelectedTestingSession()); + TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + selectedTestInstance.setProxyUsed(selectedTestingSession.getIsProxyUseEnabled()); + selectedTestInstance.setTestingSession(selectedTestingSession); selectedTestInstance = persistTestInstance(selectedTestInstance); selectedTestInstanceParticipants.setTestInstance(selectedTestInstance); if (selectedTestInstance == null) { @@ -757,7 +762,7 @@ public class StartTestInstance implements Serializable { if (inTestRoles != null) { List<SystemInSession> systemInSessionList = RoleInTest .getSystemInSessionByRoleInTestByTestingSessionBySISStatus(inTestRoles.getRoleInTest(), - TestingSession.getSelectedTestingSession(), null, true); + testingSessionService.getCurrentTestingSession(), null, true); if (systemInSessionList != null) { if (inTestRoles.getRoleInTest().equals(selectedTestInstanceParticipants.getRoleInTest())) { systemInSessionList.remove(selectedTestInstanceParticipants.getSystemInSessionUser() @@ -778,7 +783,7 @@ public class StartTestInstance implements Serializable { if (inTestRoles != null) { List<SystemInSession> systemInSessionList = RoleInTest .getSystemInSessionByRoleInTestByTestingSessionBySISStatus(inTestRoles.getRoleInTest(), - TestingSession.getSelectedTestingSession(), null, true); + testingSessionService.getCurrentTestingSession(), null, true); if (systemInSessionList != null) { if (inTestRoles.getRoleInTest().equals(selectedTestInstanceParticipants.getRoleInTest())) { systemInSessionList.remove(selectedTestInstanceParticipants.getSystemInSessionUser() @@ -806,7 +811,7 @@ public class StartTestInstance implements Serializable { if (inTestRoles != null) { List<SystemInSession> systemInSessionList = RoleInTest .getSystemInSessionByRoleInTestByTestingSessionBySISStatus(inTestRoles.getRoleInTest(), - TestingSession.getSelectedTestingSession(), null, true); + testingSessionService.getCurrentTestingSession(), null, true); if (systemInSessionList != null) { if (inTestRoles.getRoleInTest().equals(selectedTestInstanceParticipants.getRoleInTest())) { systemInSessionList.remove(selectedTestInstanceParticipants.getSystemInSessionUser() @@ -914,15 +919,15 @@ public class StartTestInstance implements Serializable { } private boolean getAllowOneCompanyPlaySeveralRolesInP2PTests() { - return TestingSession.getSelectedTestingSession().isAllowOneCompanyPlaySeveralRolesInP2PTests(); + return testingSessionService.getCurrentTestingSession().isAllowOneCompanyPlaySeveralRolesInP2PTests(); } private boolean getAllowOneCompanyPlaySeveralRolesInGroupTests() { - return TestingSession.getSelectedTestingSession().isAllowOneCompanyPlaySeveralRolesInGroupTests(); + return testingSessionService.getCurrentTestingSession().isAllowOneCompanyPlaySeveralRolesInGroupTests(); } private boolean getAllowParticipantsStartGroupTests() { - return TestingSession.getSelectedTestingSession().isAllowParticipantsStartGroupTests(); + return testingSessionService.getCurrentTestingSession().isAllowParticipantsStartGroupTests(); } public boolean displayIntendedBehaviorWarningMessage() { @@ -954,9 +959,10 @@ public class StartTestInstance implements Serializable { // Now we are adding a preference in the testing session. This may be not enforced (relaxed for the current session) Identity identity = Identity.instance(); // GZL-4872 : New Group Tests properties added in feasibility computing during test instance starting - boolean isAllowOneCompanyPlaySeveralRolesInP2PTests = TestingSession.getSelectedTestingSession().isAllowOneCompanyPlaySeveralRolesInP2PTests(); - boolean isAllowOneCompanyPlaySeveralRolesInGroupTests = TestingSession.getSelectedTestingSession().isAllowOneCompanyPlaySeveralRolesInGroupTests(); - boolean isAllowParticipantsStartGroupTests = TestingSession.getSelectedTestingSession().isAllowParticipantsStartGroupTests(); + TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + boolean isAllowOneCompanyPlaySeveralRolesInP2PTests = selectedTestingSession.isAllowOneCompanyPlaySeveralRolesInP2PTests(); + boolean isAllowOneCompanyPlaySeveralRolesInGroupTests = selectedTestingSession.isAllowOneCompanyPlaySeveralRolesInGroupTests(); + boolean isAllowParticipantsStartGroupTests = selectedTestingSession.isAllowParticipantsStartGroupTests(); TestPeerType testPeerType = testInstance.getTest().getTestPeerType(); boolean userAllowedToForceTest = identity.hasRole("admin_role") || identity.hasRole("testing_session_admin_role"); boolean isUserParticipant = identity.hasRole("vendor_role") || identity.hasRole("vendor_admin_role"); @@ -1028,7 +1034,7 @@ public class StartTestInstance implements Serializable { LOG.debug("getSimulatorsByTestRoles"); } if (inTestRoles != null) { - TestingSession ts = TestingSession.getSelectedTestingSession(); + TestingSession ts = testingSessionService.getCurrentTestingSession(); SimulatorInSessionQuery query = new SimulatorInSessionQuery(); query.testingSession().eq(ts); query.system().systemActorProfiles().aipo().testParticipants().roleInTest().testRoles().id() diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java index 9fb62e45b..bc1f3d87a 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java @@ -9,7 +9,9 @@ import net.ihe.gazelle.hql.HQLRestriction; import net.ihe.gazelle.hql.criterion.HQLCriterionsForFilter; import net.ihe.gazelle.hql.criterion.QueryModifier; import net.ihe.gazelle.hql.restrictions.HQLRestrictions; +import net.ihe.gazelle.preferences.PreferenceService; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; +import net.ihe.gazelle.ssov7.gum.client.application.service.UserPreferencesService; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.ssov7.gum.client.application.User; import net.ihe.gazelle.tf.model.Domain; @@ -23,6 +25,7 @@ import net.ihe.gazelle.tm.filter.modifier.TestParticipantTested; import net.ihe.gazelle.tm.gazelletest.model.definition.Test; import net.ihe.gazelle.tm.gazelletest.model.definition.TestEntity; import net.ihe.gazelle.tm.report.action.ReportManager; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; import org.jboss.seam.ScopeType; @@ -63,6 +66,9 @@ public class SystemInSessionOverview implements Serializable, QueryModifier<Syst @In(value = "gumUserService") private UserService userService; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + public List<System> getSystemsWithoutTestingSession() { if (LOG.isDebugEnabled()) { LOG.debug("getSystemsWithoutTestingSession"); @@ -139,7 +145,7 @@ public class SystemInSessionOverview implements Serializable, QueryModifier<Syst if (filter == null) { FacesContext fc = FacesContext.getCurrentInstance(); Map<String, String> requestParameterMap = fc.getExternalContext().getRequestParameterMap(); - filter = new SystemInSessionFilter1(identity, requestParameterMap); + filter = new SystemInSessionFilter1(identity, requestParameterMap, testingSessionService); } return filter; } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceManager.java index 71afc9f2d..116501ed8 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceManager.java @@ -31,6 +31,7 @@ import net.ihe.gazelle.tm.configurations.model.WebServiceConfiguration; import net.ihe.gazelle.tm.gazelletest.model.definition.ContextualInformation; import net.ihe.gazelle.tm.gazelletest.model.definition.TestSteps; import net.ihe.gazelle.tm.gazelletest.model.instance.*; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.action.NoteManager; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; @@ -173,6 +174,9 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us @In DatahouseURIService datahouseURIService; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + public static void main(String[] args) { HttpClient client = new HttpClient(); PostMethod filePost = new PostMethod("http://gazelle.ihe.net/EVSClient/upload"); @@ -614,7 +618,7 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us //Update monitor to current user if (MonitorInSession.isMonitorForSelectedSession(identity.getUsername())) { if ((selectedStatus.equals(Status.getSTATUS_VERIFIED()) || selectedStatus.equals(Status.getSTATUS_FAILED()) || selectedStatus.equals(Status.getSTATUS_PARTIALLY_VERIFIED()))) { - inTestInstance.setMonitorInSession(MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(TestingSession.getSelectedTestingSession(), identity.getUsername())); + inTestInstance.setMonitorInSession(MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(testingSessionService.getCurrentTestingSession(), identity.getUsername())); } } @@ -1030,13 +1034,14 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us statusList.add(Status.getSTATUS_PAUSED()); statusList.add(Status.getSTATUS_COMPLETED()); statusList.add(Status.getSTATUS_ABORTED()); - if (TestingSession.getSelectedTestingSession().getIsCriticalStatusEnabled()) { + TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + if (selectedTestingSession.getIsCriticalStatusEnabled()) { statusList.add(Status.getSTATUS_CRITICAL()); } // enable these status for vendors according to the test session preference if ((identity.hasRole(Role.VENDOR_ADMIN) || identity.hasRole(Role.VENDOR)) - && TestingSession.getSelectedTestingSession().isSessionWithoutMonitors()) { + && selectedTestingSession.isSessionWithoutMonitors()) { statusList.add(Status.getSTATUS_VERIFIED()); statusList.add(Status.getSTATUS_PARTIALLY_VERIFIED()); statusList.add(Status.getSTATUS_FAILED()); @@ -1462,7 +1467,8 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us LOG.trace("claimTestInstance"); if (testInstance.getMonitorInSession() == null) { if (identity.isLoggedIn()) { - MonitorInSession monitorInSession = MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(TestingSession.getSelectedTestingSession(), identity.getUsername()); + TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + MonitorInSession monitorInSession = MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(selectedTestingSession, identity.getUsername()); if (monitorInSession != null) { EntityManager entityManager = EntityManagerService.provideEntityManager(); testInstance.setMonitorInSession(monitorInSession); @@ -1470,7 +1476,7 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us entityManager.flush(); ((ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext()).setAttribute(String.valueOf(testInstance.getId()), "claimed"); } else { - LOG.error("The user {} is not monitor for the session {}.", identity.getUsername(), TestingSession.getSelectedTestingSession()); + LOG.error("The user {} is not monitor for the session {}.", identity.getUsername(), selectedTestingSession); } } } else { @@ -1480,7 +1486,7 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us public void releaseTestInstance(TestInstance testInstance) { LOG.trace("releaseTestInstance"); - MonitorInSession monitorInSession = MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(TestingSession.getSelectedTestingSession(), identity.getUsername()); + MonitorInSession monitorInSession = MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(testingSessionService.getCurrentTestingSession(), identity.getUsername()); if (monitorInSession != null) { EntityManager entityManager = EntityManagerService.provideEntityManager(); testInstance.setMonitorInSession(null); @@ -3182,7 +3188,7 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us if (LOG.isDebugEnabled()) { LOG.debug("proxyIsActivated"); } - TestingSession inTestinSession = TestingSession.getSelectedTestingSession(); + TestingSession inTestinSession = testingSessionService.getCurrentTestingSession(); TestingSessionQuery q = new TestingSessionQuery(); q.id().eq(inTestinSession.getId()); List<Boolean> res = q.isProxyUseEnabled().getListDistinct(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java index f44eba364..356e3fd82 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java @@ -10,15 +10,15 @@ import java.util.List; public interface TestingSessionService { /** - * Get current testing session, based on HTTP session + * Get current testing session, based on Cookie. + * If the service cannot find a session, it will use the default one. * - * @return TestingSession + * @return TestingSession from cookie, if not found return the default one */ TestingSession getCurrentTestingSession(); /** * Set in cookie the currentTestingSession of the logged user. - * If the service cannot find a session, it will use the default one. * * @param testingSession the current session */ diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/DemonstrationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/DemonstrationManager.java index 18106cc10..687bd9dce 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/DemonstrationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/DemonstrationManager.java @@ -21,12 +21,14 @@ import net.ihe.gazelle.hql.HQLQueryBuilder; import net.ihe.gazelle.hql.criterion.HQLCriterionsForFilter; import net.ihe.gazelle.hql.criterion.QueryModifier; import net.ihe.gazelle.hql.providers.EntityManagerService; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.Demonstration; import net.ihe.gazelle.tm.systems.model.DemonstrationQuery; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Destroy; +import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.faces.FacesMessages; @@ -84,6 +86,9 @@ public class DemonstrationManager implements Serializable, QueryModifier<Demonst private List<TestingSession> availableTestingSessions; private List<SystemInSession> systemsInSessionLinkedToDemonstration; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + // Getters and Setters public Demonstration getSelectedDemonstration() { if (LOG.isDebugEnabled()) { @@ -192,7 +197,7 @@ public class DemonstrationManager implements Serializable, QueryModifier<Demonst LOG.debug("findAllDemonstrations"); } if (!allSessions) { - selectedTestingSession = TestingSession.getSelectedTestingSession(); + selectedTestingSession = testingSessionService.getCurrentTestingSession(); } else { selectedTestingSession = null; } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionBuilder.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionBuilder.java index 68a34b02b..ecf6a0593 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionBuilder.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionBuilder.java @@ -4,9 +4,11 @@ import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.Role; import net.ihe.gazelle.ssov7.gum.client.application.User; import net.ihe.gazelle.tm.application.action.ApplicationManager; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.users.model.Institution; +import org.jboss.seam.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -22,6 +24,7 @@ import java.util.Set; public class SystemInSessionBuilder extends AbstractSystemInSessionBuilder { private static final Logger LOG = LoggerFactory.getLogger(SystemInSessionBuilder.class); + private TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); public SystemInSessionBuilder() { } @@ -82,9 +85,10 @@ public class SystemInSessionBuilder extends AbstractSystemInSessionBuilder { TableSession tableSession = TableSession.getTableSessionByKeyword(TableSession .getDEFAULT_TABLE_SESSION_STRING()); SystemInSessionStatus systemInSessionStatus = SystemInSessionStatus.getSTATUS_NOT_HERE_YET(); + TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); systemInSession = new SystemInSession(tableSession, newSystem, - TestingSession.getSelectedTestingSession(), null, systemInSessionStatus); - if (TestingSession.getSelectedTestingSession().isSystemAutoAcceptance()) { + selectedTestingSession, null, systemInSessionStatus); + if (selectedTestingSession.isSystemAutoAcceptance()) { systemInSession.setAcceptedToSession(true); } Set<InstitutionSystem> is = new HashSet<InstitutionSystem>(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCreator.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCreator.java index 361194cff..2ccf8d28f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCreator.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCreator.java @@ -8,7 +8,6 @@ import net.ihe.gazelle.ssov7.gum.client.interlay.client.utils.UserSearchParams; import net.ihe.gazelle.tm.application.action.ApplicationManager; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.SystemType; -import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.users.model.Institution; import org.jboss.seam.annotations.*; import org.jboss.seam.annotations.security.Restrict; @@ -34,7 +33,10 @@ import static org.jboss.seam.ScopeType.PAGE; public class SystemInSessionCreator extends AbstractSystemInSessionEditor implements Serializable, SystemInSessionCreatorLocal { + + private static final Logger LOG = LoggerFactory.getLogger(SystemInSessionCreator.class); + private static final long serialVersionUID = -566180111619017150L; protected SystemType sysType; protected String sysversion; protected String syskeywordSuffix; @@ -148,27 +150,22 @@ public class SystemInSessionCreator extends AbstractSystemInSessionEditor if (LOG.isDebugEnabled()) { LOG.debug("addSystem"); } - if (TestingSession.getSelectedTestingSession() == null) { - LOG.error(NO_ACTIVE_SESSION); - StatusMessages.instance() - .addFromResourceBundle(StatusMessage.Severity.ERROR, "gazelle.systems.error.noActivatedTestingSession"); - } else { - sisBuilder = new SystemInSessionBuilder(sysType, sysversion, syskeywordSuffix, sysname, institutionForCreation, - userService.getUserById(sysOwnerId)); - try { - addSystemForTM(sisBuilder); - if (ApplicationManager.instance().isProductRegistry()) { - addSystemForPR(sisBuilder); - } - StatusMessages.instance() - .addFromResourceBundle(StatusMessage.Severity.INFO, "gazelle.systems.system.faces" + - ".SystemSuccessfullyCreated", sysname); - - setDefaultTab("editSystemSummaryTab"); - return "/systems/system/editSystemInSession.seam?id=" + sisBuilder.getSystemInSession().getId(); - } catch (SystemActionException e) { - StatusMessages.instance().addFromResourceBundle(StatusMessage.Severity.ERROR, e.getMessage()); + + sisBuilder = new SystemInSessionBuilder(sysType, sysversion, syskeywordSuffix, sysname, institutionForCreation, + userService.getUserById(sysOwnerId)); + try { + addSystemForTM(sisBuilder); + if (ApplicationManager.instance().isProductRegistry()) { + addSystemForPR(sisBuilder); } + StatusMessages.instance() + .addFromResourceBundle(StatusMessage.Severity.INFO, "gazelle.systems.system.faces" + + ".SystemSuccessfullyCreated", sysname); + + setDefaultTab("editSystemSummaryTab"); + return "/systems/system/editSystemInSession.seam?id=" + sisBuilder.getSystemInSession().getId(); + } catch (SystemActionException e) { + StatusMessages.instance().addFromResourceBundle(StatusMessage.Severity.ERROR, e.getMessage()); } return null; } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionListManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionListManager.java index ddf7f640a..b359dbd3b 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionListManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionListManager.java @@ -268,7 +268,7 @@ public class SystemInSessionListManager extends AbstractSystemInSessionEditor im || Identity.instance().hasRole(Role.TESTING_SESSION_ADMIN) || Identity.instance().hasRole(Role.VENDOR)) { - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); if (testingSession == null) { LOG.error(NO_ACTIVE_SESSION); StatusMessages.instance().addFromResourceBundle(StatusMessage.Severity.ERROR, "gazelle.systems.error.noActivatedTestingSession"); @@ -406,7 +406,7 @@ public class SystemInSessionListManager extends AbstractSystemInSessionEditor im LOG.debug("createSystemSessionForSystem"); TableSession tableSession = TableSession.getTableSessionByKeyword(TableSession.getDEFAULT_TABLE_SESSION_STRING()); SystemInSessionStatus systemInSessionStatus = SystemInSessionStatus.getSTATUS_NOT_HERE_YET(); - SystemInSession newSysInSess = new SystemInSession(tableSession, s, TestingSession.getSelectedTestingSession(), null, systemInSessionStatus); + SystemInSession newSysInSess = new SystemInSession(tableSession, s, currentTestingSession, null, systemInSessionStatus); // The system status need to be set to IN_PROGRESS newSysInSess.setRegistrationStatus(SystemInSessionRegistrationStatus.IN_PROGRESS); // The copied system is set to false @@ -417,7 +417,7 @@ public class SystemInSessionListManager extends AbstractSystemInSessionEditor im entityManager.flush(); FacesMessages.instance().add(StatusMessage.Severity.INFO, "New system in session : " + newSysInSess.getLabel() + " has been added in " - + TestingSession.getSelectedTestingSession().getName()); + + currentTestingSession.getName()); } @Override @@ -539,7 +539,7 @@ public class SystemInSessionListManager extends AbstractSystemInSessionEditor im public Testability getTestabilityForProfile(IntegrationProfile profile){ ProfileInTestingSessionQuery query = new ProfileInTestingSessionQuery(); query.integrationProfile().id().eq(profile.getId()); - query.testingSession().id().eq(TestingSession.getSelectedTestingSession().getId()); + query.testingSession().id().eq(testingSessionService.getCurrentTestingSession().getId()); try{ return query.getUniqueResult().getTestability(); }catch (Exception e){ diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java index d4fd35e72..b0155470b 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java @@ -99,8 +99,8 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin @In(value = "gumUserService") private UserService userService; - @In(value = "testingSessionService", create = true) - private TestingSessionService testingSessionService; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; @In(value = "profileInTestingSessionService") private ProfileInTestingSessionService profileInTestingSessionService; @@ -285,7 +285,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin if (LOG.isDebugEnabled()) { LOG.debug("initializeTestingSessionChoosen"); } - testingSessionChoosen = TestingSession.getSelectedTestingSession(); + testingSessionChoosen = testingSessionService.getCurrentTestingSession(); Contexts.getSessionContext().set("testingSessionChoosen", testingSessionChoosen); } @@ -575,7 +575,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin entityManager.persist(newSessionToActivate); entityManager.flush(); - activatedTestingSession = TestingSession.getSelectedTestingSession(); + activatedTestingSession = testingSessionService.getCurrentTestingSession(); } catch (javax.validation.ConstraintViolationException e) { Set<ConstraintViolation<?>> constraintViolations = e.getConstraintViolations(); for (ConstraintViolation<?> constraintViolation : constraintViolations) { @@ -602,7 +602,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin if (LOG.isDebugEnabled()) { LOG.debug("getActivatedTestingSession"); } - return TestingSession.getSelectedTestingSession(); + return testingSessionService.getCurrentTestingSession(); } @@ -622,7 +622,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin */ public boolean isRegistrationDeadlineExpired() { LOG.trace("isRegistrationDeadlineExpired"); - return !TestingSession.getSelectedTestingSession().isRegistrationOpened() && + return !testingSessionService.getCurrentTestingSession().isRegistrationOpened() && !identity.hasRole(Role.VENDOR_LATE_REGISTRATION); } @@ -671,7 +671,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin } List<Institution> returnList = null; - activatedTestingSession = TestingSession.getSelectedTestingSession(); + activatedTestingSession = testingSessionService.getCurrentTestingSession(); returnList = TestingSession.getListOfInstitutionsRegisterInSession(activatedTestingSession); @@ -802,7 +802,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin Query q = em .createQuery("from TableSession ts where ts.id not IN ( SELECT distinct sis.tableSession.id from SystemInSession sis where sis" + ".tableSession.id != null AND sis.testingSession =:inTestingSession )"); - q.setParameter("inTestingSession", TestingSession.getSelectedTestingSession()); + q.setParameter("inTestingSession", testingSessionService.getCurrentTestingSession()); List<TableSession> listTableSession = q.getResultList(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/gui/TestExecutionBeanGUI.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/gui/TestExecutionBeanGUI.java index bcf5f8f65..9f2be2717 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/gui/TestExecutionBeanGUI.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/gui/TestExecutionBeanGUI.java @@ -6,6 +6,7 @@ import net.ihe.gazelle.hql.HQLQueryBuilder; import net.ihe.gazelle.hql.criterion.QueryModifier; import net.ihe.gazelle.tm.gazelletest.model.definition.TestType; import net.ihe.gazelle.tm.gazelletest.model.instance.SystemAIPOResultForATestingSession; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.testexecution.*; import net.ihe.gazelle.tm.testexecution.sorting.SUTCapabilityReportSortMethod; @@ -35,6 +36,8 @@ public class TestExecutionBeanGUI implements Serializable { private FilterDataModel<SystemAIPOResultForATestingSession> dataModel; private transient Map<SystemAIPOResultForATestingSession, SUTCapabilityReport> cachedSutCapabilityReports = new HashMap<>(); + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; @Create public void init() { @@ -227,7 +230,7 @@ public class TestExecutionBeanGUI implements Serializable { } public boolean isAbleToStartTestInstance() { - return !TestingSession.getSelectedTestingSession().isClosed(); + return !testingSessionService.getCurrentTestingSession().isClosed(); } public String getRunningPartnersForTestRunReport(TestRunReport testRunReport) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/ConnectathonParticipantManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/ConnectathonParticipantManager.java index bb5ae6909..7c26691dc 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/ConnectathonParticipantManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/ConnectathonParticipantManager.java @@ -37,6 +37,7 @@ import net.ihe.gazelle.ssov7.gum.client.application.Role; import net.ihe.gazelle.ssov7.gum.client.application.User; import net.ihe.gazelle.tm.financial.action.FinancialManager; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.users.filter.UserFilterImpl; @@ -115,6 +116,10 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho private UserService userService; @In(create = true) private DataScrollerMemory dataScrollerMemory; + @In(value = "testingSessionService") + private TestingSessionService testingSessionService; + + /** * Testing Session choosen by a user */ @@ -285,12 +290,12 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution"); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); } else { query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); } connectathonParticipants = query.getResultList(); @@ -301,7 +306,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); connectathonParticipants = query.getResultList(); @@ -428,7 +433,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho !identity.hasRole(Role.MONITOR)) { selectedConnectathonParticipant.setInstitution(Institution.getLoggedInInstitution()); } - selectedConnectathonParticipant.setTestingSession(TestingSession.getSelectedTestingSession()); + selectedConnectathonParticipant.setTestingSession(testingSessionService.getCurrentTestingSession()); } @@ -539,7 +544,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho private HQLCriterionsForFilter<ConnectathonParticipant> getHQLCriterionsForFilter() { ConnectathonParticipantQuery q = new ConnectathonParticipantQuery(); HQLCriterionsForFilter<ConnectathonParticipant> criterionsForFilter = q.getHQLCriterionsForFilter(); - criterionsForFilter.addPath("testingSession", q.testingSession(), TestingSession.getSelectedTestingSession()); + criterionsForFilter.addPath("testingSession", q.testingSession(), testingSessionService.getCurrentTestingSession()); criterionsForFilter.addPath("status", q.connectathonParticipantStatus()); if (identity.isLoggedIn() && identity.hasRole("admin_role")) { InstitutionManagerLocal institutionManager = (InstitutionManagerLocal) Component.getInstance("institutionManager"); @@ -670,7 +675,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho cp.getLastName(), cp.getEmail()); } } - FinancialManager.updateInvoiceIfPossible(choosenInstitutionForAdmin, TestingSession.getSelectedTestingSession(), + FinancialManager.updateInvoiceIfPossible(choosenInstitutionForAdmin, testingSessionService.getCurrentTestingSession(), entityManager, false); } @@ -744,7 +749,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho cp.setFridayMeal(true); cp.setVegetarianMeal(false); cp.setSocialEvent(false); - cp.setTestingSession(TestingSession.getSelectedTestingSession()); + cp.setTestingSession(testingSessionService.getCurrentTestingSession()); Institution institution = Institution.findInstitutionWithKeyword(entry.getKey().getOrganizationId()); cp.setInstitution(institution); cp.setInstitutionName(institution.getName()); @@ -793,7 +798,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho if (contactsForImportation.get(i).getObject1()) { ConnectathonParticipant cp = new ConnectathonParticipant(); ConnectathonParticipantQuery query = new ConnectathonParticipantQuery(); - query.testingSession().eq(TestingSession.getSelectedTestingSession()); + query.testingSession().eq(testingSessionService.getCurrentTestingSession()); query.email().eq(contactsForImportation.get(i).getObject2().getEmail()); if (query.getCount() == 0) { @@ -810,7 +815,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho cp.setFridayMeal(true); cp.setVegetarianMeal(false); cp.setSocialEvent(false); - cp.setTestingSession(TestingSession.getSelectedTestingSession()); + cp.setTestingSession(testingSessionService.getCurrentTestingSession()); cp.setInstitution(contactsForImportation.get(i).getObject2().getInstitution()); cp.setInstitutionName(contactsForImportation.get(i).getObject2().getInstitution().getName()); @@ -1004,7 +1009,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho EntityManager em = EntityManagerService.provideEntityManager(); companiesWithoutParticipants = new ArrayList<>(); List<ConnectathonParticipant> foundParticipantsPerCompany; - TestingSession ts = TestingSession.getSelectedTestingSession(); + TestingSession ts = testingSessionService.getCurrentTestingSession(); List<Institution> companiesParticipating = TestingSession.getListOfInstitutionsParticipatingInSession(ts); for (Institution inst : companiesParticipating) { @@ -1069,7 +1074,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); listOfCP = query.getResultList(); } } else { @@ -1122,13 +1127,13 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND mondayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); return query.getResultList(); } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND mondayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); return query.getResultList(); } } else { @@ -1137,7 +1142,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND mondayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); return query.getResultList(); } @@ -1166,13 +1171,13 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND tuesdayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); return query.getResultList(); } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND tuesdayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); return query.getResultList(); } } else { @@ -1181,7 +1186,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND tuesdayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); return query.getResultList(); } @@ -1209,14 +1214,14 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND wednesdayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); return query.getResultList(); } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND wednesdayMeal IS " + "true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); return query.getResultList(); } } else { @@ -1225,7 +1230,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND wednesdayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); return query.getResultList(); } @@ -1253,14 +1258,14 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND thursdayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); return query.getResultList(); } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND thursdayMeal IS " + "true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); return query.getResultList(); } } else { @@ -1269,7 +1274,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND thursdayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); return query.getResultList(); } @@ -1297,13 +1302,13 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND fridayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); return query.getResultList(); } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND fridayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); return query.getResultList(); } } else { @@ -1312,7 +1317,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND fridayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); return query.getResultList(); } @@ -1340,14 +1345,14 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND vegetarianMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); return query.getResultList(); } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND vegetarianMeal IS " + "true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); return query.getResultList(); } } else { @@ -1356,7 +1361,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND vegetarianMeal IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); return query.getResultList(); } @@ -1384,13 +1389,13 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND socialEvent IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); return query.getResultList(); } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND socialEvent IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); return query.getResultList(); } } else { @@ -1399,7 +1404,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND socialEvent IS true"); - query.setParameter(IN_TESTING_SESSION, TestingSession.getSelectedTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); return query.getResultList(); } @@ -1614,7 +1619,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho return 0; } int numSys = this.foundSystemsInSession.size(); - return numSys * TestingSession.getSelectedTestingSession().getNbParticipantsIncludedInSystemFees(); + return numSys * testingSessionService.getCurrentTestingSession().getNbParticipantsIncludedInSystemFees(); } @Override @@ -1626,7 +1631,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho } public void importMonitorsInSession() { - List<MonitorInSession> monitors = MonitorInSession.getAllActivatedMonitorsForATestingSession(TestingSession.getSelectedTestingSession()); + List<MonitorInSession> monitors = MonitorInSession.getAllActivatedMonitorsForATestingSession(testingSessionService.getCurrentTestingSession()); if (monitors == null || monitors.isEmpty()) { FacesMessages.instance().add(StatusMessage.Severity.INFO, "No monitor available for this testing session"); } else { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/InstitutionManagerTM.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/InstitutionManagerTM.java index 0d020a09e..f4b985f4c 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/InstitutionManagerTM.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/InstitutionManagerTM.java @@ -25,6 +25,7 @@ import net.ihe.gazelle.tm.financial.FinancialSummary; import net.ihe.gazelle.tm.financial.FinancialSummaryOneSystem; import net.ihe.gazelle.tm.financial.action.FinancialManager; import net.ihe.gazelle.tm.financial.model.Invoice; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.InstitutionSystem; import net.ihe.gazelle.tm.systems.model.InstitutionSystemQuery; import net.ihe.gazelle.tm.systems.model.System; @@ -124,6 +125,8 @@ public class InstitutionManagerTM implements Serializable, InstitutionManagerTML private System systemToRemove; private Institution institutionToRemove; + @In(value = "testingSessionService") + private TestingSessionService testingSessionService; /** * Destroy the Manager bean when the session is over. @@ -278,7 +281,7 @@ public class InstitutionManagerTM implements Serializable, InstitutionManagerTML } // Check invoice instanciation try { - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); // We check if the invoice exists (cause if the testing session changed, the invoice may not exist) @@ -385,7 +388,7 @@ public class InstitutionManagerTM implements Serializable, InstitutionManagerTML if (LOG.isDebugEnabled()) { LOG.debug("calculateFinancialSummaryDTO"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); financialSummary = FinancialManager.getFinancialSummaryWithCalculatedAmountsStatic( activatedTestingSession, -- GitLab From 88e90134214b61932a64eb6723b238b7d4c7d776 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Thu, 22 Aug 2024 15:48:50 +0200 Subject: [PATCH 29/77] [WIP] fixing test --- .../conformitytestreport/domain/ReportGenerator.java | 4 ++++ .../action/conformityTestReport/ReportGeneratorTest.java | 9 +-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/conformitytestreport/domain/ReportGenerator.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/conformitytestreport/domain/ReportGenerator.java index 992b4f388..dbd7fccae 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/conformitytestreport/domain/ReportGenerator.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/conformitytestreport/domain/ReportGenerator.java @@ -33,6 +33,10 @@ public class ReportGenerator { this.reportDAO = new ConformityTestReportDAOImpl(identity); } + public ReportGenerator(ConformityTestReportDAO reportDAO) { + this.reportDAO = reportDAO; + } + public void checkCompanyKeyWord(String companyKeyword) throws InvalidTokenException { for (Institution institution : reportDAO.getInstitutionQueryList()) { if (institution.getKeyword().equals(companyKeyword)) { diff --git a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/gazelletest/action/conformityTestReport/ReportGeneratorTest.java b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/gazelletest/action/conformityTestReport/ReportGeneratorTest.java index 709604fb4..6be2f630f 100644 --- a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/gazelletest/action/conformityTestReport/ReportGeneratorTest.java +++ b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/gazelletest/action/conformityTestReport/ReportGeneratorTest.java @@ -21,7 +21,6 @@ import org.mockito.Mockito; import java.text.ParseException; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; public class ReportGeneratorTest { @@ -31,13 +30,7 @@ public class ReportGeneratorTest { @Before public void init() { ConformityTestReportDAO conformityTestReportDAOMock = new ConformityTestReportDAOMock(); - GazelleIdentity identity = GazelleIdentityMock.builder() - .withUsername("admin") - .withOrganization("ADMIN_ORGA") - .withRoles(Arrays.asList("admin_role")) - .build(); - ReportGenerator reportGenerator = new ReportGenerator(identity); - reportGenerator.setReportDAO(conformityTestReportDAOMock); + ReportGenerator reportGenerator = new ReportGenerator(conformityTestReportDAOMock); spiedReportGenerator = Mockito.spy(reportGenerator); } -- GitLab From 77198906aa3f1a3334f482cb399d08b265680a31 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 23 Aug 2024 10:38:49 +0200 Subject: [PATCH 30/77] Removed call to static method getSelectedTestingSession --- .../TestingSessionScopeDao.java | 4 +- .../TestingSessionScopeServiceImpl.java | 6 ++- .../dao/TestingSessionScopeDaoImpl.java | 4 +- .../gui/TestingSessionScopeBeanGui.java | 15 +++---- .../common/StatisticsCommonDao.java | 19 +++++---- .../common/StatisticsCommonServiceImpl.java | 26 +++++++------ .../common/dao/StatisticsCommonDaoImpl.java | 39 +++++++++++-------- .../common/gui/StatisticsCommonBeanGui.java | 7 +++- 8 files changed, 69 insertions(+), 51 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/TestingSessionScopeDao.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/TestingSessionScopeDao.java index f05a6caa1..8de360f7f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/TestingSessionScopeDao.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/TestingSessionScopeDao.java @@ -16,9 +16,9 @@ import java.util.Map; public interface TestingSessionScopeDao { Filter<ProfileInTestingSession> getFilter(Map<String, String> requestParameterMap); - List<SystemInSession> getSystemsInSessionByActorAndProfile(IntegrationProfile integrationProfile, Actor actor); + List<SystemInSession> getSystemsInSessionByActorAndProfile(IntegrationProfile integrationProfile, Actor actor, TestingSession testingSession); - List<IntegrationProfileOption> getProfileOptionsBySAIP(SystemInSession systemInSession,Actor actor, IntegrationProfile integrationProfile ); + List<IntegrationProfileOption> getProfileOptionsBySAIP(SystemInSession systemInSession, Actor actor, IntegrationProfile integrationProfile ); void updateProfileInTestingSession(ProfileInTestingSession profileInTestingSession); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/TestingSessionScopeServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/TestingSessionScopeServiceImpl.java index 712d86581..17523f774 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/TestingSessionScopeServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/TestingSessionScopeServiceImpl.java @@ -8,6 +8,7 @@ import net.ihe.gazelle.tf.model.IntegrationProfile; import net.ihe.gazelle.tf.model.IntegrationProfileOption; import net.ihe.gazelle.tm.gazelletest.model.instance.StatusResults; import net.ihe.gazelle.tm.gazelletest.model.instance.SystemAIPOResultForATestingSession; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.ProfileInTestingSession; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.Testability; @@ -23,7 +24,6 @@ import org.jboss.seam.annotations.Scope; import javax.faces.context.FacesContext; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.Map; @@ -36,6 +36,8 @@ public class TestingSessionScopeServiceImpl implements TestingSessionScopeServic TestingSessionScopeDao testingSessionScopeDao; @In(value = "SUTCapabilityReportService") SUTCapabilityReportService sutCapabilityReportService; + @In(value = "testingSessionService") + TestingSessionService testingSessionService; @Override public Filter<ProfileInTestingSession> getFilter(Map<String, String> requestParameterMap) { @@ -113,7 +115,7 @@ public class TestingSessionScopeServiceImpl implements TestingSessionScopeServic profileCoverage.setActorName(actor.getName()); List<ImplementedActorInSystem> implementedActorInSystems = new ArrayList<>(); - List<SystemInSession> systemInSessions = testingSessionScopeDao.getSystemsInSessionByActorAndProfile(integrationProfile, actor); + List<SystemInSession> systemInSessions = testingSessionScopeDao.getSystemsInSessionByActorAndProfile(integrationProfile, actor, testingSessionService.getCurrentTestingSession()); for (SystemInSession systemInSession : systemInSessions) { if (systemInSession != null) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/dao/TestingSessionScopeDaoImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/dao/TestingSessionScopeDaoImpl.java index eca05aa6f..af62f7e2b 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/dao/TestingSessionScopeDaoImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/dao/TestingSessionScopeDaoImpl.java @@ -44,7 +44,7 @@ public class TestingSessionScopeDaoImpl implements TestingSessionScopeDao { } @Override - public List<SystemInSession> getSystemsInSessionByActorAndProfile(IntegrationProfile integrationProfile, Actor actor) { + public List<SystemInSession> getSystemsInSessionByActorAndProfile(IntegrationProfile integrationProfile, Actor actor, TestingSession testingSession) { ActorIntegrationProfileOptionQuery aipoQuery = new ActorIntegrationProfileOptionQuery(); aipoQuery.actorIntegrationProfile().actor().id().eq(actor.getId()); aipoQuery.actorIntegrationProfile().integrationProfile().id().eq(integrationProfile.getId()); @@ -54,7 +54,7 @@ public class TestingSessionScopeDaoImpl implements TestingSessionScopeDao { if (actorIntegrationProfileOption!=null) { SystemInSessionQuery systemInSessionQuery = new SystemInSessionQuery(); - systemInSessionQuery.testingSession().id().eq(TestingSession.getSelectedTestingSession().getId()); + systemInSessionQuery.testingSession().id().eq(testingSession.getId()); systemInSessionQuery.system().systemActorProfiles().actorIntegrationProfileOption().id().eq(actorIntegrationProfileOption.getId()); systemInSessionQuery.registrationStatus().neq(SystemInSessionRegistrationStatus.DROPPED); return systemInSessionQuery.getListDistinct(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/gui/TestingSessionScopeBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/gui/TestingSessionScopeBeanGui.java index 0b5f82068..a534eb26c 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/gui/TestingSessionScopeBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/gui/TestingSessionScopeBeanGui.java @@ -1,17 +1,17 @@ package net.ihe.gazelle.tm.gazelletest.testingSessionScope.gui; import net.ihe.gazelle.common.filter.Filter; +import net.ihe.gazelle.ssov7.gum.client.application.Role; import net.ihe.gazelle.ssov7.gum.client.application.UserAttributeCommon; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; -import net.ihe.gazelle.ssov7.gum.client.application.Role; import net.ihe.gazelle.tm.gazelletest.testingSessionScope.ProfileCoverage; import net.ihe.gazelle.tm.gazelletest.testingSessionScope.ProfileScope; import net.ihe.gazelle.tm.gazelletest.testingSessionScope.ProfileScopeSortMethod; import net.ihe.gazelle.tm.gazelletest.testingSessionScope.TestingSessionScopeService; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.ProfileInTestingSession; import net.ihe.gazelle.tm.systems.model.Testability; import net.ihe.gazelle.tm.systems.model.TestingSession; -import net.ihe.gazelle.tm.testexecution.SUTCapabilityReportService; import net.ihe.gazelle.tm.testexecution.SUTCapabilityStatus; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; @@ -47,8 +47,9 @@ public class TestingSessionScopeBeanGui implements Serializable, UserAttributeCo private static final long serialVersionUID = 7085338188572119609L; private static Logger log = LoggerFactory.getLogger(TestingSessionScopeBeanGui.class); - @In(value="SUTCapabilityReportService") - SUTCapabilityReportService sutCapabilityReportService; + + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; @In(value = "gumUserService") private transient UserService userService; @@ -69,7 +70,7 @@ public class TestingSessionScopeBeanGui implements Serializable, UserAttributeCo private Testability selectedTestability; @In(value = "testingSessionScopeService") - TestingSessionScopeService testingSessionScopeService; + private transient TestingSessionScopeService testingSessionScopeService; private SUTCapabilityStatus selectedStatus; @@ -235,7 +236,7 @@ public class TestingSessionScopeBeanGui implements Serializable, UserAttributeCo HttpServletResponse response = (HttpServletResponse) externalContext.getResponse(); ServletOutputStream servletOutputStream = response.getOutputStream(); response.setContentType("application/vnd.ms-excel"); - Integer sessionsId = TestingSession.getSelectedTestingSession().getId(); + Integer sessionsId = testingSessionService.getCurrentTestingSession().getId(); response.setHeader("Content-Disposition", "attachment;filename=\"testingSession_" + sessionsId + "_scope.xls\""); workbook.write(servletOutputStream); servletOutputStream.flush(); @@ -247,7 +248,7 @@ public class TestingSessionScopeBeanGui implements Serializable, UserAttributeCo * Change the status of each profile with the selected testability then update the DataBase */ public void autoEvaluate(){ - TestingSession session = TestingSession.getSelectedTestingSession(); + TestingSession session = testingSessionService.getCurrentTestingSession(); testingSessionScopeService.autoEvaluate(session, selectedTestability, selectedStatus); FacesMessages.instance().add("Evaluation done"); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/StatisticsCommonDao.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/StatisticsCommonDao.java index b81a07439..06190352a 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/StatisticsCommonDao.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/StatisticsCommonDao.java @@ -3,6 +3,7 @@ package net.ihe.gazelle.tm.statistics.common; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstanceParticipantsQuery; import net.ihe.gazelle.tm.systems.model.ProfileInTestingSession; import net.ihe.gazelle.tm.systems.model.SystemInSessionQuery; +import net.ihe.gazelle.tm.systems.model.TestingSession; import java.util.List; @@ -10,19 +11,21 @@ import java.util.List; public interface StatisticsCommonDao { - TestInstanceParticipantsQuery getTestInstanceParticipantsQuery(); + TestInstanceParticipantsQuery getTestInstanceParticipantsQuery(TestingSession selectedTestingSession); - SystemInSessionQuery getSystemInSessionQuery(); + SystemInSessionQuery getSystemInSessionQuery(TestingSession selectedTestingSession); - List<ProfileInTestingSession> getAllProfileInTestingSessionForCurrentSession(); + List<ProfileInTestingSession> getAllProfileInTestingSessionForCurrentSession(TestingSession selectedTestingSession); - int getNumberOfSessionParticipants(); + int getNumberOfSessionParticipants(TestingSession selectedTestingSession); - int getNumberOfRegisteredInstitutionWithAttendee(); + int getNumberOfRegisteredInstitutionWithAttendee(TestingSession selectedTestingSession); - int getNumberOfRegisteredInstitutionWithSystem(); + int getNumberOfRegisteredInstitutionWithSystem(TestingSession selectedTestingSession); - int getNumberOfRegisteredSystemInSession(); + int getNumberOfRegisteredSystemInSession(TestingSession selectedTestingSession); - int getNumberOfDomainForCurrentSession(); + int getNumberOfDomainForCurrentSession(TestingSession selectedTestingSession); + + int getNumberOfIntegrationProfilesForCurrentSession(TestingSession testingSession); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/StatisticsCommonServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/StatisticsCommonServiceImpl.java index 299f7531e..e9a45215e 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/StatisticsCommonServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/StatisticsCommonServiceImpl.java @@ -1,9 +1,9 @@ package net.ihe.gazelle.tm.statistics.common; -import net.ihe.gazelle.tf.model.Domain; import net.ihe.gazelle.tm.gazelletest.model.instance.Status; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstanceParticipantsQuery; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.*; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.AutoCreate; @@ -21,19 +21,22 @@ public class StatisticsCommonServiceImpl implements StatisticsCommonService { @In(value = "statisticsCommonDao") StatisticsCommonDao statisticsCommonDao; + @In(value = "testingSessionService") + TestingSessionService testingSessionService; + @Override public TestInstanceParticipantsQuery getTestInstanceParticipantsQuery() { - return statisticsCommonDao.getTestInstanceParticipantsQuery(); + return statisticsCommonDao.getTestInstanceParticipantsQuery(testingSessionService.getCurrentTestingSession()); } @Override public SystemInSessionQuery getSystemInSessionQuery() { - return statisticsCommonDao.getSystemInSessionQuery(); + return statisticsCommonDao.getSystemInSessionQuery(testingSessionService.getCurrentTestingSession()); } @Override public ProfileInTestingSessionStats getProfileInTestingSessionStatsForCurrentSession() { - List<ProfileInTestingSession> profileInTestingSessions = statisticsCommonDao.getAllProfileInTestingSessionForCurrentSession(); + List<ProfileInTestingSession> profileInTestingSessions = statisticsCommonDao.getAllProfileInTestingSessionForCurrentSession(testingSessionService.getCurrentTestingSession()); int nbTestable = 0; int nbDropped = 0; @@ -61,34 +64,33 @@ public class StatisticsCommonServiceImpl implements StatisticsCommonService { @Override public int getNumberOfSessionParticipants() { - return statisticsCommonDao.getNumberOfSessionParticipants(); + return statisticsCommonDao.getNumberOfSessionParticipants(testingSessionService.getCurrentTestingSession()); } @Override public int getNumberOfRegisteredInstitutionWithAttendee() { - return statisticsCommonDao.getNumberOfRegisteredInstitutionWithAttendee(); + return statisticsCommonDao.getNumberOfRegisteredInstitutionWithAttendee(testingSessionService.getCurrentTestingSession()); } @Override public int getNumberOfRegisteredInstitutionWithSystem() { - return statisticsCommonDao.getNumberOfRegisteredInstitutionWithSystem(); + return statisticsCommonDao.getNumberOfRegisteredInstitutionWithSystem(testingSessionService.getCurrentTestingSession()); } @Override public int getNumberOfRegisteredSystemInSession() { - return statisticsCommonDao.getNumberOfRegisteredSystemInSession(); + return statisticsCommonDao.getNumberOfRegisteredSystemInSession(testingSessionService.getCurrentTestingSession()); } @Override public int getNumberOfIntegrationProfilesForCurrentSession() { - TestingSessionQuery testingSessionQuery = new TestingSessionQuery(); - testingSessionQuery.id().eq(TestingSession.getSelectedTestingSession().getId()); - return testingSessionQuery.integrationProfiles().id().getCountDistinctOnPath(); + TestingSession currentTestingSession = testingSessionService.getCurrentTestingSession(); + return statisticsCommonDao.getNumberOfIntegrationProfilesForCurrentSession(currentTestingSession); } @Override public int getNumberOfDomainsForCurrentSession() { - return statisticsCommonDao.getNumberOfDomainForCurrentSession(); + return statisticsCommonDao.getNumberOfDomainForCurrentSession(testingSessionService.getCurrentTestingSession()); } @Override diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/dao/StatisticsCommonDaoImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/dao/StatisticsCommonDaoImpl.java index 75533ced2..7066501e6 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/dao/StatisticsCommonDaoImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/dao/StatisticsCommonDaoImpl.java @@ -18,9 +18,9 @@ import java.util.List; public class StatisticsCommonDaoImpl implements StatisticsCommonDao { @Override - public TestInstanceParticipantsQuery getTestInstanceParticipantsQuery() { + public TestInstanceParticipantsQuery getTestInstanceParticipantsQuery(TestingSession selectedTestingSession) { TestInstanceParticipantsQuery testInstanceParticipantsQuery = new TestInstanceParticipantsQuery(); - testInstanceParticipantsQuery.testInstance().testingSession().eq(TestingSession.getSelectedTestingSession()); + testInstanceParticipantsQuery.testInstance().testingSession().eq(selectedTestingSession); testInstanceParticipantsQuery.testInstance().lastStatus().neq(Status.ABORTED); testInstanceParticipantsQuery.systemInSessionUser().systemInSession().system().isTool().eq(false); testInstanceParticipantsQuery.testInstance().test().testType().keyword().neq("preparatory"); @@ -28,54 +28,61 @@ public class StatisticsCommonDaoImpl implements StatisticsCommonDao { } @Override - public int getNumberOfSessionParticipants() { + public int getNumberOfSessionParticipants(TestingSession selectedTestingSession) { ConnectathonParticipantQuery connectathonParticipantQuery = new ConnectathonParticipantQuery(); - connectathonParticipantQuery.testingSession().id().eq(TestingSession.getSelectedTestingSession().getId()); + connectathonParticipantQuery.testingSession().id().eq(selectedTestingSession.getId()); return connectathonParticipantQuery.getCountDistinctOnPath(); } @Override - public int getNumberOfRegisteredInstitutionWithAttendee() { + public int getNumberOfRegisteredInstitutionWithAttendee(TestingSession selectedTestingSession) { ConnectathonParticipantQuery connectathonParticipantQuery = new ConnectathonParticipantQuery(); - connectathonParticipantQuery.testingSession().id().eq(TestingSession.getSelectedTestingSession().getId()); + connectathonParticipantQuery.testingSession().id().eq(selectedTestingSession.getId()); connectathonParticipantQuery.institution().activated().eq(true); return connectathonParticipantQuery.institution().getCountDistinctOnPath(); } @Override - public int getNumberOfRegisteredInstitutionWithSystem() { + public int getNumberOfRegisteredInstitutionWithSystem(TestingSession selectedTestingSession) { SystemInSessionQuery systemInSessionQuery = new SystemInSessionQuery(); - systemInSessionQuery.testingSession().id().eq(TestingSession.getSelectedTestingSession().getId()); + systemInSessionQuery.testingSession().id().eq(selectedTestingSession.getId()); systemInSessionQuery.system().institutionSystems().institution().activated().eq(true); return systemInSessionQuery.system().institutionSystems().institution().getCountDistinctOnPath(); } @Override - public int getNumberOfRegisteredSystemInSession() { - SystemInSessionQuery systemInSessionQuery = getSystemInSessionQuery(); + public int getNumberOfRegisteredSystemInSession(TestingSession selectedTestingSession) { + SystemInSessionQuery systemInSessionQuery = getSystemInSessionQuery(selectedTestingSession); return systemInSessionQuery.getCountDistinctOnPath(); } @Override - public int getNumberOfDomainForCurrentSession() { + public int getNumberOfDomainForCurrentSession(TestingSession selectedTestingSession) { TestingSessionQuery testingSessionQuery = new TestingSessionQuery(); - testingSessionQuery.id().eq(TestingSession.getSelectedTestingSession().getId()); + testingSessionQuery.id().eq(selectedTestingSession.getId()); return testingSessionQuery.integrationProfiles().domainsProfile().domain().getCountDistinctOnPath(); } - public SystemInSessionQuery getSystemInSessionQuery() { + @Override + public int getNumberOfIntegrationProfilesForCurrentSession(TestingSession testingSession) { + TestingSessionQuery testingSessionQuery = new TestingSessionQuery(); + testingSessionQuery.id().eq(testingSession.getId()); + return testingSessionQuery.integrationProfiles().id().getCountDistinctOnPath(); + } + + public SystemInSessionQuery getSystemInSessionQuery(TestingSession selectedTestingSession) { SystemInSessionQuery systemInSessionQuery = new SystemInSessionQuery(); - systemInSessionQuery.testingSession().id().eq(TestingSession.getSelectedTestingSession().getId()); + systemInSessionQuery.testingSession().id().eq(selectedTestingSession.getId()); return systemInSessionQuery; } @Override - public List<ProfileInTestingSession> getAllProfileInTestingSessionForCurrentSession() { + public List<ProfileInTestingSession> getAllProfileInTestingSessionForCurrentSession(TestingSession selectedTestingSession) { ProfileInTestingSessionQuery profileInTestingSessionQuery = new ProfileInTestingSessionQuery(); - profileInTestingSessionQuery.testingSession().id().eq(TestingSession.getSelectedTestingSession().getId()); + profileInTestingSessionQuery.testingSession().id().eq(selectedTestingSession.getId()); return profileInTestingSessionQuery.getListDistinct(); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/gui/StatisticsCommonBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/gui/StatisticsCommonBeanGui.java index dd57e5238..d32738e02 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/gui/StatisticsCommonBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/gui/StatisticsCommonBeanGui.java @@ -4,8 +4,8 @@ import net.ihe.gazelle.menu.Pages; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.Role; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.statistics.common.StatisticsCommonService; -import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.AutoCreate; import org.jboss.seam.annotations.In; @@ -31,6 +31,9 @@ public class StatisticsCommonBeanGui { @In private GazelleIdentity identity; + @In(value = "testingSessionService") + TestingSessionService testingSessionService; + public List<Integer> getProfileInTestingSessionStats() { StatisticsCommonService.ProfileInTestingSessionStats profileInTestingSessionStats = statisticsCommonService.getProfileInTestingSessionStatsForCurrentSession(); return Arrays.asList( @@ -60,7 +63,7 @@ public class StatisticsCommonBeanGui { } public boolean isMonitorOfCurrentSession() { return identity.hasRole(Role.MONITOR) - && (MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(TestingSession.getSelectedTestingSession(), identity.getUsername()) != null); + && (MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(testingSessionService.getCurrentTestingSession(), identity.getUsername()) != null); } public String getTestingSessionScopeLink() { -- GitLab From 33a8a0d74c3a2a2b8eef429b897149a8e92082c9 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 23 Aug 2024 10:45:01 +0200 Subject: [PATCH 31/77] Removed call to static method getSelectedTestingSession --- .../StatisticsForEvaluationPhaseDao.java | 7 ++++--- ...atisticsForEvaluationPhaseServiceImpl.java | 11 +++++++--- .../StatisticsForEvaluationPhaseDaoImpl.java | 20 +++++++++---------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/StatisticsForEvaluationPhaseDao.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/StatisticsForEvaluationPhaseDao.java index f073901d7..823156383 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/StatisticsForEvaluationPhaseDao.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/StatisticsForEvaluationPhaseDao.java @@ -4,20 +4,21 @@ import net.ihe.gazelle.tf.model.Domain; import net.ihe.gazelle.tm.gazelletest.model.instance.SystemAIPOResultForATestingSession; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; import net.ihe.gazelle.tm.systems.model.SystemInSession; +import net.ihe.gazelle.tm.systems.model.TestingSession; import java.util.List; public interface StatisticsForEvaluationPhaseDao { - List<SystemInSession> getSystemsForCurrentUser(); + List<SystemInSession> getSystemsForCurrentUser(TestingSession selectedTestingSession); List<SystemAIPOResultForATestingSession> getCapabilitiesForASystem(SystemInSession system); List<TestInstance> getAllTestInstancesForCurrentSession(); - List<SystemAIPOResultForATestingSession> getAllCapabilitiesForADomain(Domain domain); + List<SystemAIPOResultForATestingSession> getAllCapabilitiesForADomain(Domain domain, TestingSession selectedTestingSession); int getNbTotalTestInstancesForCurrentSession(); - int getNbTotalCapabilitiesForADomain(Domain domain); + int getNbTotalCapabilitiesForADomain(Domain domain, TestingSession selectedTestingSession); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/StatisticsForEvaluationPhaseServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/StatisticsForEvaluationPhaseServiceImpl.java index 8bbcd3758..65e8a28e3 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/StatisticsForEvaluationPhaseServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/StatisticsForEvaluationPhaseServiceImpl.java @@ -4,6 +4,7 @@ import net.ihe.gazelle.tf.model.Domain; import net.ihe.gazelle.tm.gazelletest.model.instance.StatusResults; import net.ihe.gazelle.tm.gazelletest.model.instance.SystemAIPOResultForATestingSession; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.statistics.common.StatisticsCommonService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import org.jboss.seam.ScopeType; @@ -25,9 +26,13 @@ public class StatisticsForEvaluationPhaseServiceImpl implements StatisticsForEva @In(value = "statisticsCommonService") private StatisticsCommonService statisticsCommonService; + @In(value = "testingSessionService") + TestingSessionService testingSessionService; + + @Override public List<SystemInSession> getSystemsForCurrentUser() { - return statisticsForEvaluationPhaseDao.getSystemsForCurrentUser(); + return statisticsForEvaluationPhaseDao.getSystemsForCurrentUser(testingSessionService.getCurrentTestingSession()); } @Override @@ -87,7 +92,7 @@ public class StatisticsForEvaluationPhaseServiceImpl implements StatisticsForEva @Override public CapabilityStats getCapabilitiesStatisticsForADomain(Domain domain) { if (domain != null) { - List<SystemAIPOResultForATestingSession> capabilities = statisticsForEvaluationPhaseDao.getAllCapabilitiesForADomain(domain); + List<SystemAIPOResultForATestingSession> capabilities = statisticsForEvaluationPhaseDao.getAllCapabilitiesForADomain(domain, testingSessionService.getCurrentTestingSession()); return getCapabilityStats(capabilities); } return new CapabilityStats(0, 0, 0, 0, 0, 0); @@ -100,7 +105,7 @@ public class StatisticsForEvaluationPhaseServiceImpl implements StatisticsForEva @Override public int getNbTotalCapabilitiesForADomain(Domain domain) { - return statisticsForEvaluationPhaseDao.getNbTotalCapabilitiesForADomain(domain); + return statisticsForEvaluationPhaseDao.getNbTotalCapabilitiesForADomain(domain, testingSessionService.getCurrentTestingSession()); } private int getNbEvaluationPending(int nbEvaluationPending, SystemAIPOResultForATestingSession capability) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/dao/StatisticsForEvaluationPhaseDaoImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/dao/StatisticsForEvaluationPhaseDaoImpl.java index 6e73f92cb..af411f4da 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/dao/StatisticsForEvaluationPhaseDaoImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/dao/StatisticsForEvaluationPhaseDaoImpl.java @@ -30,19 +30,19 @@ public class StatisticsForEvaluationPhaseDaoImpl implements StatisticsForEvaluat StatisticsCommonService statisticsCommonService; @Override - public List<SystemInSession> getSystemsForCurrentUser() { - SystemInSessionQuery systemInSessionQuery = getSystemInSessionQuery(); + public List<SystemInSession> getSystemsForCurrentUser(TestingSession selectedTestingSession) { + SystemInSessionQuery systemInSessionQuery = getSystemInSessionQuery(selectedTestingSession); systemInSessionQuery.system().institutionSystems().institution().eq(Institution.getLoggedInInstitution()); return systemInSessionQuery.getListDistinct(); } - private SystemInSessionQuery getSystemInSessionQuery() { + private SystemInSessionQuery getSystemInSessionQuery(TestingSession selectedTestingSession) { SystemInSessionQuery systemInSessionQuery = new SystemInSessionQuery(); systemInSessionQuery.acceptedToSession().eq(true); systemInSessionQuery.system().isTool().eq(false); - systemInSessionQuery.testingSession().eq(TestingSession.getSelectedTestingSession()); + systemInSessionQuery.testingSession().eq(selectedTestingSession); return systemInSessionQuery; } @@ -61,16 +61,16 @@ public class StatisticsForEvaluationPhaseDaoImpl implements StatisticsForEvaluat } @Override - public List<SystemAIPOResultForATestingSession> getAllCapabilitiesForADomain(Domain domain) { - SystemAIPOResultForATestingSessionQuery capabilityQuery = getSystemAIPOResultForATestingSessionQueryForADomain(domain); + public List<SystemAIPOResultForATestingSession> getAllCapabilitiesForADomain(Domain domain, TestingSession selectedTestingSession) { + SystemAIPOResultForATestingSessionQuery capabilityQuery = getSystemAIPOResultForATestingSessionQueryForADomain(domain, selectedTestingSession); return capabilityQuery.getListDistinct(); } - private SystemAIPOResultForATestingSessionQuery getSystemAIPOResultForATestingSessionQueryForADomain(Domain domain) { + private SystemAIPOResultForATestingSessionQuery getSystemAIPOResultForATestingSessionQueryForADomain(Domain domain, TestingSession selectedTestingSession) { SystemAIPOResultForATestingSessionQuery capabilityQuery = new SystemAIPOResultForATestingSessionQuery(); ActorIntegrationProfileOptionAttributes<ActorIntegrationProfileOption> aipoAttributes = capabilityQuery.systemActorProfile().actorIntegrationProfileOption(); capabilityQuery.addRestriction(aipoAttributes.actorIntegrationProfile().integrationProfile().domainsForDP().id().eqRestriction(domain.getId())); - capabilityQuery.testSession().eq(TestingSession.getSelectedTestingSession()); + capabilityQuery.testSession().eq(selectedTestingSession); capabilityQuery.systemActorProfile().system().systemsInSession().registrationStatus().neq(SystemInSessionRegistrationStatus.DROPPED); capabilityQuery.systemActorProfile().system().isTool().neq(true); capabilityQuery.systemActorProfile().system().systemsInSession().acceptedToSession().eq(true); @@ -83,8 +83,8 @@ public class StatisticsForEvaluationPhaseDaoImpl implements StatisticsForEvaluat } @Override - public int getNbTotalCapabilitiesForADomain(Domain domain) { - SystemAIPOResultForATestingSessionQuery capabilityQuery = getSystemAIPOResultForATestingSessionQueryForADomain(domain); + public int getNbTotalCapabilitiesForADomain(Domain domain, TestingSession selectedTestingSession) { + SystemAIPOResultForATestingSessionQuery capabilityQuery = getSystemAIPOResultForATestingSessionQueryForADomain(domain, selectedTestingSession); return capabilityQuery.getCountDistinctOnPath(); } -- GitLab From ee9195feeae6bb10a749d6f689be910e4fed4cf3 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 23 Aug 2024 11:02:59 +0200 Subject: [PATCH 32/77] Removed call to static method getSelectedTestingSession --- .../action/ConfigurationsOverview.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsOverview.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsOverview.java index e704d41bc..7bbaad432 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsOverview.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsOverview.java @@ -28,6 +28,7 @@ import net.ihe.gazelle.tm.configurations.model.interfaces.ServerConfiguration; import net.ihe.gazelle.tm.filter.BooleanLabelProvider; import net.ihe.gazelle.tm.filter.PropertyCriterionConfigurationClass; import net.ihe.gazelle.tm.filter.valueprovider.InstitutionFixer; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.users.model.Institution; import org.hibernate.Session; @@ -73,6 +74,10 @@ public class ConfigurationsOverview implements Serializable, MapNotifierListener @In(create = true) GenerateConfigurationForANotDroppedSystemInSessionJobInterface generateConfigurationForANotDroppedSystemInSessionJob; + + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + private FilterDataModel<AbstractConfiguration> datamodel = null; private Filter<AbstractConfiguration> filter = null; private FilterDataModel<SystemInSession> datamodelSystems = null; @@ -133,8 +138,9 @@ public class ConfigurationsOverview implements Serializable, MapNotifierListener SystemInSessionQuery sisQuery = new SystemInSessionQuery(); HQLCriterionsForFilter<SystemInSession> hqlCriterions = sisQuery.getHQLCriterionsForFilter(); - hqlCriterions.addPath(TEST_SESSION, sisQuery.testingSession(), TestingSession.getSelectedTestingSession(), - TestingSession.getSelectedTestingSession()); + TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + hqlCriterions.addPath(TEST_SESSION, sisQuery.testingSession(), selectedTestingSession, + selectedTestingSession); hqlCriterions.addPath(INSTITUTION, sisQuery.system().institutionSystems().institution(), InstitutionFixer.INSTANCE); hqlCriterions.addPath(SYSTEM, sisQuery); @@ -162,7 +168,7 @@ public class ConfigurationsOverview implements Serializable, MapNotifierListener .neqRestriction(SystemInSessionRegistrationStatus.DROPPED), query.system().systemsInSession() .registrationStatus().isNullRestriction())); queryBuilder.addRestriction(query.system().systemsInSession().testingSession() - .eqRestriction(TestingSession.getSelectedTestingSession())); + .eqRestriction(testingSessionService.getCurrentTestingSession())); } @Override @@ -196,9 +202,10 @@ public class ConfigurationsOverview implements Serializable, MapNotifierListener HQLCriterionsForFilter<AbstractConfiguration> hqlCriterions = abstractConfigurationQuery .getHQLCriterionsForFilter(); + final TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); hqlCriterions.addPath(TEST_SESSION, abstractConfigurationQuery.configuration().systemInSession() - .testingSession(), TestingSession.getSelectedTestingSession(), - TestingSession.getSelectedTestingSession()); + .testingSession(), selectedTestingSession, + selectedTestingSession); hqlCriterions.addPath(INSTITUTION, abstractConfigurationQuery.configuration().systemInSession().system() .institutionSystems().institution(), InstitutionFixer.INSTANCE); hqlCriterions.addPath(SYSTEM, abstractConfigurationQuery.configuration().systemInSession()); @@ -236,13 +243,13 @@ public class ConfigurationsOverview implements Serializable, MapNotifierListener .registrationStatus().neqRestriction(SystemInSessionRegistrationStatus.DROPPED), query .configuration().systemInSession().registrationStatus().isNullRestriction())); queryBuilder.addRestriction(query.configuration().systemInSession().testingSession() - .eqRestriction(TestingSession.getSelectedTestingSession())); + .eqRestriction(selectedTestingSession)); } }); Filter<AbstractConfiguration> result = new Filter<AbstractConfiguration>(hqlCriterions.getEntityClass(), hqlCriterions.getQueryModifiers(), criterions, queryModifiersForSuggest, requestParameterMap); - result.getFilterValues().put(TEST_SESSION, TestingSession.getSelectedTestingSession()); + result.getFilterValues().put(TEST_SESSION, selectedTestingSession); return result; } -- GitLab From 4b5955fa18e82089d59d643811fc77f30a1d6d0c Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 23 Aug 2024 11:11:10 +0200 Subject: [PATCH 33/77] Removed call to static method getSelectedTestingSession --- .../tm/configurations/action/ConfigurationsAdminChecks.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsAdminChecks.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsAdminChecks.java index d63daaf3a..986baa24f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsAdminChecks.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsAdminChecks.java @@ -147,8 +147,7 @@ public class ConfigurationsAdminChecks { public void checkProxyPortIsUniqueInCurrentTestingSession() { AbstractConfigurationQuery query = new AbstractConfigurationQuery(); - query.configuration().systemInSession().testingSession().eq(TestingSession - .getSelectedTestingSession()); + query.configuration().systemInSession().testingSession().eq(testingSessionService.getCurrentTestingSession()); query.configuration().isSecured().eq(false); List<AbstractConfiguration> configurations = query.getList(); List<ServerConfiguration> duplicatesConfigurations = new ArrayList<>(); -- GitLab From 30750439ba1ed3f131814dd1c6fedb4fb2c9ef31 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 23 Aug 2024 12:00:11 +0200 Subject: [PATCH 34/77] Removed call to static method getSelectedTestingSession --- .../OidsAndIPParamForSessionManager.java | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OidsAndIPParamForSessionManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OidsAndIPParamForSessionManager.java index 16d08a853..6d162347a 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OidsAndIPParamForSessionManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OidsAndIPParamForSessionManager.java @@ -20,14 +20,13 @@ import net.ihe.gazelle.common.application.action.ApplicationPreferenceManagerImp import net.ihe.gazelle.common.interfacegenerator.GenerateInterface; import net.ihe.gazelle.common.report.ReportExporterManager; import net.ihe.gazelle.hql.providers.EntityManagerService; -import net.ihe.gazelle.proxy.ws.Configuration; import net.ihe.gazelle.tf.model.IntegrationProfile; import net.ihe.gazelle.tm.configurations.model.*; import net.ihe.gazelle.tm.configurations.model.HL7.*; import net.ihe.gazelle.tm.configurations.model.OIDSConfigurationForSessionForHL7.OidsTypeForHL7; -import net.ihe.gazelle.tm.configurations.model.interfaces.ServerConfiguration; import net.ihe.gazelle.tm.gazelletest.action.ProxyManager; import net.ihe.gazelle.tm.gazelletest.bean.IpComparator; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.OIDInstitution; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; @@ -90,6 +89,9 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP private ProxyConfigurationForSession proxyConfigurationForForAllServicesSession; + @In(value = "testingSessionService") + TestingSessionService testingSessionService; + // ~ Methods // /////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -149,7 +151,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP LOG.debug("initializeOIDSConfiguration"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); oidsConfigurationForHL7 = OIDSConfigurationForSessionForHL7 .getConfigurationParametersForSession(activatedTestingSession); @@ -263,7 +265,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP LOG.debug("initializeNetworkConfiguration"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); networkConfigurationForTestingSession = NetworkConfigurationForTestingSession .getConfigurationParametersForSession(activatedTestingSession); @@ -478,9 +480,10 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP if (LOG.isDebugEnabled()) { LOG.debug("getNumberOfIpsAvailable"); } - int allIps = NetworkConfigurationForTestingSession.getAllIPs(TestingSession.getSelectedTestingSession()).size(); + TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + int allIps = NetworkConfigurationForTestingSession.getAllIPs(selectedTestingSession).size(); int availableIps = NetworkConfigurationForTestingSession.getAvailableIPs( - TestingSession.getSelectedTestingSession()).size(); + selectedTestingSession).size(); return availableIps + " / " + allIps; } @@ -548,7 +551,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP LOG.debug("initializeOIDSList"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); if (oidChoosedForHL7 == null) { return; @@ -571,7 +574,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP LOG.debug("initializeOIDSListForWS"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); if (oidChoosedForWS == null) { return; @@ -606,7 +609,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP if (LOG.isDebugEnabled()) { LOG.debug("assignAllOIDSInConfigurations"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); List<Institution> listOfInstitution = Institution.listAllInstitutions(); EntityManager em = EntityManagerService.provideEntityManager(); for (Institution currentInstitution : listOfInstitution) { @@ -714,7 +717,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP if (LOG.isDebugEnabled()) { LOG.debug("updateOIDS"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); List<Institution> listOfInstitution = Institution.listAllInstitutions(); EntityManager em = EntityManagerService.provideEntityManager(); @@ -876,7 +879,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP LOG.debug("deleteAllOIDSInConfigurations"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); List<AbstractConfiguration> list = AbstractConfiguration .GetListOfConfigurationWithOIDS(activatedTestingSession); @@ -913,7 +916,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP if (LOG.isDebugEnabled()) { LOG.debug("initProxiesConfigurationsForSession"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); ConfigurationType.GetConfigurationTypeCompatibleWithAProxy(); @@ -977,7 +980,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP if (LOG.isDebugEnabled()) { LOG.debug("saveProxyConfiguration"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); try { entityManager.flush(); proxyConfigurationForForAllServicesSession.setTestingSession(activatedTestingSession); @@ -1014,7 +1017,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP if (LOG.isDebugEnabled()) { LOG.debug("attributeConfigPortProxyForActiveSession"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); List<AbstractConfiguration> configurations = AbstractConfiguration .GetListOfConfigurationWithPortProxy(activatedTestingSession); @@ -1044,7 +1047,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); if ((params.get("sessionId") == null) || (params.get("sessionId").isEmpty())) { - sessionId = TestingSession.getSelectedTestingSession().getId(); + sessionId = testingSessionService.getCurrentTestingSession().getId(); } else { sessionId = Integer.parseInt(params.get("sessionId")); } @@ -1188,7 +1191,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); if ((params.get("sessionId") == null) || (params.get("sessionId").isEmpty())) { - sessionId = TestingSession.getSelectedTestingSession().getId(); + sessionId = testingSessionService.getCurrentTestingSession().getId(); } else { sessionId = Integer.parseInt(params.get("sessionId")); } @@ -1239,7 +1242,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); if ((params.get("sessionId") == null) || (params.get("sessionId").isEmpty())) { - ts = TestingSession.getSelectedTestingSession(); + ts = testingSessionService.getCurrentTestingSession(); } else { ts = TestingSession.getSessionById(Integer.parseInt(params.get("sessionId"))); } @@ -1352,11 +1355,11 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP if (LOG.isDebugEnabled()) { LOG.debug("getSelectedTestingSession"); } - return TestingSession.getSelectedTestingSession(); + return testingSessionService.getCurrentTestingSession(); } private void changeProxyUseForATestingSession(boolean isProxyUseEnabled) { - TestingSession inTestinSession = TestingSession.getSelectedTestingSession(); + TestingSession inTestinSession = testingSessionService.getCurrentTestingSession(); inTestinSession.setIsProxyUseEnabled(isProxyUseEnabled); TestingSession.mergeTestingSession(inTestinSession, entityManager); } @@ -1367,7 +1370,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP LOG.debug("startAllChannels"); } // test is new values has been saved - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); ProxyConfigurationForSession proxyConfigForSession = ProxyConfigurationForSession .getProxyConfigurationForSession(activatedTestingSession); if ((!proxyConfigurationForForAllServicesSession.getPortRangeHigh().equals(proxyConfigForSession.getPortRangeHigh())) -- GitLab From 60dd19fa3a9e64316bd4c8956082c6b1838054ad Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 23 Aug 2024 13:56:03 +0200 Subject: [PATCH 35/77] Removed call to static method getSelectedTestingSession --- .../ihe/gazelle/objects/action/ObjectManager.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/ObjectManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/ObjectManager.java index 8b09eaca3..75123a48e 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/ObjectManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/ObjectManager.java @@ -27,6 +27,7 @@ import net.ihe.gazelle.objects.model.*; import net.ihe.gazelle.ssov7.gum.client.application.UserAttributeCommon; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.tm.application.action.ApplicationManager; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.users.model.Institution; @@ -87,6 +88,9 @@ public class ObjectManager extends AbstractSampleManager implements ObjectManage @In(value = "gumUserService") private transient UserService userService; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + // ~ getter && setter //////////////////////////////////////////////////////////////// @Override @@ -232,7 +236,7 @@ public class ObjectManager extends AbstractSampleManager implements ObjectManage if (LOG.isDebugEnabled()) { LOG.debug("getSystemListForSelectedInstitution"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); EntityManager em = EntityManagerService.provideEntityManager(); if ((this.selectedInstitution != null) && (activatedTestingSession != null)) { List<SystemInSession> systemInSessionList = SystemInSession @@ -298,7 +302,7 @@ public class ObjectManager extends AbstractSampleManager implements ObjectManage List<SystemInSession> result = new ArrayList<SystemInSession>(); EntityManager em = EntityManagerService.provideEntityManager(); if (objectType != null) { - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); result = SystemInSession.getSystemInSessionFiltered(em, null, testingSession, null, null, null, null, null, null, null, null, null, null, null, objectType, null, null, null); } @@ -310,7 +314,7 @@ public class ObjectManager extends AbstractSampleManager implements ObjectManage if (LOG.isDebugEnabled()) { LOG.debug("getAllInstitutionsForCurrentSession"); } - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); return TestingSession.getListOfInstitutionsParticipatingInSession(testingSession); } @@ -1012,7 +1016,7 @@ public class ObjectManager extends AbstractSampleManager implements ObjectManage LOG.debug("canDownloadAllSampleOfType"); } boolean result = false; - TestingSession inTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession inTestingSession = testingSessionService.getCurrentTestingSession(); int noi = ObjectInstance.getNumberObjectInstanceFiltered(ot, null, inTestingSession, null); if (noi == 0) { result = false; -- GitLab From 0f86ddd87a7732bfa0bb9159dbe4619ff2faaf53 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 23 Aug 2024 15:11:39 +0200 Subject: [PATCH 36/77] Removed call to static method getSelectedTestingSession --- .../action/SystemConfigurationManager.java | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/SystemConfigurationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/SystemConfigurationManager.java index fd91be3b3..f4dda8ed7 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/SystemConfigurationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/SystemConfigurationManager.java @@ -38,6 +38,7 @@ import net.ihe.gazelle.tm.configurations.model.DICOM.DicomSCPConfiguration; import net.ihe.gazelle.tm.configurations.model.DICOM.DicomSCUConfiguration; import net.ihe.gazelle.tm.configurations.model.HL7.*; import net.ihe.gazelle.tm.configurations.model.OIDSConfigurationForSessionForHL7.OidsTypeForHL7; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.action.SystemManager; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; @@ -136,6 +137,9 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc @In(value = "gumUserService") private transient UserService userService; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + public SystemConfigurationManager() { } @@ -329,7 +333,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc } } GenerateSystemConfiguration gsc = new GenerateSystemConfiguration(); - gsc.generateSystemConfigurationsOnly(host, sIs, TestingSession.getSelectedTestingSession()); + gsc.generateSystemConfigurationsOnly(host, sIs, testingSessionService.getCurrentTestingSession()); } @Override @@ -352,7 +356,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc } GenerateSystemConfiguration gsc = new GenerateSystemConfiguration(); - gsc.generateSystemConfigurationsOnly(host, sIs, TestingSession.getSelectedTestingSession()); + gsc.generateSystemConfigurationsOnly(host, sIs, testingSessionService.getCurrentTestingSession()); } else { Institution choosenInstitutionForAdmin = (Institution) Component .getInstance(CHOOSEN_INSTITUTION_FOR_ADMIN); @@ -503,7 +507,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc LOG.debug("void generateConfigurationsForCompany"); } Institution choosenInstitutionForAdmin = (Institution) Component.getInstance(CHOOSEN_INSTITUTION_FOR_ADMIN); - activatedTestingSession = TestingSession.getSelectedTestingSession(); + activatedTestingSession = testingSessionService.getCurrentTestingSession(); EntityManager em = EntityManagerService.provideEntityManager(); if ((choosenInstitutionForAdmin != null) && (choosenInstitutionForAdmin.getName() != null)) { @@ -531,7 +535,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc LOG.debug("generateConfigurationsForCompany"); } EntityManager em = EntityManagerService.provideEntityManager(); - activatedTestingSession = TestingSession.getSelectedTestingSession(); + activatedTestingSession = testingSessionService.getCurrentTestingSession(); List<SystemInSession> listOfSystemInSession = SystemInSession.getSystemInSessionFiltered(em, null, activatedTestingSession, institution, null, null, null, null, null, null, null, null, null); @@ -577,7 +581,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc if (LOG.isDebugEnabled()) { LOG.debug("generateAllConfigurationsForSession"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); List<Institution> listOfInstitution = TestingSession .getListOfInstitutionsParticipatingInSession(activatedTestingSession); @@ -663,7 +667,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc LOG.debug("getPossibleSystems"); } SystemInSessionQuery systemInSessionQuery = new SystemInSessionQuery(); - systemInSessionQuery.testingSession().eq(TestingSession.getSelectedTestingSession()); + systemInSessionQuery.testingSession().eq(testingSessionService.getCurrentTestingSession()); if (!Authorizations.ADMIN.isGranted()) { Institution institution = Institution.findInstitutionWithKeyword(identity.getOrganisationKeyword()); systemInSessionQuery.system().institutionSystems().institution().eq(institution); @@ -896,7 +900,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc if (LOG.isDebugEnabled()) { LOG.debug("deleteAllConfigurationsForSession"); } - activatedTestingSession = TestingSession.getSelectedTestingSession(); + activatedTestingSession = testingSessionService.getCurrentTestingSession(); deleteAllConfigurationsForSession(activatedTestingSession); return CONFIGURATION_CONFIGURATIONS_XHTML; } @@ -1106,7 +1110,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc LOG.debug("prepareBean"); } if (activatedTestingSession == null) { - activatedTestingSession = TestingSession.getSelectedTestingSession(); + activatedTestingSession = testingSessionService.getCurrentTestingSession(); } selectedSystemInSession = null; return ""; @@ -1120,7 +1124,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc } if (activatedTestingSession == null) { - activatedTestingSession = TestingSession.getSelectedTestingSession(); + activatedTestingSession = testingSessionService.getCurrentTestingSession(); } selectedSystemInSession = null; @@ -1216,7 +1220,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc LOG.debug("validateAssigningAuthorityOID"); } if (activatedTestingSession == null) { - activatedTestingSession = TestingSession.getSelectedTestingSession(); + activatedTestingSession = testingSessionService.getCurrentTestingSession(); } if (oidsConfigurationForSessionForHL7 == null) { oidsConfigurationForSessionForHL7 = OIDSConfigurationForSessionForHL7 -- GitLab From 83dc38d0c5140e9790e5c12d695c2af40cd97d0b Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 23 Aug 2024 15:30:41 +0200 Subject: [PATCH 37/77] Removed call to static method getSelectedTestingSession --- .../action/ConnecthatonTestingManager.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java index 88f9809a2..dfdbc850c 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java @@ -12,6 +12,7 @@ import net.ihe.gazelle.tf.model.*; import net.ihe.gazelle.tm.gazelletest.bean.*; import net.ihe.gazelle.tm.gazelletest.model.definition.*; import net.ihe.gazelle.tm.gazelletest.model.instance.*; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.users.model.Institution; @@ -105,6 +106,9 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc @In private GazelleIdentity identity; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + @Override public String getBACK_MESSAGE() { if (LOG.isDebugEnabled()) { @@ -550,7 +554,7 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc SystemActorProfiles systemActorProfile = testRolesParticipantsResult.getSystemActorProfiles(); TestRoles testRoles = testRolesParticipantsResult.getTestRoles(); EntityManager entityManager = EntityManagerService.provideEntityManager(); - PartnersStatisticsBuilder.get(TestingSession.getSelectedTestingSession()).addPartners(entityManager, partners, + PartnersStatisticsBuilder.get(testingSessionService.getCurrentTestingSession()).addPartners(entityManager, partners, systemActorProfile, Collections.singletonList(testRoles)); } @@ -559,7 +563,7 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc if (LOG.isDebugEnabled()) { LOG.debug("getActivatedTestingSession"); } - activatedTestingSession = TestingSession.getSelectedTestingSession(); + activatedTestingSession = testingSessionService.getCurrentTestingSession(); return activatedTestingSession; } @@ -1067,7 +1071,7 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc if (LOG.isDebugEnabled()) { LOG.debug("deleteAllConnectathonTestInstanceForActivatedTestingSession"); } - deleteAllConnectathonTestInstanceByTestingSession(TestingSession.getSelectedTestingSession()); + deleteAllConnectathonTestInstanceByTestingSession(testingSessionService.getCurrentTestingSession()); } @Override @@ -1595,16 +1599,17 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc List<TestInstance> testInstanceList = null; if (inStatus != null) { - List<TestType> testTypes = TestingSession.getSelectedTestingSession().getTestTypes(); + TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + List<TestType> testTypes = selectedTestingSession.getTestTypes(); if ((selectedInstitution == null) && (selectedSystemInSession == null) && (selectedIntegrationProfile == null) && (selectedActor == null) && (selectedMonitor == null) && (selectedTest == null)) { testInstanceList = TestInstance.getTestInstancesFiltered(null, inStatus, null, null, null, null, null, - null, testTypes, TestingSession.getSelectedTestingSession(), null); + null, testTypes, selectedTestingSession, null); } else { testInstanceList = TestInstance.getTestInstancesFiltered(selectedMonitor, inStatus, selectedInstitution, selectedSystemInSession, null, selectedIntegrationProfile, selectedActor, - null, testTypes, TestingSession.getSelectedTestingSession(), selectedTest); + null, testTypes, selectedTestingSession, selectedTest); } } -- GitLab From 72c8aaeebc2802f65a0f2195bc049f8fb00c63e4 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 23 Aug 2024 15:40:50 +0200 Subject: [PATCH 38/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../StatisticsForPreparationPhaseDao.java | 122 +++++++++++++++--- ...tisticsForPreparationPhaseServiceImpl.java | 26 ++-- .../StatisticsForPreparationPhaseDaoImpl.java | 61 +++++---- 3 files changed, 146 insertions(+), 63 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/StatisticsForPreparationPhaseDao.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/StatisticsForPreparationPhaseDao.java index efcf520f1..f221271c1 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/StatisticsForPreparationPhaseDao.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/StatisticsForPreparationPhaseDao.java @@ -1,35 +1,115 @@ package net.ihe.gazelle.tm.statistics.preparation; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; +import net.ihe.gazelle.tm.systems.model.TestingSession; import java.util.List; +/** + * The DAO interface preparation phase statistics. + */ public interface StatisticsForPreparationPhaseDao { - int getNumberOfActivatedMonitorInSession(); - + /** + * Gets number of activated monitor in session. + * + * @param selectedTestingSession the selected testing session + * @return the number of activated monitor in session + */ + int getNumberOfActivatedMonitorInSession(TestingSession selectedTestingSession); + + /** + * Gets number of accepted system in session. + * + * @return the number of accepted system in session + */ int getNumberOfAcceptedSystemInSession(); + /** + * Gets number of not accepted system in session. + * + * @return the number of not accepted system in session + */ int getNumberOfNotAcceptedSystemInSession(); - int getNumberOfAcceptedSupportiveRequest(); - - int getNumberOfNotYetAcceptedSupportiveRequest(); - - int getNumberOfSUTNetworkConfiguration(); - - int getNumberOfSUTNetworkConfigurationAccepted(); - - int getNumberOfSUTNetworkConfigurationNotAccepted(); - - int getNumberOfGeneratedHosts(); - - int getNumberOfGeneratedHostsWithIP(); - - int getNumberOfGeneratedHostsWithoutIP(); - - int getNumberOfPreparatoryTests(); - - List<TestInstance> getAllPreparatoryTestInstances(); + /** + * Gets number of accepted supportive request. + * + * @param selectedTestingSession the selected testing session + * @return the number of accepted supportive request + */ + int getNumberOfAcceptedSupportiveRequest(TestingSession selectedTestingSession); + + /** + * Gets number of not yet accepted supportive request. + * + * @param selectedTestingSession the selected testing session + * @return the number of not yet accepted supportive request + */ + int getNumberOfNotYetAcceptedSupportiveRequest(TestingSession selectedTestingSession); + + /** + * Gets number of sut network configuration. + * + * @param selectedTestingSession the selected testing session + * @return the number of sut network configuration + */ + int getNumberOfSUTNetworkConfiguration(TestingSession selectedTestingSession); + + /** + * Gets number of sut network configuration accepted. + * + * @param selectedTestingSession the selected testing session + * @return the number of sut network configuration accepted + */ + int getNumberOfSUTNetworkConfigurationAccepted(TestingSession selectedTestingSession); + + /** + * Gets number of sut network configuration not accepted. + * + * @param selectedTestingSession the selected testing session + * @return the number of sut network configuration not accepted + */ + int getNumberOfSUTNetworkConfigurationNotAccepted(TestingSession selectedTestingSession); + + /** + * Gets number of generated hosts. + * + * @param selectedTestingSession the selected testing session + * @return the number of generated hosts + */ + int getNumberOfGeneratedHosts(TestingSession selectedTestingSession); + + /** + * Gets number of generated hosts with ip. + * + * @param selectedTestingSession the selected testing session + * @return the number of generated hosts with ip + */ + int getNumberOfGeneratedHostsWithIP(TestingSession selectedTestingSession); + + /** + * Gets number of generated hosts without ip. + * + * @param selectedTestingSession the selected testing session + * @return the number of generated hosts without ip + */ + int getNumberOfGeneratedHostsWithoutIP(TestingSession selectedTestingSession); + + /** + * Gets number of preparatory tests. + * + * @param selectedTestingSession the selected testing session + * @return the number of preparatory tests + */ + int getNumberOfPreparatoryTests(TestingSession selectedTestingSession); + + /** + * Gets all preparatory test instances. + * + * @param selectedTestingSession the selected testing session + * @return the all preparatory test instances + */ + List<TestInstance> getAllPreparatoryTestInstances(TestingSession selectedTestingSession); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/StatisticsForPreparationPhaseServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/StatisticsForPreparationPhaseServiceImpl.java index 49e908b45..a91f4df1b 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/StatisticsForPreparationPhaseServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/StatisticsForPreparationPhaseServiceImpl.java @@ -1,6 +1,7 @@ package net.ihe.gazelle.tm.statistics.preparation; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.statistics.common.StatisticsCommonService; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.AutoCreate; @@ -21,6 +22,9 @@ public class StatisticsForPreparationPhaseServiceImpl implements StatisticsForPr @In(value = "statisticsForPreparationPhaseDao") StatisticsForPreparationPhaseDao statisticsForPreparationPhaseDao; + @In(value = "testingSessionService") + private TestingSessionService testingSessionService; + @Override public int getNumberOfSessionParticipants() { return statisticsCommonService.getNumberOfSessionParticipants(); @@ -43,7 +47,7 @@ public class StatisticsForPreparationPhaseServiceImpl implements StatisticsForPr @Override public int getNumberOfActivatedMonitorInSession() { - return statisticsForPreparationPhaseDao.getNumberOfActivatedMonitorInSession(); + return statisticsForPreparationPhaseDao.getNumberOfActivatedMonitorInSession(testingSessionService.getCurrentTestingSession()); } @Override @@ -58,52 +62,52 @@ public class StatisticsForPreparationPhaseServiceImpl implements StatisticsForPr @Override public int getNumberOfAcceptedSupportiveRequest() { - return statisticsForPreparationPhaseDao.getNumberOfAcceptedSupportiveRequest(); + return statisticsForPreparationPhaseDao.getNumberOfAcceptedSupportiveRequest(testingSessionService.getCurrentTestingSession()); } @Override public int getNumberOfNotYetAcceptedSupportiveRequest() { - return statisticsForPreparationPhaseDao.getNumberOfNotYetAcceptedSupportiveRequest(); + return statisticsForPreparationPhaseDao.getNumberOfNotYetAcceptedSupportiveRequest(testingSessionService.getCurrentTestingSession()); } @Override public int getNumberOfSUTNetworkConfiguration() { - return statisticsForPreparationPhaseDao.getNumberOfSUTNetworkConfiguration(); + return statisticsForPreparationPhaseDao.getNumberOfSUTNetworkConfiguration(testingSessionService.getCurrentTestingSession()); } @Override public int getNumberOfSUTNetworkConfigurationAccepted() { - return statisticsForPreparationPhaseDao.getNumberOfSUTNetworkConfigurationAccepted(); + return statisticsForPreparationPhaseDao.getNumberOfSUTNetworkConfigurationAccepted(testingSessionService.getCurrentTestingSession()); } @Override public int getNumberOfSUTNetworkConfigurationNotAccepted() { - return statisticsForPreparationPhaseDao.getNumberOfSUTNetworkConfigurationNotAccepted(); + return statisticsForPreparationPhaseDao.getNumberOfSUTNetworkConfigurationNotAccepted(testingSessionService.getCurrentTestingSession()); } @Override public int getNumberOfGeneratedHosts() { - return statisticsForPreparationPhaseDao.getNumberOfGeneratedHosts(); + return statisticsForPreparationPhaseDao.getNumberOfGeneratedHosts(testingSessionService.getCurrentTestingSession()); } @Override public int getNumberOfGeneratedHostsWithIP() { - return statisticsForPreparationPhaseDao.getNumberOfGeneratedHostsWithIP(); + return statisticsForPreparationPhaseDao.getNumberOfGeneratedHostsWithIP(testingSessionService.getCurrentTestingSession()); } @Override public int getNumberOfGeneratedHostsWithoutIP() { - return statisticsForPreparationPhaseDao.getNumberOfGeneratedHostsWithoutIP(); + return statisticsForPreparationPhaseDao.getNumberOfGeneratedHostsWithoutIP(testingSessionService.getCurrentTestingSession()); } @Override public int getNumberOfPreparatoryTests() { - return statisticsForPreparationPhaseDao.getNumberOfPreparatoryTests(); + return statisticsForPreparationPhaseDao.getNumberOfPreparatoryTests(testingSessionService.getCurrentTestingSession()); } @Override public StatisticsCommonService.TestInstanceStats getPreparatoryTestStatistics() { - List<TestInstance> testInstances = statisticsForPreparationPhaseDao.getAllPreparatoryTestInstances(); + List<TestInstance> testInstances = statisticsForPreparationPhaseDao.getAllPreparatoryTestInstances(testingSessionService.getCurrentTestingSession()); return statisticsCommonService.getStatisticsForTestInstances(testInstances); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/dao/StatisticsForPreparationPhaseDaoImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/dao/StatisticsForPreparationPhaseDaoImpl.java index a97d9f35b..b55d25bfe 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/dao/StatisticsForPreparationPhaseDaoImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/dao/StatisticsForPreparationPhaseDaoImpl.java @@ -8,7 +8,6 @@ import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstanceParticipantsQuery; import net.ihe.gazelle.tm.statistics.common.StatisticsCommonService; import net.ihe.gazelle.tm.statistics.preparation.StatisticsForPreparationPhaseDao; -import net.ihe.gazelle.tm.systems.action.TestingSessionManager; import net.ihe.gazelle.tm.systems.model.SystemActorProfilesQuery; import net.ihe.gazelle.tm.systems.model.SystemInSessionQuery; import net.ihe.gazelle.tm.systems.model.SystemInSessionRegistrationStatus; @@ -30,10 +29,10 @@ public class StatisticsForPreparationPhaseDaoImpl implements StatisticsForPrepar StatisticsCommonService statisticsCommonService; @Override - public int getNumberOfActivatedMonitorInSession() { + public int getNumberOfActivatedMonitorInSession(TestingSession selectedTestingSession) { MonitorInSessionQuery monitorInSessionQuery = new MonitorInSessionQuery(); monitorInSessionQuery.isActivated().eq(true); - monitorInSessionQuery.testingSession().id().eq(TestingSession.getSelectedTestingSession().getId()); + monitorInSessionQuery.testingSession().id().eq(selectedTestingSession.getId()); return monitorInSessionQuery.getCountDistinctOnPath(); } @@ -54,95 +53,95 @@ public class StatisticsForPreparationPhaseDaoImpl implements StatisticsForPrepar } @Override - public int getNumberOfAcceptedSupportiveRequest() { - SystemActorProfilesQuery systemActorProfilesQuery = getSystemActorProfilesQuery(); + public int getNumberOfAcceptedSupportiveRequest(TestingSession selectedTestingSession) { + SystemActorProfilesQuery systemActorProfilesQuery = getSystemActorProfilesQuery(selectedTestingSession); systemActorProfilesQuery.testingDepthReviewed().eq(true); return systemActorProfilesQuery.getCountDistinctOnPath(); } @Override - public int getNumberOfNotYetAcceptedSupportiveRequest() { - SystemActorProfilesQuery systemActorProfilesQuery = getSystemActorProfilesQuery(); + public int getNumberOfNotYetAcceptedSupportiveRequest(TestingSession selectedTestingSession) { + SystemActorProfilesQuery systemActorProfilesQuery = getSystemActorProfilesQuery(selectedTestingSession); systemActorProfilesQuery.testingDepthReviewed().eq(false); return systemActorProfilesQuery.getCountDistinctOnPath(); } @Override - public int getNumberOfSUTNetworkConfiguration() { - ConfigurationQuery configurationQuery = getConfigurationQuery(); + public int getNumberOfSUTNetworkConfiguration(TestingSession selectedTestingSession) { + ConfigurationQuery configurationQuery = getConfigurationQuery(selectedTestingSession); return configurationQuery.getCountDistinctOnPath(); } @Override - public int getNumberOfSUTNetworkConfigurationAccepted() { - ConfigurationQuery configurationQuery = getConfigurationQuery(); + public int getNumberOfSUTNetworkConfigurationAccepted(TestingSession selectedTestingSession) { + ConfigurationQuery configurationQuery = getConfigurationQuery(selectedTestingSession); configurationQuery.isApproved().eq(true); return configurationQuery.getCountDistinctOnPath(); } @Override - public int getNumberOfSUTNetworkConfigurationNotAccepted() { - ConfigurationQuery configurationQuery = getConfigurationQuery(); + public int getNumberOfSUTNetworkConfigurationNotAccepted(TestingSession selectedTestingSession) { + ConfigurationQuery configurationQuery = getConfigurationQuery(selectedTestingSession); configurationQuery.isApproved().eq(false); return configurationQuery.getCountDistinctOnPath(); } @Override - public int getNumberOfGeneratedHosts() { - HostQuery hostQuery = getHostQuery(); + public int getNumberOfGeneratedHosts(TestingSession selectedTestingSession) { + HostQuery hostQuery = getHostQuery(selectedTestingSession); return hostQuery.getCountDistinctOnPath(); } @Override - public int getNumberOfGeneratedHostsWithIP() { - HostQuery hostQuery = getHostQuery(); + public int getNumberOfGeneratedHostsWithIP(TestingSession selectedTestingSession) { + HostQuery hostQuery = getHostQuery(selectedTestingSession); hostQuery.ip().isNotNull(); return hostQuery.getCount(); } @Override - public int getNumberOfGeneratedHostsWithoutIP() { - HostQuery hostQuery = getHostQuery(); + public int getNumberOfGeneratedHostsWithoutIP(TestingSession selectedTestingSession) { + HostQuery hostQuery = getHostQuery(selectedTestingSession); hostQuery.ip().isNull(); return hostQuery.getCount(); } @Override - public int getNumberOfPreparatoryTests() { - TestInstanceParticipantsQuery testInstanceParticipantsQuery = getPreparatoryTestInstanceParticipantsQuery(); + public int getNumberOfPreparatoryTests(TestingSession selectedTestingSession) { + TestInstanceParticipantsQuery testInstanceParticipantsQuery = getPreparatoryTestInstanceParticipantsQuery(selectedTestingSession); return testInstanceParticipantsQuery.testInstance().getCountDistinctOnPath(); } @Override - public List<TestInstance> getAllPreparatoryTestInstances() { - TestInstanceParticipantsQuery testInstanceParticipantsQuery = getPreparatoryTestInstanceParticipantsQuery(); + public List<TestInstance> getAllPreparatoryTestInstances(TestingSession selectedTestingSession) { + TestInstanceParticipantsQuery testInstanceParticipantsQuery = getPreparatoryTestInstanceParticipantsQuery(selectedTestingSession); return testInstanceParticipantsQuery.testInstance().getListDistinct(); } - private TestInstanceParticipantsQuery getPreparatoryTestInstanceParticipantsQuery() { + private TestInstanceParticipantsQuery getPreparatoryTestInstanceParticipantsQuery(TestingSession selectedTestingSession) { TestInstanceParticipantsQuery testInstanceParticipantsQuery = new TestInstanceParticipantsQuery(); - testInstanceParticipantsQuery.testInstance().testingSession().eq(TestingSession.getSelectedTestingSession()); + testInstanceParticipantsQuery.testInstance().testingSession().eq(selectedTestingSession); testInstanceParticipantsQuery.systemInSessionUser().systemInSession().system().isTool().eq(false); testInstanceParticipantsQuery.testInstance().lastStatus().neq(Status.ABORTED); testInstanceParticipantsQuery.testInstance().test().testType().keyword().eq("preparatory"); return testInstanceParticipantsQuery; } - private HostQuery getHostQuery() { + private HostQuery getHostQuery(TestingSession selectedTestingSession) { HostQuery hostQuery = new HostQuery(); - hostQuery.testingSession().id().eq(TestingSession.getSelectedTestingSession().getId()); + hostQuery.testingSession().id().eq(selectedTestingSession.getId()); return hostQuery; } - private ConfigurationQuery getConfigurationQuery() { + private ConfigurationQuery getConfigurationQuery(TestingSession selectedTestingSession) { ConfigurationQuery configurationQuery = new ConfigurationQuery(); - configurationQuery.systemInSession().testingSession().id().eq(TestingSession.getSelectedTestingSession().getId()); + configurationQuery.systemInSession().testingSession().id().eq(selectedTestingSession.getId()); configurationQuery.systemInSession().registrationStatus().neq(SystemInSessionRegistrationStatus.DROPPED); return configurationQuery; } - private SystemActorProfilesQuery getSystemActorProfilesQuery() { + private SystemActorProfilesQuery getSystemActorProfilesQuery(TestingSession selectedTestingSession) { SystemActorProfilesQuery systemActorProfilesQuery = new SystemActorProfilesQuery(); - systemActorProfilesQuery.system().systemsInSession().testingSession().id().eq(TestingSession.getSelectedTestingSession().getId()); + systemActorProfilesQuery.system().systemsInSession().testingSession().id().eq(selectedTestingSession.getId()); systemActorProfilesQuery.system().systemsInSession().registrationStatus().neq(SystemInSessionRegistrationStatus.DROPPED); systemActorProfilesQuery.wantedTestingDepth().keyword().eq("S"); systemActorProfilesQuery.testingDepth().keyword().eq("S"); -- GitLab From b6d4c25eb4074a80f419a25a0f34d6bcb58bbf85 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 23 Aug 2024 16:23:19 +0200 Subject: [PATCH 39/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../testing/StatisticsForTestingPhaseDao.java | 62 ++++++++++++++++++- .../StatisticsForTestingPhaseServiceImpl.java | 10 ++- .../dao/StatisticsForTestingPhaseDaoImpl.java | 4 +- 3 files changed, 70 insertions(+), 6 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/StatisticsForTestingPhaseDao.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/StatisticsForTestingPhaseDao.java index 9889115dc..a4a768ae8 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/StatisticsForTestingPhaseDao.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/StatisticsForTestingPhaseDao.java @@ -3,28 +3,88 @@ package net.ihe.gazelle.tm.statistics.testing; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; import net.ihe.gazelle.tm.systems.model.SystemInSession; +import net.ihe.gazelle.tm.systems.model.TestingSession; import java.util.List; +/** + * The DAO interface for testing phase statistics. + */ public interface StatisticsForTestingPhaseDao { - List<SystemInSession> getSystemsForCurrentUser(); + /** + * Gets systems for current user. + * + * @param selectedTestingSession the selected testing session + * @return the systems for current user + */ + List<SystemInSession> getSystemsForCurrentUser(TestingSession selectedTestingSession); + + /** + * Gets test instances for a system. + * + * @param system the system + * @return the test instances for a system + */ List<TestInstance> getTestInstancesForASystem(SystemInSession system); + /** + * Gets all test instances for current session. + * + * @return the all test instances for current session + */ List<TestInstance> getAllTestInstancesForCurrentSession(); + /** + * Gets test instances with verification pending. + * + * @return the test instances with verification pending + */ List<TestInstance> getTestInstancesWithVerificationPending(); + /** + * Gets leftover test instances. + * + * @return the leftover test instances + */ List<TestInstance> getLeftOverTestInstances(); + /** + * Gets test instances for monitor in session. + * + * @param monitor the monitor + * @return the test instances for monitor in session + */ List<TestInstance> getTestInstancesForMonitorInSession(MonitorInSession monitor); + /** + * Gets number of total test instance for a system in session. + * + * @param system the system + * @return the number of total test instance for a system in session + */ int getNumberOfTotalTestInstanceForASystemInSession(SystemInSession system); + /** + * Gets number of total test instances for monitor in session. + * + * @param monitor the monitor + * @return the number of total test instances for monitor in session + */ int getNumberOfTotalTestInstancesForMonitorInSession(MonitorInSession monitor); + /** + * Gets number of total test instances. + * + * @return the number of total test instances + */ int getNumberOfTotalTestInstances(); + /** + * Gets number of verification pending test instances. + * + * @return the number of verification pending test instances + */ int getNumberOfVerificationPendingTestInstances(); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/StatisticsForTestingPhaseServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/StatisticsForTestingPhaseServiceImpl.java index cb051efcf..b17d9768d 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/StatisticsForTestingPhaseServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/StatisticsForTestingPhaseServiceImpl.java @@ -3,6 +3,7 @@ package net.ihe.gazelle.tm.statistics.testing; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; import net.ihe.gazelle.tm.gazelletest.model.instance.Status; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.statistics.common.StatisticsCommonService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import org.jboss.seam.ScopeType; @@ -26,9 +27,12 @@ public class StatisticsForTestingPhaseServiceImpl implements StatisticsForTestin @In(value = "statisticsCommonService") private StatisticsCommonService statisticsCommonService; + @In(value = "testingSessionService") + private TestingSessionService testingSessionService; + @Override public List<SystemInSession> getSystemsForCurrentUser() { - return statisticsForTestingPhaseDao.getSystemsForCurrentUser(); + return statisticsForTestingPhaseDao.getSystemsForCurrentUser(testingSessionService.getCurrentTestingSession()); } @Override @@ -74,13 +78,13 @@ public class StatisticsForTestingPhaseServiceImpl implements StatisticsForTestin @Override public int getNumberOfLeftOverTestInstances() { List<TestInstance> testInstances = getLeftOverTestInstances(); - int nbLeftOver=0; + int nbLeftOver = 0; if (!testInstances.isEmpty()) { Date currentDate = new Date(); for (TestInstance testInstance : testInstances) { long elapsedTimeMillis = currentDate.getTime() - testInstance.getLastChanged().getTime(); long elapsedTimeHours = TimeUnit.HOURS.convert(elapsedTimeMillis, TimeUnit.MILLISECONDS); - if (elapsedTimeHours > 24){ + if (elapsedTimeHours > 24) { nbLeftOver++; } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/dao/StatisticsForTestingPhaseDaoImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/dao/StatisticsForTestingPhaseDaoImpl.java index 15d291d51..48591e7d3 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/dao/StatisticsForTestingPhaseDaoImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/dao/StatisticsForTestingPhaseDaoImpl.java @@ -28,11 +28,11 @@ public class StatisticsForTestingPhaseDaoImpl implements StatisticsForTestingPha StatisticsCommonService statisticsCommonService; @Override - public List<SystemInSession> getSystemsForCurrentUser() { + public List<SystemInSession> getSystemsForCurrentUser(TestingSession selectedTestingSession) { SystemInSessionQuery systemInSessionQuery = new SystemInSessionQuery(); systemInSessionQuery.acceptedToSession().eq(true); systemInSessionQuery.system().isTool().eq(false); - systemInSessionQuery.testingSession().eq(TestingSession.getSelectedTestingSession()); + systemInSessionQuery.testingSession().eq(selectedTestingSession); systemInSessionQuery.system().institutionSystems().institution().eq(Institution.getLoggedInInstitution()); return systemInSessionQuery.getListDistinct(); -- GitLab From 691ddbcbd215c800a0a86e05a2b7701d704bf726 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 23 Aug 2024 16:33:26 +0200 Subject: [PATCH 40/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../gui/StatisticsForTestingPhaseBeanGui.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/gui/StatisticsForTestingPhaseBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/gui/StatisticsForTestingPhaseBeanGui.java index c6d41ae2f..15196a590 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/gui/StatisticsForTestingPhaseBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/gui/StatisticsForTestingPhaseBeanGui.java @@ -7,6 +7,7 @@ import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.ssov7.gum.client.application.Role; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.statistics.common.StatisticsCommonService; import net.ihe.gazelle.tm.statistics.testing.StatisticsForTestingPhaseService; import net.ihe.gazelle.tm.systems.model.SystemInSession; @@ -36,6 +37,8 @@ public class StatisticsForTestingPhaseBeanGui implements Serializable { public static final String COLOR_ORANGE_STRING = "\"orange\""; public static final String COLOR_GREY_STRING = "\"#C1C1C1\""; public static final String COLOR_GREEN_STRING = "\"#5cb85c\""; + private static final long serialVersionUID = -6291798638543602085L; + @In(value = "statisticsForTestingPhaseService") private StatisticsForTestingPhaseService statisticsForTestingPhaseService; @@ -45,6 +48,9 @@ public class StatisticsForTestingPhaseBeanGui implements Serializable { @In(value = "gumUserService") private UserService userService; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + public List<Integer> getTestRunsStatisticsForASystem(SystemInSession system) { List<TestInstance> testInstances = statisticsForTestingPhaseService.getTestInstancesForASystem(system); StatisticsCommonService.TestInstanceStats testInstanceStats = @@ -102,7 +108,7 @@ public class StatisticsForTestingPhaseBeanGui implements Serializable { public List<Integer> getStatisticsForAllTestInstancesOfCurrentMonitor() { List<TestInstance> testInstances = statisticsForTestingPhaseService.getTestInstancesForMonitorInSession( MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser( - TestingSession.getSelectedTestingSession(), identity.getUsername())); + testingSessionService.getCurrentTestingSession(), identity.getUsername())); StatisticsCommonService.TestInstanceStats testInstanceStats = statisticsForTestingPhaseService.getStatisticsForTestInstances( @@ -133,7 +139,7 @@ public class StatisticsForTestingPhaseBeanGui implements Serializable { return statisticsForTestingPhaseService.getNumberOfTotalTestInstancesForMonitorInSession( MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser( - TestingSession.getSelectedTestingSession(), + testingSessionService.getCurrentTestingSession(), identity.getUsername())); } @@ -158,7 +164,7 @@ public class StatisticsForTestingPhaseBeanGui implements Serializable { public boolean isMonitorOfCurrentSession() { return Identity.instance().hasRole(Role.MONITOR) && (MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser( - TestingSession.getSelectedTestingSession(), identity.getUsername()) != null); + testingSessionService.getCurrentTestingSession(), identity.getUsername()) != null); } @@ -176,15 +182,16 @@ public class StatisticsForTestingPhaseBeanGui implements Serializable { } public String getWorklistFilteredForMonitor() { - return Pages.CAT_MONITOR_WORKLIST.getMenuLink() + "?testingSession=" + TestingSession.getSelectedTestingSession() + TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + return Pages.CAT_MONITOR_WORKLIST.getMenuLink() + "?testingSession=" + selectedTestingSession .getId() + "&monitor=" + MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser( - TestingSession.getSelectedTestingSession(), identity.getUsername()).getId(); + selectedTestingSession, identity.getUsername()).getId(); } public String getAllTestRunsLinkFilteredForMonitor() { String userId = userService.getUserById(identity.getUsername()).getId(); - return Pages.CAT_INSTANCES.getMenuLink() + "?testingSession=" + TestingSession.getSelectedTestingSession().getId() + return Pages.CAT_INSTANCES.getMenuLink() + "?testingSession=" + testingSessionService.getCurrentTestingSession().getId() + "&monitorInSession=" + userId; } -- GitLab From d8bb64497018bb6af0a5bd867ecce42a4af2b024 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 23 Aug 2024 16:43:00 +0200 Subject: [PATCH 41/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../gui/StatisticsForPreparationPhaseBeanGui.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/gui/StatisticsForPreparationPhaseBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/gui/StatisticsForPreparationPhaseBeanGui.java index 14d1bf6a7..b61f2c024 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/gui/StatisticsForPreparationPhaseBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/gui/StatisticsForPreparationPhaseBeanGui.java @@ -2,9 +2,9 @@ package net.ihe.gazelle.tm.statistics.preparation.gui; import net.ihe.gazelle.menu.Pages; import net.ihe.gazelle.tm.gazelletest.model.definition.TestType; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.statistics.common.StatisticsCommonService; import net.ihe.gazelle.tm.statistics.preparation.StatisticsForPreparationPhaseService; -import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.AutoCreate; import org.jboss.seam.annotations.In; @@ -24,6 +24,9 @@ public class StatisticsForPreparationPhaseBeanGui { @In(value = "statisticsForPreparationPhaseService") StatisticsForPreparationPhaseService statisticsForPreparationPhaseService; + @In(value = "testingSessionService") + private TestingSessionService testingSessionService; + public int getNumberOfSessionParticipants() { return statisticsForPreparationPhaseService.getNumberOfSessionParticipants(); } @@ -183,6 +186,6 @@ public class StatisticsForPreparationPhaseBeanGui { } public boolean isProxyUseEnabled(){ - return TestingSession.getSelectedTestingSession().getIsProxyUseEnabled(); + return testingSessionService.getCurrentTestingSession().getIsProxyUseEnabled(); } } -- GitLab From 03acb9a468dbecc340c69c8cfb85274496974450 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 23 Aug 2024 16:55:03 +0200 Subject: [PATCH 42/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../network/SutNetworkConfigurationDao.java | 37 +++++++++++++++++-- .../SutNetworkConfigurationService.java | 18 +++++++++ .../SutNetworkConfigurationServiceImpl.java | 11 ++++-- .../SutNetworkConfigurationSummary.java | 13 ++++++- .../dao/SutNetworkConfigurationDaoImpl.java | 12 +++--- .../gui/SutNetworkConfigurationBeanGui.java | 3 +- 6 files changed, 79 insertions(+), 15 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationDao.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationDao.java index 220fc2069..b205191ae 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationDao.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationDao.java @@ -1,17 +1,48 @@ package net.ihe.gazelle.tm.preparation.network; import net.ihe.gazelle.tm.systems.model.SystemInSession; +import net.ihe.gazelle.tm.systems.model.TestingSession; import java.util.List; public interface SutNetworkConfigurationDao { + /** + * Gets number of network configurations approved for a system id. + * + * @param systemInSessionId the system in session id + * @return the number of network configurations approved for a system id + */ int getNumberOfNetworkConfigurationsApprovedForASystemId(int systemInSessionId); + /** + * Gets number of network configurations not approved for a system id. + * + * @param systemInSessionId the system in session id + * @return the number of network configurations not approved for a system id + */ int getNumberOfNetworkConfigurationsNotApprovedForASystemId(int systemInSessionId); - int getNumberOfNetworkConfigurationsHosts(); + /** + * Gets number of network configurations hosts. + * + * @param selectedTestingSession the selected testing session + * @return the number of network configurations hosts + */ + int getNumberOfNetworkConfigurationsHosts(TestingSession selectedTestingSession); - int getNumberOfNetworkConfigurationsHostsNoIp(); + /** + * Gets number of network configurations hosts no ip. + * + * @param selectedTestingSession the selected testing session + * @return the number of network configurations hosts no ip + */ + int getNumberOfNetworkConfigurationsHostsNoIp(TestingSession selectedTestingSession); - List<SystemInSession> getListSystemInSessionOfCurrenUser(); + /** + * Gets list system in session of curren user. + * + * @param selectedTestingSession the selected testing session + * @return the list system in session of curren user + */ + List<SystemInSession> getListSystemInSessionOfCurrenUser(TestingSession selectedTestingSession); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationService.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationService.java index b0e31d354..0d2d85de0 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationService.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationService.java @@ -3,8 +3,26 @@ package net.ihe.gazelle.tm.preparation.network; import java.util.List; public interface SutNetworkConfigurationService { + + /** + * Gets sut network configuration summaries. + * @see SutNetworkConfigurationSummary + * @return the sut network configuration summaries + */ List<SutNetworkConfigurationSummary> getSutNetworkConfigurationSummaries(); + + /** + * Gets number of network configurations hosts. + * + * @return the number of network configurations hosts + */ int getNumberOfNetworkConfigurationsHosts(); + + /** + * Gets number of network configurations hosts no ip. + * + * @return the number of network configurations hosts no ip + */ int getNumberOfNetworkConfigurationsHostsNoIp(); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationServiceImpl.java index 6f7e143fc..838519ef0 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationServiceImpl.java @@ -1,5 +1,6 @@ package net.ihe.gazelle.tm.preparation.network; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.AutoCreate; @@ -18,10 +19,13 @@ public class SutNetworkConfigurationServiceImpl implements SutNetworkConfigurati @In(value = "sutNetworkConfigurationDao") private SutNetworkConfigurationDao sutNetworkConfigurationDao; + @In(value = "testingSessionService") + private TestingSessionService testingSessionService; + @Override public List<SutNetworkConfigurationSummary> getSutNetworkConfigurationSummaries() { List<SutNetworkConfigurationSummary> networkConfigurationSummaries = new ArrayList<>(); - for (SystemInSession system : sutNetworkConfigurationDao.getListSystemInSessionOfCurrenUser()) { + for (SystemInSession system : sutNetworkConfigurationDao.getListSystemInSessionOfCurrenUser(testingSessionService.getCurrentTestingSession())) { networkConfigurationSummaries.add(constructSutNetworkConfigurationSummary(system)); } return networkConfigurationSummaries; @@ -29,18 +33,19 @@ public class SutNetworkConfigurationServiceImpl implements SutNetworkConfigurati @Override public int getNumberOfNetworkConfigurationsHosts() { - return sutNetworkConfigurationDao.getNumberOfNetworkConfigurationsHosts(); + return sutNetworkConfigurationDao.getNumberOfNetworkConfigurationsHosts(testingSessionService.getCurrentTestingSession()); } @Override public int getNumberOfNetworkConfigurationsHostsNoIp() { - return sutNetworkConfigurationDao.getNumberOfNetworkConfigurationsHostsNoIp(); + return sutNetworkConfigurationDao.getNumberOfNetworkConfigurationsHostsNoIp(testingSessionService.getCurrentTestingSession()); } private SutNetworkConfigurationSummary constructSutNetworkConfigurationSummary(SystemInSession systemInSession) { SutNetworkConfigurationSummary sutNetworkConfigurationSummary = new SutNetworkConfigurationSummary(); sutNetworkConfigurationSummary.setSutName(systemInSession.getSystem().getKeyword()); + sutNetworkConfigurationSummary.setTestingSessionId(systemInSession.getTestingSession().getId()); Integer systemInSessionId = systemInSession.getId(); sutNetworkConfigurationSummary.setSystemId(systemInSessionId); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationSummary.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationSummary.java index 47ffeca25..cb15171be 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationSummary.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationSummary.java @@ -1,7 +1,6 @@ package net.ihe.gazelle.tm.preparation.network; import net.ihe.gazelle.menu.Pages; -import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.users.model.Institution; public class SutNetworkConfigurationSummary { @@ -10,6 +9,7 @@ public class SutNetworkConfigurationSummary { private int numberApproved; private int numberNotApproved; private int systemId; + private int testingSessionId; public String getSutName() { return sutName; @@ -43,7 +43,16 @@ public class SutNetworkConfigurationSummary { this.systemId = systemId; } + public int getTestingSessionId() { + return testingSessionId; + } + + public void setTestingSessionId(int testingSessionId) { + this.testingSessionId = testingSessionId; + } + public String getNetworkInterfaceLink() { - return Pages.CONFIG_ALL.getMenuLink() + "?" + "system=" + systemId + "&testSession=" + TestingSession.getSelectedTestingSession().getId() + "&institution=" + Institution.getLoggedInInstitution().getId(); + return Pages.CONFIG_ALL.getMenuLink() + "?" + "system=" + systemId + "&testSession=" + testingSessionId + + "&institution=" + Institution.getLoggedInInstitution().getId(); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/dao/SutNetworkConfigurationDaoImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/dao/SutNetworkConfigurationDaoImpl.java index 6a88c3131..3a4eec29c 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/dao/SutNetworkConfigurationDaoImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/dao/SutNetworkConfigurationDaoImpl.java @@ -36,28 +36,28 @@ public class SutNetworkConfigurationDaoImpl implements SutNetworkConfigurationDa } @Override - public int getNumberOfNetworkConfigurationsHosts() { + public int getNumberOfNetworkConfigurationsHosts(TestingSession selectedTestingSession) { HostQuery hostQuery = new HostQuery(); - hostQuery.testingSession().eq(TestingSession.getSelectedTestingSession()); + hostQuery.testingSession().eq(selectedTestingSession); hostQuery.institution().eq(Institution.getLoggedInInstitution()); return hostQuery.getCount(); } @Override - public int getNumberOfNetworkConfigurationsHostsNoIp() { + public int getNumberOfNetworkConfigurationsHostsNoIp(TestingSession selectedTestingSession) { HostQuery hostQuery = new HostQuery(); - hostQuery.testingSession().eq(TestingSession.getSelectedTestingSession()); + hostQuery.testingSession().eq(selectedTestingSession); hostQuery.institution().eq(Institution.getLoggedInInstitution()); hostQuery.ip().isNull(); return hostQuery.getCount(); } @Override - public List<SystemInSession> getListSystemInSessionOfCurrenUser() { + public List<SystemInSession> getListSystemInSessionOfCurrenUser(TestingSession selectedTestingSession) { SystemInSessionQuery systemInSessionQuery = new SystemInSessionQuery(); systemInSessionQuery.acceptedToSession().eq(true); - systemInSessionQuery.testingSession().eq(TestingSession.getSelectedTestingSession()); + systemInSessionQuery.testingSession().eq(selectedTestingSession); systemInSessionQuery.system().institutionSystems().institution().eq(Institution.getLoggedInInstitution()); return systemInSessionQuery.getList(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/gui/SutNetworkConfigurationBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/gui/SutNetworkConfigurationBeanGui.java index 1f79b2d38..0dd16a45f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/gui/SutNetworkConfigurationBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/gui/SutNetworkConfigurationBeanGui.java @@ -15,8 +15,9 @@ import java.util.List; @Scope(ScopeType.EVENT) public class SutNetworkConfigurationBeanGui implements Serializable { + private static final long serialVersionUID = -1667730152367201347L; @In(value = "sutNetworkConfigurationService") - SutNetworkConfigurationService sutNetworkConfigurationService; + private transient SutNetworkConfigurationService sutNetworkConfigurationService; public List<SutNetworkConfigurationSummary> getSutNetworkConfigurationSummaries() { return sutNetworkConfigurationService.getSutNetworkConfigurationSummaries(); -- GitLab From fd595b8bfcfaa38db6236534ee450f13d8c1a681 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 23 Aug 2024 17:30:41 +0200 Subject: [PATCH 43/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../net/ihe/gazelle/menu/Authorizations.java | 19 +++++++++++-------- .../objects/admin/ObjectTypeManager.java | 13 +++++++++---- .../action/ConnecthatonTestingManager.java | 3 +-- .../action/SimulatorInSessionManager.java | 12 ++++++++---- .../systems/action/SystemInSessionCopier.java | 11 ++++++++--- .../systems/action/SystemInSessionEditor.java | 6 +++++- .../action/SystemInSessionManager.java | 8 ++++++-- 7 files changed, 48 insertions(+), 24 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Authorizations.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Authorizations.java index 865ec4e1f..b697dde0d 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Authorizations.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Authorizations.java @@ -10,6 +10,7 @@ import net.ihe.gazelle.ssov7.gum.client.application.Role; import net.ihe.gazelle.ssov7.gum.client.application.User; import net.ihe.gazelle.tm.application.action.ApplicationManager; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.systems.model.TestingSessionAdmin; import org.jboss.seam.Component; @@ -19,6 +20,8 @@ import java.util.List; public class Authorizations { + private final static TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + public static final Authorization ALL = new Authorization() { @Override public boolean isGranted(Object... context) { @@ -146,7 +149,7 @@ public class Authorizations { public boolean isGranted(Object... context) { return isUserAdminOfTestingSession( GazelleIdentityImpl.instance(), - TestingSession.getSelectedTestingSession() + testingSessionService.getCurrentTestingSession() ); } } @@ -288,7 +291,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_CONTRACT = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); return testingSession != null && testingSession.isContractRequired(); } }; @@ -296,7 +299,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_PRECAT = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); return testingSession != null && testingSession.isEnablePrecatTests(); } }; @@ -307,7 +310,7 @@ public class Authorizations { new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); return testingSession != null && testingSession.getAllowParticipantRegistration(); } } @@ -316,7 +319,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_INTEROPERABILITY = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); return testingSession != null && testingSession.isTestingInteroperability(); } }; @@ -324,7 +327,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_MONITORS = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); return testingSession != null && !testingSession.isSessionWithoutMonitors(); } }; @@ -332,7 +335,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_PATIENTS = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); return testingSession != null && !testingSession.getDisablePatientGenerationAndSharing(); } }; @@ -340,7 +343,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_SAMPLE_SEARCH = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); return testingSession != null && !testingSession.isHideAdvancedSampleSearchToVendors(); } }; diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/admin/ObjectTypeManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/admin/ObjectTypeManager.java index 575e62d44..21d558983 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/admin/ObjectTypeManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/admin/ObjectTypeManager.java @@ -25,10 +25,12 @@ import net.ihe.gazelle.tf.action.TFPersistenceManager; import net.ihe.gazelle.tf.action.converter.SamplesTypeToXmlConverter; import net.ihe.gazelle.tf.model.*; import net.ihe.gazelle.tm.datamodel.ObjectTypeDataModel; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.SystemInSessionRegistrationStatus; import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.ScopeType; +import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.annotations.Synchronized; @@ -119,6 +121,9 @@ public class ObjectTypeManager extends ObjectFileTypeManager implements ObjectTy private ObjectTypeIE objectTypeToImport; private boolean reviewBeforeSaving = true; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + // ~ getter && setter //////////////////////////////////////////////////////////////// /** @@ -1053,7 +1058,7 @@ public class ObjectTypeManager extends ObjectFileTypeManager implements ObjectTy public String getNumberOfObjectInstanceByObjectTypeForCurrentTestingSession(ObjectType objectType) { LOG.debug("getNumberOfObjectInstanceByObjectTypeForCurrentTestingSession"); String result = ""; - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); List<ObjectInstance> listObjectInstance = ObjectInstance.getObjectInstanceFiltered(objectType, null, testingSession); if (listObjectInstance != null) { @@ -1087,7 +1092,7 @@ public class ObjectTypeManager extends ObjectFileTypeManager implements ObjectTy @Override public List<SystemInSession> getListSystemInSessionOfAIPO(ActorIntegrationProfileOption AIPO) { LOG.debug("getListSystemInSessionOfAIPO"); - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); EntityManager em = EntityManagerService.provideEntityManager(); return SystemInSession.getSystemInSessionFiltered(em, null, testingSession, null, null, null, null, null, AIPO, null, null, null, null); @@ -1128,7 +1133,7 @@ public class ObjectTypeManager extends ObjectFileTypeManager implements ObjectTy public String getNumberOfObjectInstanceBySISForSelectedObjectType(SystemInSession SIS) { LOG.debug("getNumberOfObjectInstanceBySISForSelectedObjectType"); String result = ""; - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); List<ObjectInstance> listObjectInstance = ObjectInstance.getObjectInstanceFiltered(selectedObjectType, SIS, testingSession); int nbre = 0; @@ -1479,7 +1484,7 @@ public class ObjectTypeManager extends ObjectFileTypeManager implements ObjectTy public String getNumberOfObjectInstanceToReadBySIS(SystemInSession inSystemInSession) { LOG.debug("getNumberOfObjectInstanceToReadBySIS"); int result = 0; - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); List<ObjectType> list_OT_OnR = this.getListOfObjectTypeForCurrentSessionOnReading(inSystemInSession); List<ObjectInstance> list_OI_tmp; for (ObjectType inObjectType : list_OT_OnR) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java index dfdbc850c..ec54575ed 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java @@ -701,8 +701,7 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc if (LOG.isDebugEnabled()) { LOG.debug("getInstitutionListForActivatedTestingSession"); } - List<Institution> list = TestingSession.getListOfInstitutionsParticipatingInSession(TestingSession - .getSelectedTestingSession()); + List<Institution> list = TestingSession.getListOfInstitutionsParticipatingInSession(testingSessionService.getCurrentTestingSession()); Collections.sort(list); return list; } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SimulatorInSessionManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SimulatorInSessionManager.java index 32a4771dd..bc80d250f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SimulatorInSessionManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SimulatorInSessionManager.java @@ -12,6 +12,7 @@ import net.ihe.gazelle.ssov7.gum.client.interlay.client.utils.UserSearchParams; import net.ihe.gazelle.tf.model.*; import net.ihe.gazelle.tm.gazelletest.model.instance.SystemAIPOResultForATestingSession; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstanceParticipants; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.tm.utils.systems.IHEImplementationForSystem; @@ -64,6 +65,9 @@ public class SimulatorInSessionManager implements SimulatorInSessionManagerLocal @In GazelleIdentity identity; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + // /////////////////////////////////////////// @Override @@ -167,7 +171,7 @@ public class SimulatorInSessionManager implements SimulatorInSessionManagerLocal if (LOG.isDebugEnabled()) { LOG.debug("getAvailableSimulatorInSession"); } - TestingSession tss = TestingSession.getSelectedTestingSession(); + TestingSession tss = testingSessionService.getCurrentTestingSession(); SimulatorInSessionQuery query = new SimulatorInSessionQuery(); query.testingSession().eq(tss); @@ -294,7 +298,7 @@ public class SimulatorInSessionManager implements SimulatorInSessionManagerLocal institutionSystem = new InstitutionSystem(); institutionSystem.setInstitution(Institution.findInstitutionWithKeyword(connectedUser.getOrganizationId())); institutionSystem.setSystem(simulator); - selectedSimulatorInSession = new SimulatorInSession(simulator, TestingSession.getSelectedTestingSession()); + selectedSimulatorInSession = new SimulatorInSession(simulator, testingSessionService.getCurrentTestingSession()); return "/systems/simulators/editSimulator.xhtml"; } @@ -335,7 +339,7 @@ public class SimulatorInSessionManager implements SimulatorInSessionManagerLocal selectedActorIntegrationProfileOption = new ActorIntegrationProfileOption(); selectedActorIntegrationProfileOption.setActorIntegrationProfile(new ActorIntegrationProfile()); } - possibleDomains = getPossibleDomainsDependingOnTestingSession(TestingSession.getSelectedTestingSession()); + possibleDomains = getPossibleDomainsDependingOnTestingSession(testingSessionService.getCurrentTestingSession()); } private List<Domain> getPossibleDomainsDependingOnTestingSession(TestingSession ts) { @@ -367,7 +371,7 @@ public class SimulatorInSessionManager implements SimulatorInSessionManagerLocal selectedDomain = null; resetSelectedOtherItems(); if (possibleDomains == null) { - possibleDomains = getPossibleDomainsDependingOnTestingSession(TestingSession.getSelectedTestingSession()); + possibleDomains = getPossibleDomainsDependingOnTestingSession(testingSessionService.getCurrentTestingSession()); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCopier.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCopier.java index 28de4a5bf..d194ff373 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCopier.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCopier.java @@ -4,6 +4,7 @@ import net.ihe.gazelle.common.interfacegenerator.GenerateInterface; import net.ihe.gazelle.common.log.ExceptionLogging; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.tm.financial.action.FinancialManager; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.users.model.Institution; @@ -43,6 +44,7 @@ public class SystemInSessionCopier extends AbstractSystemInSessionEditor impleme private static final String NEW_KEY = ", newKey="; private static final String KEY_STRING = " + keyString = "; private static final String WITH_ID = " with id="; + private static final long serialVersionUID = -8278555847289987926L; @In private GazelleIdentity identity; @In @@ -51,6 +53,9 @@ public class SystemInSessionCopier extends AbstractSystemInSessionEditor impleme private List<Pair<Boolean, System>> previousSystems; private Institution choosenInstitutionForAdmin; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + @Override public String getSystemInSessionKeywordBase() { return null; @@ -162,7 +167,7 @@ public class SystemInSessionCopier extends AbstractSystemInSessionEditor impleme } private void calculateFinancialSummaryDTO() { - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); this.calculateFinancialSummaryDTOByTestingSession(activatedTestingSession); } @@ -190,7 +195,7 @@ public class SystemInSessionCopier extends AbstractSystemInSessionEditor impleme ExceptionLogging.logException(e, LOG); FacesMessages.instance().add(StatusMessage.Severity.ERROR, "Error persisting the new system, maybe a system keyword " + system.getKeyword() + "_For_" - + TestingSession.getSelectedTestingSession().getName() + " already exists"); + + testingSessionService.getCurrentTestingSession().getName() + " already exists"); } } @@ -269,7 +274,7 @@ public class SystemInSessionCopier extends AbstractSystemInSessionEditor impleme TableSession tableSession = TableSession.getTableSessionByKeyword(TableSession.getDEFAULT_TABLE_SESSION_STRING()); SystemInSessionStatus systemInSessionStatus = SystemInSessionStatus.getSTATUS_NOT_HERE_YET(); SystemInSession newSysInSess = new SystemInSession(tableSession, newSystem, - TestingSession.getSelectedTestingSession(), null, systemInSessionStatus); + testingSessionService.getCurrentTestingSession(), null, systemInSessionStatus); // The copied system status need to be set to IN_PROGRESS newSysInSess.setRegistrationStatus(SystemInSessionRegistrationStatus.IN_PROGRESS); // The copied system is set to true diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditor.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditor.java index 421aa2eb8..296ed2766 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditor.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditor.java @@ -7,6 +7,7 @@ import net.ihe.gazelle.ssov7.gum.client.application.User; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.ssov7.gum.client.interlay.client.utils.UserSearchParams; import net.ihe.gazelle.tm.application.action.ApplicationManager; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.SystemSummary; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; @@ -49,6 +50,9 @@ public class SystemInSessionEditor extends AbstractSystemInSessionEditor impleme @In(value = "gumUserService") private UserService userService; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + private SystemInSessionModifier sisModifier; private SystemSubtypesPerSystemType systemSubtypesPerSystemType; @Pattern(regexp = "(^$)|(?i)(^http://.+$|^https://.+$|^ftp://.+$)", message = "{gazelle.validator.http}") @@ -480,7 +484,7 @@ public class SystemInSessionEditor extends AbstractSystemInSessionEditor impleme @Restrict("#{s:hasPermission('SystemInSessionEditor', 'editSystem', null)}") public void editSystem() { LOG.debug("editSystem"); - if (TestingSession.getSelectedTestingSession() == null) { + if (testingSessionService.getCurrentTestingSession() == null) { LOG.error(NO_ACTIVE_SESSION); StatusMessages.instance().addFromResourceBundle(StatusMessage.Severity.ERROR, "gazelle.systems.error" + ".noActivatedTestingSession"); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionManager.java index 55e5b7fe9..b098e57fb 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionManager.java @@ -18,6 +18,7 @@ package net.ihe.gazelle.tm.systems.action; import net.ihe.gazelle.common.interfacegenerator.GenerateInterface; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.Role; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.SystemSummary; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; @@ -81,6 +82,9 @@ public class SystemInSessionManager implements Serializable, SystemInSessionMana @In private GazelleIdentity identity; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + /** * List of all accepted systems in session, objects to be managed by this manager bean */ @@ -211,7 +215,7 @@ public class SystemInSessionManager implements Serializable, SystemInSessionMana if (LOG.isDebugEnabled()) { LOG.debug("getListOfAcceptedSystemsForActivatedSession"); } - getListOfAcceptedSystemsToSession(TestingSession.getSelectedTestingSession()); + getListOfAcceptedSystemsToSession(testingSessionService.getCurrentTestingSession()); } /** @@ -260,7 +264,7 @@ public class SystemInSessionManager implements Serializable, SystemInSessionMana if (LOG.isDebugEnabled()) { LOG.debug("getListOfNotAcceptedSystemsForActivatedSession"); } - getListOfNotAcceptedSystemsToSession(TestingSession.getSelectedTestingSession()); + getListOfNotAcceptedSystemsToSession(testingSessionService.getCurrentTestingSession()); } /** -- GitLab From 4e02dfaa3930921756223ee1e64d47e05015ec2f Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 26 Aug 2024 10:23:34 +0200 Subject: [PATCH 44/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../dao/SUTReportServiceDAOImpl.java | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/dao/SUTReportServiceDAOImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/dao/SUTReportServiceDAOImpl.java index 559526b3c..9340beb6b 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/dao/SUTReportServiceDAOImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/dao/SUTReportServiceDAOImpl.java @@ -14,9 +14,11 @@ import net.ihe.gazelle.tm.filter.modifier.SystemNotTool; import net.ihe.gazelle.tm.filter.valueprovider.InstitutionFixer; import net.ihe.gazelle.tm.gazelletest.model.definition.*; import net.ihe.gazelle.tm.gazelletest.model.instance.*; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.tm.testexecution.*; +import org.jboss.seam.Component; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.AutoCreate; import org.jboss.seam.annotations.In; @@ -36,6 +38,8 @@ public class SUTReportServiceDAOImpl implements SUTReportServiceDAO, QueryModifi @In private GazelleIdentity identity; + private final transient TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + @Override public List<TestReport> getTestReports(SUTCapabilityReport sutCapabilityReport) { @@ -65,7 +69,7 @@ public class SUTReportServiceDAOImpl implements SUTReportServiceDAO, QueryModifi } } if (!metatests.isEmpty()) { - for (TestReport metatest: metatests.values()){ + for (TestReport metatest : metatests.values()) { testReports.add(metatest); testReports.addAll(metatest.getEquivalentTestReports()); } @@ -98,17 +102,19 @@ public class SUTReportServiceDAOImpl implements SUTReportServiceDAO, QueryModifi } return new Filter<>(criteria, requestParameterMap); } + @Override public void modifyQuery(HQLQueryBuilder<SystemAIPOResultForATestingSession> hqlQueryBuilder, Map<String, Object> requestParameterMap) { SystemAIPOResultForATestingSessionQuery query = new SystemAIPOResultForATestingSessionQuery(hqlQueryBuilder); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); HQLRestriction enabledRestriction = HQLRestrictions.or(query.enabled().eqRestriction(true), query.enabled().isNullRestriction()); hqlQueryBuilder.addRestriction(query.systemActorProfile().system().systemsInSession().acceptedToSession().eqRestriction(true)); hqlQueryBuilder.addRestriction(query.systemActorProfile().system().systemsInSession().testingSession() - .eqRestriction(TestingSession.getSelectedTestingSession())); + .eqRestriction(testingSession)); hqlQueryBuilder.addRestriction(query.systemActorProfile().aipo().testParticipants().roleInTest() .testRoles().test().testType() - .inRestriction(TestingSession.getSelectedTestingSession().getTestTypes())); + .inRestriction(testingSession.getTestTypes())); hqlQueryBuilder.addRestriction(enabledRestriction); } @@ -169,9 +175,9 @@ public class SUTReportServiceDAOImpl implements SUTReportServiceDAO, QueryModifi List<RoleInTest> roleInTests = getRoleInTestsForTestRoles(testRole); List<PartnerReport> partnerReports = new ArrayList<>(); - for (RoleInTest roleInTest :roleInTests){ - List<ActorIntegrationProfileOption> aipoList =new ArrayList<>(); - for (TestParticipants testParticipants : roleInTest.getTestParticipantsList()){ + for (RoleInTest roleInTest : roleInTests) { + List<ActorIntegrationProfileOption> aipoList = new ArrayList<>(); + for (TestParticipants testParticipants : roleInTest.getTestParticipantsList()) { if (testParticipants.getTested() != null && testParticipants.getTested()) { aipoList.add(testParticipants.getActorIntegrationProfileOption()); } @@ -200,7 +206,7 @@ public class SUTReportServiceDAOImpl implements SUTReportServiceDAO, QueryModifi List<PartnerSystemReport> partnerSystemReports = new ArrayList<>(); - for (System system : availableSystems){ + for (System system : availableSystems) { PartnerSystemReport partnerSystemReport = constructPartnerSystemReport(testedSystems, system); partnerSystemReports.add(partnerSystemReport); } @@ -215,9 +221,9 @@ public class SUTReportServiceDAOImpl implements SUTReportServiceDAO, QueryModifi partnerSystemReport.setSystemKeyword(system.getKeyword()); SystemInSession systemInSession = getSystemInSessionBySystem(system); - if (systemInSession==null || systemInSession.getTableSession()==null){ + if (systemInSession == null || systemInSession.getTableSession() == null) { partnerSystemReport.setTable(""); - }else { + } else { partnerSystemReport.setTable(systemInSession.getTableSession().getTableKeyword()); } partnerSystemReport.setTested(testedSystems.contains(system.getKeyword())); @@ -244,7 +250,7 @@ public class SUTReportServiceDAOImpl implements SUTReportServiceDAO, QueryModifi } private List<System> getAvailableSystems(SystemAIPOResultForATestingSession capability, List<ActorIntegrationProfileOption> aipoList) { - SystemAIPOResultForATestingSessionQuery query=new SystemAIPOResultForATestingSessionQuery(); + SystemAIPOResultForATestingSessionQuery query = new SystemAIPOResultForATestingSessionQuery(); query.testSession().id().eq(capability.getTestSession().getId()); query.systemActorProfile().actorIntegrationProfileOption().in(aipoList); query.systemActorProfile().system().systemsInSession().acceptedToSession().eq(true); @@ -253,7 +259,7 @@ public class SUTReportServiceDAOImpl implements SUTReportServiceDAO, QueryModifi } private List<RoleInTest> getRoleInTestsForTestRoles(TestRoles testRole) { - RoleInTestQuery roleInTestQuery=new RoleInTestQuery(); + RoleInTestQuery roleInTestQuery = new RoleInTestQuery(); roleInTestQuery.testRoles().test().keyword().eq(testRole.getTest().getKeyword()); roleInTestQuery.testRoles().id().neq(testRole.getId()); roleInTestQuery.testRoles().test().testPeerType().neq(TestPeerType.getNO_PEER_TEST()); @@ -278,7 +284,7 @@ public class SUTReportServiceDAOImpl implements SUTReportServiceDAO, QueryModifi System system = systemActorProfile.getSystem(); trQuery.roleInTest().testParticipantsList().tested().eq(Boolean.TRUE); trQuery.test().testStatus().keyword().eq("ready"); - trQuery.test().testType().in(TestingSession.getSelectedTestingSession().getTestTypes()); + trQuery.test().testType().in(testingSessionService.getCurrentTestingSession().getTestTypes()); trQuery.roleInTest().addFetch(); trQuery.roleInTest().testParticipantsList().addFetch(); trQuery.roleInTest().testParticipantsList().actorIntegrationProfileOption().addFetch(); @@ -294,7 +300,7 @@ public class SUTReportServiceDAOImpl implements SUTReportServiceDAO, QueryModifi } @Override - public void updateEvaluation(SystemAIPOResultForATestingSession aipoResult){ + public void updateEvaluation(SystemAIPOResultForATestingSession aipoResult) { EntityManager em = EntityManagerService.provideEntityManager(); em.merge(aipoResult); em.flush(); -- GitLab From 2a10f3a79b8b892296ee7f544a957650d89d880c Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 26 Aug 2024 16:05:28 +0200 Subject: [PATCH 45/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../tm/systems/action/AbstractSystemInSessionBuilder.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionBuilder.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionBuilder.java index 380fd2ecc..9b0fb7d56 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionBuilder.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionBuilder.java @@ -5,9 +5,11 @@ import net.ihe.gazelle.hql.providers.EntityManagerService; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.User; import net.ihe.gazelle.tm.financial.action.FinancialManager; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.users.model.Institution; +import org.jboss.seam.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -22,6 +24,7 @@ import java.util.List; public abstract class AbstractSystemInSessionBuilder implements Serializable { private static final Logger LOG = LoggerFactory.getLogger(AbstractSystemInSessionBuilder.class); + private static final long serialVersionUID = 5893066874565540627L; protected SystemInSession systemInSession = new SystemInSession(); @@ -33,6 +36,8 @@ public abstract class AbstractSystemInSessionBuilder implements Serializable { protected String sysname; protected User sysOwnerUser; + private final transient TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + public AbstractSystemInSessionBuilder() { } @@ -194,7 +199,7 @@ public abstract class AbstractSystemInSessionBuilder implements Serializable { } protected void calculateFinancialSummaryDTO() { - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); FinancialManager.calculateFinancialSummaryDTOByTestingSessionByInstitution(activatedTestingSession, institutionForCreation); } -- GitLab From 5b8cc9acdc4847057013be070d30ce1fa3f99aa8 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 26 Aug 2024 16:16:20 +0200 Subject: [PATCH 46/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../ihe/gazelle/objects/action/SampleDisplayManager.java | 8 +++++++- .../tm/gazelletest/action/SystemInSessionOverview.java | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleDisplayManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleDisplayManager.java index dcfac89cc..bb2a09649 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleDisplayManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleDisplayManager.java @@ -6,6 +6,7 @@ import net.ihe.gazelle.objects.model.ObjectInstance; import net.ihe.gazelle.objects.model.ObjectInstanceFile; import net.ihe.gazelle.ssov7.gum.client.application.UserAttributeCommon; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.users.model.Institution; @@ -26,12 +27,17 @@ import java.util.Map; @Scope(ScopeType.PAGE) @Synchronized(timeout = 10000) public class SampleDisplayManager extends AbstractSampleManager implements Serializable, UserAttributeCommon { + private static final Logger LOG = LoggerFactory.getLogger(SampleDisplayManager.class); + private static final long serialVersionUID = 7061843815991264814L; private Boolean userAllowedToEditSystemFileReaderOfSample = null; @In(value = "gumUserService") private transient UserService userService; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + @Create public void initialize() { if (LOG.isDebugEnabled()) { @@ -90,7 +96,7 @@ public class SampleDisplayManager extends AbstractSampleManager implements Seria userAllowedToEditSystemFileReaderOfSample = false; Institution inst = Institution.getLoggedInInstitution(); EntityManager em = EntityManagerService.provideEntityManager(); - TestingSession ts = TestingSession.getSelectedTestingSession(); + TestingSession ts = testingSessionService.getCurrentTestingSession(); List<SystemInSession> sisList = SystemInSession.getSystemsInSessionForCompanyForSession(em, inst, ts); if (sisList != null && !ts.testingSessionClosedForUser() && selectedSis != null) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java index bc1f3d87a..9703779d6 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java @@ -276,7 +276,7 @@ public class SystemInSessionOverview implements Serializable, QueryModifier<Syst .neqRestriction(SystemInSessionRegistrationStatus.DROPPED), query.system().systemsInSession() .registrationStatus().isNullRestriction())); queryBuilder.addRestriction(query.system().systemsInSession().testingSession() - .eqRestriction(TestingSession.getSelectedTestingSession())); + .eqRestriction(testingSessionService.getCurrentTestingSession())); } @@ -318,7 +318,7 @@ public class SystemInSessionOverview implements Serializable, QueryModifier<Syst } systemsList = removeDuplicateSystems(systemsList); - TestingSession activeSession = TestingSession.getSelectedTestingSession(); + TestingSession activeSession = testingSessionService.getCurrentTestingSession(); Collection<IntegrationProfile> listOfIntegrationProfile = activeSession.getIntegrationProfilesUnsorted(); List<IntegrationProfile> listOfIntegrationProfileCopy = new ArrayList<>(listOfIntegrationProfile); for (IntegrationProfile integrationProfile : listOfIntegrationProfile) { -- GitLab From 56094c0fcafff1e29b54a43bd504563984af0bd6 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 26 Aug 2024 16:31:56 +0200 Subject: [PATCH 47/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../objects/action/SampleOverview.java | 11 ++++-- .../IHEImplementationForSystemManager.java | 38 +++++++------------ .../systems/action/TestingSessionManager.java | 8 +--- 3 files changed, 23 insertions(+), 34 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleOverview.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleOverview.java index 8bab17700..185514fb5 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleOverview.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleOverview.java @@ -11,8 +11,9 @@ import net.ihe.gazelle.menu.Authorizations; import net.ihe.gazelle.objects.model.ObjectInstance; import net.ihe.gazelle.objects.model.ObjectInstanceQuery; import net.ihe.gazelle.ssov7.gum.client.application.Role; -import net.ihe.gazelle.tm.systems.model.TestingSession; +import net.ihe.gazelle.tm.session.TestingSessionService; import org.jboss.seam.ScopeType; +import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.annotations.Synchronized; @@ -36,6 +37,10 @@ public class SampleOverview implements Serializable, QueryModifier<ObjectInstanc private FilterDataModel<ObjectInstance> objectInstances; private Filter<ObjectInstance> filter; private final ApplicationPreferenceManager applicationPreferenceManager = new ApplicationPreferenceManagerImpl(); + + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + public SampleOverview() { super(); } @@ -93,7 +98,7 @@ public class SampleOverview implements Serializable, QueryModifier<ObjectInstanc hideTestingSessionInSampleSearchFilter(hqlCriterionsForFilter, query); hqlCriterionsForFilter.addPath("testing_session", query.system().testingSession(), - TestingSession.getSelectedTestingSession()); + testingSessionService.getCurrentTestingSession()); hqlCriterionsForFilter.addPath("objectType", query.object()); hqlCriterionsForFilter.addPath("objectFileType", query.objectInstanceFiles().file().type()); @@ -118,7 +123,7 @@ public class SampleOverview implements Serializable, QueryModifier<ObjectInstanc * @param hqlCriterionsForFilter HqlCriterionsForFilter * @param query ObjectInstanceQuery */ - private void hideTestingSessionInSampleSearchFilter(HQLCriterionsForFilter hqlCriterionsForFilter, ObjectInstanceQuery query){ + private void hideTestingSessionInSampleSearchFilter(HQLCriterionsForFilter hqlCriterionsForFilter, ObjectInstanceQuery query) { if (!Authorizations.SAMPLE_SEARCH_USERS.isGranted()) { hqlCriterionsForFilter.addPath("hideTestingSession", query.system().testingSession().hideAdvancedSampleSearchToVendors(), false, false); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/IHEImplementationForSystemManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/IHEImplementationForSystemManager.java index 4f968dddc..7ea4b0013 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/IHEImplementationForSystemManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/IHEImplementationForSystemManager.java @@ -30,13 +30,9 @@ import net.ihe.gazelle.tm.financial.FinancialSummary; import net.ihe.gazelle.tm.financial.FinancialSummaryOneSystem; import net.ihe.gazelle.tm.financial.action.FinancialManager; import net.ihe.gazelle.tm.gazelletest.model.instance.SystemAIPOResultForATestingSession; -import net.ihe.gazelle.tm.systems.model.ProfileInTestingSessionQuery; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; -import net.ihe.gazelle.tm.systems.model.SystemActorProfiles; -import net.ihe.gazelle.tm.systems.model.SystemInSession; -import net.ihe.gazelle.tm.systems.model.SystemInSessionQuery; -import net.ihe.gazelle.tm.systems.model.TestingDepth; -import net.ihe.gazelle.tm.systems.model.TestingSession; +import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.tm.utils.systems.IHEImplementationForSystem; import net.ihe.gazelle.tm.utils.systems.IHEImplementationForSystemComparatorActor; import net.ihe.gazelle.users.model.Institution; @@ -44,12 +40,7 @@ import net.ihe.gazelle.util.Pair; import net.sf.jasperreports.engine.JRException; import org.hibernate.exception.ConstraintViolationException; import org.jboss.seam.ScopeType; -import org.jboss.seam.annotations.Create; -import org.jboss.seam.annotations.Destroy; -import org.jboss.seam.annotations.In; -import org.jboss.seam.annotations.Name; -import org.jboss.seam.annotations.Out; -import org.jboss.seam.annotations.Scope; +import org.jboss.seam.annotations.*; import org.jboss.seam.faces.FacesMessages; import org.jboss.seam.international.StatusMessage; import org.jboss.seam.international.StatusMessages; @@ -58,12 +49,7 @@ import org.slf4j.LoggerFactory; import javax.faces.context.FacesContext; import javax.persistence.EntityManager; import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Vector; +import java.util.*; import static org.jboss.seam.ScopeType.PAGE; @@ -150,6 +136,9 @@ public class IHEImplementationForSystemManager implements Serializable, IHEImple private IHEImplementationForSystem iheImplementationForSystemToDelete; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + // ~ Methods // /////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -261,7 +250,7 @@ public class IHEImplementationForSystemManager implements Serializable, IHEImple /** * Add a combination Actor/Profile/OPtion to a system, if this combination does not exist. Also calculate the news fees amount. * - * @param inActorIntegrationProfileOption : Integration Profile + * @param inActorIntegrationProfileOption : Integration Profile * @return JSF page to render */ @Override @@ -540,7 +529,6 @@ public class IHEImplementationForSystemManager implements Serializable, IHEImple * Check if an AIPO is already associated to the selected system in session * * @param iheImplementationForSystem : object containing AIPO information - * * @return Boolean : true if the AIPO already exists for that system in session */ @Override @@ -588,7 +576,6 @@ public class IHEImplementationForSystemManager implements Serializable, IHEImple * This method is called to generate an Integration Statement. An Integration Statement possesses all IHE features for a system. * * @param syst : Integration Statement to generate for this system - * * @return String : JSF page to render */ @Override @@ -656,6 +643,7 @@ public class IHEImplementationForSystemManager implements Serializable, IHEImple /** * Used in ShowSystemInSession for making the table sortable + * * @return GazelleListDataModel of Implementations to display */ public NoHQLDataModel<IHEImplementationForSystem> getIheImplementationsToDisplaySortable() { @@ -743,7 +731,7 @@ public class IHEImplementationForSystemManager implements Serializable, IHEImple if (LOG.isDebugEnabled()) { LOG.debug("calculateFinancialSummaryDTO"); } - financialSummary = FinancialManager.getFinancialSummaryWithCalculatedAmountsStatic(TestingSession.getSelectedTestingSession(), + financialSummary = FinancialManager.getFinancialSummaryWithCalculatedAmountsStatic(testingSessionService.getCurrentTestingSession(), choosenInstitutionForAdmin, entityManager, false); if (financialSummary != null) { financialSummaryForOneSystem = financialSummary.getFinancialSummaryOneSystems(); @@ -758,7 +746,7 @@ public class IHEImplementationForSystemManager implements Serializable, IHEImple LOG.debug("listTransactionsToSupportForGivenSystemPDF"); } Map<String, Object> parameters = new HashMap<String, Object>(); - parameters.put("sessionId", TestingSession.getSelectedTestingSession().getId()); + parameters.put("sessionId", testingSessionService.getCurrentTestingSession().getId()); parameters.put("systemId", selectedSystemInSession.getSystem().getId()); try { ReportExporterManager.exportToPDF("listOfTransactionsToSupportPerSystem", @@ -791,7 +779,7 @@ public class IHEImplementationForSystemManager implements Serializable, IHEImple public boolean displayWarning() { try { - if(getIheImplementations() == null){ + if (getIheImplementations() == null) { getAllIHEImplementationsForSystemInSession(selectedSystemInSession); } Iterator<IHEImplementationForSystem> it = getIheImplementations().iterator(); @@ -801,7 +789,7 @@ public class IHEImplementationForSystemManager implements Serializable, IHEImple return true; } } - }catch (Exception e){ + } catch (Exception e) { LOG.error(e.toString()); } return false; diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java index 95174968e..cb87bf9e3 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java @@ -50,7 +50,6 @@ import org.jboss.seam.international.StatusMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.faces.context.FacesContext; import javax.persistence.EntityManager; import javax.persistence.Query; import javax.validation.ConstraintViolation; @@ -697,12 +696,9 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin if (LOG.isDebugEnabled()) { LOG.debug("getSelectedTestingSession"); } + if (selectedTestingSession == null) { - FacesContext fc = FacesContext.getCurrentInstance(); - String id = fc.getExternalContext().getRequestParameterMap().get("editId"); - if (id != null) { - initEditTestingSession(entityManager.find(TestingSession.class, Integer.valueOf(id))); - } + selectedTestingSession = testingSessionService.getCurrentTestingSession(); } return selectedTestingSession; } -- GitLab From 56efcc3a05d0964091a2d1d2a6e037aa54707d69 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 26 Aug 2024 17:01:24 +0200 Subject: [PATCH 48/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../tm/application/action/SearchGeneric.java | 13 ++++++----- .../tm/gazelletest/action/AIPOSelector.java | 11 +++++----- .../action/TestInstancesOverview.java | 22 +++++++++++-------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/SearchGeneric.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/SearchGeneric.java index 75ca862ad..84a38bd29 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/SearchGeneric.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/SearchGeneric.java @@ -5,12 +5,12 @@ import net.ihe.gazelle.common.LinkDataProviderService; import net.ihe.gazelle.common.filter.list.ListQueryBuilder; import net.ihe.gazelle.hql.HQLQueryBuilder; import net.ihe.gazelle.hql.providers.EntityManagerService; -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.tm.datamodel.MonitorUser; import net.ihe.gazelle.tm.filter.entities.SearchType; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; -import net.ihe.gazelle.tm.systems.model.TestingSession; +import net.ihe.gazelle.tm.session.TestingSessionService; import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; @@ -54,9 +54,12 @@ public class SearchGeneric implements Serializable { private String criteriaValue2 = null; private SearchType criteriaType; private Map<SearchType, Integer> countTypes = new HashMap<>(); - @In(value="gumUserService") + @In(value = "gumUserService") private UserService userService; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + public static String getRegexpId() { if (LOG.isDebugEnabled()) { LOG.debug("String getRegexpId"); @@ -97,7 +100,7 @@ public class SearchGeneric implements Serializable { int indexOfDouble = suggestedId.indexOf(":"); SearchType providedType = null; String shortId = suggestedId.substring(0, indexOfDouble); - for (SearchType searchType : SearchType.values()) { + for (SearchType searchType : SearchType.values()) { if (searchType.getShortId().equals(shortId)) { providedType = searchType; } @@ -138,7 +141,7 @@ public class SearchGeneric implements Serializable { } private List<MonitorUser> getMonitorUsers() { - List<MonitorInSession> monitorInSessions = MonitorInSession.getAllActivatedMonitorsForATestingSession(TestingSession.getSelectedTestingSession()); + List<MonitorInSession> monitorInSessions = MonitorInSession.getAllActivatedMonitorsForATestingSession(testingSessionService.getCurrentTestingSession()); if (monitorInSessions == null) { monitorInSessions = new ArrayList<>(); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/AIPOSelector.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/AIPOSelector.java index e644f83a9..fe241adcb 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/AIPOSelector.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/AIPOSelector.java @@ -11,16 +11,14 @@ import net.ihe.gazelle.tf.model.*; import net.ihe.gazelle.tf.model.constraints.AipoSingle; import net.ihe.gazelle.tm.application.action.ApplicationManager; import net.ihe.gazelle.tm.filter.TMCriterions; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.action.SystemManagerLocal; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; import org.apache.commons.lang.StringUtils; import org.jboss.seam.Component; import org.jboss.seam.ScopeType; -import org.jboss.seam.annotations.Create; -import org.jboss.seam.annotations.Destroy; -import org.jboss.seam.annotations.Name; -import org.jboss.seam.annotations.Scope; +import org.jboss.seam.annotations.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,6 +38,9 @@ public class AIPOSelector implements Serializable, QueryModifier<ActorIntegratio private FilterDataModel<ActorIntegrationProfileOption> aipos; private TestingSession testingSession = null; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + @Create public void create() { if (LOG.isDebugEnabled()) { @@ -59,7 +60,7 @@ public class AIPOSelector implements Serializable, QueryModifier<ActorIntegratio if (selectedSystemInSession != null) { setTestingSession(selectedSystemInSession.getTestingSession()); } else { - setTestingSession(TestingSession.getSelectedTestingSession()); + setTestingSession(testingSessionService.getCurrentTestingSession()); } } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverview.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverview.java index d1e9f3347..2879fe50f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverview.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverview.java @@ -5,13 +5,13 @@ import net.ihe.gazelle.hql.HQLRestriction; import net.ihe.gazelle.hql.restrictions.HQLRestrictionIn; import net.ihe.gazelle.hql.restrictions.HQLRestrictions; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; -import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.ssov7.gum.client.application.Role; +import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.tm.datamodel.TestInstanceDataModel; import net.ihe.gazelle.tm.filter.TestInstanceFilter; import net.ihe.gazelle.tm.gazelletest.model.instance.Status; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; -import net.ihe.gazelle.tm.systems.model.TestingSession; +import net.ihe.gazelle.tm.session.TestingSessionService; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.*; import org.slf4j.Logger; @@ -46,6 +46,9 @@ public class TestInstancesOverview implements Serializable { @In(value = "gumUserService") private UserService userService; + @In(value = "testingSessionService") + private TestingSessionService testingSessionService; + @Create public void create() { if (LOG.isDebugEnabled()) { @@ -321,38 +324,39 @@ public class TestInstancesOverview implements Serializable { setFilterStatus(value, Status.getSTATUS_FAILED()); } - public boolean getFilterTestVerifiedByVendors(){ + public boolean getFilterTestVerifiedByVendors() { if (LOG.isDebugEnabled()) { LOG.debug("getFilterTestVerifiedByVendors"); } return getFilterStatus(Status.getStatusByKeyword("self verified")); } - public void setFilterTestVerifiedByVendors(boolean value){ + public void setFilterTestVerifiedByVendors(boolean value) { if (LOG.isDebugEnabled()) { LOG.debug("setFilterTestVerifiedByVendors"); } - setFilterStatus(value,Status.getStatusByKeyword("self verified")); + setFilterStatus(value, Status.getStatusByKeyword("self verified")); } - public boolean getFilterTestCompletedWithErrors(){ + public boolean getFilterTestCompletedWithErrors() { if (LOG.isDebugEnabled()) { LOG.debug("getFilterTestCompletedWithErrors"); } return getFilterStatus(Status.getStatusByKeyword("completed errors")); } - public void setFilterTestCompletedWithErrors(boolean value){ + public void setFilterTestCompletedWithErrors(boolean value) { if (LOG.isDebugEnabled()) { LOG.debug("setFilterTestCompletedWithErrors"); } - setFilterStatus(value,Status.getStatusByKeyword("completed errors")); + setFilterStatus(value, Status.getStatusByKeyword("completed errors")); } + public int getTotalTestTodo() { int total = 0; setInteroperabilityTestsOnly(false); setMonitorWorkList(true); - if (TestingSession.getSelectedTestingSession().getIsCriticalStatusEnabled()) { + if (testingSessionService.getCurrentTestingSession().getIsCriticalStatusEnabled()) { if (testsCritical != null) { total = total + testsCritical.size(); } -- GitLab From 43493506e4a25407ec406f78fcb6f648bd436310 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 26 Aug 2024 17:53:34 +0200 Subject: [PATCH 49/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../action/TestInstancesOverviewManager.java | 7 +++- .../action/TestMonitorManager.java | 6 ++- ...TestsDefinitionsAdministrationManager.java | 42 ++++--------------- 3 files changed, 18 insertions(+), 37 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverviewManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverviewManager.java index b3e4bd5e4..5dfe69b72 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverviewManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverviewManager.java @@ -7,10 +7,10 @@ import net.ihe.gazelle.hql.criterion.HQLCriterionsForFilter; import net.ihe.gazelle.hql.criterion.QueryModifier; import net.ihe.gazelle.hql.providers.EntityManagerService; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.SystemInSessionQuery; import net.ihe.gazelle.tm.systems.model.TestingSession; - import net.ihe.gazelle.users.model.Institution; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.In; @@ -42,11 +42,14 @@ public class TestInstancesOverviewManager implements Serializable { @In(value = "gumUserService") private UserService userService; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + public TestingSession getSelectedTestingSession() { if (LOG.isDebugEnabled()) { LOG.debug("getSelectedTestingSession"); } - return TestingSession.getSelectedTestingSession(); + return testingSessionService.getCurrentTestingSession(); } public Institution getSelectedInstitution() { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestMonitorManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestMonitorManager.java index 77767fe40..edb9b230a 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestMonitorManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestMonitorManager.java @@ -13,6 +13,7 @@ import net.ihe.gazelle.tm.gazelletest.model.definition.Test; import net.ihe.gazelle.tm.gazelletest.model.definition.TestQuery; import net.ihe.gazelle.tm.gazelletest.model.definition.TestStatus; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.*; @@ -56,6 +57,9 @@ public class TestMonitorManager implements Serializable, QueryModifier<Test> { @In(value = "gumUserService") private UserService userService; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + // getter && settter //////////////////////////////////////////////////// public List<MonitorInSession> getListMonitorsForSelectedTestsByAdmin() { @@ -178,7 +182,7 @@ public class TestMonitorManager implements Serializable, QueryModifier<Test> { if (LOG.isDebugEnabled()) { LOG.debug("reset"); } - this.testingSession = TestingSession.getSelectedTestingSession(); + this.testingSession = testingSessionService.getCurrentTestingSession(); this.listAllMonitorsForSelectedSession = MonitorInSession .getAllActivatedMonitorsForATestingSession(testingSession); this.listMonitorsForSelectedTests = new ArrayList<>(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestsDefinitionsAdministrationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestsDefinitionsAdministrationManager.java index e8881765b..869878cda 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestsDefinitionsAdministrationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestsDefinitionsAdministrationManager.java @@ -12,37 +12,20 @@ import net.ihe.gazelle.hql.criterion.QueryModifier; import net.ihe.gazelle.hql.providers.EntityManagerService; import net.ihe.gazelle.hql.restrictions.HQLRestrictions; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; +import net.ihe.gazelle.ssov7.gum.client.application.Role; import net.ihe.gazelle.ssov7.gum.client.application.UserAttributeCommon; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; -import net.ihe.gazelle.ssov7.gum.client.application.Role; import net.ihe.gazelle.tf.model.Hl7MessageProfile; import net.ihe.gazelle.tf.model.Transaction; import net.ihe.gazelle.tf.model.WSTransactionUsage; import net.ihe.gazelle.tm.datamodel.TestDataModel; import net.ihe.gazelle.tm.filter.TMCriterions; import net.ihe.gazelle.tm.gazelletest.bean.InfoCookies; -import net.ihe.gazelle.tm.gazelletest.model.definition.ContextualInformation; -import net.ihe.gazelle.tm.gazelletest.model.definition.GazelleLanguage; -import net.ihe.gazelle.tm.gazelletest.model.definition.RoleInTest; -import net.ihe.gazelle.tm.gazelletest.model.definition.RoleInTestEnum; -import net.ihe.gazelle.tm.gazelletest.model.definition.RoleInTestQuery; -import net.ihe.gazelle.tm.gazelletest.model.definition.TSMPConfigFile; -import net.ihe.gazelle.tm.gazelletest.model.definition.Test; -import net.ihe.gazelle.tm.gazelletest.model.definition.TestDescription; -import net.ihe.gazelle.tm.gazelletest.model.definition.TestOption; -import net.ihe.gazelle.tm.gazelletest.model.definition.TestPeerType; -import net.ihe.gazelle.tm.gazelletest.model.definition.TestRoles; -import net.ihe.gazelle.tm.gazelletest.model.definition.TestRolesQuery; -import net.ihe.gazelle.tm.gazelletest.model.definition.TestStatus; -import net.ihe.gazelle.tm.gazelletest.model.definition.TestStepConfigurationFileType; -import net.ihe.gazelle.tm.gazelletest.model.definition.TestSteps; -import net.ihe.gazelle.tm.gazelletest.model.definition.TestStepsOption; -import net.ihe.gazelle.tm.gazelletest.model.definition.TestStepsQuery; -import net.ihe.gazelle.tm.gazelletest.model.definition.TestType; -import net.ihe.gazelle.tm.gazelletest.model.definition.UserComment; +import net.ihe.gazelle.tm.gazelletest.model.definition.*; import net.ihe.gazelle.tm.gazelletest.model.instance.ContextualInformationInstance; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; import net.ihe.gazelle.tm.gazelletest.model.instance.TestStepsInstance; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.tee.dao.MessageValidationServiceDAO; import net.ihe.gazelle.tm.tee.dao.ValidationServiceDAO; @@ -54,11 +37,7 @@ import net.sf.jasperreports.engine.JRException; import org.apache.commons.lang.StringUtils; import org.hibernate.exception.ConstraintViolationException; import org.jboss.seam.ScopeType; -import org.jboss.seam.annotations.Create; -import org.jboss.seam.annotations.Destroy; -import org.jboss.seam.annotations.In; -import org.jboss.seam.annotations.Name; -import org.jboss.seam.annotations.Scope; +import org.jboss.seam.annotations.*; import org.jboss.seam.annotations.security.Restrict; import org.jboss.seam.faces.FacesMessages; import org.jboss.seam.faces.Redirect; @@ -83,15 +62,7 @@ import java.io.Serializable; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; +import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -181,6 +152,9 @@ public class TestsDefinitionsAdministrationManager implements Serializable, Quer @In(value = "gumUserService") private UserService userService; + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + public List<List<Test>> getListOfTestLists() { if (LOG.isDebugEnabled()) { LOG.debug("getListOfTestLists"); -- GitLab From 6dc4fcd749b062619377c365fbed16393644aab7 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 26 Aug 2024 18:00:56 +0200 Subject: [PATCH 50/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../ihe/gazelle/tm/gazelletest/action/MonitorExporter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorExporter.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorExporter.java index e1a74db48..fa2897cf0 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorExporter.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorExporter.java @@ -21,6 +21,7 @@ import net.ihe.gazelle.common.filter.list.NoHQLDataModel; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.ssov7.gum.client.application.User; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.users.model.Institution; import org.apache.poi.hssf.usermodel.HSSFWorkbook; @@ -65,6 +66,7 @@ public class MonitorExporter implements Serializable { private int colIndex; private transient UserService userService = (UserService) Component.getInstance("gumUserService"); + private final transient TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("gumTestingSessionService"); @SuppressWarnings("unchecked") public void exportDataModel(NoHQLDataModel<MonitorInSession> monitors) throws IOException { @@ -78,7 +80,7 @@ public class MonitorExporter implements Serializable { if (LOG.isDebugEnabled()) { LOG.debug("export"); } - TestingSession testingSession = TestingSession.getSelectedTestingSession(); + TestingSession testingSession = testingSessionService.getCurrentTestingSession(); // initiate workbook Workbook workbook = new HSSFWorkbook(); -- GitLab From 7d49ed6dcb1a4834777bb446d47a6410659cae96 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 27 Aug 2024 09:44:09 +0200 Subject: [PATCH 51/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../gazelle/tm/gazelletest/action/TMCheckListManager.java | 7 +++++-- .../action/TestsDefinitionsAdministrationManager.java | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TMCheckListManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TMCheckListManager.java index 2ec3246d0..35bc945be 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TMCheckListManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TMCheckListManager.java @@ -22,7 +22,7 @@ import net.ihe.gazelle.tm.gazelletest.model.instance.ContextualInformationInstan import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; import net.ihe.gazelle.tm.gazelletest.model.instance.TestStepsInstance; import net.ihe.gazelle.tm.gazelletest.model.reversed.AIPOQuery; -import net.ihe.gazelle.tm.systems.model.TestingSession; +import net.ihe.gazelle.tm.session.TestingSessionService; import org.ajax4jsf.model.DataVisitResult; import org.ajax4jsf.model.DataVisitor; import org.jboss.seam.annotations.*; @@ -97,6 +97,9 @@ public class TMCheckListManager implements TMCheckListManagerLocal, Serializable @In(value = "gumUserService") private transient UserService userService; + @In(value = "testingSessionService") + private TestingSessionService testingSessionService; + @Override public FilterDataModel<ActorIntegrationProfileOption> getActorIntegrationProfileOption() { if (LOG.isDebugEnabled()) { @@ -440,7 +443,7 @@ public class TMCheckListManager implements TMCheckListManagerLocal, Serializable } TestInstance ti = (TestInstance) arg1; try { - ti.setTestingSession(TestingSession.getSelectedTestingSession()); + ti.setTestingSession(testingSessionService.getCurrentTestingSession()); EntityManager entityManager = EntityManagerService.provideEntityManager(); ti = entityManager.merge(ti); entityManager.flush(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestsDefinitionsAdministrationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestsDefinitionsAdministrationManager.java index 869878cda..770b81fb9 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestsDefinitionsAdministrationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestsDefinitionsAdministrationManager.java @@ -26,7 +26,6 @@ import net.ihe.gazelle.tm.gazelletest.model.instance.ContextualInformationInstan import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; import net.ihe.gazelle.tm.gazelletest.model.instance.TestStepsInstance; import net.ihe.gazelle.tm.session.TestingSessionService; -import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.tee.dao.MessageValidationServiceDAO; import net.ihe.gazelle.tm.tee.dao.ValidationServiceDAO; import net.ihe.gazelle.tm.tee.model.MessageDirection; @@ -1107,7 +1106,7 @@ public class TestsDefinitionsAdministrationManager implements Serializable, Quer + "WHERE sap.actorIntegrationProfileOption = participants.actorIntegrationProfileOption " + "AND sIs.system=sap.system " + "AND tr.test=:inTest " + "AND participants.tested='true' " + "AND tr.testOption=:inTestOption " + "AND sIs.testingSession=:inTestingSession"); - query.setParameter("inTestingSession", TestingSession.getSelectedTestingSession()); + query.setParameter("inTestingSession", testingSessionService.getCurrentTestingSession()); query.setParameter("inTest", inTest); query.setParameter("inTestOption", TestOption.getTEST_OPTION_REQUIRED()); return ((Long) query.getSingleResult()).intValue(); -- GitLab From b09cf77a00b6c5f9360b0225014f1eb05300cf6d Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 27 Aug 2024 14:49:56 +0200 Subject: [PATCH 52/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../gazelle/objects/action/SampleDisplayManager.java | 3 --- .../net/ihe/gazelle/tm/filter/TestInstanceFilter.java | 6 +++++- .../ihe/gazelle/tm/filter/entities/SearchType.java | 11 ++++++++--- .../tm/gazelletest/action/TestInstanceGenerator.java | 6 +++++- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleDisplayManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleDisplayManager.java index bb2a09649..ef48dba5a 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleDisplayManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleDisplayManager.java @@ -6,7 +6,6 @@ import net.ihe.gazelle.objects.model.ObjectInstance; import net.ihe.gazelle.objects.model.ObjectInstanceFile; import net.ihe.gazelle.ssov7.gum.client.application.UserAttributeCommon; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; -import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.users.model.Institution; @@ -35,8 +34,6 @@ public class SampleDisplayManager extends AbstractSampleManager implements Seria @In(value = "gumUserService") private transient UserService userService; - @In(value = "testingSessionService") - private transient TestingSessionService testingSessionService; @Create public void initialize() { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/TestInstanceFilter.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/TestInstanceFilter.java index a24d498fe..04eeb7c11 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/TestInstanceFilter.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/TestInstanceFilter.java @@ -16,7 +16,9 @@ import net.ihe.gazelle.tm.filter.valueprovider.TestingSessionInitiator; import net.ihe.gazelle.tm.gazelletest.model.definition.TestType; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstanceQuery; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.TestingSession; +import org.jboss.seam.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,6 +40,8 @@ public class TestInstanceFilter extends Filter<TestInstance> { private String monitorWorklistUserId; private boolean interoperabilityTestsOnly; + private static final TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + public TestInstanceFilter(boolean monitorWorkList, Map<String, String> requestParameterMap, boolean interoperabilityTestsOnly, GazelleIdentity identity) { super(getHQLCriterions(monitorWorkList, interoperabilityTestsOnly, identity), requestParameterMap); @@ -56,7 +60,7 @@ public class TestInstanceFilter extends Filter<TestInstance> { // Only tests instance matching testing session filters result.addQueryModifier(new TestMatchingTestingSession(query.test(), "testingSession")); - result.addPath("testingSession", query.testingSession(), TestingSessionInitiator.INSTANCE, TestingSession.getSelectedTestingSession()); + result.addPath("testingSession", query.testingSession(), TestingSessionInitiator.INSTANCE, testingSessionService.getCurrentTestingSession()); result.addQueryModifierForCriterion("testingSession", new TestingSessionFilter(identity, query.testingSession())); TMCriterions.addAIPOCriterionsUsingTestInstance(result, query, "testingSession"); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/entities/SearchType.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/entities/SearchType.java index be7f608c8..6faf0671f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/entities/SearchType.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/entities/SearchType.java @@ -8,9 +8,11 @@ import net.ihe.gazelle.objects.model.ObjectInstance; import net.ihe.gazelle.tm.datamodel.MonitorUser; import net.ihe.gazelle.tm.gazelletest.model.definition.Test; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; import org.apache.commons.lang.StringUtils; +import org.jboss.seam.Component; import org.jboss.seam.core.ResourceBundle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -31,6 +33,8 @@ public enum SearchType implements SearchEntity { private Class<?> entityClass; private String shortId; + private final transient TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + SearchType(String label, String shortId, Class<?> entityClass) { this.label = label; this.shortId = shortId; @@ -64,6 +68,7 @@ public enum SearchType implements SearchEntity { LOG.debug("addRestrictionsForQuery"); } List<HQLRestriction> restrictions; + TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); switch (this) { case SAMPLE: restrictions = new ArrayList<>(); @@ -72,7 +77,7 @@ public enum SearchType implements SearchEntity { restrictions.add(HQLRestrictions.like("description", query)); restrictions.add(HQLRestrictions.like("object.description", query)); SearchType.addListRestrictions(queryBuilder, restrictions); - queryBuilder.addEq("system.testingSession", TestingSession.getSelectedTestingSession()); + queryBuilder.addEq("system.testingSession", selectedTestingSession); return true; case SYSTEM: restrictions = new ArrayList<>(); @@ -80,7 +85,7 @@ public enum SearchType implements SearchEntity { restrictions.add(HQLRestrictions.like("system.keyword", query)); restrictions.add(HQLRestrictions.like("system.name", query)); SearchType.addListRestrictions(queryBuilder, restrictions); - queryBuilder.addEq("testingSession", TestingSession.getSelectedTestingSession()); + queryBuilder.addEq("testingSession", selectedTestingSession); return true; case TEST: restrictions = new ArrayList<>(); @@ -128,7 +133,7 @@ public enum SearchType implements SearchEntity { public List<MonitorUser> parameterizedSearch(ListQueryBuilder<MonitorUser> monitorQueryBuilder, String searchParameter, String query, int maxCount) { monitorQueryBuilder.addLike(searchParameter, query); - monitorQueryBuilder.addEq("monitorInSession.testingSession", TestingSession.getSelectedTestingSession()); + monitorQueryBuilder.addEq("monitorInSession.testingSession", testingSessionService.getCurrentTestingSession()); monitorQueryBuilder.addEq("monitorInSession.isActivated", true); monitorQueryBuilder.setMaxResults(maxCount); return monitorQueryBuilder.getList(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceGenerator.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceGenerator.java index 01b0a2838..efff12cf6 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceGenerator.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceGenerator.java @@ -5,11 +5,13 @@ import net.ihe.gazelle.tf.model.ActorIntegrationProfileOption; import net.ihe.gazelle.tf.model.IntegrationProfileOption; import net.ihe.gazelle.tm.gazelletest.model.definition.*; import net.ihe.gazelle.tm.gazelletest.model.instance.*; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.users.model.Institution; import org.hibernate.envers.AuditReader; import org.hibernate.envers.AuditReaderFactory; +import org.jboss.seam.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -27,6 +29,8 @@ public class TestInstanceGenerator { private static final Logger LOG = LoggerFactory.getLogger(TestInstanceGenerator.class); + private static final TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + /* * Random Test Instance generation */ @@ -124,7 +128,7 @@ public class TestInstanceGenerator { for (TestRoles testRoles : testRolesList) { List<SystemInSession> systemInSessionList = RoleInTest .getSystemInSessionByRoleInTestByTestingSessionBySISStatus(testRoles.getRoleInTest(), - TestingSession.getSelectedTestingSession(), null, true); + testingSessionService.getCurrentTestingSession(), null, true); if ((systemInSessionList != null) && (systemInSessionList.size() > 0)) { systemInSessionList.remove(inSystemInSession); if (systemInSessionList.size() > testRoles.getCardMax()) { -- GitLab From 79684eb7d64c914094e2826a091383b5b276fe7b Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 27 Aug 2024 15:07:08 +0200 Subject: [PATCH 53/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../objects/action/AbstractSampleManager.java | 11 ++++++++--- .../ihe/gazelle/tm/filter/MonitorWorklistFilter.java | 6 +++++- .../gazelle/tm/gazelletest/action/ProxyManager.java | 9 +++++++-- .../dao/ConformityTestReportDAOImpl.java | 12 ++++++++---- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/AbstractSampleManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/AbstractSampleManager.java index 0f09a2959..143f01562 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/AbstractSampleManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/AbstractSampleManager.java @@ -13,6 +13,7 @@ import net.ihe.gazelle.objects.model.ObjectInstanceFile; import net.ihe.gazelle.preferences.PreferenceService; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.Role; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.users.model.Institution; @@ -46,6 +47,9 @@ public abstract class AbstractSampleManager extends ObjectManipulation { @In private GazelleIdentity identity; + @In(value = "testingSessionService") + protected TestingSessionService testingSessionService; + public void validate(ObjectInstanceFile file) { if (LOG.isDebugEnabled()) { LOG.debug("validate"); @@ -175,7 +179,7 @@ public abstract class AbstractSampleManager extends ObjectManipulation { EntityManager em = EntityManagerService.provideEntityManager(); Institution userinst = Institution.findInstitutionWithKeyword(identity.getOrganisationKeyword()); List<SystemInSession> systemInSessionList = SystemInSession.getSystemsInSessionForCompanyForSession(em, - userinst, TestingSession.getSelectedTestingSession()); + userinst, testingSessionService.getCurrentTestingSession()); if (systemInSessionList != null) { if (this.selectedObjectInstance.getSystem() != null) { if (systemInSessionList.contains(this.selectedObjectInstance.getSystem())) { @@ -199,13 +203,14 @@ public abstract class AbstractSampleManager extends ObjectManipulation { } EntityManager em = EntityManagerService.provideEntityManager(); Institution userinst = Institution.findInstitutionWithKeyword(identity.getOrganisationKeyword()); + TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); List<SystemInSession> systemInSessionList = SystemInSession.getSystemsInSessionForCompanyForSession(em, - userinst, TestingSession.getSelectedTestingSession()); + userinst, selectedTestingSession); if (systemInSessionList.contains(this.selectedObjectInstance.getSystem())) { return true; } List<SystemInSession> sislist = SystemInSession.getSystemInSessionFiltered(em, null, - TestingSession.getSelectedTestingSession(), userinst, null, null, null, null, null, null, null, null, + selectedTestingSession, userinst, null, null, null, null, null, null, null, null, null, null, null, this.selectedObjectInstance.getObject(), null, null); if (sislist != null) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/MonitorWorklistFilter.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/MonitorWorklistFilter.java index 32a5dacf5..56ac3c7c8 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/MonitorWorklistFilter.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/MonitorWorklistFilter.java @@ -6,7 +6,9 @@ import net.ihe.gazelle.hql.criterion.HQLCriterionsForFilter; import net.ihe.gazelle.hql.criterion.QueryModifier; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSessionQuery; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.TestingSession; +import org.jboss.seam.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -23,6 +25,8 @@ public class MonitorWorklistFilter extends Filter<MonitorInSession> { super(getHQLCriterions()); } + private static final TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + private static HQLCriterionsForFilter<MonitorInSession> getHQLCriterions() { MonitorInSessionQuery query = new MonitorInSessionQuery(); HQLCriterionsForFilter<MonitorInSession> result = query.getHQLCriterionsForFilter(); @@ -40,7 +44,7 @@ public class MonitorWorklistFilter extends Filter<MonitorInSession> { LOG.debug("modifyQuery"); } MonitorInSessionQuery query = new MonitorInSessionQuery(queryBuilder); - queryBuilder.addRestriction(query.testingSession().eqRestriction(TestingSession.getSelectedTestingSession())); + queryBuilder.addRestriction(query.testingSession().eqRestriction(testingSessionService.getCurrentTestingSession())); } }); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ProxyManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ProxyManager.java index 813a50cce..130cb841f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ProxyManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ProxyManager.java @@ -21,9 +21,11 @@ import net.ihe.gazelle.tm.configurations.model.HL7.HL7V3ResponderConfiguration; import net.ihe.gazelle.tm.gazelletest.model.definition.RoleInTest; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstanceParticipants; import net.ihe.gazelle.tm.gazelletest.model.instance.TestStepsInstance; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; import org.apache.commons.lang.ArrayUtils; +import org.jboss.seam.Component; import org.jboss.seam.faces.FacesMessages; import org.jboss.seam.international.StatusMessage; import org.kohsuke.MetaInfServices; @@ -43,6 +45,9 @@ public class ProxyManager implements MessagingProvider { private static final ApplicationPreferenceManager applicationPreferenceManager = new ApplicationPreferenceManagerImpl(); private static NetworkConfigurationForTestingSession networkConfigurationForTestingSession; + + private static final TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + public ProxyManager() { super(); } @@ -252,7 +257,7 @@ public class ProxyManager implements MessagingProvider { public static Collection<Configuration> getConfigurationsForCurrentSession() { Map<Integer, Configuration> configurations = new HashMap<Integer, Configuration>(); List<AbstractConfiguration> confs = AbstractConfiguration - .listAllConfigurationsForATestingSession(TestingSession.getSelectedTestingSession()); + .listAllConfigurationsForATestingSession(testingSessionService.getCurrentTestingSession()); for (AbstractConfiguration configuration : confs) { addAndConvertConfiguration(configurations, configuration); } @@ -288,7 +293,7 @@ public class ProxyManager implements MessagingProvider { private static net.ihe.gazelle.proxy.ws.Configuration convertConfiguration(AbstractConfiguration abstractConfiguration) { net.ihe.gazelle.proxy.ws.Configuration configuration = null; - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); networkConfigurationForTestingSession = NetworkConfigurationForTestingSession .getConfigurationParametersForSession(activatedTestingSession); if (networkConfigurationForTestingSession == null) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/conformitytestreport/dao/ConformityTestReportDAOImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/conformitytestreport/dao/ConformityTestReportDAOImpl.java index d24356b19..cd4e64387 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/conformitytestreport/dao/ConformityTestReportDAOImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/conformitytestreport/dao/ConformityTestReportDAOImpl.java @@ -18,10 +18,12 @@ import net.ihe.gazelle.tm.gazelletest.model.definition.TestRoles; import net.ihe.gazelle.tm.gazelletest.model.definition.TestRolesQuery; import net.ihe.gazelle.tm.gazelletest.model.definition.TestType; import net.ihe.gazelle.tm.gazelletest.model.instance.*; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.users.model.Institution; import net.ihe.gazelle.users.model.InstitutionQuery; +import org.jboss.seam.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,6 +41,8 @@ public class ConformityTestReportDAOImpl implements ConformityTestReportDAO { private TestInstanceStatusMapper statusMapper = new TestInstanceStatusMapper(); + private TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + public ConformityTestReportDAOImpl(GazelleIdentity identity) { this.datamodel = new ConnectathonResultDataModel(createFilter(identity)); this.applicationPreferenceManager = new ApplicationPreferenceManagerImpl(); @@ -141,7 +145,7 @@ public class ConformityTestReportDAOImpl implements ConformityTestReportDAO { TestInstanceParticipantsQuery tipQuery = new TestInstanceParticipantsQuery(); List<TestType> testTypes = new ArrayList<>(systemAIPOResult.getTestSession().getTestTypes()); - if (isInteroperability && TestingSession.getSelectedTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { tipQuery.testInstance().test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { testTypes.remove(TestType.getTYPE_INTEROPERABILITY()); @@ -185,7 +189,7 @@ public class ConformityTestReportDAOImpl implements ConformityTestReportDAO { trQuery.roleInTest().testParticipantsList().tested().eq(Boolean.TRUE); List<TestType> testTypes = new ArrayList<>(systemAIPOResult.getTestSession().getTestTypes()); - if (isInteroperability && TestingSession.getSelectedTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { trQuery.test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { testTypes.remove(TestType.getTYPE_INTEROPERABILITY()); @@ -222,7 +226,7 @@ public class ConformityTestReportDAOImpl implements ConformityTestReportDAO { trQuery.roleInTest().testParticipantsList().tested().eq(Boolean.TRUE); List<TestType> testTypes = new ArrayList<>(systemAIPOResult.getTestSession().getTestTypes()); - if (isInteroperability && TestingSession.getSelectedTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { trQuery.test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { testTypes.remove(TestType.getTYPE_INTEROPERABILITY()); @@ -262,7 +266,7 @@ public class ConformityTestReportDAOImpl implements ConformityTestReportDAO { trQuery.test().testStatus().keyword().eq(READY); - if (isInteroperability && TestingSession.getSelectedTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { trQuery.test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { testTypes.remove(TestType.getTYPE_INTEROPERABILITY()); -- GitLab From 9eed6de381d18d0f90ed217c0fe106b44ae16c19 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Thu, 29 Aug 2024 10:02:25 +0200 Subject: [PATCH 54/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../tm/financial/action/FinancialManager.java | 20 +++++++---- .../action/FinancialManagerTest.java | 33 ++++++++++++------- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/financial/action/FinancialManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/financial/action/FinancialManager.java index f5f4dbef1..a9db736a9 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/financial/action/FinancialManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/financial/action/FinancialManager.java @@ -33,6 +33,7 @@ import net.ihe.gazelle.tm.datamodel.InvoiceDataModel; import net.ihe.gazelle.tm.financial.FinancialSummary; import net.ihe.gazelle.tm.financial.FinancialSummaryOneSystem; import net.ihe.gazelle.tm.financial.model.Invoice; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.tm.users.model.ConnectathonParticipant; @@ -40,6 +41,7 @@ import net.ihe.gazelle.users.model.*; import net.sf.jasperreports.engine.JRException; import org.apache.commons.lang.StringUtils; import org.hibernate.HibernateException; +import org.jboss.seam.Component; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.*; import org.jboss.seam.annotations.security.Restrict; @@ -85,7 +87,6 @@ public class FinancialManager implements Serializable, FinancialManagerLocal { private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(FinancialManager.class); private final ApplicationPreferenceManager applicationPreferenceManager = new ApplicationPreferenceManagerImpl(); - // ~ IN/OUT Attributes // //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -137,6 +138,10 @@ public class FinancialManager implements Serializable, FinancialManagerLocal { @In private GazelleIdentity identity; + static TestingSessionService getTestingSessionService() { + return (TestingSessionService) Component.getInstance("testingSessionService"); + } + public static FinancialSummary getFinancialSummaryWithCalculatedAmountsStatic(TestingSession activatedTestingSession, Institution selectedInstitution, EntityManager em, boolean mustRecalculateIfVatIsDue) { @@ -221,7 +226,7 @@ public class FinancialManager implements Serializable, FinancialManagerLocal { private static TestingSession verifyTestingSessionAndInstitution(TestingSession activatedTestingSession, Institution selectedInstitution) { if (activatedTestingSession == null) { - activatedTestingSession = TestingSession.getSelectedTestingSession(); + activatedTestingSession = getTestingSessionService().getCurrentTestingSession(); } if ((activatedTestingSession == null) || (!activatedTestingSession.isContractRequired())) { LOG.error("FinancialSummary : No contract is required for this testing session."); @@ -490,7 +495,7 @@ public class FinancialManager implements Serializable, FinancialManagerLocal { ins = Institution.getLoggedInInstitution(); } if (activatedTestingSession == null) { - activatedTestingSession = TestingSession.getSelectedTestingSession(); + activatedTestingSession = getTestingSessionService().getCurrentTestingSession(); } FinancialManager.getFinancialSummaryWithCalculatedAmountsStatic(activatedTestingSession, ins, em, mustRecalculateIfVatIsDue); @@ -591,7 +596,7 @@ public class FinancialManager implements Serializable, FinancialManagerLocal { LOG.debug("calculateFinancialSummaryDTO"); } - TestingSession activatedTestingSession = TestingSession.getSelectedTestingSession(); + TestingSession activatedTestingSession = getTestingSessionService().getCurrentTestingSession(); financialSummary = FinancialManager.getFinancialSummaryWithCalculatedAmountsStatic( activatedTestingSession, @@ -632,12 +637,13 @@ public class FinancialManager implements Serializable, FinancialManagerLocal { calculateFinancialSummaryDTO(false); Institution institutionForContract = entityManager.find(Institution.class, selectedInstitution.getId()); + TestingSession selectedTestingSession = getTestingSessionService().getCurrentTestingSession(); Long res = ContractExporter.exportContractToPDF(institutionForContract.getId(), - institutionForContract.getKeyword(), TestingSession.getSelectedTestingSession(), + institutionForContract.getKeyword(), selectedTestingSession, gazelleDataContracts.getAbsolutePath(), entityManager); Invoice invoice = Invoice.getInvoiceForAnInstitutionAndATestingSession(entityManager, institutionForContract, - TestingSession.getSelectedTestingSession()); + selectedTestingSession); if (invoice != null && res != null) { invoice.setLastGenerationDate(res); invoice.setContractOutOfDate(false); @@ -905,7 +911,7 @@ public class FinancialManager implements Serializable, FinancialManagerLocal { Contexts.getSessionContext().set("selectedInstitution", selectedInstitution); EntityManager em = EntityManagerService.provideEntityManager(); invoiceSelected = Invoice.getInvoiceForAnInstitutionAndATestingSession(em, inInstitution, - TestingSession.getSelectedTestingSession()); + getTestingSessionService().getCurrentTestingSession()); if (invoiceSelected != null) { if (invoiceSelected.getFeesDiscount() == null) { invoiceSelected.setFeesDiscount(new BigDecimal("0.00")); diff --git a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/financial/action/FinancialManagerTest.java b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/financial/action/FinancialManagerTest.java index a41dad012..989a5c9b4 100644 --- a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/financial/action/FinancialManagerTest.java +++ b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/financial/action/FinancialManagerTest.java @@ -3,6 +3,7 @@ package net.ihe.gazelle.tm.financial.action; import net.ihe.gazelle.tm.financial.FinancialSummary; import net.ihe.gazelle.tm.financial.FinancialSummaryOneSystem; import net.ihe.gazelle.tm.financial.model.Invoice; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.users.model.Institution; @@ -26,7 +27,7 @@ import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.*; @RunWith(PowerMockRunner.class) -@PrepareForTest({Invoice.class, TestingSession.class, FinancialManager.class, SystemInSession.class}) +@PrepareForTest({Invoice.class, TestingSession.class, FinancialManager.class, SystemInSession.class, TestingSessionService.class}) @PowerMockIgnore("javax.management.*") public class FinancialManagerTest { @@ -37,9 +38,11 @@ public class FinancialManagerTest { @Mock private EntityManager em; + @Mock + private TestingSessionService testingSessionService; @Before - public void setUp(){ + public void setUp() { em = Mockito.mock(EntityManager.class); } @@ -52,6 +55,7 @@ public class FinancialManagerTest { fm.setInvoiceSelected(invoiceSelected); fm.computeVatDueStateChange(); + testingSessionService = Mockito.mock(TestingSessionService.class); assertThat(fm.getInvoiceSelected().getVatAmount(), is(BigDecimal.ZERO)); } @@ -93,6 +97,9 @@ public class FinancialManagerTest { @Test public void getFinancialSummaryWithCalculatedAmountsWithoutChangingVatIsDueStaticSessionIsNullTest() { + PowerMockito.mockStatic(FinancialManager.class); + PowerMockito.when(FinancialManager.getTestingSessionService()) + .thenReturn(testingSessionService); initTestingSessionWithAmounts(); mockGetSelectedTestingSessionStatic(null); @@ -156,6 +163,8 @@ public class FinancialManagerTest { initTestingSessionWithAmounts(); mockGetSelectedTestingSessionStatic(ts); mockFinancialManagerStatic(null); + PowerMockito.when(FinancialManager.getTestingSessionService()) + .thenReturn(testingSessionService); initFinancialManagerWithAmounts(); fm.calculateFinancialSummaryDTO(false); @@ -169,6 +178,8 @@ public class FinancialManagerTest { mockGetSelectedTestingSessionStatic(ts); initFinancialSummary(); mockFinancialManagerStatic(fs); + PowerMockito.when(FinancialManager.getTestingSessionService()) + .thenReturn(testingSessionService); initFinancialManagerWithAmounts(); fm.calculateFinancialSummaryDTO(false); @@ -178,7 +189,9 @@ public class FinancialManagerTest { assertThat(fm.getFinancialSummaryForOneSystem().get(0).getId(), is(7)); } - /** Private init and mock methods **/ + /** + * Private init and mock methods + **/ private void mockInvoiceStatic(Invoice forgedInvoiceToReturn) { PowerMockito.mockStatic(Invoice.class); @@ -206,8 +219,8 @@ public class FinancialManagerTest { private void mockFinancialManagerStatic(FinancialSummary forgedFinancialSummaryToReturn) { PowerMockito.mockStatic(FinancialManager.class); PowerMockito.when(FinancialManager.getFinancialSummaryWithCalculatedAmountsStatic( - Mockito.<TestingSession>any(), Mockito.<Institution>any(), Mockito.<EntityManager>any(), - Mockito.eq(false))) + Mockito.<TestingSession>any(), Mockito.<Institution>any(), Mockito.<EntityManager>any(), + Mockito.eq(false))) .thenReturn(forgedFinancialSummaryToReturn); } @@ -221,9 +234,7 @@ public class FinancialManagerTest { } private void mockGetSelectedTestingSessionStatic(TestingSession forgedTestingSessionToReturn) { - PowerMockito.mockStatic(TestingSession.class); - PowerMockito.when(TestingSession.getSelectedTestingSession()) - .thenReturn(forgedTestingSessionToReturn); + Mockito.when(testingSessionService.getCurrentTestingSession()).thenReturn(forgedTestingSessionToReturn); } private void initInstitution() { @@ -242,9 +253,9 @@ public class FinancialManagerTest { private void mockGetSystemsInSessionForCompanyForSession(List<SystemInSession> forgedSystemsInSession) { PowerMockito.mockStatic(SystemInSession.class); PowerMockito.when(SystemInSession.getSystemsInSessionForCompanyForSession( - Mockito.<EntityManager>any(), - Mockito.<Institution>any(), - Mockito.<TestingSession>any())) + Mockito.<EntityManager>any(), + Mockito.<Institution>any(), + Mockito.<TestingSession>any())) .thenReturn(forgedSystemsInSession); } } \ No newline at end of file -- GitLab From 351611348c3a224ffb8ddcb92a3c418fbf0cf393 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Thu, 29 Aug 2024 11:02:53 +0200 Subject: [PATCH 55/77] Fixed test --- .../net/ihe/gazelle/menu/Authorizations.java | 23 +++++++++++-------- .../action/SystemInSessionEditorTest.java | 7 ++++-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Authorizations.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Authorizations.java index b697dde0d..952ea915e 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Authorizations.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Authorizations.java @@ -5,9 +5,9 @@ import net.ihe.gazelle.common.pages.AuthorizationAnd; import net.ihe.gazelle.common.pages.AuthorizationOr; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.authn.interlay.adapter.GazelleIdentityImpl; -import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.ssov7.gum.client.application.Role; import net.ihe.gazelle.ssov7.gum.client.application.User; +import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.tm.application.action.ApplicationManager; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; import net.ihe.gazelle.tm.session.TestingSessionService; @@ -20,7 +20,10 @@ import java.util.List; public class Authorizations { - private final static TestingSessionService testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + + static TestingSessionService getTestingSessionService(){ + return (TestingSessionService) Component.getInstance("testingSessionService"); + } public static final Authorization ALL = new Authorization() { @Override @@ -149,7 +152,7 @@ public class Authorizations { public boolean isGranted(Object... context) { return isUserAdminOfTestingSession( GazelleIdentityImpl.instance(), - testingSessionService.getCurrentTestingSession() + getTestingSessionService().getCurrentTestingSession() ); } } @@ -291,7 +294,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_CONTRACT = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = getTestingSessionService().getCurrentTestingSession(); return testingSession != null && testingSession.isContractRequired(); } }; @@ -299,7 +302,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_PRECAT = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = getTestingSessionService().getCurrentTestingSession(); return testingSession != null && testingSession.isEnablePrecatTests(); } }; @@ -310,7 +313,7 @@ public class Authorizations { new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = getTestingSessionService().getCurrentTestingSession(); return testingSession != null && testingSession.getAllowParticipantRegistration(); } } @@ -319,7 +322,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_INTEROPERABILITY = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = getTestingSessionService().getCurrentTestingSession(); return testingSession != null && testingSession.isTestingInteroperability(); } }; @@ -327,7 +330,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_MONITORS = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = getTestingSessionService().getCurrentTestingSession(); return testingSession != null && !testingSession.isSessionWithoutMonitors(); } }; @@ -335,7 +338,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_PATIENTS = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = getTestingSessionService().getCurrentTestingSession(); return testingSession != null && !testingSession.getDisablePatientGenerationAndSharing(); } }; @@ -343,7 +346,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_SAMPLE_SEARCH = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = getTestingSessionService().getCurrentTestingSession(); return testingSession != null && !testingSession.isHideAdvancedSampleSearchToVendors(); } }; diff --git a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditorTest.java b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditorTest.java index d11910dd9..099c9a264 100644 --- a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditorTest.java +++ b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditorTest.java @@ -8,6 +8,7 @@ import net.ihe.gazelle.menu.Authorizations; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.Role; import net.ihe.gazelle.ssov7.gum.client.application.User; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; @@ -41,7 +42,7 @@ public class SystemInSessionEditorTest { SystemInSessionEditor systemInSessionEditor; SystemInSessionEditor spiedSystemInSessionEditor; - private void mockStatics() { + private void mockStatics() throws Exception { if (mockedApplicationManager == null) { mockedApplicationManager = PowerMockito.mock(ApplicationPreferenceManager.class); @@ -51,6 +52,8 @@ public class SystemInSessionEditorTest { } if (mockedMonitorOrTsmOfSessionAuth == null) { + PowerMockito.spy(Authorizations.class); + PowerMockito.doReturn(PowerMockito.mock(TestingSessionService.class)).when(Authorizations.class,"getTestingSessionService"); mockedMonitorOrTsmOfSessionAuth = PowerMockito.mock(Authorizations.MONITOR_OR_TESTING_SESSION_ADMIN_OF_CURRENT_TESTING_SESSION.getClass()); Whitebox.setInternalState(Authorizations.class, "MONITOR_OR_TESTING_SESSION_ADMIN_OF_CURRENT_TESTING_SESSION", mockedMonitorOrTsmOfSessionAuth); @@ -58,7 +61,7 @@ public class SystemInSessionEditorTest { } @Before - public void setUp() { + public void setUp() throws Exception { //Prepare stubs ownerUser = new User(); ownerUser.setId("ownerUser"); -- GitLab From 26443a84857f02679fca1cec31b94c9091ee1342 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Thu, 29 Aug 2024 11:17:10 +0200 Subject: [PATCH 56/77] Fixed test --- .../application/action/GazellePreferenceProvider.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java index 232c6ef7c..d29a14f93 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java @@ -10,8 +10,6 @@ import net.ihe.gazelle.geoip.GeoIP; import net.ihe.gazelle.geoip.result.Location; import net.ihe.gazelle.preferences.PreferenceProvider; import net.ihe.gazelle.tm.session.TestingSessionService; -import net.ihe.gazelle.tm.session.TestingSessionServiceImpl; -import net.ihe.gazelle.tm.session.dao.TestingSessionServiceDAOImpl; import org.apache.commons.lang.StringUtils; import org.jboss.seam.Component; import org.jboss.seam.contexts.Contexts; @@ -33,10 +31,8 @@ public class GazellePreferenceProvider implements PreferenceProvider { private static final Logger LOG = LoggerFactory.getLogger(GazellePreferenceProvider.class); private final ApplicationPreferenceManager applicationPreferenceManager = new ApplicationPreferenceManagerImpl(); - private final TestingSessionService testingSessionService; - - public GazellePreferenceProvider() { - testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + static TestingSessionService getTestingSessionService() { + return (TestingSessionService) Component.getInstance("testingSessionService"); } @Override @@ -174,7 +170,7 @@ public class GazellePreferenceProvider implements PreferenceProvider { if (LOG.isDebugEnabled()) { LOG.debug("getValue"); } - return testingSessionService.getCurrentTestingSession(); + return getTestingSessionService().getCurrentTestingSession(); } }, null); } -- GitLab From 8248643726771589191ae796f044e3b0d8d55290 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Thu, 29 Aug 2024 17:46:52 +0200 Subject: [PATCH 57/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../net/ihe/gazelle/dao/SystemInSessionDAOImpl.java | 10 ++++++++-- .../net/ihe/gazelle/dao/SystemInSessionDAOTest.java | 7 ++++++- .../tm/systems/action/SystemInSessionEditorTest.java | 7 +++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/SystemInSessionDAOImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/SystemInSessionDAOImpl.java index 93982f479..25a8a45f1 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/SystemInSessionDAOImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/SystemInSessionDAOImpl.java @@ -7,11 +7,13 @@ import net.ihe.gazelle.common.model.PathLinkingADocument; import net.ihe.gazelle.common.util.File; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.ssov7.gum.client.interlay.factory.UserServiceFactory; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.SystemInSessionQuery; import net.ihe.gazelle.tm.systems.model.TestingSession; import org.apache.commons.io.IOUtils; +import org.jboss.seam.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -57,7 +59,7 @@ public class SystemInSessionDAOImpl implements SystemInSessionDAO { */ @Override public ArrayList<File> retrieveDicomConformanceStatementForSelectedSystemToViewOrEdit(SystemInSession - systemInSession) { + systemInSession) { LOG.debug("retrieveDicomConformanceStatementForSelectedSystemToViewOrEdit"); return findDocumentsFilesForSelectedSystem(applicationPreferenceManager.getGazelleDicomConformanceStatementsPath(), systemInSession.getSystem(), systemInSession.getSystem() .getPathsToDicomDocuments()); @@ -89,7 +91,7 @@ public class SystemInSessionDAOImpl implements SystemInSessionDAO { @Override public boolean isSystemInSessionRelatedToUser(SystemInSession systemInSession, String username) { - List<SystemInSession> listSis = getSystemInSessionRelatedToUser(username, TestingSession.getSelectedTestingSession()); + List<SystemInSession> listSis = getSystemInSessionRelatedToUser(username, getTestingSessionService().getCurrentTestingSession()); return listSis.contains(systemInSession); } @@ -107,4 +109,8 @@ public class SystemInSessionDAOImpl implements SystemInSessionDAO { } return q.getList(); } + + private static TestingSessionService getTestingSessionService() { + return (TestingSessionService) Component.getInstance("testingSessionService"); + } } diff --git a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/dao/SystemInSessionDAOTest.java b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/dao/SystemInSessionDAOTest.java index 62f1221da..76a334fa7 100644 --- a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/dao/SystemInSessionDAOTest.java +++ b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/dao/SystemInSessionDAOTest.java @@ -4,6 +4,7 @@ import net.ihe.gazelle.common.application.action.ApplicationPreferenceManager; import net.ihe.gazelle.hql.providers.EntityManagerService; import net.ihe.gazelle.ssov7.gum.client.application.Group; import net.ihe.gazelle.ssov7.gum.client.application.User; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.TestingSession; import org.junit.Before; @@ -22,7 +23,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @RunWith(PowerMockRunner.class) -@PrepareForTest({ApplicationPreferenceManager.class, EntityManagerService.class, TestingSession.class}) +@PrepareForTest({ApplicationPreferenceManager.class, EntityManagerService.class, TestingSession.class, SystemInSessionDAOImpl.class}) @PowerMockIgnore("javax.management.*") public class SystemInSessionDAOTest { @@ -46,6 +47,9 @@ public class SystemInSessionDAOTest { PowerMockito.mockStatic(EntityManagerService.class); PowerMockito.mockStatic(TestingSession.class); + TestingSessionService testingSessionServiceMock = PowerMockito.mock(TestingSessionService.class); + PowerMockito.spy(SystemInSessionDAOImpl.class); + PowerMockito.doReturn(testingSessionServiceMock).when(SystemInSessionDAOImpl.class, "getTestingSessionService"); user = new User(); user.setGroups(Collections.singleton(Group.GRP_TEST_DESIGNER)); @@ -55,6 +59,7 @@ public class SystemInSessionDAOTest { systemInSessionDAO = new SystemInSessionDAOImpl(); spiedSystemInSessionDAO = Mockito.spy(systemInSessionDAO); + } @Test diff --git a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditorTest.java b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditorTest.java index 099c9a264..b21b68ec9 100644 --- a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditorTest.java +++ b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditorTest.java @@ -29,7 +29,7 @@ import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; @RunWith(PowerMockRunner.class) -@PrepareForTest({ApplicationPreferenceManager.class, User.class, Role.class, Authorizations.class}) +@PrepareForTest({ApplicationPreferenceManager.class, User.class, Role.class, Authorizations.class, SystemInSessionDAOImpl.class}) @PowerMockIgnore("javax.management.*") public class SystemInSessionEditorTest { @@ -50,14 +50,17 @@ public class SystemInSessionEditorTest { PowerMockito.when(mockedApplicationManager.getGazelleHL7ConformanceStatementsPath()).thenReturn(""); PowerMockito.when(mockedApplicationManager.getGazelleDicomConformanceStatementsPath()).thenReturn(""); } + TestingSessionService testingSessionServiceMock = PowerMockito.mock(TestingSessionService.class); if (mockedMonitorOrTsmOfSessionAuth == null) { PowerMockito.spy(Authorizations.class); - PowerMockito.doReturn(PowerMockito.mock(TestingSessionService.class)).when(Authorizations.class,"getTestingSessionService"); + PowerMockito.doReturn(testingSessionServiceMock).when(Authorizations.class,"getTestingSessionService"); mockedMonitorOrTsmOfSessionAuth = PowerMockito.mock(Authorizations.MONITOR_OR_TESTING_SESSION_ADMIN_OF_CURRENT_TESTING_SESSION.getClass()); Whitebox.setInternalState(Authorizations.class, "MONITOR_OR_TESTING_SESSION_ADMIN_OF_CURRENT_TESTING_SESSION", mockedMonitorOrTsmOfSessionAuth); } + PowerMockito.spy(SystemInSessionDAOImpl.class); + PowerMockito.doReturn(testingSessionServiceMock).when(SystemInSessionDAOImpl.class, "getTestingSessionService"); } @Before -- GitLab From 62a65df9ca302f3f2f1b631344a84878800da73b Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 30 Aug 2024 09:20:24 +0200 Subject: [PATCH 58/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../action/AbstractSystemInSessionEditor.java | 345 +++++++++--------- .../systems/action/SystemInSessionCopier.java | 11 +- .../systems/action/SystemInSessionEditor.java | 6 +- .../action/SystemInSessionListManager.java | 1 + .../action/SystemInSessionNavigator.java | 18 +- .../systems/action/SystemInSessionViewer.java | 1 + 6 files changed, 196 insertions(+), 186 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionEditor.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionEditor.java index b59da4105..de912b852 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionEditor.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionEditor.java @@ -27,176 +27,177 @@ import java.util.List; */ public abstract class AbstractSystemInSessionEditor extends SystemInSessionNavigator { - protected static final String NO_ACTIVE_SESSION = "No Active Session !"; - - protected Institution institutionForCreation; - protected String defaultTab; - protected SystemInSession systemInSession = new SystemInSession(); - // List of all HL7 Conformance Statements (Documents) for a selected system - protected ArrayList<File> hl7DocumentsFilesForSelectedSystem = new ArrayList<File>(); - // List of all DICOM Conformance Statements (Documents) for a selected system - protected ArrayList<File> dicomDocumentsFilesForSelectedSystem = new ArrayList<File>(); - - @In - protected GazelleIdentity identity; - protected SystemInSessionDAO systemInSessionDAO = new SystemInSessionDAOImpl(); - - public static List<SystemType> getPossibleSystemTypes() { - SystemTypeQuery query = new SystemTypeQuery(); - HQLRestriction visibleTrue = query.visible().eqRestriction(true); - HQLRestriction visibleNull = query.visible().isNullRestriction(); - query.addRestriction(HQLRestrictions.or(visibleTrue, visibleNull)); - query.systemTypeKeyword().order(true); - return query.getList(); - } - - public void reloadSystemInSession() { - systemInSession = HQLReloader.reloadDetached(systemInSession); - } - - public SystemInSession getSystemInSession() { - return systemInSession; - } - - public void setSystemInSession(SystemInSession systemInSession) { - this.systemInSession = systemInSession; - } - - public ArrayList<File> getHl7DocumentsFilesForSelectedSystem() { - return hl7DocumentsFilesForSelectedSystem; - } - - public ArrayList<File> getDicomDocumentsFilesForSelectedSystem() { - return dicomDocumentsFilesForSelectedSystem; - } - - public abstract String getSystemInSessionKeywordBase(); - - public String getDefaultTab() { - if (defaultTab == null || defaultTab.isEmpty()) { - setDefaultTab("editSystemSummaryTab"); - } - return defaultTab; - } - - public void setDefaultTab(String defaultTab) { - this.defaultTab = defaultTab; - } - - public String goToSystemList() { - if (identity.hasRole(Role.ADMIN) || - Authorizations.TESTING_SESSION_ADMIN_OF_CURRENT_TESTING_SESSION.isGranted()) { - return Pages.REGISTRATION_SYSTEMS.getLink(); - } else { - return Pages.SINGLE_REGISTRATION.getLink(); - } - } - - public boolean userIsCreator(SystemInSession currentSystemInSession) { - String ownerUserName = currentSystemInSession.getSystem().getOwnerUserId(); - String userName = identity.getUsername(); - return ownerUserName.equals(userName); - } - - /** - * Reinitialize the list of Dicom Documents listed in the Dicom Conformance statement modal panel (method used when - * user clicks on 'Cancel' or for initialization) - */ - public void initializeDicomDocuments() { - this.dicomDocumentsFilesForSelectedSystem = systemInSessionDAO - .retrieveDicomConformanceStatementForSelectedSystemToViewOrEdit(systemInSession); - } - - /** - * Reinitialize the list of HL7 Documents listed in the HL7 Conformance statement modal panel (method used when user - * clicks on 'Cancel' or for initialization) - */ - public void initializeHL7Documents() { - this.hl7DocumentsFilesForSelectedSystem = systemInSessionDAO - .retrieveHL7ConformanceStatementForSelectedSystemToViewOrEdit(systemInSession); - } - - /** - * Show a Hl7 conformance statements document (clicking on a link) It calls a static method which performing job for - * all kind of docs (HL7, DICOM...) This method is in net.ihe.gazelle.common.util.DocumentFileUpload - * - * @param file name : File name of the conformance statements (without path) - */ - public void showHl7ConformanceStatementFile(String file) { - showConformanceStatementFile(file, systemInSessionDAO.getHl7ConformanceStatementsPath()); - } - - /** - * Show a DICOM conformance statements document (clicking on a link) It calls a static method which performing job - * for all kind of docs (HL7, DICOM...) This method is in net.ihe.gazelle.common.util.DocumentFileUpload - * - * @param file name : File name of the conformance statements (without path) - */ - public void showDicomConformanceStatementFile(String file) { - showConformanceStatementFile(file, systemInSessionDAO.getDicomConformanceStatementsPath()); - } - - private void showConformanceStatementFile(String file, String conformanceStatementsPath) { - String fullPath = conformanceStatementsPath + java.io.File.separatorChar + systemInSession.getSystem() - .getId() + java.io.File.separatorChar - + file; - net.ihe.gazelle.common.util.DocumentFileUpload.showFile(fullPath); - } - - public boolean canViewSystemNotes() { - if (identity.hasRole(Role.ADMIN) || identity.hasRole(Role.PROJECT_MANAGER) || - Authorizations.MONITOR_OR_TESTING_SESSION_ADMIN_OF_CURRENT_TESTING_SESSION.isGranted()) { - return true; - } - return isUserRelatedToSystemOrga(); - } - - - public boolean canEditSystemInSession() { - if (identity.hasRole(Role.ADMIN)) { - return true; - } - return isUserRelatedToSystemOrga() && - (isRegistrationOpened() || isLateRegistrationGranted()) && - isUserCreatorOrVendorAdmin(); - } - - private boolean isUserCreatorOrVendorAdmin() { - return userIsCreator(systemInSession) || identity.hasRole(Role.VENDOR_ADMIN); - } - - private boolean isUserRelatedToSystemOrga() { - return systemInSessionDAO.isSystemInSessionRelatedToUser(systemInSession, identity.getUsername()); - } - - private boolean isRegistrationOpened() { - return systemInSession.getTestingSession().isRegistrationOpened(); - } - - private boolean isLateRegistrationGranted() { - return identity.hasRole(Role.VENDOR_LATE_REGISTRATION) && !systemInSession.getTestingSession().isClosed(); - } - - /** - * Copy apio from <b>systemFrom</b> to <b>newSystem</b> - * - * @param systemFrom system containing AIPO - * @param newSystem system to copy AIPO - */ - protected void linkAIPO(System systemFrom, System newSystem) { - List<SystemActorProfiles> listSAP = SystemActorProfiles.getListOfActorIntegrationProfileOptionsWithTestingDepth( - systemFrom, TestingSession.getSelectedTestingSession()); - - EntityManager entityManager = EntityManagerService.provideEntityManager(); - - for (int elementAIPO = 0; elementAIPO < listSAP.size(); elementAIPO++) { - SystemActorProfiles newSAP = new SystemActorProfiles(); - newSAP.setSystem(newSystem); - newSAP.setActorIntegrationProfileOption(entityManager.find(ActorIntegrationProfileOption.class, listSAP - .get(elementAIPO).getActorIntegrationProfileOption().getId())); - newSAP.setTestingDepth(AuditedObject.getObjectByKeyword(TestingDepth.class, "T")); - entityManager.merge(newSAP); - } - entityManager.flush(); - } + protected static final String NO_ACTIVE_SESSION = "No Active Session !"; + + protected Institution institutionForCreation; + protected String defaultTab; + protected SystemInSession systemInSession = new SystemInSession(); + // List of all HL7 Conformance Statements (Documents) for a selected system + protected ArrayList<File> hl7DocumentsFilesForSelectedSystem = new ArrayList<File>(); + // List of all DICOM Conformance Statements (Documents) for a selected system + protected ArrayList<File> dicomDocumentsFilesForSelectedSystem = new ArrayList<File>(); + + @In + protected GazelleIdentity identity; + protected SystemInSessionDAO systemInSessionDAO = new SystemInSessionDAOImpl(); + + + public static List<SystemType> getPossibleSystemTypes() { + SystemTypeQuery query = new SystemTypeQuery(); + HQLRestriction visibleTrue = query.visible().eqRestriction(true); + HQLRestriction visibleNull = query.visible().isNullRestriction(); + query.addRestriction(HQLRestrictions.or(visibleTrue, visibleNull)); + query.systemTypeKeyword().order(true); + return query.getList(); + } + + public void reloadSystemInSession() { + systemInSession = HQLReloader.reloadDetached(systemInSession); + } + + public SystemInSession getSystemInSession() { + return systemInSession; + } + + public void setSystemInSession(SystemInSession systemInSession) { + this.systemInSession = systemInSession; + } + + public ArrayList<File> getHl7DocumentsFilesForSelectedSystem() { + return hl7DocumentsFilesForSelectedSystem; + } + + public ArrayList<File> getDicomDocumentsFilesForSelectedSystem() { + return dicomDocumentsFilesForSelectedSystem; + } + + public abstract String getSystemInSessionKeywordBase(); + + public String getDefaultTab() { + if (defaultTab == null || defaultTab.isEmpty()) { + setDefaultTab("editSystemSummaryTab"); + } + return defaultTab; + } + + public void setDefaultTab(String defaultTab) { + this.defaultTab = defaultTab; + } + + public String goToSystemList() { + if (identity.hasRole(Role.ADMIN) || + Authorizations.TESTING_SESSION_ADMIN_OF_CURRENT_TESTING_SESSION.isGranted()) { + return Pages.REGISTRATION_SYSTEMS.getLink(); + } else { + return Pages.SINGLE_REGISTRATION.getLink(); + } + } + + public boolean userIsCreator(SystemInSession currentSystemInSession) { + String ownerUserName = currentSystemInSession.getSystem().getOwnerUserId(); + String userName = identity.getUsername(); + return ownerUserName.equals(userName); + } + + /** + * Reinitialize the list of Dicom Documents listed in the Dicom Conformance statement modal panel (method used when + * user clicks on 'Cancel' or for initialization) + */ + public void initializeDicomDocuments() { + this.dicomDocumentsFilesForSelectedSystem = systemInSessionDAO + .retrieveDicomConformanceStatementForSelectedSystemToViewOrEdit(systemInSession); + } + + /** + * Reinitialize the list of HL7 Documents listed in the HL7 Conformance statement modal panel (method used when user + * clicks on 'Cancel' or for initialization) + */ + public void initializeHL7Documents() { + this.hl7DocumentsFilesForSelectedSystem = systemInSessionDAO + .retrieveHL7ConformanceStatementForSelectedSystemToViewOrEdit(systemInSession); + } + + /** + * Show a Hl7 conformance statements document (clicking on a link) It calls a static method which performing job for + * all kind of docs (HL7, DICOM...) This method is in net.ihe.gazelle.common.util.DocumentFileUpload + * + * @param file name : File name of the conformance statements (without path) + */ + public void showHl7ConformanceStatementFile(String file) { + showConformanceStatementFile(file, systemInSessionDAO.getHl7ConformanceStatementsPath()); + } + + /** + * Show a DICOM conformance statements document (clicking on a link) It calls a static method which performing job + * for all kind of docs (HL7, DICOM...) This method is in net.ihe.gazelle.common.util.DocumentFileUpload + * + * @param file name : File name of the conformance statements (without path) + */ + public void showDicomConformanceStatementFile(String file) { + showConformanceStatementFile(file, systemInSessionDAO.getDicomConformanceStatementsPath()); + } + + private void showConformanceStatementFile(String file, String conformanceStatementsPath) { + String fullPath = conformanceStatementsPath + java.io.File.separatorChar + systemInSession.getSystem() + .getId() + java.io.File.separatorChar + + file; + net.ihe.gazelle.common.util.DocumentFileUpload.showFile(fullPath); + } + + public boolean canViewSystemNotes() { + if (identity.hasRole(Role.ADMIN) || identity.hasRole(Role.PROJECT_MANAGER) || + Authorizations.MONITOR_OR_TESTING_SESSION_ADMIN_OF_CURRENT_TESTING_SESSION.isGranted()) { + return true; + } + return isUserRelatedToSystemOrga(); + } + + + public boolean canEditSystemInSession() { + if (identity.hasRole(Role.ADMIN)) { + return true; + } + return isUserRelatedToSystemOrga() && + (isRegistrationOpened() || isLateRegistrationGranted()) && + isUserCreatorOrVendorAdmin(); + } + + private boolean isUserCreatorOrVendorAdmin() { + return userIsCreator(systemInSession) || identity.hasRole(Role.VENDOR_ADMIN); + } + + private boolean isUserRelatedToSystemOrga() { + return systemInSessionDAO.isSystemInSessionRelatedToUser(systemInSession, identity.getUsername()); + } + + private boolean isRegistrationOpened() { + return systemInSession.getTestingSession().isRegistrationOpened(); + } + + private boolean isLateRegistrationGranted() { + return identity.hasRole(Role.VENDOR_LATE_REGISTRATION) && !systemInSession.getTestingSession().isClosed(); + } + + /** + * Copy apio from <b>systemFrom</b> to <b>newSystem</b> + * + * @param systemFrom system containing AIPO + * @param newSystem system to copy AIPO + */ + protected void linkAIPO(System systemFrom, System newSystem) { + List<SystemActorProfiles> listSAP = SystemActorProfiles.getListOfActorIntegrationProfileOptionsWithTestingDepth( + systemFrom, getTestingSessionService().getCurrentTestingSession()); + + EntityManager entityManager = EntityManagerService.provideEntityManager(); + + for (int elementAIPO = 0; elementAIPO < listSAP.size(); elementAIPO++) { + SystemActorProfiles newSAP = new SystemActorProfiles(); + newSAP.setSystem(newSystem); + newSAP.setActorIntegrationProfileOption(entityManager.find(ActorIntegrationProfileOption.class, listSAP + .get(elementAIPO).getActorIntegrationProfileOption().getId())); + newSAP.setTestingDepth(AuditedObject.getObjectByKeyword(TestingDepth.class, "T")); + entityManager.merge(newSAP); + } + entityManager.flush(); + } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCopier.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCopier.java index d194ff373..b816f0d0f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCopier.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCopier.java @@ -4,7 +4,6 @@ import net.ihe.gazelle.common.interfacegenerator.GenerateInterface; import net.ihe.gazelle.common.log.ExceptionLogging; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.tm.financial.action.FinancialManager; -import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.users.model.Institution; @@ -53,8 +52,6 @@ public class SystemInSessionCopier extends AbstractSystemInSessionEditor impleme private List<Pair<Boolean, System>> previousSystems; private Institution choosenInstitutionForAdmin; - @In(value = "testingSessionService") - private transient TestingSessionService testingSessionService; @Override public String getSystemInSessionKeywordBase() { @@ -167,7 +164,7 @@ public class SystemInSessionCopier extends AbstractSystemInSessionEditor impleme } private void calculateFinancialSummaryDTO() { - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = getTestingSessionService().getCurrentTestingSession(); this.calculateFinancialSummaryDTOByTestingSession(activatedTestingSession); } @@ -195,7 +192,7 @@ public class SystemInSessionCopier extends AbstractSystemInSessionEditor impleme ExceptionLogging.logException(e, LOG); FacesMessages.instance().add(StatusMessage.Severity.ERROR, "Error persisting the new system, maybe a system keyword " + system.getKeyword() + "_For_" - + testingSessionService.getCurrentTestingSession().getName() + " already exists"); + + getTestingSessionService().getCurrentTestingSession().getName() + " already exists"); } } @@ -232,7 +229,7 @@ public class SystemInSessionCopier extends AbstractSystemInSessionEditor impleme while (sysKeywordIsNotUnique) { try { sysKeywordIsNotUnique = !SystemInSessionValidator.validateSystemKeywordStatic(newSystem.getKeyword(), newSuffix, newSystem, - (GazelleIdentity) Component.getInstance("org.jboss.seam.security.identity")); + (GazelleIdentity) Component.getInstance("org.jboss.seam.security.identity")); } catch (SystemActionException e) { if (LOG.isInfoEnabled()) { LOG.info("Validate - " + newSystem.getKeyword() + NEW_SUFFIX + newSuffix + NEW_KEY + newKey + KEY_STRING @@ -274,7 +271,7 @@ public class SystemInSessionCopier extends AbstractSystemInSessionEditor impleme TableSession tableSession = TableSession.getTableSessionByKeyword(TableSession.getDEFAULT_TABLE_SESSION_STRING()); SystemInSessionStatus systemInSessionStatus = SystemInSessionStatus.getSTATUS_NOT_HERE_YET(); SystemInSession newSysInSess = new SystemInSession(tableSession, newSystem, - testingSessionService.getCurrentTestingSession(), null, systemInSessionStatus); + getTestingSessionService().getCurrentTestingSession(), null, systemInSessionStatus); // The copied system status need to be set to IN_PROGRESS newSysInSess.setRegistrationStatus(SystemInSessionRegistrationStatus.IN_PROGRESS); // The copied system is set to true diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditor.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditor.java index 296ed2766..cd2c62d40 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditor.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditor.java @@ -7,7 +7,6 @@ import net.ihe.gazelle.ssov7.gum.client.application.User; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.ssov7.gum.client.interlay.client.utils.UserSearchParams; import net.ihe.gazelle.tm.application.action.ApplicationManager; -import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.SystemSummary; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; @@ -44,14 +43,13 @@ public class SystemInSessionEditor extends AbstractSystemInSessionEditor impleme private static final Logger LOG = LoggerFactory.getLogger(SystemInSessionEditor.class); // Number Max of downloads allowed private static final int MAX_UPLOADS = 5; + private static final long serialVersionUID = -6939192790701871992L; @In private EntityManager entityManager; @In(value = "gumUserService") private UserService userService; - @In(value = "testingSessionService") - private transient TestingSessionService testingSessionService; private SystemInSessionModifier sisModifier; private SystemSubtypesPerSystemType systemSubtypesPerSystemType; @@ -484,7 +482,7 @@ public class SystemInSessionEditor extends AbstractSystemInSessionEditor impleme @Restrict("#{s:hasPermission('SystemInSessionEditor', 'editSystem', null)}") public void editSystem() { LOG.debug("editSystem"); - if (testingSessionService.getCurrentTestingSession() == null) { + if (getTestingSessionService().getCurrentTestingSession() == null) { LOG.error(NO_ACTIVE_SESSION); StatusMessages.instance().addFromResourceBundle(StatusMessage.Severity.ERROR, "gazelle.systems.error" + ".noActivatedTestingSession"); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionListManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionListManager.java index b359dbd3b..75a340e6e 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionListManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionListManager.java @@ -63,6 +63,7 @@ import static org.jboss.seam.ScopeType.PAGE; public class SystemInSessionListManager extends AbstractSystemInSessionEditor implements Serializable, SystemInSessionListManagerLocal { private static final Logger LOG = LoggerFactory.getLogger(SystemInSessionListManager.class); + private static final long serialVersionUID = -9119983737419317076L; @In private EntityManager entityManager; diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionNavigator.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionNavigator.java index 9fb1f1a6d..3395ed583 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionNavigator.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionNavigator.java @@ -1,10 +1,12 @@ package net.ihe.gazelle.tm.systems.action; import net.ihe.gazelle.menu.Authorizations; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.SystemInSessionQuery; -import net.ihe.gazelle.tm.systems.model.TestingSession; import org.apache.commons.lang.StringUtils; +import org.jboss.seam.Component; +import org.jboss.seam.annotations.In; import org.jboss.seam.faces.Redirect; import org.jboss.seam.faces.RedirectException; import org.jboss.seam.international.StatusMessage; @@ -18,6 +20,16 @@ public class SystemInSessionNavigator { private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(SystemInSessionNavigator.class); private static final String NO_ACTIVE_SESSION = "No Active Session !!!!!!!"; + @In(value = "testingSessionService") + private TestingSessionService testingSessionService; + + protected TestingSessionService getTestingSessionService() { + if (testingSessionService == null) + return (TestingSessionService) Component.getInstance("testingSessionService"); + else + return testingSessionService; + } + /** * Add a new system action (from the management list or from the menu bar) This operation is allowed for some granted users (check the security * .drl) (This does not add a button, but rather adds a @@ -75,7 +87,7 @@ public class SystemInSessionNavigator { public String manageAllSystemActions() { LOG.debug("manageAllSystemActions"); - if (TestingSession.getSelectedTestingSession() == null) { + if (getTestingSessionService() == null) { LOG.error(NO_ACTIVE_SESSION); StatusMessages.instance().addFromResourceBundle(StatusMessage.Severity.ERROR, "gazelle.systems.error.noActivatedTestingSession"); } @@ -132,7 +144,7 @@ public class SystemInSessionNavigator { } } - public String backToRegistrationRedirect(){ + public String backToRegistrationRedirect() { return "/registration/registration.seam"; } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionViewer.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionViewer.java index 4f7c98b46..ff6282381 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionViewer.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionViewer.java @@ -37,6 +37,7 @@ import static org.jboss.seam.ScopeType.PAGE; public class SystemInSessionViewer extends AbstractSystemInSessionEditor implements Serializable, SystemInSessionViewerLocal { private static final Logger LOG = LoggerFactory.getLogger(SystemInSessionViewer.class); private static final String SEPARATOR = " - "; + private static final long serialVersionUID = -3260596480498963438L; @In private EntityManager entityManager; -- GitLab From 54b5b945cfc56786c0198acc8734434c523d14cc Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 30 Aug 2024 11:30:25 +0200 Subject: [PATCH 59/77] Removed unused file --- .../src/main/webapp/objects/sample.xhtml.old | 522 ------------------ 1 file changed, 522 deletions(-) delete mode 100644 gazelle-tm-war/src/main/webapp/objects/sample.xhtml.old diff --git a/gazelle-tm-war/src/main/webapp/objects/sample.xhtml.old b/gazelle-tm-war/src/main/webapp/objects/sample.xhtml.old deleted file mode 100644 index 991bfa1fb..000000000 --- a/gazelle-tm-war/src/main/webapp/objects/sample.xhtml.old +++ /dev/null @@ -1,522 +0,0 @@ -<!-- - * Copyright 2009 IHE International (http://www.ihe.net) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - --> -<!-- File : sample - @author Abderrazek Boufahja/ INRIA Rennes - IHE development Project - @see > aboufahj@irisa.fr - http://www.ihe-europe.org - --> - -<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<ui:composition xmlns="http://www.w3.org/1999/xhtml" - xmlns:s="http://jboss.com/products/seam/taglib" - xmlns:ui="http://java.sun.com/jsf/facelets" - xmlns:f="http://java.sun.com/jsf/core" - xmlns:h="http://java.sun.com/jsf/html" - xmlns:rich="http://richfaces.ajax4jsf.org/rich" - xmlns:a4j="http://richfaces.org/a4j" - xmlns:g="http://www.ihe.net/gazelle" template="/layout/template.xhtml"> - - <ui:param name="pageNameTitle" - value="#{messages['gazelle.testmanagement.object.SampleDescription']}" /> - - <ui:define name="header"> - <a4j:loadStyle src="/stylesheet/resultStyle.css" /> - </ui:define> - - <ui:define name="body"> - - <a4j:form id="form"> - <s:token allowMultiplePosts="true" /> - <a4j:queue requestDelay="300" ignoreDupResponses="true" /> - <s:decorate id="messageDecoration"> - <h:messages globalOnly="true" styleClass="message" /> - </s:decorate> - <rich:panel id="sampleGlobalPanel"> - <f:facet name="header" id="headerOfPanel">#{messages['gazelle.testmanagement.object.DescriptionOfASample']}</f:facet> - <s:div id="descpanel" - rendered="#{sampleDisplayManager.selectedObjectInstance != null}"> - <s:div - rendered="#{!sampleDisplayManager.selectedObjectInstanceExistsOnDisc}"> - <h:outputText - value="#{messages['net.ihe.gazelle.tm.TheActualSampleHasMissingFilesOnTheServerThankYo']}" - style="font-weight:bold;color:red;" /> - </s:div> - <h:outputText - value="#{messages['gazelle.testmanagement.object.SampleName']} : " - style="font-weight:bold;color:#000099;" /> - <h:outputText - value="#{sampleDisplayManager.selectedObjectInstance.name}" - style="font-weight:bold;color:#0077aa;" /> - <br /> - <h:outputText value="#{messages['gazelle.tf.table.Id']} : " - style="font-weight:bold;color:#000099;" /> - <h:outputText - value="#{sampleDisplayManager.selectedObjectInstance.id}" /> - <br /> - <h:outputText - value="#{messages['gazelle.testmanagement.object.SampleType']} : " - style="font-weight:bold;color:#000099;" /> - <h:outputText - value="#{sampleDisplayManager.selectedObjectInstance.object.keyword}" /> - <br /> - <h:outputText - value="#{messages['gazelle.testmanagement.object.SystemInSessionCreator']} : " - style="font-weight:bold;color:#000099;" /> - <h:outputText - value="#{sampleDisplayManager.selectedObjectInstance.system.system.keyword}" /> - <br /> - <h:outputText - value="#{messages['gazelle.users.user.UserInstitution']} : " - style="font-weight:bold;color:#000099;" /> - <h:outputText - value="#{sampleDisplayManager.getInstitution(sampleDisplayManager.selectedObjectInstance)}" /> - <br /> - <h:outputText - value="#{messages['gazelle.testmanagement.object.CreationDate']} : " - style="font-weight:bold;color:#000099;" /> - <g:date tooltip="true" - value="#{sampleDisplayManager.selectedObjectInstance.lastChanged}" /> - <br /> - - <h:outputText value="#{messages['gazelle.tf.Usage']} : " - style="font-weight:bold;color:#000099;" /> - <h:outputText - value="#{sampleDisplayManager.selectedObjectInstance.objectUsageType.keyword}" /> - <br /> - - <h:outputText - value="#{messages['gazelle.tm.testing.instance.description']} : " - style="font-weight:bold;color:#000099;" /> - <br /> - <g:safehtml - value="#{sampleDisplayManager.selectedObjectInstance.description}" /> - <br /> - <br /> - <h:outputText - value="# #{messages['gazelle.testmanagement.object.ListOfFile']}" - style="font-weight:bold;color:#000099;" /> - <br /> - <br /> - - <rich:dataList id="listOfNonSnapshot" - var="currentObjectInstanceFile" - rendered="#{sampleDisplayManager.selectedObjectInstanceExistsOnDisc}" - value="#{sampleDisplayManager.getListObjectInstanceFileWhichAreNotSnapshot(sampleDisplayManager.selectedObjectInstance)}"> - <h:outputText - value="#{currentObjectInstanceFile.file.type.keyword} : " /> - <h:commandLink id="downloadCommandLink" - value="#{currentObjectInstanceFile.url}" - action="#{sampleDisplayManager.displayFileOnScreen(currentObjectInstanceFile,false)}" - target="_blank"> - <a4j:support event="onclick" immediate="true" ajaxSingle="true" /> - </h:commandLink> - <rich:spacer width="5" /> - <h:commandLink id="NonDicomFileCommandLink" - action="#{sampleDisplayManager.displayFileOnScreen(currentObjectInstanceFile,true)}" - target="_blank"> - <a4j:support event="onclick" immediate="true" ajaxSingle="true" /> - <h:graphicImage id="downloadNonDicomFile" - value="/img/icon-color-download.gif" width="15" height="15" - style="cursor:pointer;border:0;" - title="#{messages['gazelle.testmanagement.object.Download']}" /> - </h:commandLink> - - <h:outputText value="button for validation here"/> - </rich:dataList> - - <a4j:repeat id="listOfSnapshotForCreator" - var="currentObjectInstanceFile" - rendered="#{sampleDisplayManager.selectedObjectInstanceExistsOnDisc}" - value="#{sampleDisplayManager.getListObjectInstanceFileWhichAreSnapshot(sampleDisplayManager.selectedObjectInstance)}"> - <h:commandLink id="viewSnapshotOnOtherTab" - action="#{sampleDisplayManager.displayFileOnScreen(currentObjectInstanceFile,false)}" - target="_blank"> - <a4j:support event="onclick" immediate="true" ajaxSingle="true" /> - <s:graphicImage id="OpensnapshotOnNewTab" - value="#{sampleDisplayManager.getSnapshotThumbnailFile(currentObjectInstanceFile)}" - style="border:0px;cursor:pointer;" - title="#{currentObjectInstanceFile.url}" - rendered="#{sampleDisplayManager.getSnapshotThumbnailFile(currentObjectInstanceFile) != null}"> - </s:graphicImage> - </h:commandLink> - <br /> - <rich:spacer height="3" style="border:0;" /> - <br /> - </a4j:repeat> - - <rich:dataList var="currentObjectInstanceFile" - rendered="#{!sampleDisplayManager.selectedObjectInstanceExistsOnDisc}" - value="#{sampleDisplayManager.getListInstanceFileFromObjectInstance(sampleDisplayManager.selectedObjectInstance)}"> - <h:outputText - value="#{currentObjectInstanceFile.file.type.keyword} : " /> - <h:outputText value="#{currentObjectInstanceFile.url}" /> - </rich:dataList> - <br /> - - <h:outputText - value="# #{messages['gazelle.testmanagement.object.ListOfAttriute']}" - style="font-weight:bold;color:#000099;" /> - <br /> - <rich:dataList id="listOfAttribute" var="currentInstanceAttribute" - value="#{sampleDisplayManager.getListInstanceAttributeFromObjectInstance(sampleDisplayManager.selectedObjectInstance)}"> - <h:outputText - value="#{currentInstanceAttribute.attribute.keyword}" /> - </rich:dataList> - <br /> - - <!-- tree of objects added by readers --> - <br /> - <h:outputText - value="#{messages['gazelle.testmanagement.object.ListFilesUploadedReaders']} :" - style="font-weight:bold;color:#000099;" /> - <rich:tree id="TreeOfSampleOfReader" - value="#{sampleDisplayManager.getTreeNodeOfReaderInstanceFile(sampleDisplayManager.selectedObjectInstance)}" - switchType="client" var="node" nodeFace="#{node.class.simpleName}" - style="vertical-align:top"> - <rich:treeNode type="SystemInSession" - iconLeaf="/img/icons64/systems.gif" - icon="/img/icons64/systems.gif" width="15" height="15"> - <h:outputText value="#{node.system.keyword}" /> - </rich:treeNode> - <rich:treeNode type="ObjectInstanceFile" iconLeaf="/img/disc.gif" - icon="/img/disc.gif" width="15" height="15"> - <h:commandLink id="downloadCommandLinkOnR" - value="#{node.file.type.keyword} : #{node.url}" - action="#{sampleDisplayManager.displayFileOnScreen(node,false)}" - target="_blank"> - <a4j:support event="onclick" immediate="true" ajaxSingle="true" /> - </h:commandLink> - <rich:spacer width="5" /> - <h:commandLink id="NonDicomFileCommandLinkOnR" - action="#{sampleDisplayManager.displayFileOnScreen(node,true)}" - target="_blank"> - <a4j:support event="onclick" immediate="true" ajaxSingle="true" /> - <h:graphicImage id="downloadNonDicomFileOnR" - value="/img/icon-color-download.gif" width="15" height="15" - style="cursor:pointer;border:0;" - title="#{messages['gazelle.testmanagement.object.Download']}" /> - </h:commandLink> - - <h:outputText value="button for validation here"/> - </rich:treeNode> - </rich:tree> - <br /> - <!-- Comment of readers --> - <br /> - <h:outputText - value="#{messages['gazelle.testmanagement.object.CommentOfReaders']}" - style="font-weight:bold;color:#000099;" /> - <rich:spacer width="5" /> - <a4j:commandLink id="AddCommmentByCreator" - oncomplete="#{rich:component('CommentSampleModal')}.show();" - rendered="#{sampleDisplayManager.currentUserCanAddCommentSample()}" - immediate="true" ajaxSingle="true"> - <h:graphicImage id="AddCommentByCImg" value="/img/add.gif" - width="15" height="15" style="cursor:pointer;border:0;" - title="#{messages['gazelle.testmanagement.object.CommentSample']}" /> - </a4j:commandLink> - <br /> - <s:div id="helloword"> - <s:div style="width:100%;" id="helloword1" - rendered="#{sampleDisplayManager.getReadersDescriptionsOnCreate().size() > 0}"> - <rich:dataTable id="AnnotationForReaderOnCreate" - var="currentAnnotation" - value="#{sampleDisplayManager.getReadersDescriptionsOnCreate()}" - rowKeyVar="rowNumber" reRender="ds" - onRowMouseOver="this.style.backgroundColor='#94C2E6'" - onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" - rows="#{dataScrollerMemory.numberOfResultsPerPage}" width="600"> - - <rich:column id="AnnotationDateOnCreate" width="25%" - sortBy="#{currentAnnotation.lastChanged.time}" - sortOrder="DESCENDING"> - <f:facet name="header">#{messages['gazelle.testmanagement.object.CreationDate']}</f:facet> - <g:date tooltip="true" value="#{currentAnnotation.lastChanged}" /> - </rich:column> - - <rich:column id="AnnotationModifierOnCreate" - filterBy="#{currentAnnotation.lastModifierId}" - filterEvent="onkeyup" - sortBy="#{currentAnnotation.lastModifierId}" - sortOrder="ASCENDING" width="25%"> - <f:facet name="header">#{messages['gazelle.tm.search.user']}</f:facet> - <h:outputText value="#{currentAnnotation.lastModifierId}" /> - </rich:column> - - <rich:column id="AnnotationValueOnCreate" style="width:40%;" - sortBy="#{currentAnnotation.value}" sortOrder="ASCENDING"> - <f:facet name="header">#{messages['gazelle.testmanagement.object.Note']}</f:facet> - <h:outputText value="#{currentAnnotation.value}" /> - </rich:column> - - <rich:column id="ActionOnRead" style="width:10%;"> - <f:facet name="header">#{messages['gazelle.testmanagement.object.Action']}</f:facet> - <center> - <h:graphicImage id="deleteAnnotationIdRead" - value="/img/icons64/deleteRedJR.gif" width="15" height="15" - style="cursor:pointer" - rendered="#{sampleDisplayManager.viewDeleteImg(currentAnnotation)}"> - <a4j:support id="DeleteCommentOfUserRead" event="onclick" - actionListener="#{sampleDisplayManager.setSelectedAnnotation(currentAnnotation)}" - oncomplete="#{rich:component('DeleteAnnotationPanel')}.show();" - immediate="true" ajaxSingle="true" /> - </h:graphicImage> - - <rich:toolTip for="deleteAnnotationIdRead"> - <span style="white-space: nowrap;"> - #{messages['gazelle.testmanagement.object.DeleteAnnotation']} - </span> - </rich:toolTip> - - <h:graphicImage id="editobjann2" value="/img/icons64/edit.gif" - width="15" height="15" title="#{messages['gazelle.tm.Edit']}" - style="cursor:pointer" - rendered="#{sampleDisplayManager.viewDeleteImg(currentAnnotation)}"> - <a4j:support event="onclick" ajaxSingle="true" - reRender="EditSelectedAnnotation" - actionListener="#{sampleDisplayManager.setSelectedAnnotation(currentAnnotation) }" - oncomplete="#{rich:component('EditSelectedAnnotation')}.show();" /> - </h:graphicImage> - </center> - </rich:column> - - <f:facet name="footer"> - <ui:include src="/util/datatableFooter.xhtml"> - <ui:param name="dataScrollerId" value="ds" /> - <ui:param name="dataTableId" - value="AnnotationForReaderOnCreate" /> - </ui:include> - </f:facet> - </rich:dataTable> - <br /> - </s:div> - <s:div - rendered="#{sampleDisplayManager.getReadersDescriptionsOnCreate().size() == 0}"> - <h:outputText id="emptyAnnotationOnCreate" - value="#{messages['gazelle.tm.ThereAreNoCommentsFromUsersOfThisSample']}." /> - </s:div> - </s:div> - <br /> - - <h:outputText - value="#{messages['gazelle.testmanagement.object.SampleReady']}" - rendered="#{sampleDisplayManager.selectedObjectInstance.completed}" /> - <h:outputText - value="#{messages['gazelle.testmanagement.object.SampleNotReady']}" - rendered="#{!sampleDisplayManager.selectedObjectInstance.completed}" - style="color:#aa0000;" /> - <br /> - - <s:decorate id="ValidationDecoration" template="/layout/form/edit.xhtml" - rendered="#{s:hasRole('admin_role')|| s:hasRole('monitor_role')}"> - <ui:define name="label">#{messages['gazelle.testmanagement.object.Validation']}</ui:define> - <h:selectOneMenu styleClass="form-control gzl-form-control" id="ValidationBox" - value="#{sampleDisplayManager.selectedObjectInstance.validation}" - style="font-weight:bold;text-align:center;"> - <s:selectItems id="ListValidationOptions" - value="#{sampleDisplayManager.possibleValidationOptions}" - var="validationOption" - noSelectionLabel="#{messages['gazelle.common.PleaseSelect']}" - label="#{validationOption.value}" /> - <a4j:support event="onchange" - actionListener="#{sampleDisplayManager.mergeTheNewValidationOfSample(sampleDisplayManager.selectedObjectInstance)}" - reRender="messageDecoration,helloword" ajaxSingle="true" /> - </h:selectOneMenu> - </s:decorate> - - </s:div> - <s:div id="descpanelNull" - rendered="#{sampleDisplayManager.selectedObjectInstance == null}"> - <h:outputText - value="#{messages['gazelle.testmanagement.object.ProblemIdNotGoodFormat']}" - style="color:#DD0000;" /> - </s:div> - - <s:div id="editbutdiv" - rendered="#{sampleDisplayManager.currentUserCanEditSample()}"> - <a4j:commandButton styleClass="btn btn-default" - id="EditObjectInstanceButton" - value="#{messages['gazelle.testmanagement.object.EditSample']}" - actionListener="#{objectInstanceManager.initializeObjectInstanceAndReturnToSample(sampleDisplayManager.selectedObjectInstance)}" - action="/objects/EditSample.xhtml" - reRender="TreeOfSample,objectInstanceCreatorPage" - rendered="#{sampleDisplayManager.canEditSampleByCreator()}" - immediate="true" ajaxSingle="true" /> - </s:div> - - </rich:panel> - - </a4j:form> - - <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --> - <!-- Edit selected annotation --> - <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --> - <rich:modalPanel id="EditSelectedAnnotation" - onbeforeshow="ActiveModal.setActiveModalPanel('EditSelectedAnnotation')" - width="400" height="160" onshow="autofocus('CommeannFC')"> - - <f:facet name="header"> - <h:outputText - value="#{messages['gazelle.testmanagement.object.EditAnnotation']}" /> - </f:facet> - <f:facet name="controls"> - <h:graphicImage id="CommeeegeFC" - alt="#{messages['gazelle.common.button.mp.close']}" - value="/img/modal/close.gif" style="cursor:pointer" height="14" - width="14" - onclick="Richfaces.hideModalPanel('EditSelectedAnnotation')" /> - </f:facet> - - <s:decorate id="CommeannFC"> - - <a4j:form id="CommsdfrmFC"> - <s:token allowMultiplePosts="true" /> - <rich:panel id="CommentSampleModalPanelFC"> - <s:div id="CommentValDecorationFC" template="/layout/form/edit.xhtml" - rendered="#{sampleDisplayManager.selectedAnnotation != null}"> - <h:outputText - value="#{messages['gazelle.testmanagement.object.Comment']} : " - style="font-weight:bold;" /> - <br /> - <center> - <h:inputTextarea id="CommentEditorIdFC" - value="#{sampleDisplayManager.selectedAnnotation.value}" rows="3" - cols="35"> - </h:inputTextarea> - </center> - </s:div> - - <div id="saceCommentDivFC" align="right"> - - <a4j:commandButton id="saveCommentbuttonFC" - value="#{messages['gazelle.common.button.Save']}" - styleClass="btn btn-default" - reRender="helloword,messageDecoration" - actionListener="#{sampleDisplayManager.saveModificationsForSelectedAnnotation()}" - onclick="Richfaces.hideModalPanel('EditSelectedAnnotation');" /> - - <a4j:commandButton - value="#{messages['gazelle.common.button.Cancel']}" - onclick="Richfaces.hideModalPanel('EditSelectedAnnotation')" - styleClass="btn btn-default" ajaxSingle="true" /> - </div> - - </rich:panel> - </a4j:form> - </s:decorate> - </rich:modalPanel> - - <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --> - <!-- Delete selected Annotation--> - <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --> - <rich:modalPanel id="DeleteAnnotationPanel" - onbeforeshow="ActiveModal.setActiveModalPanel('DeleteAnnotationPanel')" - width="300" height="90"> - - <f:facet name="header"> - <h:outputText - value="#{messages['gazelle.testmanagement.object.DeleteAnnotation']}" /> - </f:facet> - <f:facet name="controls"> - <h:graphicImage id="DeleteAnnotationGraphicImage" - alt="#{messages['gazelle.common.button.mp.close']}" - value="/img/modal/close.gif" style="cursor:pointer" height="14" - width="14" - onclick="Richfaces.hideModalPanel('DeleteAnnotationPanel')" /> - </f:facet> - - <s:decorate id="confirmationDeleteAnno"> - - <a4j:form id="deleteAnnForm"> - <s:token allowMultiplePosts="true" /> - <s:token allowMultiplePosts="true" /> - <rich:panel id="DeleteAnnRPanel"> - <center> - - <div id="deleteAnnDiv" align="right"> - <a4j:commandButton id="deleteAnnbutton" - value="#{messages['gazelle.testmanagement.object.DeleteThisAnnotation']}" - styleClass="btn btn-default" - reRender="helloword,messageDecoration" - actionListener="#{sampleDisplayManager.deleteSelectedAnnotation()}" - onclick="Richfaces.hideModalPanel('DeleteAnnotationPanel');" /> - - <a4j:commandButton - value="#{messages['gazelle.common.button.Cancel']}" - onclick="Richfaces.hideModalPanel('DeleteAnnotationPanel')" - styleClass="btn btn-default" ajaxSingle="true" /> - </div> - </center> - </rich:panel> - </a4j:form> - </s:decorate> - </rich:modalPanel> - - <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --> - <!-- Comment Sample Modal--> - <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --> - <rich:modalPanel id="CommentSampleModal" - onbeforeshow="ActiveModal.setActiveModalPanel('CommentSampleModal')" - onshow="autofocus('CommentSampleModalDecoration')" width="400" - height="160"> - <f:facet name="header"> - <h:outputText - value="#{messages['gazelle.testmanagement.object.CommentCurrentSample']}" /> - </f:facet> - <f:facet name="controls"> - <h:graphicImage id="CommentSampleGraphicImage" - alt="#{messages['gazelle.common.button.mp.close']}" - value="/img/modal/close.gif" style="cursor:pointer" height="14" - width="14" onclick="Richfaces.hideModalPanel('CommentSampleModal')" /> - </f:facet> - - <s:decorate id="CommentSampleModalDecoration"> - - <a4j:form id="CommentSampleForm"> - <s:token allowMultiplePosts="true" /> - <rich:panel id="CommentSampleModalPanel"> - <center> - <a4j:region id="CommentValueReg"> - <s:decorate id="CommentValDecoration" - template="/layout/form/edit.xhtml"> - <ui:define name="label">#{messages['gazelle.testmanagement.object.Comment']}</ui:define> - <h:inputTextarea id="CommentEditorId" - value="#{sampleDisplayManager.commentOfCurrentSIS}" rows="3" - cols="35" /> - </s:decorate> - </a4j:region> - - <div id="saceCommentDiv" align="right"> - <a4j:commandButton id="saveCommentbutton" - value="#{messages['gazelle.common.button.Save']}" - styleClass="btn btn-default" - reRender="helloword,messageDecoration" - actionListener="#{sampleDisplayManager.saveCommentOfObjectInstance()}" - onclick="Richfaces.hideModalPanel('CommentSampleModal');" /> - - <a4j:commandButton - value="#{messages['gazelle.common.button.Cancel']}" - onclick="Richfaces.hideModalPanel('CommentSampleModal')" - styleClass="btn btn-default" ajaxSingle="true" /> - </div> - </center> - </rich:panel> - </a4j:form> - </s:decorate> - </rich:modalPanel> - - </ui:define> -</ui:composition> \ No newline at end of file -- GitLab From 9543721d5aaee20f9d90fb3bfe76ee22ad06940d Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 30 Aug 2024 11:30:53 +0200 Subject: [PATCH 60/77] Fixed context problems --- .../action/SystemInSessionOverview.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java index 9703779d6..350ac9d0e 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java @@ -9,11 +9,9 @@ import net.ihe.gazelle.hql.HQLRestriction; import net.ihe.gazelle.hql.criterion.HQLCriterionsForFilter; import net.ihe.gazelle.hql.criterion.QueryModifier; import net.ihe.gazelle.hql.restrictions.HQLRestrictions; -import net.ihe.gazelle.preferences.PreferenceService; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; -import net.ihe.gazelle.ssov7.gum.client.application.service.UserPreferencesService; -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.Domain; import net.ihe.gazelle.tf.model.IntegrationProfile; import net.ihe.gazelle.tm.datamodel.SystemUser; @@ -28,6 +26,7 @@ import net.ihe.gazelle.tm.report.action.ReportManager; import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; +import org.jboss.seam.Component; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Destroy; import org.jboss.seam.annotations.In; @@ -145,7 +144,7 @@ public class SystemInSessionOverview implements Serializable, QueryModifier<Syst if (filter == null) { FacesContext fc = FacesContext.getCurrentInstance(); Map<String, String> requestParameterMap = fc.getExternalContext().getRequestParameterMap(); - filter = new SystemInSessionFilter1(identity, requestParameterMap, testingSessionService); + filter = new SystemInSessionFilter1(identity, requestParameterMap, getTestingSessionService()); } return filter; } @@ -276,7 +275,7 @@ public class SystemInSessionOverview implements Serializable, QueryModifier<Syst .neqRestriction(SystemInSessionRegistrationStatus.DROPPED), query.system().systemsInSession() .registrationStatus().isNullRestriction())); queryBuilder.addRestriction(query.system().systemsInSession().testingSession() - .eqRestriction(testingSessionService.getCurrentTestingSession())); + .eqRestriction(getTestingSessionService().getCurrentTestingSession())); } @@ -318,7 +317,7 @@ public class SystemInSessionOverview implements Serializable, QueryModifier<Syst } systemsList = removeDuplicateSystems(systemsList); - TestingSession activeSession = testingSessionService.getCurrentTestingSession(); + TestingSession activeSession = getTestingSessionService().getCurrentTestingSession(); Collection<IntegrationProfile> listOfIntegrationProfile = activeSession.getIntegrationProfilesUnsorted(); List<IntegrationProfile> listOfIntegrationProfileCopy = new ArrayList<>(listOfIntegrationProfile); for (IntegrationProfile integrationProfile : listOfIntegrationProfile) { @@ -349,4 +348,11 @@ public class SystemInSessionOverview implements Serializable, QueryModifier<Syst systemList.addAll(systems); return systemList; } + + private TestingSessionService getTestingSessionService() { + if (testingSessionService != null) + return testingSessionService; + else + return (TestingSessionService) Component.getInstance("testingSessionService"); + } } -- GitLab From d2c4b3fb7582c94b637403d39feee91fb17e2a50 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 30 Aug 2024 11:50:21 +0200 Subject: [PATCH 61/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../net/ihe/gazelle/objects/action/AbstractSampleManager.java | 2 +- gazelle-tm-war/src/main/webapp/objects/object_instance.xhtml | 4 ++-- gazelle-tm-war/src/main/webapp/objects/sample.xhtml | 4 ++-- .../src/main/webapp/reports/registrationOverview.xhtml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/AbstractSampleManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/AbstractSampleManager.java index 143f01562..aa5553c5a 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/AbstractSampleManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/AbstractSampleManager.java @@ -281,7 +281,7 @@ public abstract class AbstractSampleManager extends ObjectManipulation { if (LOG.isDebugEnabled()) { LOG.debug("canEditSampleByCreator"); } - return this.canEditSampleByCreator(selectedObjectInstance); + return this.canEditSampleByCreator(selectedObjectInstance, testingSessionService.getCurrentTestingSession()); } public String getSelectedObjectInstanceFileContent() { diff --git a/gazelle-tm-war/src/main/webapp/objects/object_instance.xhtml b/gazelle-tm-war/src/main/webapp/objects/object_instance.xhtml index 2603330c9..fbe8b4e9c 100644 --- a/gazelle-tm-war/src/main/webapp/objects/object_instance.xhtml +++ b/gazelle-tm-war/src/main/webapp/objects/object_instance.xhtml @@ -29,8 +29,8 @@ <h:form> <s:token allowMultiplePosts="true"/> <rich:tree id="TreeOfSampleOfReaderOnReading" - rendered="#{objectManager.getTreeNodeOfReaderInstanceFile(objectManager.selectedObjectInstance) !=null}" - value="#{objectManager.getTreeNodeOfReaderInstanceFile(objectManager.selectedObjectInstance)}" + rendered="#{objectManager.getTreeNodeOfReaderInstanceFile(objectManager.selectedObjectInstance,testSessionBean.selectedTestingSession) !=null}" + value="#{objectManager.getTreeNodeOfReaderInstanceFile(objectManager.selectedObjectInstance, testSessionBean.selectedTestingSession)}" var="node" style="vertical-align:top" nodeType="#{node.data.class.simpleName}" toggleType="client"> diff --git a/gazelle-tm-war/src/main/webapp/objects/sample.xhtml b/gazelle-tm-war/src/main/webapp/objects/sample.xhtml index fff3fc814..cf0496523 100644 --- a/gazelle-tm-war/src/main/webapp/objects/sample.xhtml +++ b/gazelle-tm-war/src/main/webapp/objects/sample.xhtml @@ -12,8 +12,8 @@ <h:form> <s:token allowMultiplePosts="true"/> <rich:tree id="TreeOfSampleOfReader" - rendered="#{sampleDisplayManager.getTreeNodeOfReaderInstanceFile(sampleDisplayManager.selectedObjectInstance)!=null}" - value="#{sampleDisplayManager.getTreeNodeOfReaderInstanceFile(sampleDisplayManager.selectedObjectInstance)}" + rendered="#{sampleDisplayManager.getTreeNodeOfReaderInstanceFile(sampleDisplayManager.selectedObjectInstance, testSessionBean.selectedTestingSession)!=null}" + value="#{sampleDisplayManager.getTreeNodeOfReaderInstanceFile(sampleDisplayManager.selectedObjectInstance, testSessionBean.selectedTestingSession)}" var="node" style="vertical-align:top" nodeType="#{node.data.class.simpleName}" toggleType="client"> <rich:treeNode type="SystemInSession" width="15" diff --git a/gazelle-tm-war/src/main/webapp/reports/registrationOverview.xhtml b/gazelle-tm-war/src/main/webapp/reports/registrationOverview.xhtml index ca1521aa6..cc97398b0 100644 --- a/gazelle-tm-war/src/main/webapp/reports/registrationOverview.xhtml +++ b/gazelle-tm-war/src/main/webapp/reports/registrationOverview.xhtml @@ -18,7 +18,7 @@ actionListener="#{reportManagerBean.listSystemsForAllActorIntegrationProfilePDF()}" styleClass="gzl-btn"/> <h:commandButton id="systemsCoverageId" value="#{messages['gazelle.systems.system.SystemsSummary']}" - action="#{reportManagerBean.listSystemsSummary()}" styleClass="gzl-btn" + action="#{reportManagerBean.listSystemsSummary(testSessionBean.currentTestingSession)}" styleClass="gzl-btn" rendered="#{(s:hasRole('admin_role') || s:hasRole('monitor_role'))}"/> </h:form> -- GitLab From 4addc8170ce1eb93d58924f04953b7db38f74880 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 2 Sep 2024 09:59:31 +0200 Subject: [PATCH 62/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../java/net/ihe/gazelle/dao/GazelleDAO.java | 24 ++++++++++++++++--- .../tm/session/TestingSessionServiceImpl.java | 2 +- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/GazelleDAO.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/GazelleDAO.java index 2e7b98bf8..8870c12ec 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/GazelleDAO.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/GazelleDAO.java @@ -14,10 +14,12 @@ import net.ihe.gazelle.tm.gazelletest.model.instance.Status; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstance; import net.ihe.gazelle.tm.gazelletest.model.instance.TestInstanceParticipants; import net.ihe.gazelle.tm.gazelletest.model.instance.TestStepsInstanceStatus; +import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.System; import net.ihe.gazelle.tm.systems.model.*; import net.ihe.gazelle.tm.users.model.ConnectathonParticipantStatus; import net.ihe.gazelle.users.model.*; +import org.jboss.seam.Component; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.*; import org.slf4j.Logger; @@ -26,6 +28,7 @@ import org.slf4j.LoggerFactory; import javax.ejb.Remove; import javax.persistence.EntityManager; import javax.persistence.Query; +import java.io.IOException; import java.io.Serializable; import java.util.Collections; import java.util.Comparator; @@ -40,6 +43,10 @@ public class GazelleDAO implements Serializable { private static final Logger LOG = LoggerFactory.getLogger(GazelleDAO.class); @In(value = "gumUserService") UserService userService; + + @In(value = "testingSessionService") + private transient TestingSessionService testingSessionService; + public GazelleDAO() { super(); } @@ -395,7 +402,7 @@ public class GazelleDAO implements Serializable { } SystemInSessionQuery query = new SystemInSessionQuery(); - query.testingSession().eqIfValueNotNull(TestingSession.getSelectedTestingSession()); + query.testingSession().eqIfValueNotNull(testingSessionService.getCurrentTestingSession()); query.system().institutionSystems().institution().eqIfValueNotNull(institutionUsed); return query.getCount(); } @@ -425,7 +432,7 @@ public class GazelleDAO implements Serializable { if (LOG.isDebugEnabled()) { LOG.debug("getSelectedTestingSession"); } - return TestingSession.getSelectedTestingSession(); + return testingSessionService.getCurrentTestingSession(); } public List<Institution> getListOfInstitutionsParticipatingInSession(TestingSession ts) { @@ -541,5 +548,16 @@ public class GazelleDAO implements Serializable { } return TestInstance.getTestInstanceListToBeVerifiedByTest(inTest); } - + /** + * Reload service in case of deserialization. + * + * @param inputStream InputStream of the UserValueFormatter. + * @throws IOException + * @throws ClassNotFoundException + * @see Serializable + */ + private void readObject(java.io.ObjectInputStream inputStream) throws IOException, ClassNotFoundException { + inputStream.defaultReadObject(); + this.testingSessionService = (TestingSessionService) Component.getInstance("testingSessionService"); + } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java index 442bd51dc..17d4a8cbb 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java @@ -55,7 +55,7 @@ public class TestingSessionServiceImpl implements TestingSessionService { Integer testingSessionId = userPreferencesService.getSelectedTestingSessionId(); boolean testingSessionExisting = testingSessionId != null && testingSessionId != -1 && testingSessionServiceDAO.isTestingSessionExisting(testingSessionId); - if (!testingSessionExisting) { + if (!testingSessionExisting ) { testingSessionId = testingSessionServiceDAO.getDefaultTestingSession().getId(); userPreferencesService.setSelectedTestingSessionId(testingSessionId); } -- GitLab From 7cd566407815b8e29e8d7194f8b4645f9b9412dc Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 2 Sep 2024 17:04:57 +0200 Subject: [PATCH 63/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../configurations/action/OidsAndIPParamForSessionManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OidsAndIPParamForSessionManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OidsAndIPParamForSessionManager.java index 6d162347a..3869577bb 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OidsAndIPParamForSessionManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OidsAndIPParamForSessionManager.java @@ -904,7 +904,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP } private void deleteAllOIDInstitutionForCurrentTestingSession() { - List<OIDInstitution> loi = OIDInstitution.getAllOIDInstitutionForCurrentTestingSession(); + List<OIDInstitution> loi = OIDInstitution.getAllOIDInstitutionForCurrentTestingSession(testingSessionService.getCurrentTestingSession()); for (OIDInstitution oidInstitution : loi) { entityManager.remove(oidInstitution); } -- GitLab From d390cb4cab7864a94ac429cf67e6ec8c1467d657 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 3 Sep 2024 14:53:57 +0200 Subject: [PATCH 64/77] Refactored code with UserContext --- .../tm/session/TestingSessionServiceImpl.java | 38 ++++++------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java index 17d4a8cbb..14efc00a3 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java @@ -1,19 +1,15 @@ package net.ihe.gazelle.tm.session; -import net.ihe.gazelle.common.action.CacheRequest; -import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; -import net.ihe.gazelle.ssov7.gum.client.application.service.UserPreferencesService; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.tm.gazelletest.model.definition.TestType; import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.systems.model.TestingSessionAdmin; -import org.jboss.seam.Component; +import net.ihe.gazelle.users.UserContext; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.AutoCreate; import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; -import org.jboss.seam.contexts.Contexts; import javax.faces.model.SelectItem; import java.util.ArrayList; @@ -33,31 +29,28 @@ public class TestingSessionServiceImpl implements TestingSessionService { @In(value = "gumUserService") private UserService userService; - @In(value = "userPreferencesService") - private UserPreferencesService userPreferencesService; - - @In - private GazelleIdentity identity; + @In(value = "userContext") + private UserContext userContext; public TestingSessionServiceImpl() { //For seam } - public TestingSessionServiceImpl(TestingSessionServiceDAO testingSessionServiceDAO, UserService userService, UserPreferencesService userPreferencesService, GazelleIdentity identity) { + public TestingSessionServiceImpl(TestingSessionServiceDAO testingSessionServiceDAO, UserService userService, UserContext userContext) { this.testingSessionServiceDAO = testingSessionServiceDAO; this.userService = userService; - this.userPreferencesService = userPreferencesService; - this.identity = identity; + this.userContext = userContext; } @Override public TestingSession getCurrentTestingSession() { - Integer testingSessionId = userPreferencesService.getSelectedTestingSessionId(); + Integer testingSessionId = userContext.getSelectedTestingSessionId(); - boolean testingSessionExisting = testingSessionId != null && testingSessionId != -1 && testingSessionServiceDAO.isTestingSessionExisting(testingSessionId); - if (!testingSessionExisting ) { - testingSessionId = testingSessionServiceDAO.getDefaultTestingSession().getId(); - userPreferencesService.setSelectedTestingSessionId(testingSessionId); + boolean testingSessionExisting = testingSessionId != null && testingSessionServiceDAO.isTestingSessionExisting(testingSessionId); + if (!testingSessionExisting) { + TestingSession defaultTestingSession = testingSessionServiceDAO.getDefaultTestingSession(); + userContext.setSelectedTestingSessionId(defaultTestingSession.getId()); + return defaultTestingSession; } return testingSessionServiceDAO.getTestingSessionById(testingSessionId); @@ -65,17 +58,10 @@ public class TestingSessionServiceImpl implements TestingSessionService { @Override public void setCurrentTestingSession(TestingSession testingSession) { - if (testingSession != null) { - TestingSession refreshedTestingSession = testingSessionServiceDAO.getTestingSessionById(testingSession.getId()); - Contexts.getSessionContext().set("selectedTestingSession", refreshedTestingSession); - userPreferencesService.setSelectedTestingSessionId(refreshedTestingSession.getId()); - Contexts.getSessionContext().set("selectedUser", userService.getUserById(identity.getUsername())); - CacheRequest cacheRequest = (CacheRequest) Component.getInstance("cacheRequest"); - cacheRequest.removeValue("user_testing_session"); - } + userContext.setSelectedTestingSessionId(testingSession == null ? null : testingSession.getId()); } @Override -- GitLab From 9137fc4dae1ef00407759370cc7064ce539226cc Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 3 Sep 2024 14:54:31 +0200 Subject: [PATCH 65/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../main/java/net/ihe/gazelle/dao/GazelleDAO.java | 4 ++-- .../action/GazellePreferenceProvider.java | 11 +---------- .../action/SystemConfigurationManager.java | 6 ++++-- .../action/ConnecthatonTestingManager.java | 5 +++-- .../MonitorInSessionAdministrationManager.java | 2 +- .../tm/gazelletest/action/TestInstanceManager.java | 14 +++++++++----- .../tm/messages/EmailNotificationManager.java | 9 ++++++++- .../action/ConnectathonParticipantManager.java | 2 +- 8 files changed, 29 insertions(+), 24 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/GazelleDAO.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/GazelleDAO.java index 8870c12ec..082ce0750 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/GazelleDAO.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/GazelleDAO.java @@ -411,14 +411,14 @@ public class GazelleDAO implements Serializable { if (LOG.isDebugEnabled()) { LOG.debug("getSystemsInSessionForLoggedCompanyForSession"); } - return SystemInSession.getSystemsInSessionForLoggedCompanyForSession(); + return SystemInSession.getSystemsInSessionForLoggedCompanyForSession(getSelectedTestingSession()); } public List<SystemInSession> getNotDrppedSystemsInSessionForLoggedCompanyForSession() { if (LOG.isDebugEnabled()) { LOG.debug("getNotDrppedSystemsInSessionForLoggedCompanyForSession"); } - return SystemInSession.getNotDroppedSystemsInSessionForLoggedCompanyForSession(); + return SystemInSession.getNotDroppedSystemsInSessionForLoggedCompanyForSession(getSelectedTestingSession()); } public List<TestingSession> getPossibleTestingSessions() { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java index d29a14f93..6228de9b9 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java @@ -163,16 +163,7 @@ public class GazellePreferenceProvider implements PreferenceProvider { LOG.debug("getObject"); } if ("user_testing_session".equals(key)) { - CacheRequest cacheRequest = (CacheRequest) Component.getInstance(CACHE_REQUEST); - return cacheRequest.getValueUpdater("user_testing_session", new CacheUpdater() { - @Override - public Object getValue(String key, Object parameter) { - if (LOG.isDebugEnabled()) { - LOG.debug("getValue"); - } - return getTestingSessionService().getCurrentTestingSession(); - } - }, null); + return getTestingSessionService().getCurrentTestingSession(); } return null; } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/SystemConfigurationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/SystemConfigurationManager.java index f4dda8ed7..2b8f8437b 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/SystemConfigurationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/SystemConfigurationManager.java @@ -1388,7 +1388,8 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc selectedSystemInSession = (SystemInSession) Component.getInstance(SELECTED_SYSTEM_IN_SESSION); if (selectedSystemInSession != null && !identity.hasRole(Role.ADMIN) - && !selectedSystemInSession.isAuthorizedUser(identity.getUsername(), selectedSystemInSession) + && !selectedSystemInSession.isAuthorizedUser(identity.getUsername(), selectedSystemInSession, + testingSessionService.getCurrentTestingSession()) && !identity.hasRole(Role.VENDOR_ADMIN)) { selectedSystemInSession = null; } @@ -1399,7 +1400,8 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc if (LOG.isDebugEnabled()) { LOG.debug("initOneMenu"); } - if (selectedSystemInSession == null || !selectedSystemInSession.isAuthorizedUser(identity.getUsername(), selectedSystemInSession)) { + if (selectedSystemInSession == null || !selectedSystemInSession.isAuthorizedUser(identity.getUsername(), + selectedSystemInSession, testingSessionService.getCurrentTestingSession())) { GazelleDAO gazelleDAO = new GazelleDAO(); List<SystemInSession> res = gazelleDAO.getNotDrppedSystemsInSessionForLoggedCompanyForSession(); if (res.size() == 1) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java index ec54575ed..55494daa0 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java @@ -589,7 +589,8 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc if (!identity.hasRole(Role.ADMIN)) { selectedInstitution = Institution.findInstitutionWithKeyword(identity.getOrganisationKeyword()); List<SystemInSession> systemInSessionList = SystemInSession - .getSystemInSessionByUserForActivatedTestingSession(identity.getUsername()); + .getSystemInSessionByUserByTestingSession(identity.getUsername(), + testingSessionService.getCurrentTestingSession()); if (systemInSessionList != null) { getSystemListForSelectedInstitution(); } @@ -1253,7 +1254,7 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc private void searchTestRoles() { if (selectedSystemInSession != null) { boolean isUserAdminOrMonitorForSession = identity.hasRole(Role.ADMIN) - || MonitorInSession.isMonitorForSelectedSession(identity.getUsername()); + || MonitorInSession.isMonitorForSelectedSession(identity.getUsername(), testingSessionService.getCurrentTestingSession()); if (isConnectedUserAllowedToStartTest == null) { if (identity.isLoggedIn()) { if (selectedInstitution.getKeyword().equals(identity.getOrganisationKeyword())) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorInSessionAdministrationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorInSessionAdministrationManager.java index 982184a13..04ae07d1d 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorInSessionAdministrationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorInSessionAdministrationManager.java @@ -799,7 +799,7 @@ public class MonitorInSessionAdministrationManager implements Serializable, Quer public boolean isConnectedUserMonitorForSelectedSession() { LOG.trace("isConnectedUserMonitorForSelectedSession"); - return MonitorInSession.isMonitorForSelectedSession(identity.getUsername()); + return MonitorInSession.isMonitorForSelectedSession(identity.getUsername(), testingSessionService.getCurrentTestingSession()); } @Override diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceManager.java index 1afdff471..4758aaa36 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceManager.java @@ -591,7 +591,7 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us EntityManager entityManager = EntityManagerService.provideEntityManager(); //Update monitor to current user - if (MonitorInSession.isMonitorForSelectedSession(identity.getUsername())) { + if (MonitorInSession.isMonitorForSelectedSession(identity.getUsername(),testingSessionService.getCurrentTestingSession())) { if ((selectedStatus.equals(Status.getSTATUS_VERIFIED()) || selectedStatus.equals(Status.getSTATUS_FAILED()) || selectedStatus.equals(Status.getSTATUS_PARTIALLY_VERIFIED()))) { inTestInstance.setMonitorInSession(MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(testingSessionService.getCurrentTestingSession(), identity.getUsername())); } @@ -642,13 +642,15 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us public boolean isConnectedUserAllowedToValidateTestInstance(TestInstance inTestInstance) { LOG.trace("isConnectedUserAllowedToValidateTestInstance"); - return MonitorInSession.isUserAllowedToValidateTestInstance(identity, inTestInstance); + return MonitorInSession.isUserAllowedToValidateTestInstance(identity, inTestInstance, + testingSessionService.getCurrentTestingSession()); } public boolean isConnectedUserAllowedToValidateSelectedTestInstance() { LOG.trace("isConnectedUserAllowedToValidateSelectedTestInstance"); if (isConnectedUserAllowedToValidateTestInstance == null) { - isConnectedUserAllowedToValidateTestInstance = MonitorInSession.isMonitorForSelectedSession(identity.getUsername()); + isConnectedUserAllowedToValidateTestInstance = MonitorInSession.isMonitorForSelectedSession(identity.getUsername(), + testingSessionService.getCurrentTestingSession()); } return isConnectedUserAllowedToValidateTestInstance; } @@ -1022,12 +1024,14 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us statusList.add(Status.getSTATUS_FAILED()); } - if (identity.hasRole(Role.ADMIN) || MonitorInSession.isMonitorForSelectedSession(identity.getUsername())) { + if (identity.hasRole(Role.ADMIN) || MonitorInSession.isMonitorForSelectedSession(identity.getUsername(), + selectedTestingSession)) { statusList.add(Status.getSTATUS_VERIFIED()); statusList.add(Status.getSTATUS_PARTIALLY_VERIFIED()); statusList.add(Status.getSTATUS_FAILED()); } - if (!identity.hasRole(Role.ADMIN) && MonitorInSession.isMonitorForSelectedSession(identity.getUsername())) { + if (!identity.hasRole(Role.ADMIN) && MonitorInSession.isMonitorForSelectedSession(identity.getUsername(), + selectedTestingSession)) { statusList.remove(Status.getSTATUS_ABORTED()); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java index 8d41550e4..ba2c409f3 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/messages/EmailNotificationManager.java @@ -46,7 +46,7 @@ public class EmailNotificationManager implements Serializable, NotificationListe User author = userService.getUserById(message.getAuthor()); for (MessageUser recipientId : message.getUsers()) { User recipient = userService.getUserById(recipientId.getUserId()); - UserPreference userPreference = userPreferencesService.getUserPreferencesByUserId(recipientId.getUserId()); + UserPreference userPreference = getUserPreferencesService().getUserPreferencesByUserId(recipientId.getUserId()); if (userPreference != null && userPreference.isNotifiedByEmail()) { emailManager.setConcerned(author); emailManager.setRecipient(recipient); @@ -72,6 +72,13 @@ public class EmailNotificationManager implements Serializable, NotificationListe } } + private UserPreferencesService getUserPreferencesService() { + if (userPreferencesService != null) + return userPreferencesService; + else + return (UserPreferencesService) Component.getInstance("userPreferencesService"); + } + /** * Reload userPreferencesService in case of deserialization. diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/ConnectathonParticipantManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/ConnectathonParticipantManager.java index 2da231c69..c94d52b2e 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/ConnectathonParticipantManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/ConnectathonParticipantManager.java @@ -698,7 +698,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho if (choosenInstitutionForAdmin != null) { listOfSiS = SystemInSession.getSystemsInSessionForCompanyForSession(em, choosenInstitutionForAdmin); } else { - listOfSiS = SystemInSession.getSystemsInSessionForActivatedTestingSession(); + listOfSiS = SystemInSession.getSystemsInSessionForSession(testingSessionService.getCurrentTestingSession()); } } else { listOfSiS = SystemInSession.getSystemsInSessionForCompanyForSession(em, -- GitLab From 2c31465128944ff260435cf9f440a3850a9898e7 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 3 Sep 2024 15:51:01 +0200 Subject: [PATCH 66/77] Renamed method --- .../java/net/ihe/gazelle/dao/GazelleDAO.java | 4 +- .../gazelle/dao/SystemInSessionDAOImpl.java | 3 +- .../net/ihe/gazelle/menu/Authorizations.java | 18 ++--- .../objects/action/AbstractSampleManager.java | 6 +- .../gazelle/objects/action/ObjectManager.java | 8 +- .../objects/action/SampleDisplayManager.java | 2 +- .../objects/action/SampleOverview.java | 2 +- .../objects/admin/ObjectTypeManager.java | 8 +- .../action/GazellePreferenceProvider.java | 2 +- .../tm/application/action/SearchGeneric.java | 3 +- .../tm/application/gui/HomeBeanGui.java | 4 +- .../gui/SessionProgressBeanGui.java | 4 +- .../gui/summary/AttendeesSummaryBeanGui.java | 2 +- .../gui/summary/ContractSummaryBeanGui.java | 2 +- .../PreparatoryTestsSummaryBeanGui.java | 2 +- .../gui/summary/SUTSummaryBeanGui.java | 2 +- .../gui/summary/TeamSummaryBeanGui.java | 2 +- .../action/ConfigurationsAdminChecks.java | 7 +- .../action/ConfigurationsOverview.java | 6 +- .../configurations/action/LdifGenerator.java | 2 +- .../action/NetworkConfigurationManager.java | 12 +-- .../tm/configurations/action/OIDManager.java | 5 +- .../OidsAndIPParamForSessionManager.java | 37 ++++----- .../action/SystemConfigurationManager.java | 24 +++--- .../tm/filter/MonitorWorklistFilter.java | 3 +- .../tm/filter/SystemInSessionFilter1.java | 4 +- .../gazelle/tm/filter/TestInstanceFilter.java | 2 +- .../tm/filter/entities/SearchType.java | 4 +- .../valueprovider/TestingSessionFixer.java | 2 +- .../TestingSessionInitiator.java | 2 +- .../tm/financial/action/FinancialManager.java | 10 +-- .../tm/gazelletest/action/AIPOSelector.java | 2 +- .../action/ConnectathonReport.java | 4 +- .../action/ConnectathonResult.java | 17 +++-- .../action/ConnectathonResultDataModel.java | 5 +- .../action/ConnecthatonTestingManager.java | 17 +++-- .../tm/gazelletest/action/KpiDisplay.java | 3 +- .../tm/gazelletest/action/KpiSystems.java | 3 +- .../gazelletest/action/MesaTestManager.java | 4 +- .../action/MetaTestAdministrationManager.java | 7 +- .../gazelletest/action/MonitorExporter.java | 2 +- ...MonitorInSessionAdministrationManager.java | 14 ++-- .../tm/gazelletest/action/ProxyManager.java | 4 +- .../gazelletest/action/StartTestInstance.java | 18 ++--- .../action/SystemInSessionOverview.java | 4 +- .../action/TMCheckListManager.java | 2 +- .../action/TestInstanceGenerator.java | 2 +- .../action/TestInstanceManager.java | 24 +++--- .../action/TestInstancesOverview.java | 2 +- .../action/TestInstancesOverviewManager.java | 2 +- .../action/TestMonitorManager.java | 2 +- ...TestsDefinitionsAdministrationManager.java | 2 +- .../dao/ConformityTestReportDAOImpl.java | 8 +- .../TestingSessionScopeServiceImpl.java | 3 +- .../gui/TestingSessionScopeBeanGui.java | 4 +- .../SutNetworkConfigurationServiceImpl.java | 7 +- .../registration/gui/RegistrationBeanGui.java | 2 +- .../tm/session/TestingSessionService.java | 6 +- .../tm/session/TestingSessionServiceImpl.java | 9 ++- .../tm/session/bean/TestSessionBean.java | 2 +- .../common/StatisticsCommonServiceImpl.java | 19 +++-- .../common/gui/StatisticsCommonBeanGui.java | 3 +- ...atisticsForEvaluationPhaseServiceImpl.java | 8 +- ...tisticsForPreparationPhaseServiceImpl.java | 23 +++--- .../StatisticsForPreparationPhaseBeanGui.java | 2 +- .../StatisticsForTestingPhaseServiceImpl.java | 2 +- .../gui/StatisticsForTestingPhaseBeanGui.java | 10 +-- .../AbstractSystemInSessionBuilder.java | 16 ++-- .../action/AbstractSystemInSessionEditor.java | 2 +- .../systems/action/DemonstrationManager.java | 2 +- .../IHEImplementationForSystemManager.java | 4 +- .../action/SimulatorInSessionManager.java | 9 +-- .../action/SystemInSessionBuilder.java | 2 +- .../systems/action/SystemInSessionCopier.java | 6 +- .../systems/action/SystemInSessionEditor.java | 2 +- .../action/SystemInSessionListManager.java | 6 +- .../action/SystemInSessionManager.java | 4 +- .../systems/action/TestingSessionManager.java | 16 ++-- .../dao/SUTReportServiceDAOImpl.java | 4 +- .../gui/TestExecutionBeanGUI.java | 3 +- .../ConnectathonParticipantManager.java | 75 ++++++++++--------- .../tm/users/action/InstitutionManagerTM.java | 4 +- .../action/FinancialManagerTest.java | 2 +- 83 files changed, 306 insertions(+), 293 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/GazelleDAO.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/GazelleDAO.java index 082ce0750..389c33e59 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/GazelleDAO.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/GazelleDAO.java @@ -402,7 +402,7 @@ public class GazelleDAO implements Serializable { } SystemInSessionQuery query = new SystemInSessionQuery(); - query.testingSession().eqIfValueNotNull(testingSessionService.getCurrentTestingSession()); + query.testingSession().eqIfValueNotNull(testingSessionService.getUserTestingSession()); query.system().institutionSystems().institution().eqIfValueNotNull(institutionUsed); return query.getCount(); } @@ -432,7 +432,7 @@ public class GazelleDAO implements Serializable { if (LOG.isDebugEnabled()) { LOG.debug("getSelectedTestingSession"); } - return testingSessionService.getCurrentTestingSession(); + return testingSessionService.getUserTestingSession(); } public List<Institution> getListOfInstitutionsParticipatingInSession(TestingSession ts) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/SystemInSessionDAOImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/SystemInSessionDAOImpl.java index 25a8a45f1..2db3ab2d4 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/SystemInSessionDAOImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/dao/SystemInSessionDAOImpl.java @@ -91,7 +91,8 @@ public class SystemInSessionDAOImpl implements SystemInSessionDAO { @Override public boolean isSystemInSessionRelatedToUser(SystemInSession systemInSession, String username) { - List<SystemInSession> listSis = getSystemInSessionRelatedToUser(username, getTestingSessionService().getCurrentTestingSession()); + List<SystemInSession> listSis = getSystemInSessionRelatedToUser(username, + getTestingSessionService().getUserTestingSession()); return listSis.contains(systemInSession); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Authorizations.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Authorizations.java index 952ea915e..4856f1766 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Authorizations.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/menu/Authorizations.java @@ -152,7 +152,7 @@ public class Authorizations { public boolean isGranted(Object... context) { return isUserAdminOfTestingSession( GazelleIdentityImpl.instance(), - getTestingSessionService().getCurrentTestingSession() + getTestingSessionService().getUserTestingSession() ); } } @@ -217,7 +217,7 @@ public class Authorizations { @Override public boolean isGranted(Object... context) { return MonitorInSession.isMonitorForSelectedSession( - GazelleIdentityImpl.instance().getUsername() + GazelleIdentityImpl.instance().getUsername(), getTestingSessionService().getUserTestingSession() ); } }; @@ -294,7 +294,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_CONTRACT = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = getTestingSessionService().getCurrentTestingSession(); + TestingSession testingSession = getTestingSessionService().getUserTestingSession(); return testingSession != null && testingSession.isContractRequired(); } }; @@ -302,7 +302,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_PRECAT = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = getTestingSessionService().getCurrentTestingSession(); + TestingSession testingSession = getTestingSessionService().getUserTestingSession(); return testingSession != null && testingSession.isEnablePrecatTests(); } }; @@ -313,7 +313,7 @@ public class Authorizations { new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = getTestingSessionService().getCurrentTestingSession(); + TestingSession testingSession = getTestingSessionService().getUserTestingSession(); return testingSession != null && testingSession.getAllowParticipantRegistration(); } } @@ -322,7 +322,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_INTEROPERABILITY = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = getTestingSessionService().getCurrentTestingSession(); + TestingSession testingSession = getTestingSessionService().getUserTestingSession(); return testingSession != null && testingSession.isTestingInteroperability(); } }; @@ -330,7 +330,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_MONITORS = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = getTestingSessionService().getCurrentTestingSession(); + TestingSession testingSession = getTestingSessionService().getUserTestingSession(); return testingSession != null && !testingSession.isSessionWithoutMonitors(); } }; @@ -338,7 +338,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_PATIENTS = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = getTestingSessionService().getCurrentTestingSession(); + TestingSession testingSession = getTestingSessionService().getUserTestingSession(); return testingSession != null && !testingSession.getDisablePatientGenerationAndSharing(); } }; @@ -346,7 +346,7 @@ public class Authorizations { public static final Authorization SESSION_WITH_SAMPLE_SEARCH = new Authorization() { @Override public boolean isGranted(Object... context) { - TestingSession testingSession = getTestingSessionService().getCurrentTestingSession(); + TestingSession testingSession = getTestingSessionService().getUserTestingSession(); return testingSession != null && !testingSession.isHideAdvancedSampleSearchToVendors(); } }; diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/AbstractSampleManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/AbstractSampleManager.java index aa5553c5a..c63a22fb1 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/AbstractSampleManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/AbstractSampleManager.java @@ -179,7 +179,7 @@ public abstract class AbstractSampleManager extends ObjectManipulation { EntityManager em = EntityManagerService.provideEntityManager(); Institution userinst = Institution.findInstitutionWithKeyword(identity.getOrganisationKeyword()); List<SystemInSession> systemInSessionList = SystemInSession.getSystemsInSessionForCompanyForSession(em, - userinst, testingSessionService.getCurrentTestingSession()); + userinst, testingSessionService.getUserTestingSession()); if (systemInSessionList != null) { if (this.selectedObjectInstance.getSystem() != null) { if (systemInSessionList.contains(this.selectedObjectInstance.getSystem())) { @@ -203,7 +203,7 @@ public abstract class AbstractSampleManager extends ObjectManipulation { } EntityManager em = EntityManagerService.provideEntityManager(); Institution userinst = Institution.findInstitutionWithKeyword(identity.getOrganisationKeyword()); - TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession selectedTestingSession = testingSessionService.getUserTestingSession(); List<SystemInSession> systemInSessionList = SystemInSession.getSystemsInSessionForCompanyForSession(em, userinst, selectedTestingSession); if (systemInSessionList.contains(this.selectedObjectInstance.getSystem())) { @@ -281,7 +281,7 @@ public abstract class AbstractSampleManager extends ObjectManipulation { if (LOG.isDebugEnabled()) { LOG.debug("canEditSampleByCreator"); } - return this.canEditSampleByCreator(selectedObjectInstance, testingSessionService.getCurrentTestingSession()); + return this.canEditSampleByCreator(selectedObjectInstance, testingSessionService.getUserTestingSession()); } public String getSelectedObjectInstanceFileContent() { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/ObjectManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/ObjectManager.java index 75123a48e..4631579e5 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/ObjectManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/ObjectManager.java @@ -236,7 +236,7 @@ public class ObjectManager extends AbstractSampleManager implements ObjectManage if (LOG.isDebugEnabled()) { LOG.debug("getSystemListForSelectedInstitution"); } - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); EntityManager em = EntityManagerService.provideEntityManager(); if ((this.selectedInstitution != null) && (activatedTestingSession != null)) { List<SystemInSession> systemInSessionList = SystemInSession @@ -302,7 +302,7 @@ public class ObjectManager extends AbstractSampleManager implements ObjectManage List<SystemInSession> result = new ArrayList<SystemInSession>(); EntityManager em = EntityManagerService.provideEntityManager(); if (objectType != null) { - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = testingSessionService.getUserTestingSession(); result = SystemInSession.getSystemInSessionFiltered(em, null, testingSession, null, null, null, null, null, null, null, null, null, null, null, objectType, null, null, null); } @@ -314,7 +314,7 @@ public class ObjectManager extends AbstractSampleManager implements ObjectManage if (LOG.isDebugEnabled()) { LOG.debug("getAllInstitutionsForCurrentSession"); } - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = testingSessionService.getUserTestingSession(); return TestingSession.getListOfInstitutionsParticipatingInSession(testingSession); } @@ -1016,7 +1016,7 @@ public class ObjectManager extends AbstractSampleManager implements ObjectManage LOG.debug("canDownloadAllSampleOfType"); } boolean result = false; - TestingSession inTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession inTestingSession = testingSessionService.getUserTestingSession(); int noi = ObjectInstance.getNumberObjectInstanceFiltered(ot, null, inTestingSession, null); if (noi == 0) { result = false; diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleDisplayManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleDisplayManager.java index ef48dba5a..744ece34f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleDisplayManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleDisplayManager.java @@ -93,7 +93,7 @@ public class SampleDisplayManager extends AbstractSampleManager implements Seria userAllowedToEditSystemFileReaderOfSample = false; Institution inst = Institution.getLoggedInInstitution(); EntityManager em = EntityManagerService.provideEntityManager(); - TestingSession ts = testingSessionService.getCurrentTestingSession(); + TestingSession ts = testingSessionService.getUserTestingSession(); List<SystemInSession> sisList = SystemInSession.getSystemsInSessionForCompanyForSession(em, inst, ts); if (sisList != null && !ts.testingSessionClosedForUser() && selectedSis != null) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleOverview.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleOverview.java index 185514fb5..da79560bf 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleOverview.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/action/SampleOverview.java @@ -98,7 +98,7 @@ public class SampleOverview implements Serializable, QueryModifier<ObjectInstanc hideTestingSessionInSampleSearchFilter(hqlCriterionsForFilter, query); hqlCriterionsForFilter.addPath("testing_session", query.system().testingSession(), - testingSessionService.getCurrentTestingSession()); + testingSessionService.getUserTestingSession()); hqlCriterionsForFilter.addPath("objectType", query.object()); hqlCriterionsForFilter.addPath("objectFileType", query.objectInstanceFiles().file().type()); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/admin/ObjectTypeManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/admin/ObjectTypeManager.java index 21d558983..93916be74 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/admin/ObjectTypeManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/objects/admin/ObjectTypeManager.java @@ -1058,7 +1058,7 @@ public class ObjectTypeManager extends ObjectFileTypeManager implements ObjectTy public String getNumberOfObjectInstanceByObjectTypeForCurrentTestingSession(ObjectType objectType) { LOG.debug("getNumberOfObjectInstanceByObjectTypeForCurrentTestingSession"); String result = ""; - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = testingSessionService.getUserTestingSession(); List<ObjectInstance> listObjectInstance = ObjectInstance.getObjectInstanceFiltered(objectType, null, testingSession); if (listObjectInstance != null) { @@ -1092,7 +1092,7 @@ public class ObjectTypeManager extends ObjectFileTypeManager implements ObjectTy @Override public List<SystemInSession> getListSystemInSessionOfAIPO(ActorIntegrationProfileOption AIPO) { LOG.debug("getListSystemInSessionOfAIPO"); - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = testingSessionService.getUserTestingSession(); EntityManager em = EntityManagerService.provideEntityManager(); return SystemInSession.getSystemInSessionFiltered(em, null, testingSession, null, null, null, null, null, AIPO, null, null, null, null); @@ -1133,7 +1133,7 @@ public class ObjectTypeManager extends ObjectFileTypeManager implements ObjectTy public String getNumberOfObjectInstanceBySISForSelectedObjectType(SystemInSession SIS) { LOG.debug("getNumberOfObjectInstanceBySISForSelectedObjectType"); String result = ""; - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = testingSessionService.getUserTestingSession(); List<ObjectInstance> listObjectInstance = ObjectInstance.getObjectInstanceFiltered(selectedObjectType, SIS, testingSession); int nbre = 0; @@ -1484,7 +1484,7 @@ public class ObjectTypeManager extends ObjectFileTypeManager implements ObjectTy public String getNumberOfObjectInstanceToReadBySIS(SystemInSession inSystemInSession) { LOG.debug("getNumberOfObjectInstanceToReadBySIS"); int result = 0; - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = testingSessionService.getUserTestingSession(); List<ObjectType> list_OT_OnR = this.getListOfObjectTypeForCurrentSessionOnReading(inSystemInSession); List<ObjectInstance> list_OI_tmp; for (ObjectType inObjectType : list_OT_OnR) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java index 6228de9b9..b58749c9e 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/GazellePreferenceProvider.java @@ -163,7 +163,7 @@ public class GazellePreferenceProvider implements PreferenceProvider { LOG.debug("getObject"); } if ("user_testing_session".equals(key)) { - return getTestingSessionService().getCurrentTestingSession(); + return getTestingSessionService().getUserTestingSession(); } return null; } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/SearchGeneric.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/SearchGeneric.java index 84a38bd29..3e876f64c 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/SearchGeneric.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/action/SearchGeneric.java @@ -141,7 +141,8 @@ public class SearchGeneric implements Serializable { } private List<MonitorUser> getMonitorUsers() { - List<MonitorInSession> monitorInSessions = MonitorInSession.getAllActivatedMonitorsForATestingSession(testingSessionService.getCurrentTestingSession()); + List<MonitorInSession> monitorInSessions = MonitorInSession.getAllActivatedMonitorsForATestingSession( + testingSessionService.getUserTestingSession()); if (monitorInSessions == null) { monitorInSessions = new ArrayList<>(); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/HomeBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/HomeBeanGui.java index 811599e48..c5c3021d7 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/HomeBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/HomeBeanGui.java @@ -82,12 +82,12 @@ public class HomeBeanGui implements Serializable { } } if (identity.isLoggedIn() && applicationManager.isTestManagement()) { - if (testingSessionService.isTestingSessionRunning(testingSessionService.getCurrentTestingSession())) { + if (testingSessionService.isTestingSessionRunning(testingSessionService.getUserTestingSession())) { return filterSectionForRoles(sectionsWithoutToolIndex, SectionsTypePage.ANNOUNCEMENT, Role.MONITOR, Role.ADMIN, Role.TESTING_SESSION_ADMIN, Role.VENDOR, Role.VENDOR_ADMIN); } - if (testingSessionService.isAfterSessionEnd(testingSessionService.getCurrentTestingSession())) { + if (testingSessionService.isAfterSessionEnd(testingSessionService.getUserTestingSession())) { return filterSectionForRoles(sectionsWithoutToolIndex, SectionsTypePage.ANNOUNCEMENT, Role.ADMIN, Role.TESTING_SESSION_ADMIN, Role.VENDOR, Role.VENDOR_ADMIN); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/SessionProgressBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/SessionProgressBeanGui.java index cbf9c3a27..05f2b58e6 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/SessionProgressBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/SessionProgressBeanGui.java @@ -79,7 +79,7 @@ public class SessionProgressBeanGui implements Serializable { @Create public void init() { try { - this.currentTestingSession = testingSessionService.getCurrentTestingSession(); + this.currentTestingSession = testingSessionService.getUserTestingSession(); Institution currentInstitution = organizationService.getCurrentOrganization(); if (currentTestingSession != null && currentInstitution != null) { this.isThereAcceptedSystem = systemUnderTestService @@ -284,7 +284,7 @@ public class SessionProgressBeanGui implements Serializable { public boolean showEvaluationPhase() { if (identity.isLoggedIn() && identity.hasRole(Role.MONITOR) && - testingSessionService.isTestingSessionRunning(testingSessionService.getCurrentTestingSession())) { + testingSessionService.isTestingSessionRunning(testingSessionService.getUserTestingSession())) { return false; } return isTestingSessionAfterEnd && !isContinuousSession; diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/AttendeesSummaryBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/AttendeesSummaryBeanGui.java index 6cfc9d997..b52541cce 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/AttendeesSummaryBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/AttendeesSummaryBeanGui.java @@ -46,7 +46,7 @@ public class AttendeesSummaryBeanGui implements Serializable { @Create public void init(){ try { - this.currentTestingSession = testingSessionService.getCurrentTestingSession(); + this.currentTestingSession = testingSessionService.getUserTestingSession(); this.currentInstitution = organizationService.getCurrentOrganization(); } catch (IllegalArgumentException e){ diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/ContractSummaryBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/ContractSummaryBeanGui.java index 4110d016d..482a1447c 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/ContractSummaryBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/ContractSummaryBeanGui.java @@ -22,7 +22,7 @@ public class ContractSummaryBeanGui { @Create public void init(){ - currentTestingSession = testingSessionService.getCurrentTestingSession(); + currentTestingSession = testingSessionService.getUserTestingSession(); } /////////////////// Checkers /////////////////// diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/PreparatoryTestsSummaryBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/PreparatoryTestsSummaryBeanGui.java index 7762091ff..093d503ee 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/PreparatoryTestsSummaryBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/PreparatoryTestsSummaryBeanGui.java @@ -35,7 +35,7 @@ public class PreparatoryTestsSummaryBeanGui implements Serializable { @Create public void init(){ try { - this.currentTestingSession = testingSessionService.getCurrentTestingSession(); + this.currentTestingSession = testingSessionService.getUserTestingSession(); } catch (IllegalArgumentException e){ FacesMessages.instance().add(StatusMessage.Severity.ERROR, "An error has occurred during initialization"); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/SUTSummaryBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/SUTSummaryBeanGui.java index d89ad3af9..8442d52de 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/SUTSummaryBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/SUTSummaryBeanGui.java @@ -63,7 +63,7 @@ public class SUTSummaryBeanGui implements Serializable { @Create public void init(){ try{ - this.currentTestingSession = testingSessionService.getCurrentTestingSession(); + this.currentTestingSession = testingSessionService.getUserTestingSession(); this.currentInstitution = organizationService.getCurrentOrganization(); if(currentTestingSession != null && currentInstitution != null){ this.registrationOpen = testingSessionService.isRegistrationOpen(currentTestingSession); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/TeamSummaryBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/TeamSummaryBeanGui.java index 15429767e..20b9382ec 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/TeamSummaryBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/gui/summary/TeamSummaryBeanGui.java @@ -41,7 +41,7 @@ public class TeamSummaryBeanGui implements Serializable { @Create public void init(){ - currentTestingSession = testingSessionService.getCurrentTestingSession(); + currentTestingSession = testingSessionService.getUserTestingSession(); this.currentInstitution = organizationService.getCurrentOrganization(); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsAdminChecks.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsAdminChecks.java index 986baa24f..4327a582c 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsAdminChecks.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsAdminChecks.java @@ -8,7 +8,6 @@ import net.ihe.gazelle.tm.configurations.model.Host; import net.ihe.gazelle.tm.configurations.model.HostQuery; import net.ihe.gazelle.tm.configurations.model.interfaces.ServerConfiguration; import net.ihe.gazelle.tm.session.TestingSessionService; -import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Name; @@ -74,7 +73,7 @@ public class ConfigurationsAdminChecks { private boolean isIPAvailable(String ipToTest) { HostQuery q = new HostQuery(); - q.testingSession().eq(testingSessionService.getCurrentTestingSession()); + q.testingSession().eq(testingSessionService.getUserTestingSession()); q.ip().eq(ipToTest); hostsAvailable = q.getListNullIfEmpty(); return hostsAvailable == null; @@ -82,7 +81,7 @@ public class ConfigurationsAdminChecks { public void checkIpIsUniqueInCurrentTestingSession() { HostQuery query = new HostQuery(); - query.testingSession().eq(testingSessionService.getCurrentTestingSession()); + query.testingSession().eq(testingSessionService.getUserTestingSession()); List<Host> hosts = query.getList(); List<Host> duplicateHosts = new ArrayList<>(); Map<Host, String> ipsList = new HashMap<>(); @@ -147,7 +146,7 @@ public class ConfigurationsAdminChecks { public void checkProxyPortIsUniqueInCurrentTestingSession() { AbstractConfigurationQuery query = new AbstractConfigurationQuery(); - query.configuration().systemInSession().testingSession().eq(testingSessionService.getCurrentTestingSession()); + query.configuration().systemInSession().testingSession().eq(testingSessionService.getUserTestingSession()); query.configuration().isSecured().eq(false); List<AbstractConfiguration> configurations = query.getList(); List<ServerConfiguration> duplicatesConfigurations = new ArrayList<>(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsOverview.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsOverview.java index 7bbaad432..0d4cdcd82 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsOverview.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/ConfigurationsOverview.java @@ -138,7 +138,7 @@ public class ConfigurationsOverview implements Serializable, MapNotifierListener SystemInSessionQuery sisQuery = new SystemInSessionQuery(); HQLCriterionsForFilter<SystemInSession> hqlCriterions = sisQuery.getHQLCriterionsForFilter(); - TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession selectedTestingSession = testingSessionService.getUserTestingSession(); hqlCriterions.addPath(TEST_SESSION, sisQuery.testingSession(), selectedTestingSession, selectedTestingSession); hqlCriterions.addPath(INSTITUTION, sisQuery.system().institutionSystems().institution(), @@ -168,7 +168,7 @@ public class ConfigurationsOverview implements Serializable, MapNotifierListener .neqRestriction(SystemInSessionRegistrationStatus.DROPPED), query.system().systemsInSession() .registrationStatus().isNullRestriction())); queryBuilder.addRestriction(query.system().systemsInSession().testingSession() - .eqRestriction(testingSessionService.getCurrentTestingSession())); + .eqRestriction(testingSessionService.getUserTestingSession())); } @Override @@ -202,7 +202,7 @@ public class ConfigurationsOverview implements Serializable, MapNotifierListener HQLCriterionsForFilter<AbstractConfiguration> hqlCriterions = abstractConfigurationQuery .getHQLCriterionsForFilter(); - final TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + final TestingSession selectedTestingSession = testingSessionService.getUserTestingSession(); hqlCriterions.addPath(TEST_SESSION, abstractConfigurationQuery.configuration().systemInSession() .testingSession(), selectedTestingSession, selectedTestingSession); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/LdifGenerator.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/LdifGenerator.java index 696af88cb..8d7e99b1e 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/LdifGenerator.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/LdifGenerator.java @@ -61,7 +61,7 @@ public class LdifGenerator implements Serializable, LdifGeneratorLocal { Integer sessionId; Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); if ((params.get(SESSION_ID) == null) || (params.get(SESSION_ID).isEmpty())) { - sessionId = testingSessionService.getCurrentTestingSession().getId(); + sessionId = testingSessionService.getUserTestingSession().getId(); } else { sessionId = Integer.parseInt(params.get(SESSION_ID)); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/NetworkConfigurationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/NetworkConfigurationManager.java index 2a2f1dfce..12e991be0 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/NetworkConfigurationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/NetworkConfigurationManager.java @@ -363,7 +363,7 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL if (!validateIP(selectedNetworkConfiguration.getIp())) { return null; } else { - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); HostQuery hostQuery = new HostQuery(); hostQuery.testingSession().eq(activatedTestingSession); @@ -457,7 +457,7 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL String hostname = host.getHostname(); HostQuery q = new HostQuery(); - q.testingSession().id().eq(testingSessionService.getCurrentTestingSession().getId()); + q.testingSession().id().eq(testingSessionService.getUserTestingSession().getId()); q.hostname().eq(hostname); if (host.getId() != null) { q.id().neq(host.getId()); @@ -659,7 +659,7 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL } entityManager.flush(); - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); LinkedList<String> availableIPs = NetworkConfigurationForTestingSession .getAvailableIPs(activatedTestingSession); @@ -681,7 +681,7 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL } entityManager.flush(); - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); LinkedList<String> availableIPs = NetworkConfigurationForTestingSession .getAvailableIPs(activatedTestingSession); @@ -714,7 +714,7 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL LOG.debug("generateIP"); } EntityManager entityManager = EntityManagerService.provideEntityManager(); - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); LinkedList<String> availableIPs = NetworkConfigurationForTestingSession.getAvailableIPs(activatedTestingSession); if (availableIPs.isEmpty()) { FacesMessages.instance().add(StatusMessage.Severity.ERROR, "No more IP's available " + @@ -733,7 +733,7 @@ public class NetworkConfigurationManager implements NetworkConfigurationManagerL if (LOG.isDebugEnabled()) { LOG.debug("generateIP"); } - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); LinkedList<String> availableIPs = NetworkConfigurationForTestingSession.getAvailableIPs(activatedTestingSession); if (availableIPs.isEmpty()) { FacesMessages.instance().add(StatusMessage.Severity.ERROR, "No more IP's available " + diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OIDManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OIDManager.java index e99f85de3..807d3d859 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OIDManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OIDManager.java @@ -22,7 +22,6 @@ import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.Component; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Destroy; -import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.faces.FacesMessages; @@ -489,7 +488,7 @@ public class OIDManager implements Serializable, OIDManagerLocal { private void deleteAllOIDSystemAssignment1() { List<OIDSystemAssignment> losa = OIDSystemAssignment.getOIDSystemAssignmentFiltered(null, null, - testingSessionService.getCurrentTestingSession(), null); + testingSessionService.getUserTestingSession(), null); EntityManager em = EntityManagerService.provideEntityManager(); if (losa != null) { for (OIDSystemAssignment oidSystemAssignment : losa) { @@ -556,7 +555,7 @@ public class OIDManager implements Serializable, OIDManagerLocal { List<OIDRequirement> lor = OIDRequirement.getAllOIDRequirement(); for (OIDRequirement oidRequirement : lor) { List<SystemInSession> lsis = SystemInSession.getSystemInSessionFiltered(em, null, - testingSessionService.getCurrentTestingSession(), null, null, null, null, null, null, null, null, null, + testingSessionService.getUserTestingSession(), null, null, null, null, null, null, null, null, null, null); for (SystemInSession systemInSession : lsis) { List<SystemActorProfiles> lsap = SystemActorProfiles.getSystemActorProfilesFiltered(em, null, diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OidsAndIPParamForSessionManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OidsAndIPParamForSessionManager.java index 3869577bb..ef59c07d1 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OidsAndIPParamForSessionManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/OidsAndIPParamForSessionManager.java @@ -151,7 +151,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP LOG.debug("initializeOIDSConfiguration"); } - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); oidsConfigurationForHL7 = OIDSConfigurationForSessionForHL7 .getConfigurationParametersForSession(activatedTestingSession); @@ -265,7 +265,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP LOG.debug("initializeNetworkConfiguration"); } - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); networkConfigurationForTestingSession = NetworkConfigurationForTestingSession .getConfigurationParametersForSession(activatedTestingSession); @@ -480,7 +480,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP if (LOG.isDebugEnabled()) { LOG.debug("getNumberOfIpsAvailable"); } - TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession selectedTestingSession = testingSessionService.getUserTestingSession(); int allIps = NetworkConfigurationForTestingSession.getAllIPs(selectedTestingSession).size(); int availableIps = NetworkConfigurationForTestingSession.getAvailableIPs( selectedTestingSession).size(); @@ -551,7 +551,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP LOG.debug("initializeOIDSList"); } - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); if (oidChoosedForHL7 == null) { return; @@ -574,7 +574,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP LOG.debug("initializeOIDSListForWS"); } - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); if (oidChoosedForWS == null) { return; @@ -609,7 +609,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP if (LOG.isDebugEnabled()) { LOG.debug("assignAllOIDSInConfigurations"); } - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); List<Institution> listOfInstitution = Institution.listAllInstitutions(); EntityManager em = EntityManagerService.provideEntityManager(); for (Institution currentInstitution : listOfInstitution) { @@ -717,7 +717,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP if (LOG.isDebugEnabled()) { LOG.debug("updateOIDS"); } - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); List<Institution> listOfInstitution = Institution.listAllInstitutions(); EntityManager em = EntityManagerService.provideEntityManager(); @@ -879,7 +879,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP LOG.debug("deleteAllOIDSInConfigurations"); } - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); List<AbstractConfiguration> list = AbstractConfiguration .GetListOfConfigurationWithOIDS(activatedTestingSession); @@ -904,7 +904,8 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP } private void deleteAllOIDInstitutionForCurrentTestingSession() { - List<OIDInstitution> loi = OIDInstitution.getAllOIDInstitutionForCurrentTestingSession(testingSessionService.getCurrentTestingSession()); + List<OIDInstitution> loi = OIDInstitution.getAllOIDInstitutionForCurrentTestingSession( + testingSessionService.getUserTestingSession()); for (OIDInstitution oidInstitution : loi) { entityManager.remove(oidInstitution); } @@ -916,7 +917,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP if (LOG.isDebugEnabled()) { LOG.debug("initProxiesConfigurationsForSession"); } - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); ConfigurationType.GetConfigurationTypeCompatibleWithAProxy(); @@ -980,7 +981,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP if (LOG.isDebugEnabled()) { LOG.debug("saveProxyConfiguration"); } - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); try { entityManager.flush(); proxyConfigurationForForAllServicesSession.setTestingSession(activatedTestingSession); @@ -1017,7 +1018,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP if (LOG.isDebugEnabled()) { LOG.debug("attributeConfigPortProxyForActiveSession"); } - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); List<AbstractConfiguration> configurations = AbstractConfiguration .GetListOfConfigurationWithPortProxy(activatedTestingSession); @@ -1047,7 +1048,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); if ((params.get("sessionId") == null) || (params.get("sessionId").isEmpty())) { - sessionId = testingSessionService.getCurrentTestingSession().getId(); + sessionId = testingSessionService.getUserTestingSession().getId(); } else { sessionId = Integer.parseInt(params.get("sessionId")); } @@ -1191,7 +1192,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); if ((params.get("sessionId") == null) || (params.get("sessionId").isEmpty())) { - sessionId = testingSessionService.getCurrentTestingSession().getId(); + sessionId = testingSessionService.getUserTestingSession().getId(); } else { sessionId = Integer.parseInt(params.get("sessionId")); } @@ -1242,7 +1243,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); if ((params.get("sessionId") == null) || (params.get("sessionId").isEmpty())) { - ts = testingSessionService.getCurrentTestingSession(); + ts = testingSessionService.getUserTestingSession(); } else { ts = TestingSession.getSessionById(Integer.parseInt(params.get("sessionId"))); } @@ -1355,11 +1356,11 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP if (LOG.isDebugEnabled()) { LOG.debug("getSelectedTestingSession"); } - return testingSessionService.getCurrentTestingSession(); + return testingSessionService.getUserTestingSession(); } private void changeProxyUseForATestingSession(boolean isProxyUseEnabled) { - TestingSession inTestinSession = testingSessionService.getCurrentTestingSession(); + TestingSession inTestinSession = testingSessionService.getUserTestingSession(); inTestinSession.setIsProxyUseEnabled(isProxyUseEnabled); TestingSession.mergeTestingSession(inTestinSession, entityManager); } @@ -1370,7 +1371,7 @@ public class OidsAndIPParamForSessionManager implements Serializable, OidsAndIPP LOG.debug("startAllChannels"); } // test is new values has been saved - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); ProxyConfigurationForSession proxyConfigForSession = ProxyConfigurationForSession .getProxyConfigurationForSession(activatedTestingSession); if ((!proxyConfigurationForForAllServicesSession.getPortRangeHigh().equals(proxyConfigForSession.getPortRangeHigh())) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/SystemConfigurationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/SystemConfigurationManager.java index 2b8f8437b..6e4387621 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/SystemConfigurationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/configurations/action/SystemConfigurationManager.java @@ -333,7 +333,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc } } GenerateSystemConfiguration gsc = new GenerateSystemConfiguration(); - gsc.generateSystemConfigurationsOnly(host, sIs, testingSessionService.getCurrentTestingSession()); + gsc.generateSystemConfigurationsOnly(host, sIs, testingSessionService.getUserTestingSession()); } @Override @@ -356,7 +356,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc } GenerateSystemConfiguration gsc = new GenerateSystemConfiguration(); - gsc.generateSystemConfigurationsOnly(host, sIs, testingSessionService.getCurrentTestingSession()); + gsc.generateSystemConfigurationsOnly(host, sIs, testingSessionService.getUserTestingSession()); } else { Institution choosenInstitutionForAdmin = (Institution) Component .getInstance(CHOOSEN_INSTITUTION_FOR_ADMIN); @@ -507,7 +507,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc LOG.debug("void generateConfigurationsForCompany"); } Institution choosenInstitutionForAdmin = (Institution) Component.getInstance(CHOOSEN_INSTITUTION_FOR_ADMIN); - activatedTestingSession = testingSessionService.getCurrentTestingSession(); + activatedTestingSession = testingSessionService.getUserTestingSession(); EntityManager em = EntityManagerService.provideEntityManager(); if ((choosenInstitutionForAdmin != null) && (choosenInstitutionForAdmin.getName() != null)) { @@ -535,7 +535,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc LOG.debug("generateConfigurationsForCompany"); } EntityManager em = EntityManagerService.provideEntityManager(); - activatedTestingSession = testingSessionService.getCurrentTestingSession(); + activatedTestingSession = testingSessionService.getUserTestingSession(); List<SystemInSession> listOfSystemInSession = SystemInSession.getSystemInSessionFiltered(em, null, activatedTestingSession, institution, null, null, null, null, null, null, null, null, null); @@ -581,7 +581,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc if (LOG.isDebugEnabled()) { LOG.debug("generateAllConfigurationsForSession"); } - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); List<Institution> listOfInstitution = TestingSession .getListOfInstitutionsParticipatingInSession(activatedTestingSession); @@ -667,7 +667,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc LOG.debug("getPossibleSystems"); } SystemInSessionQuery systemInSessionQuery = new SystemInSessionQuery(); - systemInSessionQuery.testingSession().eq(testingSessionService.getCurrentTestingSession()); + systemInSessionQuery.testingSession().eq(testingSessionService.getUserTestingSession()); if (!Authorizations.ADMIN.isGranted()) { Institution institution = Institution.findInstitutionWithKeyword(identity.getOrganisationKeyword()); systemInSessionQuery.system().institutionSystems().institution().eq(institution); @@ -900,7 +900,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc if (LOG.isDebugEnabled()) { LOG.debug("deleteAllConfigurationsForSession"); } - activatedTestingSession = testingSessionService.getCurrentTestingSession(); + activatedTestingSession = testingSessionService.getUserTestingSession(); deleteAllConfigurationsForSession(activatedTestingSession); return CONFIGURATION_CONFIGURATIONS_XHTML; } @@ -1110,7 +1110,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc LOG.debug("prepareBean"); } if (activatedTestingSession == null) { - activatedTestingSession = testingSessionService.getCurrentTestingSession(); + activatedTestingSession = testingSessionService.getUserTestingSession(); } selectedSystemInSession = null; return ""; @@ -1124,7 +1124,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc } if (activatedTestingSession == null) { - activatedTestingSession = testingSessionService.getCurrentTestingSession(); + activatedTestingSession = testingSessionService.getUserTestingSession(); } selectedSystemInSession = null; @@ -1220,7 +1220,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc LOG.debug("validateAssigningAuthorityOID"); } if (activatedTestingSession == null) { - activatedTestingSession = testingSessionService.getCurrentTestingSession(); + activatedTestingSession = testingSessionService.getUserTestingSession(); } if (oidsConfigurationForSessionForHL7 == null) { oidsConfigurationForSessionForHL7 = OIDSConfigurationForSessionForHL7 @@ -1389,7 +1389,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc if (selectedSystemInSession != null && !identity.hasRole(Role.ADMIN) && !selectedSystemInSession.isAuthorizedUser(identity.getUsername(), selectedSystemInSession, - testingSessionService.getCurrentTestingSession()) + testingSessionService.getUserTestingSession()) && !identity.hasRole(Role.VENDOR_ADMIN)) { selectedSystemInSession = null; } @@ -1401,7 +1401,7 @@ public class SystemConfigurationManager implements SystemConfigurationManagerLoc LOG.debug("initOneMenu"); } if (selectedSystemInSession == null || !selectedSystemInSession.isAuthorizedUser(identity.getUsername(), - selectedSystemInSession, testingSessionService.getCurrentTestingSession())) { + selectedSystemInSession, testingSessionService.getUserTestingSession())) { GazelleDAO gazelleDAO = new GazelleDAO(); List<SystemInSession> res = gazelleDAO.getNotDrppedSystemsInSessionForLoggedCompanyForSession(); if (res.size() == 1) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/MonitorWorklistFilter.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/MonitorWorklistFilter.java index 56ac3c7c8..41650b960 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/MonitorWorklistFilter.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/MonitorWorklistFilter.java @@ -7,7 +7,6 @@ import net.ihe.gazelle.hql.criterion.QueryModifier; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSessionQuery; import net.ihe.gazelle.tm.session.TestingSessionService; -import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,7 +43,7 @@ public class MonitorWorklistFilter extends Filter<MonitorInSession> { LOG.debug("modifyQuery"); } MonitorInSessionQuery query = new MonitorInSessionQuery(queryBuilder); - queryBuilder.addRestriction(query.testingSession().eqRestriction(testingSessionService.getCurrentTestingSession())); + queryBuilder.addRestriction(query.testingSession().eqRestriction(testingSessionService.getUserTestingSession())); } }); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/SystemInSessionFilter1.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/SystemInSessionFilter1.java index bc38db0fb..3b2ccd2d6 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/SystemInSessionFilter1.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/SystemInSessionFilter1.java @@ -7,7 +7,6 @@ import net.ihe.gazelle.hql.criterion.QueryModifier; import net.ihe.gazelle.hql.restrictions.HQLRestrictions; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.Role; -import net.ihe.gazelle.ssov7.gum.client.application.service.UserPreferencesService; import net.ihe.gazelle.tm.filter.modifier.TestMatchingTestingSession; import net.ihe.gazelle.tm.filter.modifier.TestParticipantTested; import net.ihe.gazelle.tm.gazelletest.model.definition.Test; @@ -16,7 +15,6 @@ import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.SystemInSessionQuery; import net.ihe.gazelle.tm.systems.model.SystemInSessionRegistrationStatus; -import net.ihe.gazelle.tm.systems.model.TestingSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -71,7 +69,7 @@ public class SystemInSessionFilter1 extends Filter<SystemInSession> implements Q .registrationStatus().isNullRestriction())); if (!identity.hasRole(Role.ADMIN)) { queryBuilder.addRestriction(query.system().systemsInSession().testingSession() - .eqRestriction(testingSessionService.getCurrentTestingSession())); + .eqRestriction(testingSessionService.getUserTestingSession())); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/TestInstanceFilter.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/TestInstanceFilter.java index 04eeb7c11..c55b16071 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/TestInstanceFilter.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/TestInstanceFilter.java @@ -60,7 +60,7 @@ public class TestInstanceFilter extends Filter<TestInstance> { // Only tests instance matching testing session filters result.addQueryModifier(new TestMatchingTestingSession(query.test(), "testingSession")); - result.addPath("testingSession", query.testingSession(), TestingSessionInitiator.INSTANCE, testingSessionService.getCurrentTestingSession()); + result.addPath("testingSession", query.testingSession(), TestingSessionInitiator.INSTANCE, testingSessionService.getUserTestingSession()); result.addQueryModifierForCriterion("testingSession", new TestingSessionFilter(identity, query.testingSession())); TMCriterions.addAIPOCriterionsUsingTestInstance(result, query, "testingSession"); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/entities/SearchType.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/entities/SearchType.java index 6faf0671f..7d8e1050a 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/entities/SearchType.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/entities/SearchType.java @@ -68,7 +68,7 @@ public enum SearchType implements SearchEntity { LOG.debug("addRestrictionsForQuery"); } List<HQLRestriction> restrictions; - TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession selectedTestingSession = testingSessionService.getUserTestingSession(); switch (this) { case SAMPLE: restrictions = new ArrayList<>(); @@ -133,7 +133,7 @@ public enum SearchType implements SearchEntity { public List<MonitorUser> parameterizedSearch(ListQueryBuilder<MonitorUser> monitorQueryBuilder, String searchParameter, String query, int maxCount) { monitorQueryBuilder.addLike(searchParameter, query); - monitorQueryBuilder.addEq("monitorInSession.testingSession", testingSessionService.getCurrentTestingSession()); + monitorQueryBuilder.addEq("monitorInSession.testingSession", testingSessionService.getUserTestingSession()); monitorQueryBuilder.addEq("monitorInSession.isActivated", true); monitorQueryBuilder.setMaxResults(maxCount); return monitorQueryBuilder.getList(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionFixer.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionFixer.java index 98d05ca16..c30445cc3 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionFixer.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionFixer.java @@ -28,7 +28,7 @@ public class TestingSessionFixer implements ValueProvider { .TESTING_SESSION_ADMIN_OF_CURRENT_TESTING_SESSION.isGranted()) { return null; } - return testingSessionService.getCurrentTestingSession(); + return testingSessionService.getUserTestingSession(); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionInitiator.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionInitiator.java index b20f9d255..e346a9d91 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionInitiator.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/filter/valueprovider/TestingSessionInitiator.java @@ -22,7 +22,7 @@ public class TestingSessionInitiator implements ValueProvider { if (LOG.isDebugEnabled()) { LOG.debug("getValue"); } - return testingSessionService.getCurrentTestingSession(); + return testingSessionService.getUserTestingSession(); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/financial/action/FinancialManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/financial/action/FinancialManager.java index a9db736a9..cf81e2cff 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/financial/action/FinancialManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/financial/action/FinancialManager.java @@ -226,7 +226,7 @@ public class FinancialManager implements Serializable, FinancialManagerLocal { private static TestingSession verifyTestingSessionAndInstitution(TestingSession activatedTestingSession, Institution selectedInstitution) { if (activatedTestingSession == null) { - activatedTestingSession = getTestingSessionService().getCurrentTestingSession(); + activatedTestingSession = getTestingSessionService().getUserTestingSession(); } if ((activatedTestingSession == null) || (!activatedTestingSession.isContractRequired())) { LOG.error("FinancialSummary : No contract is required for this testing session."); @@ -495,7 +495,7 @@ public class FinancialManager implements Serializable, FinancialManagerLocal { ins = Institution.getLoggedInInstitution(); } if (activatedTestingSession == null) { - activatedTestingSession = getTestingSessionService().getCurrentTestingSession(); + activatedTestingSession = getTestingSessionService().getUserTestingSession(); } FinancialManager.getFinancialSummaryWithCalculatedAmountsStatic(activatedTestingSession, ins, em, mustRecalculateIfVatIsDue); @@ -596,7 +596,7 @@ public class FinancialManager implements Serializable, FinancialManagerLocal { LOG.debug("calculateFinancialSummaryDTO"); } - TestingSession activatedTestingSession = getTestingSessionService().getCurrentTestingSession(); + TestingSession activatedTestingSession = getTestingSessionService().getUserTestingSession(); financialSummary = FinancialManager.getFinancialSummaryWithCalculatedAmountsStatic( activatedTestingSession, @@ -637,7 +637,7 @@ public class FinancialManager implements Serializable, FinancialManagerLocal { calculateFinancialSummaryDTO(false); Institution institutionForContract = entityManager.find(Institution.class, selectedInstitution.getId()); - TestingSession selectedTestingSession = getTestingSessionService().getCurrentTestingSession(); + TestingSession selectedTestingSession = getTestingSessionService().getUserTestingSession(); Long res = ContractExporter.exportContractToPDF(institutionForContract.getId(), institutionForContract.getKeyword(), selectedTestingSession, gazelleDataContracts.getAbsolutePath(), entityManager); @@ -911,7 +911,7 @@ public class FinancialManager implements Serializable, FinancialManagerLocal { Contexts.getSessionContext().set("selectedInstitution", selectedInstitution); EntityManager em = EntityManagerService.provideEntityManager(); invoiceSelected = Invoice.getInvoiceForAnInstitutionAndATestingSession(em, inInstitution, - getTestingSessionService().getCurrentTestingSession()); + getTestingSessionService().getUserTestingSession()); if (invoiceSelected != null) { if (invoiceSelected.getFeesDiscount() == null) { invoiceSelected.setFeesDiscount(new BigDecimal("0.00")); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/AIPOSelector.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/AIPOSelector.java index fe241adcb..70a452699 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/AIPOSelector.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/AIPOSelector.java @@ -60,7 +60,7 @@ public class AIPOSelector implements Serializable, QueryModifier<ActorIntegratio if (selectedSystemInSession != null) { setTestingSession(selectedSystemInSession.getTestingSession()); } else { - setTestingSession(testingSessionService.getCurrentTestingSession()); + setTestingSession(testingSessionService.getUserTestingSession()); } } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonReport.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonReport.java index 8a0aa8cc7..298f61f53 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonReport.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonReport.java @@ -97,7 +97,7 @@ public class ConnectathonReport implements Serializable, UserAttributeCommon { return; } } else { - selectedTestingSession = testingSessionService.getCurrentTestingSession(); + selectedTestingSession = testingSessionService.getUserTestingSession(); } if (urlParams.containsKey("institution")) { Integer institutionId = Integer.parseInt(urlParams.get("institution")); @@ -448,7 +448,7 @@ public class ConnectathonReport implements Serializable, UserAttributeCommon { if (LOG.isDebugEnabled()) { LOG.debug("getReportUrlForVendor"); } - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = testingSessionService.getUserTestingSession(); return getReportUrl(testingSession, Institution.findInstitutionWithKeyword(identity.getOrganisationKeyword()), null); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResult.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResult.java index 650731a0a..78f9a8aa7 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResult.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResult.java @@ -99,7 +99,7 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP public List<String> getAllTestsTypesStringFromSession(){ List<String> testTypesStringValues = new ArrayList<>(); - List<TestType> testTypes = testingSessionService.getCurrentTestingSession().getTestTypes(); + List<TestType> testTypes = testingSessionService.getUserTestingSession().getTestTypes(); for (TestType testType : testTypes){ testTypesStringValues.add(testType.getKeyword()); } @@ -148,7 +148,10 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP public boolean isDisplayedAdmin(){ - return ((Identity.instance().hasRole("admin_role") && !testingSessionService.getCurrentTestingSession().isAllowReportDownload()) || ((Identity.instance().hasRole("vendor_admin_role") || Identity.instance().hasRole("vendor_role") || Identity.instance().hasRole("admin_role")) && testingSessionService.getCurrentTestingSession().isAllowReportDownload())); + return ((Identity.instance().hasRole("admin_role") && !testingSessionService.getUserTestingSession().isAllowReportDownload()) + || ((Identity.instance().hasRole("vendor_admin_role") || Identity.instance().hasRole("vendor_role") + || Identity.instance().hasRole("admin_role")) + && testingSessionService.getUserTestingSession().isAllowReportDownload())); } @Create @@ -498,7 +501,7 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP List<TestType> testTypes = new ArrayList<TestType>(systemAIPOResult.getTestSession().getTestTypes()); LOG.debug(systemAIPOResult.getTestSession().getDescription() + systemAIPOResult.getTestSession().getId() + "getTestRoles " + testTypes.toString()); - if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getUserTestingSession().isTestingInteroperability()) { tipQuery.testInstance().test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { if (testTypes.contains(TestType.getTYPE_INTEROPERABILITY())) { @@ -553,7 +556,7 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP List<TestType> testTypes = new ArrayList<TestType>(systemAIPOResult.getTestSession().getTestTypes()); LOG.debug(systemAIPOResult.getTestSession().getDescription() + systemAIPOResult.getTestSession().getId() + " getTestRolesWithMetaTests " + testTypes.toString()); - if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getUserTestingSession().isTestingInteroperability()) { trQuery.test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { if (testTypes.contains(TestType.getTYPE_INTEROPERABILITY())) { @@ -592,7 +595,7 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP List<TestType> testTypes = new ArrayList<TestType>(systemAIPOResult.getTestSession().getTestTypes()); LOG.debug(systemAIPOResult.getTestSession().getDescription() + systemAIPOResult.getTestSession().getId() + " getTestRolesWithTests " + testTypes.toString()); - if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getUserTestingSession().isTestingInteroperability()) { trQuery.test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { if (testTypes.contains(TestType.getTYPE_INTEROPERABILITY())) { @@ -634,7 +637,7 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP + " getTestRoles " + testTypes.toString()); trQuery.test().testStatus().keyword().eq("ready"); - if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getUserTestingSession().isTestingInteroperability()) { trQuery.test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { if (testTypes.contains(TestType.getTYPE_INTEROPERABILITY())) { @@ -704,7 +707,7 @@ public class ConnectathonResult implements Serializable, QueryModifier<SystemAIP query.addRestriction(query.systemActorProfile().system().systemsInSession().acceptedToSession() .eqRestriction(true)); query.addRestriction(query.systemActorProfile().system().systemsInSession().testingSession() - .eqRestriction(testingSessionService.getCurrentTestingSession())); + .eqRestriction(testingSessionService.getUserTestingSession())); query.addRestriction(enabledRestriction); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResultDataModel.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResultDataModel.java index df248ce18..a44f6fc7e 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResultDataModel.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnectathonResultDataModel.java @@ -6,9 +6,6 @@ import net.ihe.gazelle.hql.HQLQueryBuilder; import net.ihe.gazelle.tm.gazelletest.model.instance.SystemAIPOResultForATestingSession; import net.ihe.gazelle.tm.gazelletest.model.instance.SystemAIPOResultForATestingSessionQuery; import net.ihe.gazelle.tm.session.TestingSessionService; -import net.ihe.gazelle.tm.session.TestingSessionServiceImpl; -import net.ihe.gazelle.tm.session.dao.TestingSessionServiceDAOImpl; -import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,7 +52,7 @@ public class ConnectathonResultDataModel extends FilterDataModel<SystemAIPOResul .test().testStatus().keyword().eqRestriction("ready")); queryBuilder.addRestriction(query.systemActorProfile().aipo().testParticipants().roleInTest().testRoles() - .test().testType().inRestriction(testingSessionService.getCurrentTestingSession().getTestTypes())); + .test().testType().inRestriction(testingSessionService.getUserTestingSession().getTestTypes())); queryBuilder.addRestriction(query.systemActorProfile().aipo().testParticipants().roleInTest().testRoles() .test().testPeerType().id().eqRestriction(selectedTestPeerTypeId)); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java index 55494daa0..fb52ab6bc 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ConnecthatonTestingManager.java @@ -554,7 +554,7 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc SystemActorProfiles systemActorProfile = testRolesParticipantsResult.getSystemActorProfiles(); TestRoles testRoles = testRolesParticipantsResult.getTestRoles(); EntityManager entityManager = EntityManagerService.provideEntityManager(); - PartnersStatisticsBuilder.get(testingSessionService.getCurrentTestingSession()).addPartners(entityManager, partners, + PartnersStatisticsBuilder.get(testingSessionService.getUserTestingSession()).addPartners(entityManager, partners, systemActorProfile, Collections.singletonList(testRoles)); } @@ -563,7 +563,7 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc if (LOG.isDebugEnabled()) { LOG.debug("getActivatedTestingSession"); } - activatedTestingSession = testingSessionService.getCurrentTestingSession(); + activatedTestingSession = testingSessionService.getUserTestingSession(); return activatedTestingSession; } @@ -590,7 +590,7 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc selectedInstitution = Institution.findInstitutionWithKeyword(identity.getOrganisationKeyword()); List<SystemInSession> systemInSessionList = SystemInSession .getSystemInSessionByUserByTestingSession(identity.getUsername(), - testingSessionService.getCurrentTestingSession()); + testingSessionService.getUserTestingSession()); if (systemInSessionList != null) { getSystemListForSelectedInstitution(); } @@ -702,7 +702,8 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc if (LOG.isDebugEnabled()) { LOG.debug("getInstitutionListForActivatedTestingSession"); } - List<Institution> list = TestingSession.getListOfInstitutionsParticipatingInSession(testingSessionService.getCurrentTestingSession()); + List<Institution> list = TestingSession.getListOfInstitutionsParticipatingInSession( + testingSessionService.getUserTestingSession()); Collections.sort(list); return list; } @@ -1071,7 +1072,7 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc if (LOG.isDebugEnabled()) { LOG.debug("deleteAllConnectathonTestInstanceForActivatedTestingSession"); } - deleteAllConnectathonTestInstanceByTestingSession(testingSessionService.getCurrentTestingSession()); + deleteAllConnectathonTestInstanceByTestingSession(testingSessionService.getUserTestingSession()); } @Override @@ -1102,7 +1103,7 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc EntityManager em = EntityManagerService.provideEntityManager(); if (selectedInstitution != null) { List<SystemInSession> lsis = SystemInSession.getSystemsInSessionForCompanyForSession(em, - selectedInstitution); + selectedInstitution, testingSessionService.getUserTestingSession()); Collections.sort(lsis); return lsis; } @@ -1254,7 +1255,7 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc private void searchTestRoles() { if (selectedSystemInSession != null) { boolean isUserAdminOrMonitorForSession = identity.hasRole(Role.ADMIN) - || MonitorInSession.isMonitorForSelectedSession(identity.getUsername(), testingSessionService.getCurrentTestingSession()); + || MonitorInSession.isMonitorForSelectedSession(identity.getUsername(), testingSessionService.getUserTestingSession()); if (isConnectedUserAllowedToStartTest == null) { if (identity.isLoggedIn()) { if (selectedInstitution.getKeyword().equals(identity.getOrganisationKeyword())) { @@ -1599,7 +1600,7 @@ public class ConnecthatonTestingManager implements ConnecthatonTestingManagerLoc List<TestInstance> testInstanceList = null; if (inStatus != null) { - TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession selectedTestingSession = testingSessionService.getUserTestingSession(); List<TestType> testTypes = selectedTestingSession.getTestTypes(); if ((selectedInstitution == null) && (selectedSystemInSession == null) && (selectedIntegrationProfile == null) && (selectedActor == null) && (selectedMonitor == null) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiDisplay.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiDisplay.java index 7e240388b..5a5e7b941 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiDisplay.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiDisplay.java @@ -120,7 +120,8 @@ public class KpiDisplay<T> { for (Object o : list) { if (o instanceof String) { String userId = (String) o; - MonitorInSession monitorInSession = MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(testingSessionService.getCurrentTestingSession(), userId); + MonitorInSession monitorInSession = MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser( + testingSessionService.getUserTestingSession(), userId); monitors.add(monitorInSession); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiSystems.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiSystems.java index ab3521b88..b896e177f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiSystems.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/KpiSystems.java @@ -17,7 +17,6 @@ import net.ihe.gazelle.tm.gazelletest.model.instance.Status; import net.ihe.gazelle.tm.systems.model.SystemInSession; import net.ihe.gazelle.tm.systems.model.SystemInSessionQuery; import net.ihe.gazelle.tm.systems.model.SystemInSessionRegistrationStatus; -import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Create; import org.jboss.seam.annotations.Destroy; @@ -99,7 +98,7 @@ public class KpiSystems extends KpiDisplay<SystemInSession> implements Serializa .neqRestriction(SystemInSessionRegistrationStatus.DROPPED), query.system().systemsInSession() .registrationStatus().isNullRestriction())); queryBuilder.addRestriction(query.system().systemsInSession().testingSession() - .eqRestriction(testingSessionService.getCurrentTestingSession())); + .eqRestriction(testingSessionService.getUserTestingSession())); // GZL-4405: Exclude pre-connectathon tests from count List<TestType> testTypes = TestType.getTestTypesWithoutMESA(); TestEntity<Test> testEntity = query.systemInSessionUsers().testInstanceParticipants().testInstance().test(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MesaTestManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MesaTestManager.java index 4b7f8165b..aa4d3da46 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MesaTestManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MesaTestManager.java @@ -152,7 +152,7 @@ public class MesaTestManager extends ValidationForTIP implements MesaTestManager SystemInSessionQuery query = new SystemInSessionQuery(); if (!identity.hasRole(Role.ADMIN)) { TestingSessionService testingSessionService= (TestingSessionService) Component.getInstance("testingSessionService"); - queryBuilder.addRestriction(query.testingSession().eqRestriction(testingSessionService.getCurrentTestingSession())); + queryBuilder.addRestriction(query.testingSession().eqRestriction(testingSessionService.getUserTestingSession())); } } @@ -560,7 +560,7 @@ public class MesaTestManager extends ValidationForTIP implements MesaTestManager private String generateAMesaTestInstance_(TestRoles inCurrentTestRole) { TestInstance currentTestInstance = new TestInstance(); currentTestInstance.setTest(inCurrentTestRole.getTest()); - currentTestInstance.setTestingSession(testingSessionService.getCurrentTestingSession()); + currentTestInstance.setTestingSession(testingSessionService.getUserTestingSession()); currentTestInstanceParticipants = new TestInstanceParticipants(); currentTestInstanceParticipants.setTestInstance(currentTestInstance); currentTestInstanceParticipants.setRoleInTest(inCurrentTestRole.getRoleInTest()); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MetaTestAdministrationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MetaTestAdministrationManager.java index d104bd330..86ab480f5 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MetaTestAdministrationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MetaTestAdministrationManager.java @@ -14,7 +14,6 @@ import net.ihe.gazelle.tm.gazelletest.model.definition.*; import net.ihe.gazelle.tm.gazelletest.model.instance.MonitorInSession; import net.ihe.gazelle.tm.session.TestingSessionService; import net.ihe.gazelle.tm.systems.model.SystemInSession; -import net.ihe.gazelle.tm.systems.model.TestingSession; import org.jboss.seam.Component; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.*; @@ -512,7 +511,7 @@ public class MetaTestAdministrationManager implements MetaTestAdministrationMana .createQuery("SELECT DISTINCT mIs FROM MonitorInSession mIs JOIN mIs.testList test, MetaTest mt JOIN mt.testRolesList testRoles" + " WHERE testRoles.test=test AND mt=:inMetaTest AND mis.testingSession=:inTestingSession"); query.setParameter("inMetaTest", inMetaTest); - query.setParameter("inTestingSession", testingSessionService.getCurrentTestingSession()); + query.setParameter("inTestingSession", testingSessionService.getUserTestingSession()); List<MonitorInSession> list = query.getResultList(); return list; } @@ -536,7 +535,7 @@ public class MetaTestAdministrationManager implements MetaTestAdministrationMana + "AND sIs.testingSession=:inTestingSession"); query.setParameter("inMetaTest", inMetaTest); query.setParameter("inTestOption", TestOption.getTEST_OPTION_REQUIRED()); - query.setParameter("inTestingSession", testingSessionService.getCurrentTestingSession()); + query.setParameter("inTestingSession", testingSessionService.getUserTestingSession()); List<SystemInSession> list = query.getResultList(); return list; } @@ -558,7 +557,7 @@ public class MetaTestAdministrationManager implements MetaTestAdministrationMana + "AND tr.testOption=:inTestOption " + "AND testRoles=tr " + "AND mt=:inMetaTest " + "AND sIs.testingSession=:inTestingSession"); query.setParameter("inMetaTest", inMetaTest); - query.setParameter("inTestingSession", testingSessionService.getCurrentTestingSession()); + query.setParameter("inTestingSession", testingSessionService.getUserTestingSession()); query.setParameter("inTestOption", TestOption.getTEST_OPTION_REQUIRED()); return ((Long) query.getSingleResult()).intValue(); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorExporter.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorExporter.java index fa2897cf0..3634ac11a 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorExporter.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorExporter.java @@ -80,7 +80,7 @@ public class MonitorExporter implements Serializable { if (LOG.isDebugEnabled()) { LOG.debug("export"); } - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = testingSessionService.getUserTestingSession(); // initiate workbook Workbook workbook = new HSSFWorkbook(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorInSessionAdministrationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorInSessionAdministrationManager.java index 04ae07d1d..e1f9eb5fb 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorInSessionAdministrationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/MonitorInSessionAdministrationManager.java @@ -114,7 +114,7 @@ public class MonitorInSessionAdministrationManager implements Serializable, Quer } private List<MonitorInSession> getMonitorInSessions() { - return MonitorInSession.getAllActivatedMonitorsForATestingSession(testingSessionService.getCurrentTestingSession()); + return MonitorInSession.getAllActivatedMonitorsForATestingSession(testingSessionService.getUserTestingSession()); } public Filter<MonitorInSession> getFilter() { @@ -410,7 +410,8 @@ public class MonitorInSessionAdministrationManager implements Serializable, Quer monitorsMap.put(user.getId(), user); } } - List<MonitorInSession> monitorInSessionList = MonitorInSession.getAllActivatedMonitorsForATestingSession(testingSessionService.getCurrentTestingSession()); + List<MonitorInSession> monitorInSessionList = MonitorInSession.getAllActivatedMonitorsForATestingSession( + testingSessionService.getUserTestingSession()); if (monitorInSessionList != null) { for (MonitorInSession monitorInSession : monitorInSessionList) { monitorsMap.remove(monitorInSession.getUserId()); @@ -487,7 +488,7 @@ public class MonitorInSessionAdministrationManager implements Serializable, Quer private void updateMonitorInSessionListStatus() { List<MonitorInSession> monitorInSessionList = MonitorInSession - .getAllActivatedMonitorsForATestingSession(testingSessionService.getCurrentTestingSession()); + .getAllActivatedMonitorsForATestingSession(testingSessionService.getUserTestingSession()); if (monitorInSessionList != null) { EntityManager entityManager = EntityManagerService.provideEntityManager(); for (MonitorInSession monitorInSession : monitorInSessionList) { @@ -509,7 +510,7 @@ public class MonitorInSessionAdministrationManager implements Serializable, Quer EntityManager entityManager = EntityManagerService.provideEntityManager(); for (String userId : selectedMonitors) { MonitorInSession monitorInSession; - TestingSession currentTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession currentTestingSession = testingSessionService.getUserTestingSession(); List<MonitorInSession> disactivatedMonitorInSessionList = MonitorInSession .getDisactivatedMonitorInSessionForATestingSessionByUser( currentTestingSession, userId); @@ -799,7 +800,8 @@ public class MonitorInSessionAdministrationManager implements Serializable, Quer public boolean isConnectedUserMonitorForSelectedSession() { LOG.trace("isConnectedUserMonitorForSelectedSession"); - return MonitorInSession.isMonitorForSelectedSession(identity.getUsername(), testingSessionService.getCurrentTestingSession()); + return MonitorInSession.isMonitorForSelectedSession(identity.getUsername(), + testingSessionService.getUserTestingSession()); } @Override @@ -808,7 +810,7 @@ public class MonitorInSessionAdministrationManager implements Serializable, Quer LOG.debug("modifyQuery"); } MonitorInSessionQuery query = new MonitorInSessionQuery(); - hqlQueryBuilder.addRestriction(query.testingSession().eqRestriction(testingSessionService.getCurrentTestingSession())); + hqlQueryBuilder.addRestriction(query.testingSession().eqRestriction(testingSessionService.getUserTestingSession())); hqlQueryBuilder.addRestriction(query.isActivated().eqRestriction(true)); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ProxyManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ProxyManager.java index 130cb841f..48ef5b803 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ProxyManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/ProxyManager.java @@ -257,7 +257,7 @@ public class ProxyManager implements MessagingProvider { public static Collection<Configuration> getConfigurationsForCurrentSession() { Map<Integer, Configuration> configurations = new HashMap<Integer, Configuration>(); List<AbstractConfiguration> confs = AbstractConfiguration - .listAllConfigurationsForATestingSession(testingSessionService.getCurrentTestingSession()); + .listAllConfigurationsForATestingSession(testingSessionService.getUserTestingSession()); for (AbstractConfiguration configuration : confs) { addAndConvertConfiguration(configurations, configuration); } @@ -293,7 +293,7 @@ public class ProxyManager implements MessagingProvider { private static net.ihe.gazelle.proxy.ws.Configuration convertConfiguration(AbstractConfiguration abstractConfiguration) { net.ihe.gazelle.proxy.ws.Configuration configuration = null; - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); networkConfigurationForTestingSession = NetworkConfigurationForTestingSession .getConfigurationParametersForSession(activatedTestingSession); if (networkConfigurationForTestingSession == null) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/StartTestInstance.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/StartTestInstance.java index 58d18e8de..7af49d965 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/StartTestInstance.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/StartTestInstance.java @@ -316,7 +316,7 @@ public class StartTestInstance implements Serializable { } if (selectedTestInstanceParticipants != null) { selectedTestInstance = selectedTestInstanceParticipants.getTestInstance(); - TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession selectedTestingSession = testingSessionService.getUserTestingSession(); selectedTestInstance.setProxyUsed(selectedTestingSession.getIsProxyUseEnabled()); selectedTestInstance.setTestingSession(selectedTestingSession); selectedTestInstance = persistTestInstance(selectedTestInstance); @@ -762,7 +762,7 @@ public class StartTestInstance implements Serializable { if (inTestRoles != null) { List<SystemInSession> systemInSessionList = RoleInTest .getSystemInSessionByRoleInTestByTestingSessionBySISStatus(inTestRoles.getRoleInTest(), - testingSessionService.getCurrentTestingSession(), null, true); + testingSessionService.getUserTestingSession(), null, true); if (systemInSessionList != null) { if (inTestRoles.getRoleInTest().equals(selectedTestInstanceParticipants.getRoleInTest())) { systemInSessionList.remove(selectedTestInstanceParticipants.getSystemInSessionUser() @@ -783,7 +783,7 @@ public class StartTestInstance implements Serializable { if (inTestRoles != null) { List<SystemInSession> systemInSessionList = RoleInTest .getSystemInSessionByRoleInTestByTestingSessionBySISStatus(inTestRoles.getRoleInTest(), - testingSessionService.getCurrentTestingSession(), null, true); + testingSessionService.getUserTestingSession(), null, true); if (systemInSessionList != null) { if (inTestRoles.getRoleInTest().equals(selectedTestInstanceParticipants.getRoleInTest())) { systemInSessionList.remove(selectedTestInstanceParticipants.getSystemInSessionUser() @@ -811,7 +811,7 @@ public class StartTestInstance implements Serializable { if (inTestRoles != null) { List<SystemInSession> systemInSessionList = RoleInTest .getSystemInSessionByRoleInTestByTestingSessionBySISStatus(inTestRoles.getRoleInTest(), - testingSessionService.getCurrentTestingSession(), null, true); + testingSessionService.getUserTestingSession(), null, true); if (systemInSessionList != null) { if (inTestRoles.getRoleInTest().equals(selectedTestInstanceParticipants.getRoleInTest())) { systemInSessionList.remove(selectedTestInstanceParticipants.getSystemInSessionUser() @@ -919,15 +919,15 @@ public class StartTestInstance implements Serializable { } private boolean getAllowOneCompanyPlaySeveralRolesInP2PTests() { - return testingSessionService.getCurrentTestingSession().isAllowOneCompanyPlaySeveralRolesInP2PTests(); + return testingSessionService.getUserTestingSession().isAllowOneCompanyPlaySeveralRolesInP2PTests(); } private boolean getAllowOneCompanyPlaySeveralRolesInGroupTests() { - return testingSessionService.getCurrentTestingSession().isAllowOneCompanyPlaySeveralRolesInGroupTests(); + return testingSessionService.getUserTestingSession().isAllowOneCompanyPlaySeveralRolesInGroupTests(); } private boolean getAllowParticipantsStartGroupTests() { - return testingSessionService.getCurrentTestingSession().isAllowParticipantsStartGroupTests(); + return testingSessionService.getUserTestingSession().isAllowParticipantsStartGroupTests(); } public boolean displayIntendedBehaviorWarningMessage() { @@ -959,7 +959,7 @@ public class StartTestInstance implements Serializable { // Now we are adding a preference in the testing session. This may be not enforced (relaxed for the current session) Identity identity = Identity.instance(); // GZL-4872 : New Group Tests properties added in feasibility computing during test instance starting - TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession selectedTestingSession = testingSessionService.getUserTestingSession(); boolean isAllowOneCompanyPlaySeveralRolesInP2PTests = selectedTestingSession.isAllowOneCompanyPlaySeveralRolesInP2PTests(); boolean isAllowOneCompanyPlaySeveralRolesInGroupTests = selectedTestingSession.isAllowOneCompanyPlaySeveralRolesInGroupTests(); boolean isAllowParticipantsStartGroupTests = selectedTestingSession.isAllowParticipantsStartGroupTests(); @@ -1034,7 +1034,7 @@ public class StartTestInstance implements Serializable { LOG.debug("getSimulatorsByTestRoles"); } if (inTestRoles != null) { - TestingSession ts = testingSessionService.getCurrentTestingSession(); + TestingSession ts = testingSessionService.getUserTestingSession(); SimulatorInSessionQuery query = new SimulatorInSessionQuery(); query.testingSession().eq(ts); query.system().systemActorProfiles().aipo().testParticipants().roleInTest().testRoles().id() diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java index 350ac9d0e..59fa2590f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java @@ -275,7 +275,7 @@ public class SystemInSessionOverview implements Serializable, QueryModifier<Syst .neqRestriction(SystemInSessionRegistrationStatus.DROPPED), query.system().systemsInSession() .registrationStatus().isNullRestriction())); queryBuilder.addRestriction(query.system().systemsInSession().testingSession() - .eqRestriction(getTestingSessionService().getCurrentTestingSession())); + .eqRestriction(getTestingSessionService().getUserTestingSession())); } @@ -317,7 +317,7 @@ public class SystemInSessionOverview implements Serializable, QueryModifier<Syst } systemsList = removeDuplicateSystems(systemsList); - TestingSession activeSession = getTestingSessionService().getCurrentTestingSession(); + TestingSession activeSession = getTestingSessionService().getUserTestingSession(); Collection<IntegrationProfile> listOfIntegrationProfile = activeSession.getIntegrationProfilesUnsorted(); List<IntegrationProfile> listOfIntegrationProfileCopy = new ArrayList<>(listOfIntegrationProfile); for (IntegrationProfile integrationProfile : listOfIntegrationProfile) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TMCheckListManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TMCheckListManager.java index 35bc945be..b5e725ec6 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TMCheckListManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TMCheckListManager.java @@ -443,7 +443,7 @@ public class TMCheckListManager implements TMCheckListManagerLocal, Serializable } TestInstance ti = (TestInstance) arg1; try { - ti.setTestingSession(testingSessionService.getCurrentTestingSession()); + ti.setTestingSession(testingSessionService.getUserTestingSession()); EntityManager entityManager = EntityManagerService.provideEntityManager(); ti = entityManager.merge(ti); entityManager.flush(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceGenerator.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceGenerator.java index efff12cf6..2deed904d 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceGenerator.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceGenerator.java @@ -128,7 +128,7 @@ public class TestInstanceGenerator { for (TestRoles testRoles : testRolesList) { List<SystemInSession> systemInSessionList = RoleInTest .getSystemInSessionByRoleInTestByTestingSessionBySISStatus(testRoles.getRoleInTest(), - testingSessionService.getCurrentTestingSession(), null, true); + testingSessionService.getUserTestingSession(), null, true); if ((systemInSessionList != null) && (systemInSessionList.size() > 0)) { systemInSessionList.remove(inSystemInSession); if (systemInSessionList.size() > testRoles.getCardMax()) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceManager.java index 4758aaa36..097996ae0 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstanceManager.java @@ -591,9 +591,14 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us EntityManager entityManager = EntityManagerService.provideEntityManager(); //Update monitor to current user - if (MonitorInSession.isMonitorForSelectedSession(identity.getUsername(),testingSessionService.getCurrentTestingSession())) { - if ((selectedStatus.equals(Status.getSTATUS_VERIFIED()) || selectedStatus.equals(Status.getSTATUS_FAILED()) || selectedStatus.equals(Status.getSTATUS_PARTIALLY_VERIFIED()))) { - inTestInstance.setMonitorInSession(MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(testingSessionService.getCurrentTestingSession(), identity.getUsername())); + if (MonitorInSession.isMonitorForSelectedSession(identity.getUsername(),testingSessionService.getUserTestingSession())) { + if ((selectedStatus.equals(Status.getSTATUS_VERIFIED()) || selectedStatus.equals(Status.getSTATUS_FAILED()) + || selectedStatus.equals(Status.getSTATUS_PARTIALLY_VERIFIED()))) { + inTestInstance.setMonitorInSession( + MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser( + testingSessionService.getUserTestingSession(), identity.getUsername() + ) + ); } } @@ -643,14 +648,14 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us public boolean isConnectedUserAllowedToValidateTestInstance(TestInstance inTestInstance) { LOG.trace("isConnectedUserAllowedToValidateTestInstance"); return MonitorInSession.isUserAllowedToValidateTestInstance(identity, inTestInstance, - testingSessionService.getCurrentTestingSession()); + testingSessionService.getUserTestingSession()); } public boolean isConnectedUserAllowedToValidateSelectedTestInstance() { LOG.trace("isConnectedUserAllowedToValidateSelectedTestInstance"); if (isConnectedUserAllowedToValidateTestInstance == null) { isConnectedUserAllowedToValidateTestInstance = MonitorInSession.isMonitorForSelectedSession(identity.getUsername(), - testingSessionService.getCurrentTestingSession()); + testingSessionService.getUserTestingSession()); } return isConnectedUserAllowedToValidateTestInstance; } @@ -1011,7 +1016,7 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us statusList.add(Status.getSTATUS_PAUSED()); statusList.add(Status.getSTATUS_COMPLETED()); statusList.add(Status.getSTATUS_ABORTED()); - TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession selectedTestingSession = testingSessionService.getUserTestingSession(); if (selectedTestingSession.getIsCriticalStatusEnabled()) { statusList.add(Status.getSTATUS_CRITICAL()); } @@ -1446,7 +1451,7 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us LOG.trace("claimTestInstance"); if (testInstance.getMonitorInSession() == null) { if (identity.isLoggedIn()) { - TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession selectedTestingSession = testingSessionService.getUserTestingSession(); MonitorInSession monitorInSession = MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(selectedTestingSession, identity.getUsername()); if (monitorInSession != null) { EntityManager entityManager = EntityManagerService.provideEntityManager(); @@ -1465,7 +1470,8 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us public void releaseTestInstance(TestInstance testInstance) { LOG.trace("releaseTestInstance"); - MonitorInSession monitorInSession = MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(testingSessionService.getCurrentTestingSession(), identity.getUsername()); + MonitorInSession monitorInSession = MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser( + testingSessionService.getUserTestingSession(), identity.getUsername()); if (monitorInSession != null) { EntityManager entityManager = EntityManagerService.provideEntityManager(); testInstance.setMonitorInSession(null); @@ -3167,7 +3173,7 @@ public class TestInstanceManager implements Serializable, JiraClientCallback, Us if (LOG.isDebugEnabled()) { LOG.debug("proxyIsActivated"); } - TestingSession inTestinSession = testingSessionService.getCurrentTestingSession(); + TestingSession inTestinSession = testingSessionService.getUserTestingSession(); TestingSessionQuery q = new TestingSessionQuery(); q.id().eq(inTestinSession.getId()); List<Boolean> res = q.isProxyUseEnabled().getListDistinct(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverview.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverview.java index 2879fe50f..b90b93788 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverview.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverview.java @@ -356,7 +356,7 @@ public class TestInstancesOverview implements Serializable { int total = 0; setInteroperabilityTestsOnly(false); setMonitorWorkList(true); - if (testingSessionService.getCurrentTestingSession().getIsCriticalStatusEnabled()) { + if (testingSessionService.getUserTestingSession().getIsCriticalStatusEnabled()) { if (testsCritical != null) { total = total + testsCritical.size(); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverviewManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverviewManager.java index 5dfe69b72..6786f8a9b 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverviewManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestInstancesOverviewManager.java @@ -49,7 +49,7 @@ public class TestInstancesOverviewManager implements Serializable { if (LOG.isDebugEnabled()) { LOG.debug("getSelectedTestingSession"); } - return testingSessionService.getCurrentTestingSession(); + return testingSessionService.getUserTestingSession(); } public Institution getSelectedInstitution() { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestMonitorManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestMonitorManager.java index edb9b230a..5f065d65d 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestMonitorManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestMonitorManager.java @@ -182,7 +182,7 @@ public class TestMonitorManager implements Serializable, QueryModifier<Test> { if (LOG.isDebugEnabled()) { LOG.debug("reset"); } - this.testingSession = testingSessionService.getCurrentTestingSession(); + this.testingSession = testingSessionService.getUserTestingSession(); this.listAllMonitorsForSelectedSession = MonitorInSession .getAllActivatedMonitorsForATestingSession(testingSession); this.listMonitorsForSelectedTests = new ArrayList<>(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestsDefinitionsAdministrationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestsDefinitionsAdministrationManager.java index 770b81fb9..1d7afd053 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestsDefinitionsAdministrationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/TestsDefinitionsAdministrationManager.java @@ -1106,7 +1106,7 @@ public class TestsDefinitionsAdministrationManager implements Serializable, Quer + "WHERE sap.actorIntegrationProfileOption = participants.actorIntegrationProfileOption " + "AND sIs.system=sap.system " + "AND tr.test=:inTest " + "AND participants.tested='true' " + "AND tr.testOption=:inTestOption " + "AND sIs.testingSession=:inTestingSession"); - query.setParameter("inTestingSession", testingSessionService.getCurrentTestingSession()); + query.setParameter("inTestingSession", testingSessionService.getUserTestingSession()); query.setParameter("inTest", inTest); query.setParameter("inTestOption", TestOption.getTEST_OPTION_REQUIRED()); return ((Long) query.getSingleResult()).intValue(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/conformitytestreport/dao/ConformityTestReportDAOImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/conformitytestreport/dao/ConformityTestReportDAOImpl.java index cd4e64387..7a81cf285 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/conformitytestreport/dao/ConformityTestReportDAOImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/conformitytestreport/dao/ConformityTestReportDAOImpl.java @@ -145,7 +145,7 @@ public class ConformityTestReportDAOImpl implements ConformityTestReportDAO { TestInstanceParticipantsQuery tipQuery = new TestInstanceParticipantsQuery(); List<TestType> testTypes = new ArrayList<>(systemAIPOResult.getTestSession().getTestTypes()); - if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getUserTestingSession().isTestingInteroperability()) { tipQuery.testInstance().test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { testTypes.remove(TestType.getTYPE_INTEROPERABILITY()); @@ -189,7 +189,7 @@ public class ConformityTestReportDAOImpl implements ConformityTestReportDAO { trQuery.roleInTest().testParticipantsList().tested().eq(Boolean.TRUE); List<TestType> testTypes = new ArrayList<>(systemAIPOResult.getTestSession().getTestTypes()); - if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getUserTestingSession().isTestingInteroperability()) { trQuery.test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { testTypes.remove(TestType.getTYPE_INTEROPERABILITY()); @@ -226,7 +226,7 @@ public class ConformityTestReportDAOImpl implements ConformityTestReportDAO { trQuery.roleInTest().testParticipantsList().tested().eq(Boolean.TRUE); List<TestType> testTypes = new ArrayList<>(systemAIPOResult.getTestSession().getTestTypes()); - if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getUserTestingSession().isTestingInteroperability()) { trQuery.test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { testTypes.remove(TestType.getTYPE_INTEROPERABILITY()); @@ -266,7 +266,7 @@ public class ConformityTestReportDAOImpl implements ConformityTestReportDAO { trQuery.test().testStatus().keyword().eq(READY); - if (isInteroperability && testingSessionService.getCurrentTestingSession().isTestingInteroperability()) { + if (isInteroperability && testingSessionService.getUserTestingSession().isTestingInteroperability()) { trQuery.test().testType().id().eq(TestType.getTYPE_INTEROPERABILITY().getId()); } else { testTypes.remove(TestType.getTYPE_INTEROPERABILITY()); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/TestingSessionScopeServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/TestingSessionScopeServiceImpl.java index 17523f774..e3278ba1f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/TestingSessionScopeServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/TestingSessionScopeServiceImpl.java @@ -115,7 +115,8 @@ public class TestingSessionScopeServiceImpl implements TestingSessionScopeServic profileCoverage.setActorName(actor.getName()); List<ImplementedActorInSystem> implementedActorInSystems = new ArrayList<>(); - List<SystemInSession> systemInSessions = testingSessionScopeDao.getSystemsInSessionByActorAndProfile(integrationProfile, actor, testingSessionService.getCurrentTestingSession()); + List<SystemInSession> systemInSessions = testingSessionScopeDao.getSystemsInSessionByActorAndProfile( + integrationProfile, actor, testingSessionService.getUserTestingSession()); for (SystemInSession systemInSession : systemInSessions) { if (systemInSession != null) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/gui/TestingSessionScopeBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/gui/TestingSessionScopeBeanGui.java index a534eb26c..d9e57b807 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/gui/TestingSessionScopeBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/testingSessionScope/gui/TestingSessionScopeBeanGui.java @@ -236,7 +236,7 @@ public class TestingSessionScopeBeanGui implements Serializable, UserAttributeCo HttpServletResponse response = (HttpServletResponse) externalContext.getResponse(); ServletOutputStream servletOutputStream = response.getOutputStream(); response.setContentType("application/vnd.ms-excel"); - Integer sessionsId = testingSessionService.getCurrentTestingSession().getId(); + Integer sessionsId = testingSessionService.getUserTestingSession().getId(); response.setHeader("Content-Disposition", "attachment;filename=\"testingSession_" + sessionsId + "_scope.xls\""); workbook.write(servletOutputStream); servletOutputStream.flush(); @@ -248,7 +248,7 @@ public class TestingSessionScopeBeanGui implements Serializable, UserAttributeCo * Change the status of each profile with the selected testability then update the DataBase */ public void autoEvaluate(){ - TestingSession session = testingSessionService.getCurrentTestingSession(); + TestingSession session = testingSessionService.getUserTestingSession(); testingSessionScopeService.autoEvaluate(session, selectedTestability, selectedStatus); FacesMessages.instance().add("Evaluation done"); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationServiceImpl.java index 838519ef0..461ffef4c 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/preparation/network/SutNetworkConfigurationServiceImpl.java @@ -25,7 +25,8 @@ public class SutNetworkConfigurationServiceImpl implements SutNetworkConfigurati @Override public List<SutNetworkConfigurationSummary> getSutNetworkConfigurationSummaries() { List<SutNetworkConfigurationSummary> networkConfigurationSummaries = new ArrayList<>(); - for (SystemInSession system : sutNetworkConfigurationDao.getListSystemInSessionOfCurrenUser(testingSessionService.getCurrentTestingSession())) { + for (SystemInSession system : sutNetworkConfigurationDao.getListSystemInSessionOfCurrenUser( + testingSessionService.getUserTestingSession())) { networkConfigurationSummaries.add(constructSutNetworkConfigurationSummary(system)); } return networkConfigurationSummaries; @@ -33,12 +34,12 @@ public class SutNetworkConfigurationServiceImpl implements SutNetworkConfigurati @Override public int getNumberOfNetworkConfigurationsHosts() { - return sutNetworkConfigurationDao.getNumberOfNetworkConfigurationsHosts(testingSessionService.getCurrentTestingSession()); + return sutNetworkConfigurationDao.getNumberOfNetworkConfigurationsHosts(testingSessionService.getUserTestingSession()); } @Override public int getNumberOfNetworkConfigurationsHostsNoIp() { - return sutNetworkConfigurationDao.getNumberOfNetworkConfigurationsHostsNoIp(testingSessionService.getCurrentTestingSession()); + return sutNetworkConfigurationDao.getNumberOfNetworkConfigurationsHostsNoIp(testingSessionService.getUserTestingSession()); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/registration/gui/RegistrationBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/registration/gui/RegistrationBeanGui.java index 26cc3ffc0..d53d2c926 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/registration/gui/RegistrationBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/registration/gui/RegistrationBeanGui.java @@ -85,7 +85,7 @@ public class RegistrationBeanGui implements Serializable { @Create public void init() { - this.selectedTestingSession = testingSessionService.getCurrentTestingSession(); + this.selectedTestingSession = testingSessionService.getUserTestingSession(); this.registrationOpen = testingSessionService.isRegistrationOpen(selectedTestingSession); this.selectedInstitution = organizationService.getCurrentOrganization(); if (identity.isLoggedIn() && selectedTestingSession != null && selectedInstitution != null) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java index 356e3fd82..02179b2f0 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java @@ -10,12 +10,12 @@ import java.util.List; public interface TestingSessionService { /** - * Get current testing session, based on Cookie. + * Get the current testing session of the logged user * If the service cannot find a session, it will use the default one. * - * @return TestingSession from cookie, if not found return the default one + * @return the current TestingSession of the logged user. */ - TestingSession getCurrentTestingSession(); + TestingSession getUserTestingSession(); /** * Set in cookie the currentTestingSession of the logged user. diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java index 14efc00a3..26cc223df 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionServiceImpl.java @@ -43,7 +43,7 @@ public class TestingSessionServiceImpl implements TestingSessionService { } @Override - public TestingSession getCurrentTestingSession() { + public TestingSession getUserTestingSession() { Integer testingSessionId = userContext.getSelectedTestingSessionId(); boolean testingSessionExisting = testingSessionId != null && testingSessionServiceDAO.isTestingSessionExisting(testingSessionId); @@ -58,7 +58,8 @@ public class TestingSessionServiceImpl implements TestingSessionService { @Override public void setCurrentTestingSession(TestingSession testingSession) { - + //FIXME Contexts.getSessionContext().set("selectedTestingSession", refreshedTestingSession); + //FIXME Contexts.getSessionContext().set("selectedUser", userService.getUserById(identity.getUsername())); userContext.setSelectedTestingSessionId(testingSession == null ? null : testingSession.getId()); @@ -153,12 +154,12 @@ public class TestingSessionServiceImpl implements TestingSessionService { @Override public List<TestType> getListTestType() { - return getCurrentTestingSession().getTestTypes(); + return getUserTestingSession().getTestTypes(); } @Override public List<SelectItem> getListTestTypeAsSelectItems() { - List<TestType> list = getCurrentTestingSession().getTestTypes(); + List<TestType> list = getUserTestingSession().getTestTypes(); List<SelectItem> result = new ArrayList<>(); String label = org.jboss.seam.core.ResourceBundle.instance().getString("gazelle.tests.testInstance.allOptions"); result.add(new SelectItem("All", label)); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/bean/TestSessionBean.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/bean/TestSessionBean.java index 3318e861f..6626b3908 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/bean/TestSessionBean.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/bean/TestSessionBean.java @@ -20,7 +20,7 @@ public class TestSessionBean { TestingSessionService testingSessionService; public TestingSession getSelectedTestingSession() { - return testingSessionService.getCurrentTestingSession(); + return testingSessionService.getUserTestingSession(); } public void setSelectedTestingSession(TestingSession selectedTestingSession) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/StatisticsCommonServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/StatisticsCommonServiceImpl.java index e9a45215e..8b4842a60 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/StatisticsCommonServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/StatisticsCommonServiceImpl.java @@ -26,17 +26,17 @@ public class StatisticsCommonServiceImpl implements StatisticsCommonService { @Override public TestInstanceParticipantsQuery getTestInstanceParticipantsQuery() { - return statisticsCommonDao.getTestInstanceParticipantsQuery(testingSessionService.getCurrentTestingSession()); + return statisticsCommonDao.getTestInstanceParticipantsQuery(testingSessionService.getUserTestingSession()); } @Override public SystemInSessionQuery getSystemInSessionQuery() { - return statisticsCommonDao.getSystemInSessionQuery(testingSessionService.getCurrentTestingSession()); + return statisticsCommonDao.getSystemInSessionQuery(testingSessionService.getUserTestingSession()); } @Override public ProfileInTestingSessionStats getProfileInTestingSessionStatsForCurrentSession() { - List<ProfileInTestingSession> profileInTestingSessions = statisticsCommonDao.getAllProfileInTestingSessionForCurrentSession(testingSessionService.getCurrentTestingSession()); + List<ProfileInTestingSession> profileInTestingSessions = statisticsCommonDao.getAllProfileInTestingSessionForCurrentSession(testingSessionService.getUserTestingSession()); int nbTestable = 0; int nbDropped = 0; @@ -64,33 +64,32 @@ public class StatisticsCommonServiceImpl implements StatisticsCommonService { @Override public int getNumberOfSessionParticipants() { - return statisticsCommonDao.getNumberOfSessionParticipants(testingSessionService.getCurrentTestingSession()); + return statisticsCommonDao.getNumberOfSessionParticipants(testingSessionService.getUserTestingSession()); } @Override public int getNumberOfRegisteredInstitutionWithAttendee() { - return statisticsCommonDao.getNumberOfRegisteredInstitutionWithAttendee(testingSessionService.getCurrentTestingSession()); + return statisticsCommonDao.getNumberOfRegisteredInstitutionWithAttendee(testingSessionService.getUserTestingSession()); } @Override public int getNumberOfRegisteredInstitutionWithSystem() { - return statisticsCommonDao.getNumberOfRegisteredInstitutionWithSystem(testingSessionService.getCurrentTestingSession()); + return statisticsCommonDao.getNumberOfRegisteredInstitutionWithSystem(testingSessionService.getUserTestingSession()); } @Override public int getNumberOfRegisteredSystemInSession() { - return statisticsCommonDao.getNumberOfRegisteredSystemInSession(testingSessionService.getCurrentTestingSession()); + return statisticsCommonDao.getNumberOfRegisteredSystemInSession(testingSessionService.getUserTestingSession()); } @Override public int getNumberOfIntegrationProfilesForCurrentSession() { - TestingSession currentTestingSession = testingSessionService.getCurrentTestingSession(); - return statisticsCommonDao.getNumberOfIntegrationProfilesForCurrentSession(currentTestingSession); + return statisticsCommonDao.getNumberOfIntegrationProfilesForCurrentSession(testingSessionService.getUserTestingSession()); } @Override public int getNumberOfDomainsForCurrentSession() { - return statisticsCommonDao.getNumberOfDomainForCurrentSession(testingSessionService.getCurrentTestingSession()); + return statisticsCommonDao.getNumberOfDomainForCurrentSession(testingSessionService.getUserTestingSession()); } @Override diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/gui/StatisticsCommonBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/gui/StatisticsCommonBeanGui.java index d32738e02..6e563c93f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/gui/StatisticsCommonBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/common/gui/StatisticsCommonBeanGui.java @@ -63,7 +63,8 @@ public class StatisticsCommonBeanGui { } public boolean isMonitorOfCurrentSession() { return identity.hasRole(Role.MONITOR) - && (MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser(testingSessionService.getCurrentTestingSession(), identity.getUsername()) != null); + && (MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser( + testingSessionService.getUserTestingSession(), identity.getUsername()) != null); } public String getTestingSessionScopeLink() { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/StatisticsForEvaluationPhaseServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/StatisticsForEvaluationPhaseServiceImpl.java index 65e8a28e3..000a6f513 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/StatisticsForEvaluationPhaseServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/evaluation/StatisticsForEvaluationPhaseServiceImpl.java @@ -32,7 +32,7 @@ public class StatisticsForEvaluationPhaseServiceImpl implements StatisticsForEva @Override public List<SystemInSession> getSystemsForCurrentUser() { - return statisticsForEvaluationPhaseDao.getSystemsForCurrentUser(testingSessionService.getCurrentTestingSession()); + return statisticsForEvaluationPhaseDao.getSystemsForCurrentUser(testingSessionService.getUserTestingSession()); } @Override @@ -92,7 +92,8 @@ public class StatisticsForEvaluationPhaseServiceImpl implements StatisticsForEva @Override public CapabilityStats getCapabilitiesStatisticsForADomain(Domain domain) { if (domain != null) { - List<SystemAIPOResultForATestingSession> capabilities = statisticsForEvaluationPhaseDao.getAllCapabilitiesForADomain(domain, testingSessionService.getCurrentTestingSession()); + List<SystemAIPOResultForATestingSession> capabilities = statisticsForEvaluationPhaseDao.getAllCapabilitiesForADomain( + domain, testingSessionService.getUserTestingSession()); return getCapabilityStats(capabilities); } return new CapabilityStats(0, 0, 0, 0, 0, 0); @@ -105,7 +106,8 @@ public class StatisticsForEvaluationPhaseServiceImpl implements StatisticsForEva @Override public int getNbTotalCapabilitiesForADomain(Domain domain) { - return statisticsForEvaluationPhaseDao.getNbTotalCapabilitiesForADomain(domain, testingSessionService.getCurrentTestingSession()); + return statisticsForEvaluationPhaseDao.getNbTotalCapabilitiesForADomain(domain, + testingSessionService.getUserTestingSession()); } private int getNbEvaluationPending(int nbEvaluationPending, SystemAIPOResultForATestingSession capability) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/StatisticsForPreparationPhaseServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/StatisticsForPreparationPhaseServiceImpl.java index a91f4df1b..543db5048 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/StatisticsForPreparationPhaseServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/StatisticsForPreparationPhaseServiceImpl.java @@ -47,7 +47,7 @@ public class StatisticsForPreparationPhaseServiceImpl implements StatisticsForPr @Override public int getNumberOfActivatedMonitorInSession() { - return statisticsForPreparationPhaseDao.getNumberOfActivatedMonitorInSession(testingSessionService.getCurrentTestingSession()); + return statisticsForPreparationPhaseDao.getNumberOfActivatedMonitorInSession(testingSessionService.getUserTestingSession()); } @Override @@ -62,52 +62,53 @@ public class StatisticsForPreparationPhaseServiceImpl implements StatisticsForPr @Override public int getNumberOfAcceptedSupportiveRequest() { - return statisticsForPreparationPhaseDao.getNumberOfAcceptedSupportiveRequest(testingSessionService.getCurrentTestingSession()); + return statisticsForPreparationPhaseDao.getNumberOfAcceptedSupportiveRequest(testingSessionService.getUserTestingSession()); } @Override public int getNumberOfNotYetAcceptedSupportiveRequest() { - return statisticsForPreparationPhaseDao.getNumberOfNotYetAcceptedSupportiveRequest(testingSessionService.getCurrentTestingSession()); + return statisticsForPreparationPhaseDao.getNumberOfNotYetAcceptedSupportiveRequest(testingSessionService.getUserTestingSession()); } @Override public int getNumberOfSUTNetworkConfiguration() { - return statisticsForPreparationPhaseDao.getNumberOfSUTNetworkConfiguration(testingSessionService.getCurrentTestingSession()); + return statisticsForPreparationPhaseDao.getNumberOfSUTNetworkConfiguration(testingSessionService.getUserTestingSession()); } @Override public int getNumberOfSUTNetworkConfigurationAccepted() { - return statisticsForPreparationPhaseDao.getNumberOfSUTNetworkConfigurationAccepted(testingSessionService.getCurrentTestingSession()); + return statisticsForPreparationPhaseDao.getNumberOfSUTNetworkConfigurationAccepted(testingSessionService.getUserTestingSession()); } @Override public int getNumberOfSUTNetworkConfigurationNotAccepted() { - return statisticsForPreparationPhaseDao.getNumberOfSUTNetworkConfigurationNotAccepted(testingSessionService.getCurrentTestingSession()); + return statisticsForPreparationPhaseDao.getNumberOfSUTNetworkConfigurationNotAccepted(testingSessionService.getUserTestingSession()); } @Override public int getNumberOfGeneratedHosts() { - return statisticsForPreparationPhaseDao.getNumberOfGeneratedHosts(testingSessionService.getCurrentTestingSession()); + return statisticsForPreparationPhaseDao.getNumberOfGeneratedHosts(testingSessionService.getUserTestingSession()); } @Override public int getNumberOfGeneratedHostsWithIP() { - return statisticsForPreparationPhaseDao.getNumberOfGeneratedHostsWithIP(testingSessionService.getCurrentTestingSession()); + return statisticsForPreparationPhaseDao.getNumberOfGeneratedHostsWithIP(testingSessionService.getUserTestingSession()); } @Override public int getNumberOfGeneratedHostsWithoutIP() { - return statisticsForPreparationPhaseDao.getNumberOfGeneratedHostsWithoutIP(testingSessionService.getCurrentTestingSession()); + return statisticsForPreparationPhaseDao.getNumberOfGeneratedHostsWithoutIP(testingSessionService.getUserTestingSession()); } @Override public int getNumberOfPreparatoryTests() { - return statisticsForPreparationPhaseDao.getNumberOfPreparatoryTests(testingSessionService.getCurrentTestingSession()); + return statisticsForPreparationPhaseDao.getNumberOfPreparatoryTests(testingSessionService.getUserTestingSession()); } @Override public StatisticsCommonService.TestInstanceStats getPreparatoryTestStatistics() { - List<TestInstance> testInstances = statisticsForPreparationPhaseDao.getAllPreparatoryTestInstances(testingSessionService.getCurrentTestingSession()); + List<TestInstance> testInstances = statisticsForPreparationPhaseDao.getAllPreparatoryTestInstances( + testingSessionService.getUserTestingSession()); return statisticsCommonService.getStatisticsForTestInstances(testInstances); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/gui/StatisticsForPreparationPhaseBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/gui/StatisticsForPreparationPhaseBeanGui.java index b61f2c024..447945c25 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/gui/StatisticsForPreparationPhaseBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/preparation/gui/StatisticsForPreparationPhaseBeanGui.java @@ -186,6 +186,6 @@ public class StatisticsForPreparationPhaseBeanGui { } public boolean isProxyUseEnabled(){ - return testingSessionService.getCurrentTestingSession().getIsProxyUseEnabled(); + return testingSessionService.getUserTestingSession().getIsProxyUseEnabled(); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/StatisticsForTestingPhaseServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/StatisticsForTestingPhaseServiceImpl.java index b17d9768d..2f7b52d6f 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/StatisticsForTestingPhaseServiceImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/StatisticsForTestingPhaseServiceImpl.java @@ -32,7 +32,7 @@ public class StatisticsForTestingPhaseServiceImpl implements StatisticsForTestin @Override public List<SystemInSession> getSystemsForCurrentUser() { - return statisticsForTestingPhaseDao.getSystemsForCurrentUser(testingSessionService.getCurrentTestingSession()); + return statisticsForTestingPhaseDao.getSystemsForCurrentUser(testingSessionService.getUserTestingSession()); } @Override diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/gui/StatisticsForTestingPhaseBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/gui/StatisticsForTestingPhaseBeanGui.java index 15196a590..7fe7b4cc9 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/gui/StatisticsForTestingPhaseBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/statistics/testing/gui/StatisticsForTestingPhaseBeanGui.java @@ -108,7 +108,7 @@ public class StatisticsForTestingPhaseBeanGui implements Serializable { public List<Integer> getStatisticsForAllTestInstancesOfCurrentMonitor() { List<TestInstance> testInstances = statisticsForTestingPhaseService.getTestInstancesForMonitorInSession( MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser( - testingSessionService.getCurrentTestingSession(), identity.getUsername())); + testingSessionService.getUserTestingSession(), identity.getUsername())); StatisticsCommonService.TestInstanceStats testInstanceStats = statisticsForTestingPhaseService.getStatisticsForTestInstances( @@ -139,7 +139,7 @@ public class StatisticsForTestingPhaseBeanGui implements Serializable { return statisticsForTestingPhaseService.getNumberOfTotalTestInstancesForMonitorInSession( MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser( - testingSessionService.getCurrentTestingSession(), + testingSessionService.getUserTestingSession(), identity.getUsername())); } @@ -164,7 +164,7 @@ public class StatisticsForTestingPhaseBeanGui implements Serializable { public boolean isMonitorOfCurrentSession() { return Identity.instance().hasRole(Role.MONITOR) && (MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser( - testingSessionService.getCurrentTestingSession(), identity.getUsername()) != null); + testingSessionService.getUserTestingSession(), identity.getUsername()) != null); } @@ -182,7 +182,7 @@ public class StatisticsForTestingPhaseBeanGui implements Serializable { } public String getWorklistFilteredForMonitor() { - TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession selectedTestingSession = testingSessionService.getUserTestingSession(); return Pages.CAT_MONITOR_WORKLIST.getMenuLink() + "?testingSession=" + selectedTestingSession .getId() + "&monitor=" + MonitorInSession.getActivatedMonitorInSessionForATestingSessionByUser( @@ -191,7 +191,7 @@ public class StatisticsForTestingPhaseBeanGui implements Serializable { public String getAllTestRunsLinkFilteredForMonitor() { String userId = userService.getUserById(identity.getUsername()).getId(); - return Pages.CAT_INSTANCES.getMenuLink() + "?testingSession=" + testingSessionService.getCurrentTestingSession().getId() + return Pages.CAT_INSTANCES.getMenuLink() + "?testingSession=" + testingSessionService.getUserTestingSession().getId() + "&monitorInSession=" + userId; } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionBuilder.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionBuilder.java index 9b0fb7d56..bccc236e6 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionBuilder.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionBuilder.java @@ -6,8 +6,10 @@ import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.User; import net.ihe.gazelle.tm.financial.action.FinancialManager; import net.ihe.gazelle.tm.session.TestingSessionService; +import net.ihe.gazelle.tm.systems.model.IntegrationStatementStatus; import net.ihe.gazelle.tm.systems.model.System; -import net.ihe.gazelle.tm.systems.model.*; +import net.ihe.gazelle.tm.systems.model.SystemInSession; +import net.ihe.gazelle.tm.systems.model.SystemType; import net.ihe.gazelle.users.model.Institution; import org.jboss.seam.Component; import org.slf4j.Logger; @@ -175,10 +177,10 @@ public abstract class AbstractSystemInSessionBuilder implements Serializable { // Before adding the system, we check that validation is good - system // keyword does not already exist if (!SystemInSessionValidator.validateSystemKeywordStatic( - systemInSession.getSystem().getKeywordWithoutSuffix(identity), - systemInSession.getSystem().getKeywordSuffix(), - systemInSession.getSystem(), - identity)) { + systemInSession.getSystem().getKeywordWithoutSuffix(identity), + systemInSession.getSystem().getKeywordSuffix(), + systemInSession.getSystem(), + identity)) { return false; } if (!SystemInSessionValidator.validateSystemNameAndSystemVersionStatic(systemInSession.getSystem().getName(), systemInSession @@ -199,8 +201,8 @@ public abstract class AbstractSystemInSessionBuilder implements Serializable { } protected void calculateFinancialSummaryDTO() { - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); - FinancialManager.calculateFinancialSummaryDTOByTestingSessionByInstitution(activatedTestingSession, institutionForCreation); + FinancialManager.calculateFinancialSummaryDTOByTestingSessionByInstitution(testingSessionService.getUserTestingSession(), + institutionForCreation); } /** diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionEditor.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionEditor.java index de912b852..fac559531 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionEditor.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/AbstractSystemInSessionEditor.java @@ -186,7 +186,7 @@ public abstract class AbstractSystemInSessionEditor extends SystemInSessionNavig */ protected void linkAIPO(System systemFrom, System newSystem) { List<SystemActorProfiles> listSAP = SystemActorProfiles.getListOfActorIntegrationProfileOptionsWithTestingDepth( - systemFrom, getTestingSessionService().getCurrentTestingSession()); + systemFrom, getTestingSessionService().getUserTestingSession()); EntityManager entityManager = EntityManagerService.provideEntityManager(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/DemonstrationManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/DemonstrationManager.java index 687bd9dce..b8591708b 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/DemonstrationManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/DemonstrationManager.java @@ -197,7 +197,7 @@ public class DemonstrationManager implements Serializable, QueryModifier<Demonst LOG.debug("findAllDemonstrations"); } if (!allSessions) { - selectedTestingSession = testingSessionService.getCurrentTestingSession(); + selectedTestingSession = testingSessionService.getUserTestingSession(); } else { selectedTestingSession = null; } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/IHEImplementationForSystemManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/IHEImplementationForSystemManager.java index 7ea4b0013..07450cb37 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/IHEImplementationForSystemManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/IHEImplementationForSystemManager.java @@ -731,7 +731,7 @@ public class IHEImplementationForSystemManager implements Serializable, IHEImple if (LOG.isDebugEnabled()) { LOG.debug("calculateFinancialSummaryDTO"); } - financialSummary = FinancialManager.getFinancialSummaryWithCalculatedAmountsStatic(testingSessionService.getCurrentTestingSession(), + financialSummary = FinancialManager.getFinancialSummaryWithCalculatedAmountsStatic(testingSessionService.getUserTestingSession(), choosenInstitutionForAdmin, entityManager, false); if (financialSummary != null) { financialSummaryForOneSystem = financialSummary.getFinancialSummaryOneSystems(); @@ -746,7 +746,7 @@ public class IHEImplementationForSystemManager implements Serializable, IHEImple LOG.debug("listTransactionsToSupportForGivenSystemPDF"); } Map<String, Object> parameters = new HashMap<String, Object>(); - parameters.put("sessionId", testingSessionService.getCurrentTestingSession().getId()); + parameters.put("sessionId", testingSessionService.getUserTestingSession().getId()); parameters.put("systemId", selectedSystemInSession.getSystem().getId()); try { ReportExporterManager.exportToPDF("listOfTransactionsToSupportPerSystem", diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SimulatorInSessionManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SimulatorInSessionManager.java index bc80d250f..6de40e18a 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SimulatorInSessionManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SimulatorInSessionManager.java @@ -5,7 +5,6 @@ import net.ihe.gazelle.common.log.ExceptionLogging; import net.ihe.gazelle.hql.providers.EntityManagerService; import net.ihe.gazelle.ssov7.authn.domain.GazelleIdentity; import net.ihe.gazelle.ssov7.gum.client.application.Group; -import net.ihe.gazelle.ssov7.gum.client.application.Role; import net.ihe.gazelle.ssov7.gum.client.application.User; import net.ihe.gazelle.ssov7.gum.client.application.service.UserService; import net.ihe.gazelle.ssov7.gum.client.interlay.client.utils.UserSearchParams; @@ -171,7 +170,7 @@ public class SimulatorInSessionManager implements SimulatorInSessionManagerLocal if (LOG.isDebugEnabled()) { LOG.debug("getAvailableSimulatorInSession"); } - TestingSession tss = testingSessionService.getCurrentTestingSession(); + TestingSession tss = testingSessionService.getUserTestingSession(); SimulatorInSessionQuery query = new SimulatorInSessionQuery(); query.testingSession().eq(tss); @@ -298,7 +297,7 @@ public class SimulatorInSessionManager implements SimulatorInSessionManagerLocal institutionSystem = new InstitutionSystem(); institutionSystem.setInstitution(Institution.findInstitutionWithKeyword(connectedUser.getOrganizationId())); institutionSystem.setSystem(simulator); - selectedSimulatorInSession = new SimulatorInSession(simulator, testingSessionService.getCurrentTestingSession()); + selectedSimulatorInSession = new SimulatorInSession(simulator, testingSessionService.getUserTestingSession()); return "/systems/simulators/editSimulator.xhtml"; } @@ -339,7 +338,7 @@ public class SimulatorInSessionManager implements SimulatorInSessionManagerLocal selectedActorIntegrationProfileOption = new ActorIntegrationProfileOption(); selectedActorIntegrationProfileOption.setActorIntegrationProfile(new ActorIntegrationProfile()); } - possibleDomains = getPossibleDomainsDependingOnTestingSession(testingSessionService.getCurrentTestingSession()); + possibleDomains = getPossibleDomainsDependingOnTestingSession(testingSessionService.getUserTestingSession()); } private List<Domain> getPossibleDomainsDependingOnTestingSession(TestingSession ts) { @@ -371,7 +370,7 @@ public class SimulatorInSessionManager implements SimulatorInSessionManagerLocal selectedDomain = null; resetSelectedOtherItems(); if (possibleDomains == null) { - possibleDomains = getPossibleDomainsDependingOnTestingSession(testingSessionService.getCurrentTestingSession()); + possibleDomains = getPossibleDomainsDependingOnTestingSession(testingSessionService.getUserTestingSession()); } } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionBuilder.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionBuilder.java index ecf6a0593..787f975e0 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionBuilder.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionBuilder.java @@ -85,7 +85,7 @@ public class SystemInSessionBuilder extends AbstractSystemInSessionBuilder { TableSession tableSession = TableSession.getTableSessionByKeyword(TableSession .getDEFAULT_TABLE_SESSION_STRING()); SystemInSessionStatus systemInSessionStatus = SystemInSessionStatus.getSTATUS_NOT_HERE_YET(); - TestingSession selectedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession selectedTestingSession = testingSessionService.getUserTestingSession(); systemInSession = new SystemInSession(tableSession, newSystem, selectedTestingSession, null, systemInSessionStatus); if (selectedTestingSession.isSystemAutoAcceptance()) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCopier.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCopier.java index b816f0d0f..00df076da 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCopier.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionCopier.java @@ -164,7 +164,7 @@ public class SystemInSessionCopier extends AbstractSystemInSessionEditor impleme } private void calculateFinancialSummaryDTO() { - TestingSession activatedTestingSession = getTestingSessionService().getCurrentTestingSession(); + TestingSession activatedTestingSession = getTestingSessionService().getUserTestingSession(); this.calculateFinancialSummaryDTOByTestingSession(activatedTestingSession); } @@ -192,7 +192,7 @@ public class SystemInSessionCopier extends AbstractSystemInSessionEditor impleme ExceptionLogging.logException(e, LOG); FacesMessages.instance().add(StatusMessage.Severity.ERROR, "Error persisting the new system, maybe a system keyword " + system.getKeyword() + "_For_" - + getTestingSessionService().getCurrentTestingSession().getName() + " already exists"); + + getTestingSessionService().getUserTestingSession().getName() + " already exists"); } } @@ -271,7 +271,7 @@ public class SystemInSessionCopier extends AbstractSystemInSessionEditor impleme TableSession tableSession = TableSession.getTableSessionByKeyword(TableSession.getDEFAULT_TABLE_SESSION_STRING()); SystemInSessionStatus systemInSessionStatus = SystemInSessionStatus.getSTATUS_NOT_HERE_YET(); SystemInSession newSysInSess = new SystemInSession(tableSession, newSystem, - getTestingSessionService().getCurrentTestingSession(), null, systemInSessionStatus); + getTestingSessionService().getUserTestingSession(), null, systemInSessionStatus); // The copied system status need to be set to IN_PROGRESS newSysInSess.setRegistrationStatus(SystemInSessionRegistrationStatus.IN_PROGRESS); // The copied system is set to true diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditor.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditor.java index cd2c62d40..e94f92428 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditor.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionEditor.java @@ -482,7 +482,7 @@ public class SystemInSessionEditor extends AbstractSystemInSessionEditor impleme @Restrict("#{s:hasPermission('SystemInSessionEditor', 'editSystem', null)}") public void editSystem() { LOG.debug("editSystem"); - if (getTestingSessionService().getCurrentTestingSession() == null) { + if (getTestingSessionService().getUserTestingSession() == null) { LOG.error(NO_ACTIVE_SESSION); StatusMessages.instance().addFromResourceBundle(StatusMessage.Severity.ERROR, "gazelle.systems.error" + ".noActivatedTestingSession"); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionListManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionListManager.java index 75a340e6e..5a7fcfe3b 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionListManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionListManager.java @@ -128,7 +128,7 @@ public class SystemInSessionListManager extends AbstractSystemInSessionEditor im @Create public void init() { try { - this.currentTestingSession = testingSessionService.getCurrentTestingSession(); + this.currentTestingSession = testingSessionService.getUserTestingSession(); this.registeredSystemSummary = systemUnderTestService.getRegisteredSystemsOfSession(currentTestingSession); } catch (IllegalArgumentException e){ FacesMessages.instance().add(StatusMessage.Severity.ERROR, "An error has occurred during initialization"); @@ -269,7 +269,7 @@ public class SystemInSessionListManager extends AbstractSystemInSessionEditor im || Identity.instance().hasRole(Role.TESTING_SESSION_ADMIN) || Identity.instance().hasRole(Role.VENDOR)) { - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = testingSessionService.getUserTestingSession(); if (testingSession == null) { LOG.error(NO_ACTIVE_SESSION); StatusMessages.instance().addFromResourceBundle(StatusMessage.Severity.ERROR, "gazelle.systems.error.noActivatedTestingSession"); @@ -540,7 +540,7 @@ public class SystemInSessionListManager extends AbstractSystemInSessionEditor im public Testability getTestabilityForProfile(IntegrationProfile profile){ ProfileInTestingSessionQuery query = new ProfileInTestingSessionQuery(); query.integrationProfile().id().eq(profile.getId()); - query.testingSession().id().eq(testingSessionService.getCurrentTestingSession().getId()); + query.testingSession().id().eq(testingSessionService.getUserTestingSession().getId()); try{ return query.getUniqueResult().getTestability(); }catch (Exception e){ diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionManager.java index b098e57fb..867499ece 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/SystemInSessionManager.java @@ -215,7 +215,7 @@ public class SystemInSessionManager implements Serializable, SystemInSessionMana if (LOG.isDebugEnabled()) { LOG.debug("getListOfAcceptedSystemsForActivatedSession"); } - getListOfAcceptedSystemsToSession(testingSessionService.getCurrentTestingSession()); + getListOfAcceptedSystemsToSession(testingSessionService.getUserTestingSession()); } /** @@ -264,7 +264,7 @@ public class SystemInSessionManager implements Serializable, SystemInSessionMana if (LOG.isDebugEnabled()) { LOG.debug("getListOfNotAcceptedSystemsForActivatedSession"); } - getListOfNotAcceptedSystemsToSession(testingSessionService.getCurrentTestingSession()); + getListOfNotAcceptedSystemsToSession(testingSessionService.getUserTestingSession()); } /** diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java index cb87bf9e3..90f8ec569 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/systems/action/TestingSessionManager.java @@ -285,7 +285,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin if (LOG.isDebugEnabled()) { LOG.debug("initializeTestingSessionChoosen"); } - testingSessionChoosen = testingSessionService.getCurrentTestingSession(); + testingSessionChoosen = testingSessionService.getUserTestingSession(); Contexts.getSessionContext().set("testingSessionChoosen", testingSessionChoosen); } @@ -575,7 +575,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin entityManager.persist(newSessionToActivate); entityManager.flush(); - activatedTestingSession = testingSessionService.getCurrentTestingSession(); + activatedTestingSession = testingSessionService.getUserTestingSession(); } catch (javax.validation.ConstraintViolationException e) { Set<ConstraintViolation<?>> constraintViolations = e.getConstraintViolations(); for (ConstraintViolation<?> constraintViolation : constraintViolations) { @@ -602,7 +602,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin if (LOG.isDebugEnabled()) { LOG.debug("getActivatedTestingSession"); } - return testingSessionService.getCurrentTestingSession(); + return testingSessionService.getUserTestingSession(); } @@ -622,7 +622,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin */ public boolean isRegistrationDeadlineExpired() { LOG.trace("isRegistrationDeadlineExpired"); - return !testingSessionService.getCurrentTestingSession().isRegistrationOpened() && + return !testingSessionService.getUserTestingSession().isRegistrationOpened() && !identity.hasRole(Role.VENDOR_LATE_REGISTRATION); } @@ -671,7 +671,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin } List<Institution> returnList = null; - activatedTestingSession = testingSessionService.getCurrentTestingSession(); + activatedTestingSession = testingSessionService.getUserTestingSession(); returnList = TestingSession.getListOfInstitutionsRegisterInSession(activatedTestingSession); @@ -698,7 +698,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin } if (selectedTestingSession == null) { - selectedTestingSession = testingSessionService.getCurrentTestingSession(); + selectedTestingSession = testingSessionService.getUserTestingSession(); } return selectedTestingSession; } @@ -799,7 +799,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin Query q = em .createQuery("from TableSession ts where ts.id not IN ( SELECT distinct sis.tableSession.id from SystemInSession sis where sis" + ".tableSession.id != null AND sis.testingSession =:inTestingSession )"); - q.setParameter("inTestingSession", testingSessionService.getCurrentTestingSession()); + q.setParameter("inTestingSession", testingSessionService.getUserTestingSession()); List<TableSession> listTableSession = q.getResultList(); @@ -1061,7 +1061,7 @@ public class TestingSessionManager implements Serializable, QueryModifier<Testin } public boolean isUserAdminOfCurrentTestingSession(TestingSession currentTestingSession) { - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = testingSessionService.getUserTestingSession(); if (testingSession != null && testingSession.getId().equals(currentTestingSession.getId())) { return Authorizations.TESTING_SESSION_ADMIN_OF_CURRENT_TESTING_SESSION.isGranted(); } diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/dao/SUTReportServiceDAOImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/dao/SUTReportServiceDAOImpl.java index 9340beb6b..c772afe04 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/dao/SUTReportServiceDAOImpl.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/dao/SUTReportServiceDAOImpl.java @@ -106,7 +106,7 @@ public class SUTReportServiceDAOImpl implements SUTReportServiceDAO, QueryModifi @Override public void modifyQuery(HQLQueryBuilder<SystemAIPOResultForATestingSession> hqlQueryBuilder, Map<String, Object> requestParameterMap) { SystemAIPOResultForATestingSessionQuery query = new SystemAIPOResultForATestingSessionQuery(hqlQueryBuilder); - TestingSession testingSession = testingSessionService.getCurrentTestingSession(); + TestingSession testingSession = testingSessionService.getUserTestingSession(); HQLRestriction enabledRestriction = HQLRestrictions.or(query.enabled().eqRestriction(true), query.enabled().isNullRestriction()); hqlQueryBuilder.addRestriction(query.systemActorProfile().system().systemsInSession().acceptedToSession().eqRestriction(true)); @@ -284,7 +284,7 @@ public class SUTReportServiceDAOImpl implements SUTReportServiceDAO, QueryModifi System system = systemActorProfile.getSystem(); trQuery.roleInTest().testParticipantsList().tested().eq(Boolean.TRUE); trQuery.test().testStatus().keyword().eq("ready"); - trQuery.test().testType().in(testingSessionService.getCurrentTestingSession().getTestTypes()); + trQuery.test().testType().in(testingSessionService.getUserTestingSession().getTestTypes()); trQuery.roleInTest().addFetch(); trQuery.roleInTest().testParticipantsList().addFetch(); trQuery.roleInTest().testParticipantsList().actorIntegrationProfileOption().addFetch(); diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/gui/TestExecutionBeanGUI.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/gui/TestExecutionBeanGUI.java index 9f2be2717..6f4c63619 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/gui/TestExecutionBeanGUI.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/testexecution/gui/TestExecutionBeanGUI.java @@ -7,7 +7,6 @@ import net.ihe.gazelle.hql.criterion.QueryModifier; import net.ihe.gazelle.tm.gazelletest.model.definition.TestType; import net.ihe.gazelle.tm.gazelletest.model.instance.SystemAIPOResultForATestingSession; import net.ihe.gazelle.tm.session.TestingSessionService; -import net.ihe.gazelle.tm.systems.model.TestingSession; import net.ihe.gazelle.tm.testexecution.*; import net.ihe.gazelle.tm.testexecution.sorting.SUTCapabilityReportSortMethod; import net.ihe.gazelle.tm.testexecution.sorting.SutSortOrder; @@ -230,7 +229,7 @@ public class TestExecutionBeanGUI implements Serializable { } public boolean isAbleToStartTestInstance() { - return !testingSessionService.getCurrentTestingSession().isClosed(); + return !testingSessionService.getUserTestingSession().isClosed(); } public String getRunningPartnersForTestRunReport(TestRunReport testRunReport) { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/ConnectathonParticipantManager.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/ConnectathonParticipantManager.java index c94d52b2e..6c17624fc 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/ConnectathonParticipantManager.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/ConnectathonParticipantManager.java @@ -290,12 +290,12 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution"); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); } else { query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); } connectathonParticipants = query.getResultList(); @@ -306,7 +306,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); connectathonParticipants = query.getResultList(); @@ -433,7 +433,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho !identity.hasRole(Role.MONITOR)) { selectedConnectathonParticipant.setInstitution(Institution.getLoggedInInstitution()); } - selectedConnectathonParticipant.setTestingSession(testingSessionService.getCurrentTestingSession()); + selectedConnectathonParticipant.setTestingSession(testingSessionService.getUserTestingSession()); } @@ -544,7 +544,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho private HQLCriterionsForFilter<ConnectathonParticipant> getHQLCriterionsForFilter() { ConnectathonParticipantQuery q = new ConnectathonParticipantQuery(); HQLCriterionsForFilter<ConnectathonParticipant> criterionsForFilter = q.getHQLCriterionsForFilter(); - criterionsForFilter.addPath("testingSession", q.testingSession(), testingSessionService.getCurrentTestingSession()); + criterionsForFilter.addPath("testingSession", q.testingSession(), testingSessionService.getUserTestingSession()); criterionsForFilter.addPath("status", q.connectathonParticipantStatus()); if (identity.isLoggedIn() && identity.hasRole("admin_role")) { InstitutionManagerLocal institutionManager = (InstitutionManagerLocal) Component.getInstance("institutionManager"); @@ -675,7 +675,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho cp.getLastName(), cp.getEmail()); } } - FinancialManager.updateInvoiceIfPossible(choosenInstitutionForAdmin, testingSessionService.getCurrentTestingSession(), + FinancialManager.updateInvoiceIfPossible(choosenInstitutionForAdmin, testingSessionService.getUserTestingSession(), entityManager, false); } @@ -696,13 +696,14 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho choosenInstitutionForAdmin = (Institution) Component.getInstance(CHOOSEN_INSTITUTION_FOR_ADMIN); if (choosenInstitutionForAdmin != null) { - listOfSiS = SystemInSession.getSystemsInSessionForCompanyForSession(em, choosenInstitutionForAdmin); + listOfSiS = SystemInSession.getSystemsInSessionForCompanyForSession(em, choosenInstitutionForAdmin, + testingSessionService.getUserTestingSession()); } else { - listOfSiS = SystemInSession.getSystemsInSessionForSession(testingSessionService.getCurrentTestingSession()); + listOfSiS = SystemInSession.getSystemsInSessionForSession(testingSessionService.getUserTestingSession()); } } else { listOfSiS = SystemInSession.getSystemsInSessionForCompanyForSession(em, - Institution.getLoggedInInstitution()); + Institution.getLoggedInInstitution(), testingSessionService.getUserTestingSession()); } foundSystemsInSession = listOfSiS; } @@ -749,7 +750,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho cp.setFridayMeal(true); cp.setVegetarianMeal(false); cp.setSocialEvent(false); - cp.setTestingSession(testingSessionService.getCurrentTestingSession()); + cp.setTestingSession(testingSessionService.getUserTestingSession()); Institution institution = Institution.findInstitutionWithKeyword(entry.getKey().getOrganizationId()); cp.setInstitution(institution); cp.setInstitutionName(institution.getName()); @@ -798,7 +799,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho if (contactsForImportation.get(i).getObject1()) { ConnectathonParticipant cp = new ConnectathonParticipant(); ConnectathonParticipantQuery query = new ConnectathonParticipantQuery(); - query.testingSession().eq(testingSessionService.getCurrentTestingSession()); + query.testingSession().eq(testingSessionService.getUserTestingSession()); query.email().eq(contactsForImportation.get(i).getObject2().getEmail()); if (query.getCount() == 0) { @@ -815,7 +816,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho cp.setFridayMeal(true); cp.setVegetarianMeal(false); cp.setSocialEvent(false); - cp.setTestingSession(testingSessionService.getCurrentTestingSession()); + cp.setTestingSession(testingSessionService.getUserTestingSession()); cp.setInstitution(contactsForImportation.get(i).getObject2().getInstitution()); cp.setInstitutionName(contactsForImportation.get(i).getObject2().getInstitution().getName()); @@ -1009,7 +1010,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho EntityManager em = EntityManagerService.provideEntityManager(); companiesWithoutParticipants = new ArrayList<>(); List<ConnectathonParticipant> foundParticipantsPerCompany; - TestingSession ts = testingSessionService.getCurrentTestingSession(); + TestingSession ts = testingSessionService.getUserTestingSession(); List<Institution> companiesParticipating = TestingSession.getListOfInstitutionsParticipatingInSession(ts); for (Institution inst : companiesParticipating) { @@ -1074,7 +1075,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); listOfCP = query.getResultList(); } } else { @@ -1127,13 +1128,13 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND mondayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); return query.getResultList(); } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND mondayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); return query.getResultList(); } } else { @@ -1142,7 +1143,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND mondayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); return query.getResultList(); } @@ -1171,13 +1172,13 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND tuesdayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); return query.getResultList(); } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND tuesdayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); return query.getResultList(); } } else { @@ -1186,7 +1187,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND tuesdayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); return query.getResultList(); } @@ -1214,14 +1215,14 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND wednesdayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); return query.getResultList(); } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND wednesdayMeal IS " + "true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); return query.getResultList(); } } else { @@ -1230,7 +1231,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND wednesdayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); return query.getResultList(); } @@ -1258,14 +1259,14 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND thursdayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); return query.getResultList(); } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND thursdayMeal IS " + "true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); return query.getResultList(); } } else { @@ -1274,7 +1275,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND thursdayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); return query.getResultList(); } @@ -1302,13 +1303,13 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND fridayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); return query.getResultList(); } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND fridayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); return query.getResultList(); } } else { @@ -1317,7 +1318,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND fridayMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); return query.getResultList(); } @@ -1345,14 +1346,14 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND vegetarianMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); return query.getResultList(); } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND vegetarianMeal IS " + "true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); return query.getResultList(); } } else { @@ -1361,7 +1362,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND vegetarianMeal IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); return query.getResultList(); } @@ -1389,13 +1390,13 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND socialEvent IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, choosenInstitutionForAdmin); return query.getResultList(); } else { Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND socialEvent IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); return query.getResultList(); } } else { @@ -1404,7 +1405,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho Query query = em .createQuery("SELECT cp FROM ConnectathonParticipant cp WHERE cp.testingSession = :inTestingSession AND cp.institution = " + ":inInstitution AND socialEvent IS true"); - query.setParameter(IN_TESTING_SESSION, testingSessionService.getCurrentTestingSession()); + query.setParameter(IN_TESTING_SESSION, testingSessionService.getUserTestingSession()); query.setParameter(IN_INSTITUTION, selectedInstitution); return query.getResultList(); } @@ -1619,7 +1620,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho return 0; } int numSys = this.foundSystemsInSession.size(); - return numSys * testingSessionService.getCurrentTestingSession().getNbParticipantsIncludedInSystemFees(); + return numSys * testingSessionService.getUserTestingSession().getNbParticipantsIncludedInSystemFees(); } @Override @@ -1631,7 +1632,7 @@ public class ConnectathonParticipantManager implements Serializable, Connectatho } public void importMonitorsInSession() { - List<MonitorInSession> monitors = MonitorInSession.getAllActivatedMonitorsForATestingSession(testingSessionService.getCurrentTestingSession()); + List<MonitorInSession> monitors = MonitorInSession.getAllActivatedMonitorsForATestingSession(testingSessionService.getUserTestingSession()); if (monitors == null || monitors.isEmpty()) { FacesMessages.instance().add(StatusMessage.Severity.INFO, "No monitor available for this testing session"); } else { diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/InstitutionManagerTM.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/InstitutionManagerTM.java index f4b985f4c..89cadbfe8 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/InstitutionManagerTM.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/users/action/InstitutionManagerTM.java @@ -281,7 +281,7 @@ public class InstitutionManagerTM implements Serializable, InstitutionManagerTML } // Check invoice instanciation try { - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); // We check if the invoice exists (cause if the testing session changed, the invoice may not exist) @@ -388,7 +388,7 @@ public class InstitutionManagerTM implements Serializable, InstitutionManagerTML if (LOG.isDebugEnabled()) { LOG.debug("calculateFinancialSummaryDTO"); } - TestingSession activatedTestingSession = testingSessionService.getCurrentTestingSession(); + TestingSession activatedTestingSession = testingSessionService.getUserTestingSession(); financialSummary = FinancialManager.getFinancialSummaryWithCalculatedAmountsStatic( activatedTestingSession, diff --git a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/financial/action/FinancialManagerTest.java b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/financial/action/FinancialManagerTest.java index 989a5c9b4..100d9729c 100644 --- a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/financial/action/FinancialManagerTest.java +++ b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/tm/financial/action/FinancialManagerTest.java @@ -234,7 +234,7 @@ public class FinancialManagerTest { } private void mockGetSelectedTestingSessionStatic(TestingSession forgedTestingSessionToReturn) { - Mockito.when(testingSessionService.getCurrentTestingSession()).thenReturn(forgedTestingSessionToReturn); + Mockito.when(testingSessionService.getUserTestingSession()).thenReturn(forgedTestingSessionToReturn); } private void initInstitution() { -- GitLab From 15ae14aac7b8f3cd8ed79148b2df193348cd295d Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 3 Sep 2024 16:23:51 +0200 Subject: [PATCH 67/77] Removed deprecated classes --- .../users/action/UserProviderTest.java | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 gazelle-tm-ejb/src/test/java/net/ihe/gazelle/users/action/UserProviderTest.java diff --git a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/users/action/UserProviderTest.java b/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/users/action/UserProviderTest.java deleted file mode 100644 index 6ce0ed555..000000000 --- a/gazelle-tm-ejb/src/test/java/net/ihe/gazelle/users/action/UserProviderTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.ihe.gazelle.users.action; - -import net.ihe.gazelle.users.UserProvider; -import org.kohsuke.MetaInfServices; - -import java.util.Locale; - -@MetaInfServices(UserProvider.class) -public class UserProviderTest implements UserProvider { - - @Override - public String getUsername() { - return "junit"; - } - - @Override - public boolean hasRole(String roleName) { - return false; - } - - @Override - public Locale getLocale() { - return null; - } -} -- GitLab From 053611892c53347f589f0b4e63db646d9c0fab8b Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 4 Sep 2024 09:42:07 +0200 Subject: [PATCH 68/77] Removed call to static method and cleaned code --- .../tm/gazelletest/action/SystemInSessionOverview.java | 9 +++++---- .../src/main/webapp/reports/registrationOverview.xhtml | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java index 59fa2590f..815df6f91 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/gazelletest/action/SystemInSessionOverview.java @@ -48,6 +48,7 @@ import java.util.*; public class SystemInSessionOverview implements Serializable, QueryModifier<SystemActorProfiles> { private static final Logger LOG = LoggerFactory.getLogger(SystemInSessionOverview.class); private static final long serialVersionUID = 1394117177837966208L; + private static final String TESTING_SESSION = "testing_session"; private SystemInSessionFilter1 filter; private FilterDataModel<SystemInSession> systemsInSession; @@ -208,19 +209,19 @@ public class SystemInSessionOverview implements Serializable, QueryModifier<Syst HQLCriterionsForFilter<SystemActorProfiles> hqlCriterionsForFilter = sapQuery.getHQLCriterionsForFilter(); - TMCriterions.addActiveTestingSession(hqlCriterionsForFilter, "testing_session", sapQuery.system() + TMCriterions.addActiveTestingSession(hqlCriterionsForFilter, TESTING_SESSION, sapQuery.system() .systemsInSession().testingSession(), identity); TMCriterions.addAIPOCriterions(hqlCriterionsForFilter, sapQuery.actorIntegrationProfileOption()); hqlCriterionsForFilter .addQueryModifier(new IntegrationProfilesFromTestingSession(sapQuery .actorIntegrationProfileOption().actorIntegrationProfile().integrationProfile(), - "testing_session")); + TESTING_SESSION)); TestEntity<Test> testPath = sapQuery.aipo().testParticipants().roleInTest().testRoles().test(); hqlCriterionsForFilter.addPath("test", testPath); hqlCriterionsForFilter.addQueryModifierForCriterion("test", new TestMatchingTestingSession(testPath, - "testing_session")); + TESTING_SESSION)); hqlCriterionsForFilter.addQueryModifierForCriterion("test", new TestParticipantTested(sapQuery.aipo() .testParticipants())); @@ -334,7 +335,7 @@ public class SystemInSessionOverview implements Serializable, QueryModifier<Syst } ReportManager rm = new ReportManager(); - rm.listSystemsSummary(listOfIntegrationProfileCopy, systemsList); + rm.listSystemsSummary(listOfIntegrationProfileCopy, systemsList, testingSessionService.getUserTestingSession()); } } diff --git a/gazelle-tm-war/src/main/webapp/reports/registrationOverview.xhtml b/gazelle-tm-war/src/main/webapp/reports/registrationOverview.xhtml index cc97398b0..3374d06a1 100644 --- a/gazelle-tm-war/src/main/webapp/reports/registrationOverview.xhtml +++ b/gazelle-tm-war/src/main/webapp/reports/registrationOverview.xhtml @@ -15,10 +15,10 @@ <h:form id="reportsFormId"> <s:token allowMultiplePosts="true"/> <h:commandButton id="profileCoverageId" value="#{messages['gazelle.systems.system.ProfileCoverage']}" - actionListener="#{reportManagerBean.listSystemsForAllActorIntegrationProfilePDF()}" + actionListener="#{reportManagerBean.listSystemsForAllActorIntegrationProfilePDF(testSessionBean.selectedTestingSession)}" styleClass="gzl-btn"/> <h:commandButton id="systemsCoverageId" value="#{messages['gazelle.systems.system.SystemsSummary']}" - action="#{reportManagerBean.listSystemsSummary(testSessionBean.currentTestingSession)}" styleClass="gzl-btn" + action="#{reportManagerBean.listSystemsSummary(testSessionBean.selectedTestingSession)}" styleClass="gzl-btn" rendered="#{(s:hasRole('admin_role') || s:hasRole('monitor_role'))}"/> </h:form> -- GitLab From 89aecf6b1ffdd3612bf178c8597f9dfcaacb676e Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 4 Sep 2024 10:24:08 +0200 Subject: [PATCH 69/77] Updated java doc --- .../java/net/ihe/gazelle/tm/session/TestingSessionService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java index 02179b2f0..4254947c8 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/session/TestingSessionService.java @@ -18,7 +18,7 @@ public interface TestingSessionService { TestingSession getUserTestingSession(); /** - * Set in cookie the currentTestingSession of the logged user. + * Set the current TestingSession of the logged user. * * @param testingSession the current session */ -- GitLab From 04c4a7b236043c2ae89702b6883aae27db217265 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Wed, 4 Sep 2024 16:41:57 +0200 Subject: [PATCH 70/77] Removed call to static method getSelectedTestingSession and cleaned code --- .../src/main/webapp/financial/financialSummary.xhtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gazelle-tm-war/src/main/webapp/financial/financialSummary.xhtml b/gazelle-tm-war/src/main/webapp/financial/financialSummary.xhtml index b461c1079..e6966ccbd 100644 --- a/gazelle-tm-war/src/main/webapp/financial/financialSummary.xhtml +++ b/gazelle-tm-war/src/main/webapp/financial/financialSummary.xhtml @@ -349,7 +349,7 @@ <s:decorate template="/layout/display/_display.xhtml"> <ui:define name="label">#{messages['net.ihe.gazelle.tm.AdditionalFees']}</ui:define> <h:outputText id="additionalOutputText" - value="#{financialManager.financialSummary.getAdditionalFeeAsCurrency()}"/> + value="#{financialManager.financialSummary.getAdditionalFeeAsCurrency(testSessionBean.selectedTestingSession)}"/> </s:decorate> <s:decorate template="/layout/display/_display.xhtml"> <ui:define name="label">#{messages['net.ihe.gazelle.tm.ReasonsForAdditionFees']} @@ -474,7 +474,7 @@ </td> <td align="right"> <h:outputText - value="#{financialManager.financialSummary.getAdditionalFeeAsCurrency()}"/> + value="#{financialManager.financialSummary.getAdditionalFeeAsCurrency(testSessionBean.selectedTestingSession)}"/> </td> </tr> </s:span> @@ -504,7 +504,7 @@ value="- #{financialManager.financialSummary.feeDiscountAsCurrency}" rendered="#{financialManager.financialSummary.invoice.feesDiscount >= 0}"/> <h:outputText - value="+ #{financialManager.financialSummary.getAdditionalFeeAsCurrency()}" + value="+ #{financialManager.financialSummary.getAdditionalFeeAsCurrency(testSessionBean.selectedTestingSession)}" rendered="#{financialManager.financialSummary.invoice.feesDiscount < 0}"/> + #{financialManager.financialSummary.feeVATAsCurrency} -- GitLab From a8d415e0fc0559e5ed2eba32643a6735b7536f21 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Mon, 9 Sep 2024 14:07:09 +0200 Subject: [PATCH 71/77] Removed unnecessary log --- .../net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java index 187f170e5..d44836f4d 100644 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java +++ b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/monitor/gui/MonitorInfoBeanGui.java @@ -10,8 +10,6 @@ import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.contexts.Contexts; import org.jboss.seam.international.LocaleSelector; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; @@ -22,8 +20,6 @@ import java.util.Locale; @Scope(ScopeType.EVENT) public class MonitorInfoBeanGui { - private static final Logger LOG = LoggerFactory.getLogger(MonitorInfoBeanGui.class); - @In(value = "userPreferencesService") UserPreferencesService userPreferencesService; @@ -51,7 +47,6 @@ public class MonitorInfoBeanGui { public void setTableLabel(String tableLabel) { - LOG.error("setTableLabel {} for user {}", tableLabel, userPreference.getUserId()); userPreference.setTableLabel(tableLabel); userPreferencesService.updateUserPreferences(userPreference.getUserId(), userPreference); } -- GitLab From 4dfdcc2a4a20aa83031efa40360441078793c87d Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 10 Sep 2024 10:09:26 +0200 Subject: [PATCH 72/77] Updated pom version --- gazelle-tm-ear/pom.xml | 2 +- gazelle-tm-ejb/pom.xml | 2 +- gazelle-tm-war/pom.xml | 2 +- pom.xml | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gazelle-tm-ear/pom.xml b/gazelle-tm-ear/pom.xml index 32652aa33..d0e84cea8 100644 --- a/gazelle-tm-ear/pom.xml +++ b/gazelle-tm-ear/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm</artifactId> - <version>10.0.0-GZL-5369-SNAPSHOT</version> + <version>10.0.0-GZL-5400-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/gazelle-tm-ejb/pom.xml b/gazelle-tm-ejb/pom.xml index 8e3851a8b..dffe3415e 100644 --- a/gazelle-tm-ejb/pom.xml +++ b/gazelle-tm-ejb/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm</artifactId> - <version>10.0.0-GZL-5369-SNAPSHOT</version> + <version>10.0.0-GZL-5400-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/gazelle-tm-war/pom.xml b/gazelle-tm-war/pom.xml index ca1885e53..7e975b9dd 100644 --- a/gazelle-tm-war/pom.xml +++ b/gazelle-tm-war/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm</artifactId> - <version>10.0.0-GZL-5369-SNAPSHOT</version> + <version>10.0.0-GZL-5400-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/pom.xml b/pom.xml index 21a9aa7cb..1c05bab5f 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm</artifactId> - <version>10.0.0-GZL-5369-SNAPSHOT</version> + <version>10.0.0-GZL-5400-SNAPSHOT</version> <packaging>pom</packaging> <modules> @@ -284,13 +284,13 @@ <dependency> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm-ejb</artifactId> - <version>10.0.0-GZL-5369-SNAPSHOT</version> + <version>10.0.0-GZL-5400-SNAPSHOT</version> <type>ejb</type> </dependency> <dependency> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm-war</artifactId> - <version>10.0.0-GZL-5369-SNAPSHOT</version> + <version>10.0.0-GZL-5400-SNAPSHOT</version> <type>war</type> </dependency> <dependency> -- GitLab From 8001d2336c875caa24939e768780bb77072b1502 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 10 Sep 2024 12:34:48 +0200 Subject: [PATCH 73/77] Moved classes to sso --- .../application/client/GumConfigClient.java | 64 ------------------- .../client/GumConfigClientException.java | 20 ------ .../ApplicationConfigurationService.java | 10 --- .../ApplicationConfigurationServiceImpl.java | 28 -------- 4 files changed, 122 deletions(-) delete mode 100644 gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/client/GumConfigClient.java delete mode 100644 gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/client/GumConfigClientException.java delete mode 100644 gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/services/ApplicationConfigurationService.java delete mode 100644 gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/services/ApplicationConfigurationServiceImpl.java diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/client/GumConfigClient.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/client/GumConfigClient.java deleted file mode 100644 index c6de8ea79..000000000 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/client/GumConfigClient.java +++ /dev/null @@ -1,64 +0,0 @@ -package net.ihe.gazelle.tm.application.client; - -import org.apache.http.HttpStatus; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.map.ObjectMapper; - -import java.io.IOException; -import java.io.InputStream; - -public class GumConfigClient { - - private String configurationsJson; - - - public boolean getUserRegistrationEnabled() { - if (configurationsJson == null) { - try (CloseableHttpClient httpClient = HttpClients.createDefault()) { - HttpGet getGumConfigurationsRequest = new HttpGet(System.getenv("GUM_REST_API_URL") + "/rest/configurations"); - try (CloseableHttpResponse response = httpClient.execute(getGumConfigurationsRequest)) { - assertNoErrorStatus(response); - InputStream responseContent = response.getEntity().getContent(); - setConfigurationJson(responseContent); - } - } catch (IOException e) { - throw new GumConfigClientException("Could not get configurations", e); - } - } - return extractFieldValueFromJson("userRegistrationEnabled", configurationsJson); - } - - private void setConfigurationJson(InputStream responseContent) throws IOException { - JsonNode jsonNode = new ObjectMapper().readTree(responseContent); - configurationsJson = jsonNode.toString(); - } - - private void assertNoErrorStatus(CloseableHttpResponse response) { - if (response.getStatusLine().getStatusCode() >= HttpStatus.SC_BAD_REQUEST) { - String message = response.getStatusLine().getStatusCode() + " " + - response.getStatusLine().getReasonPhrase(); - try { - String body = EntityUtils.toString(response.getEntity()); - if (body != null) - throw new GumConfigClientException(message + " with body: " + body); - throw new GumConfigClientException(message); - } catch (IOException e) { - throw new GumConfigClientException(message); - } - } - } - - private boolean extractFieldValueFromJson(String fieldName, String json) { - try { - JsonNode jsonNode = new ObjectMapper().readTree(json); - return jsonNode.get(fieldName).asBoolean(); - } catch (IOException e) { - throw new GumConfigClientException(e); - } - } -} diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/client/GumConfigClientException.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/client/GumConfigClientException.java deleted file mode 100644 index a2ebe1a14..000000000 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/client/GumConfigClientException.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.ihe.gazelle.tm.application.client; - -public class GumConfigClientException extends RuntimeException{ - - public GumConfigClientException() { - super(); - } - - public GumConfigClientException(String message) { - super(message); - } - - public GumConfigClientException(String message, Throwable cause) { - super(message, cause); - } - - public GumConfigClientException(Throwable cause) { - super(cause); - } -} diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/services/ApplicationConfigurationService.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/services/ApplicationConfigurationService.java deleted file mode 100644 index 57e4a05d0..000000000 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/services/ApplicationConfigurationService.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.ihe.gazelle.tm.application.services; - -public interface ApplicationConfigurationService { - - /** - * Get if user registration is enabled - * @return true if user registration is enabled, false otherwise - */ - boolean isUserRegistrationEnabled(); -} diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/services/ApplicationConfigurationServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/services/ApplicationConfigurationServiceImpl.java deleted file mode 100644 index 4010c4a49..000000000 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/services/ApplicationConfigurationServiceImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.ihe.gazelle.tm.application.services; - -import net.ihe.gazelle.tm.application.client.GumConfigClient; -import net.ihe.gazelle.tm.application.client.GumConfigClientException; -import org.jboss.seam.ScopeType; -import org.jboss.seam.annotations.AutoCreate; -import org.jboss.seam.annotations.Name; -import org.jboss.seam.annotations.Scope; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@Scope(ScopeType.EVENT) -@AutoCreate -@Name("applicationConfigurationService") -public class ApplicationConfigurationServiceImpl implements ApplicationConfigurationService { - private static final Logger LOG = LoggerFactory.getLogger(ApplicationConfigurationServiceImpl.class); - - GumConfigClient gumConfigClient = new GumConfigClient(); - @Override - public boolean isUserRegistrationEnabled() { - try { - return gumConfigClient.getUserRegistrationEnabled(); - }catch (GumConfigClientException e){ - LOG.error("Could not determine if user registration is enabled. See following error:", e); - return false; - } - } -} -- GitLab From 28136a58adcde71502257e1ebce6878b43c10e0e Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 10 Sep 2024 12:35:03 +0200 Subject: [PATCH 74/77] Updated front --- gazelle-tm-war/src/main/webapp/install/installation.xhtml | 2 +- gazelle-tm-war/src/main/webapp/layout/menu/_menu.xhtml | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/gazelle-tm-war/src/main/webapp/install/installation.xhtml b/gazelle-tm-war/src/main/webapp/install/installation.xhtml index dea962b66..57d2c7bbe 100644 --- a/gazelle-tm-war/src/main/webapp/install/installation.xhtml +++ b/gazelle-tm-war/src/main/webapp/install/installation.xhtml @@ -14,7 +14,7 @@ <br/> <br/> <h:outputLink id="redirectToGum" styleClass="gzl-btn-green" - value="#{preferenceProvider.getString('gum_front_url')}"> + value="#{applicationConfigurationBean.getUserRegistrationUrl()}"> <h:outputText value="#{messages['gazelle.users.user.button.CreateFirstAdminUser']}"/> </h:outputLink> </ui:define> diff --git a/gazelle-tm-war/src/main/webapp/layout/menu/_menu.xhtml b/gazelle-tm-war/src/main/webapp/layout/menu/_menu.xhtml index 2f226bdba..57c7acf0a 100644 --- a/gazelle-tm-war/src/main/webapp/layout/menu/_menu.xhtml +++ b/gazelle-tm-war/src/main/webapp/layout/menu/_menu.xhtml @@ -106,14 +106,6 @@ </li> </h:panelGroup> </h:panelGroup> - <!-- Sign up menu --> - <h:panelGroup rendered="#{!identity.loggedIn and applicationConfigurationService.isUserRegistrationEnabled()}"> - <li> - <h:outputLink value="#{applicationPreferenceManager.getGumFrontUrl()}"> - <h:outputText value="#{messages['net.ihe.gazelle.tm.SignUp']}"/> - </h:outputLink> - </li> - </h:panelGroup> <!-- Login menu from cas-client-ui-v7 --> <ui:decorate template="/layout/_login_menu.xhtml"> </ui:decorate> -- GitLab From c79c766e6071698d6e978920e592f53de70b6d06 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 10 Sep 2024 12:35:24 +0200 Subject: [PATCH 75/77] Removed gum_front_url preference --- .../resources/db/migration/V10_0_0_1__Remove_gum_front_url.sql | 1 + gazelle-tm-ejb/src/main/resources/db/migration/afterMigrate.sql | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 gazelle-tm-ejb/src/main/resources/db/migration/V10_0_0_1__Remove_gum_front_url.sql diff --git a/gazelle-tm-ejb/src/main/resources/db/migration/V10_0_0_1__Remove_gum_front_url.sql b/gazelle-tm-ejb/src/main/resources/db/migration/V10_0_0_1__Remove_gum_front_url.sql new file mode 100644 index 000000000..b6b63744b --- /dev/null +++ b/gazelle-tm-ejb/src/main/resources/db/migration/V10_0_0_1__Remove_gum_front_url.sql @@ -0,0 +1 @@ +DELETE FROM cmn_application_preference WHERE preference_name = 'gum_front_url'; diff --git a/gazelle-tm-ejb/src/main/resources/db/migration/afterMigrate.sql b/gazelle-tm-ejb/src/main/resources/db/migration/afterMigrate.sql index 6c81be5f5..61e2a683d 100644 --- a/gazelle-tm-ejb/src/main/resources/db/migration/afterMigrate.sql +++ b/gazelle-tm-ejb/src/main/resources/db/migration/afterMigrate.sql @@ -25,7 +25,6 @@ UPDATE cmn_application_preference SET preference_value = '${gazelle_proxy_oid}' UPDATE cmn_application_preference SET preference_value = '${gazelle_proxy_url}' WHERE preference_name = 'gazelle_proxy_url' ; UPDATE cmn_application_preference SET preference_value = '${gazelle_proxy_webservice_endpoint}' WHERE preference_name = 'gazelle_proxy_webservice_endpoint' ; UPDATE cmn_application_preference SET preference_value = '${google_analytics_code}' WHERE preference_name = 'google_analytics_code' ; -UPDATE cmn_application_preference SET preference_value = '${gum_front_url}' WHERE preference_name = 'gum_front_url' ; UPDATE cmn_application_preference SET preference_value = '${gwt_url}' WHERE preference_name = 'gwt_url' ; UPDATE cmn_application_preference SET preference_value = '${ip_login}' WHERE preference_name = 'ip_login' ; UPDATE cmn_application_preference SET preference_value = '${ip_login_admin}' WHERE preference_name = 'ip_login_admin' ; -- GitLab From cc400c6739ec3ad93fcbafcefe58776a53248d0b Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Tue, 10 Sep 2024 12:35:31 +0200 Subject: [PATCH 76/77] Updated sso version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1c05bab5f..a85429c2c 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ <maven.release.plugin.version>2.5.3</maven.release.plugin.version> <nexus.staging.maven.plugin.version>1.6.8</nexus.staging.maven.plugin.version> <gazelle.gdpr.version>1.5.0</gazelle.gdpr.version> - <sso.client.v7.version>5.0.0-GZL-5369-SNAPSHOT</sso.client.v7.version> + <sso.client.v7.version>5.0.0-GZL-5400-SNAPSHOT</sso.client.v7.version> <communication-tool-gateway.version>1.0.1</communication-tool-gateway.version> </properties> -- GitLab From 618aa497cfe554acd979f7c3db89cd2df712a758 Mon Sep 17 00:00:00 2001 From: nry <nicolas.ronceray@kereval.com> Date: Fri, 13 Sep 2024 09:31:06 +0200 Subject: [PATCH 77/77] Updated dependency version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4ea6e896e..2842b065c 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ <maven.release.plugin.version>2.5.3</maven.release.plugin.version> <nexus.staging.maven.plugin.version>1.6.8</nexus.staging.maven.plugin.version> <gazelle.gdpr.version>1.5.0</gazelle.gdpr.version> - <sso.client.v7.version>5.0.0-GZL-5400-SNAPSHOT</sso.client.v7.version> + <sso.client.v7.version>5.0.0-NPD-834-SNAPSHOT</sso.client.v7.version> <communication-tool-gateway.version>1.0.1</communication-tool-gateway.version> </properties> -- GitLab