diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 176a458f..00000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 32858aad..00000000 --- a/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -*.class - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.ear - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 8f71f43f..00000000 --- a/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - 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. - diff --git a/README.md b/README.md new file mode 100644 index 00000000..d5a44cf1 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Module moved to [LabKey/customModules](https://github.com/LabKey/customModules) in 25.3 diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 75fb6e8b..00000000 --- a/build.gradle +++ /dev/null @@ -1,12 +0,0 @@ -import org.labkey.gradle.util.BuildUtils - -plugins { - id 'org.labkey.build.module' -} - -dependencies { - BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: BuildUtils.getPlatformModuleProjectPath(project.gradle, "study"), depProjectConfig: "apiJarFile") - BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: BuildUtils.getPlatformModuleProjectPath(project.gradle, "study"), depProjectConfig: "published", depExtension: "module") - BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: BuildUtils.getPlatformModuleProjectPath(project.gradle, "specimen"), depProjectConfig: "published", depExtension: "module") -} - diff --git a/module.properties b/module.properties deleted file mode 100644 index e5f6e94e..00000000 --- a/module.properties +++ /dev/null @@ -1,8 +0,0 @@ -ModuleClass: org.labkey.trialshare.TrialShareModule -Label: Custom specimen behavior and Data Finder configuration for ITN -Description: Overrides some behavior of the specimen module and provides Data Finder cube definitions for ITN. -URL: https://www.itntrialshare.org -License: Apache 2.0 -LicenseURL: http://www.apache.org/licenses/LICENSE-2.0 -SupportedDatabases: mssql, pgsql -ManageVersion: true diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index 2a1c8ac4..00000000 --- a/pull_request_template.md +++ /dev/null @@ -1,8 +0,0 @@ -#### Rationale - - -#### Related Pull Requests -* - -#### Changes -* diff --git a/resources/olap/ITN_PublicationCube.xml b/resources/olap/ITN_PublicationCube.xml deleted file mode 100644 index 32705231..00000000 --- a/resources/olap/ITN_PublicationCube.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - FALSE - - - - - - - - - -
- - - true - - - - -
-
- - - - - - - true - - - - - - - - - diff --git a/resources/olap/ITN_StudyCube.xml b/resources/olap/ITN_StudyCube.xml deleted file mode 100644 index 7fe29f68..00000000 --- a/resources/olap/ITN_StudyCube.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - FALSE - - -
- - - - - - - - - - - - - -
- - - true - - - -
- - - -
- - - -
- - - -
- - - - - - - - - diff --git a/src/org/labkey/trialshare/DelegatingSpecimenRequestCustomizer.java b/src/org/labkey/trialshare/DelegatingSpecimenRequestCustomizer.java deleted file mode 100644 index d72417e7..00000000 --- a/src/org/labkey/trialshare/DelegatingSpecimenRequestCustomizer.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.labkey.trialshare; - -import org.labkey.api.data.Container; -import org.labkey.api.security.User; -import org.labkey.api.settings.AdminConsole; -import org.labkey.api.settings.OptionalFeatureService; -import org.labkey.api.study.SpecimenService; -import org.labkey.api.util.HtmlString; - -/** Decides whether to supply the default behavior or an ITN-specific one based on an experimental feature flag */ -public class DelegatingSpecimenRequestCustomizer implements SpecimenService.SpecimenRequestCustomizer -{ - private final SpecimenService.SpecimenRequestCustomizer _default; - private final SpecimenService.SpecimenRequestCustomizer _itn = new ITNSpecimenRequestCustomizer(); - private SpecimenService.SpecimenRequestCustomizer _active; - - private static final String ITN_SPECIMEN_HANDLING_FEATURE_NAME = "ITNSpecimenHandling"; - - public DelegatingSpecimenRequestCustomizer(SpecimenService.SpecimenRequestCustomizer defaultCustomizer) - { - _default = defaultCustomizer; - - _active = OptionalFeatureService.get().isFeatureEnabled(ITN_SPECIMEN_HANDLING_FEATURE_NAME) ? _itn : _default; - - AdminConsole.addExperimentalFeatureFlag(ITN_SPECIMEN_HANDLING_FEATURE_NAME, "ITN specimen behavior", - "This feature allows empty specimen requests, adds ITN-specific messages, hides some reporting options, and other tweaks", false); - - OptionalFeatureService.get().addFeatureListener(ITN_SPECIMEN_HANDLING_FEATURE_NAME, (feature, enabled) -> _active = enabled ? _itn : _default); - } - - @Override - public boolean allowEmptyRequests() - { - return _active.allowEmptyRequests(); - } - - @Override - public Integer getDefaultDestinationSiteId() - { - return _active.getDefaultDestinationSiteId(); - } - - @Override - public boolean omitTypeGroupingsWhenReporting() - { - return _active.omitTypeGroupingsWhenReporting(); - } - - @Override - public boolean canChangeStatus(User user) - { - return _active.canChangeStatus(user); - } - - @Override - public boolean hideRequestWarnings() - { - return _active.hideRequestWarnings(); - } - - @Override - public HtmlString getSubmittedMessage(Container c, int requestId) - { - return _active.getSubmittedMessage(c, requestId); - } -} diff --git a/src/org/labkey/trialshare/ITNSpecimenRequestCustomizer.java b/src/org/labkey/trialshare/ITNSpecimenRequestCustomizer.java deleted file mode 100644 index e342c72e..00000000 --- a/src/org/labkey/trialshare/ITNSpecimenRequestCustomizer.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.labkey.trialshare; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.labkey.api.data.Container; -import org.labkey.api.data.ContainerManager; -import org.labkey.api.security.Group; -import org.labkey.api.security.GroupManager; -import org.labkey.api.security.User; -import org.labkey.api.study.SpecimenUrls; -import org.labkey.api.study.SpecimenService; -import org.labkey.api.util.HtmlString; -import org.labkey.api.util.PageFlowUtil; -import org.labkey.security.xml.GroupEnumType; - -import static org.labkey.api.util.PageFlowUtil.link; - -public class ITNSpecimenRequestCustomizer implements SpecimenService.SpecimenRequestCustomizer -{ - private static final Logger LOG = LogManager.getLogger(ITNSpecimenRequestCustomizer.class); - - @Override - public boolean allowEmptyRequests() - { - return true; - } - - @Override - public Integer getDefaultDestinationSiteId() - { - return 9999999; - } - - @Override - public boolean omitTypeGroupingsWhenReporting() - { - return true; - } - - @Override - public boolean canChangeStatus(User user) - { - Group specimenRequestAdmins = GroupManager.getGroup(ContainerManager.getRoot(), "Specimen Request Administrators", GroupEnumType.SITE); - if (specimenRequestAdmins != null) - { - return user.hasSiteAdminPermission() || user.isInGroup(specimenRequestAdmins.getUserId()); - } - LOG.error("Unable to find site group \"Specimen Request Administrators\", allowing user to update specimen request status"); - return true; - } - - @Override - public HtmlString getSubmittedMessage(Container c, int requestId) - { - SpecimenUrls specimenUrls = PageFlowUtil.urlProvider(SpecimenUrls.class); - return HtmlString.unsafe("Thank you for your request. A representative from the ITN will be in touch " + - "with you. You can also contact us at " + - link("trialsharesupport@immunetolerance.org").href("mailto:trialsharesupport@immunetolerance.org?Body=" + PageFlowUtil.filter(specimenUrls.getManageRequestURL(c, requestId).getURIString())).clearClasses() + - " to follow up with us regarding this request.
" + - "You may also update this request at any calendar to add comments or supporting " + - "documents by clicking here " + link("Update Request").href(specimenUrls.getManageRequestStatusURL(c, requestId))); - } - - @Override - public boolean hideRequestWarnings() - { - return true; - } -} diff --git a/src/org/labkey/trialshare/StudyITNFolderType.java b/src/org/labkey/trialshare/StudyITNFolderType.java deleted file mode 100644 index 2114a576..00000000 --- a/src/org/labkey/trialshare/StudyITNFolderType.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2016 LabKey Corporation - * - * 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. - */ -package org.labkey.trialshare; - -import org.jetbrains.annotations.NotNull; -import org.labkey.api.module.MultiPortalFolderType; -import org.labkey.api.specimen.SpecimensPage; -import org.labkey.api.study.Study; -import org.labkey.api.study.StudyFolderTabs; -import org.labkey.api.study.StudyService; -import org.labkey.api.view.FolderTab; -import org.labkey.api.view.Portal; -import org.labkey.api.view.ViewContext; - -import java.util.Collections; -import java.util.List; -import java.util.Set; - -/** - * User: Nick - * Date: 7/22/11 - */ -public class StudyITNFolderType extends MultiPortalFolderType -{ - private static final String STUDY_ITN_FOLDER_TYPE_NAME = "Study (ITN)"; - - private static final List PAGES = List.of( - new StudyFolderTabs.OverviewPage("Overview"), - new StudyFolderTabs.DataAnalysisPage("Data & Reports"), - new StudyFolderTabs.ParticipantsPage("Participants"), - new SpecimensPage("Specimens"), - new StudyFolderTabs.ManagePage("Manage") - ); - - StudyITNFolderType(TrialShareModule module) - { - super(STUDY_ITN_FOLDER_TYPE_NAME, - "Standard Study folder type with tabs pre-configured for ITN TrialShare.", - Collections.singletonList(Portal.getPortalPart("Study Overview").createWebPart()), - null, - getDefaultModuleSet(module, getModule("Experiment"), getModule("Study"), getModule("Pipeline")), - getModule("Study")); - } - - @NotNull - @Override - public Set getLegacyNames() - { - return Collections.singleton("Study Redesign (ITN)"); - } - - @Override - protected String getFolderTitle(ViewContext ctx) - { - Study study = StudyService.get().getStudy(ctx.getContainer()); - return study != null ? study.getLabel() : ctx.getContainer().getName(); - } - - @Override - public String getStartPageLabel(ViewContext ctx) - { - Study study = StudyService.get().getStudy(ctx.getContainer()); - return study == null ? "New Study" : study.getLabel(); - } - - @Override - public List getDefaultTabs() - { - return PAGES; - } -} \ No newline at end of file diff --git a/src/org/labkey/trialshare/TrialShareController.java b/src/org/labkey/trialshare/TrialShareController.java deleted file mode 100644 index 58638335..00000000 --- a/src/org/labkey/trialshare/TrialShareController.java +++ /dev/null @@ -1,736 +0,0 @@ -/* - * Copyright (c) 2015-2019 LabKey Corporation - * - * 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. - */ -package org.labkey.trialshare; - -import org.apache.logging.log4j.LogManager; -import org.jetbrains.annotations.NotNull; -import org.junit.Assert; -import org.junit.Test; -import org.labkey.api.action.ApiResponse; -import org.labkey.api.action.ApiSimpleResponse; -import org.labkey.api.action.Marshal; -import org.labkey.api.action.Marshaller; -import org.labkey.api.action.MutatingApiAction; -import org.labkey.api.action.SpringActionController; -import org.labkey.api.admin.AbstractFolderContext.ExportType; -import org.labkey.api.admin.FolderExportContext; -import org.labkey.api.admin.FolderSerializationRegistry; -import org.labkey.api.admin.FolderWriter; -import org.labkey.api.admin.FolderWriterImpl; -import org.labkey.api.admin.StaticLoggerGetter; -import org.labkey.api.data.Container; -import org.labkey.api.data.PHI; -import org.labkey.api.pipeline.PipeRoot; -import org.labkey.api.pipeline.PipelineService; -import org.labkey.api.pipeline.PipelineUrls; -import org.labkey.api.qc.SampleStatusService; -import org.labkey.api.security.IgnoresTermsOfUse; -import org.labkey.api.security.RequiresPermission; -import org.labkey.api.security.permissions.AdminPermission; -import org.labkey.api.util.PageFlowUtil; -import org.labkey.api.view.ActionURL; -import org.labkey.api.view.NotFoundException; -import org.labkey.api.writer.FileSystemFile; -import org.springframework.validation.BindException; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; - -@Marshal(Marshaller.Jackson) -public class TrialShareController extends SpringActionController -{ - private static final DefaultActionResolver _actionResolver = new DefaultActionResolver(TrialShareController.class); - static final String NAME = "trialshare"; - - public TrialShareController() - { - setActionResolver(_actionResolver); - } - - /* - TrialShare: simple study export action: - - example usage (via LabKey Remote Java API): - - SimplePostCommand pc = new SimplePostCommand("pipeline","TrialShareExport"); - JSONObject jo = new JSONObject(); - pc.setJsonObject(jo); - CommandResponse cr = pc.execute(cn, "/Studies/ITN027AIOPR/Study Data/"); - System.out.println(cr.getText()); - */ - - public static class TrialShareExportForm - { - private boolean missingValueIndicators; - private boolean study; - private boolean assayDatasets; - private boolean assaySchedule; - private boolean categories; - private boolean cohortSettings; - private boolean crfDatasets; - private boolean customParticipantView; - private boolean datasetData; - private boolean etlDefinitions; - private boolean participantCommentSettings; - private boolean participantGroups; - private boolean protocolDocuments; - private boolean qcStateSettings; - private boolean specimenSettings; - private boolean specimens; - private boolean treatmentData; - private boolean visitMap; - private boolean folderTypeAndActiveModules; - private boolean fullTextSearchSettings; - private boolean webpartPropertiesAndLayout; - private boolean containerSpecificModuleProperties; - private boolean roleAssignmentsForUsersAndGroups; - private boolean listDesigns; - private boolean listData; - private boolean queries; - private boolean gridViews; - private boolean reportsAndCharts; - private boolean externalSchemaDefinitions; - private boolean wikisAndTheirAttachments; - private boolean notificationSettings; - private boolean sampleTypeDesigns; - private boolean sampleTypeData; - private boolean dataClassDesigns; - private boolean dataClassData; - private boolean inventoryLocationsAndItems; - private boolean experimentsAndRuns; - - public boolean getMissingValueIndicators() - { - return missingValueIndicators; - } - - public void setMissingValueIndicators(boolean missingValueIndicators) - { - this.missingValueIndicators = missingValueIndicators; - } - - public boolean getStudy() - { - return study; - } - - public void setStudy(boolean study) - { - this.study = study; - } - - public boolean getAssayDatasets() - { - return assayDatasets; - } - - public void setAssayDatasets(boolean assayDatasets) - { - this.assayDatasets = assayDatasets; - } - - public boolean getAssaySchedule() - { - return assaySchedule; - } - - public void setAssaySchedule(boolean assaySchedule) - { - this.assaySchedule = assaySchedule; - } - - public boolean getCategories() - { - return categories; - } - - public void setCategories(boolean categories) - { - this.categories = categories; - } - - public boolean getCohortSettings() - { - return cohortSettings; - } - - public void setCohortSettings(boolean cohortSettings) - { - this.cohortSettings = cohortSettings; - } - - public boolean getCrfDatasets() - { - return crfDatasets; - } - - public void setCrfDatasets(boolean crfDatasets) - { - this.crfDatasets = crfDatasets; - } - - public boolean getEtlDefinitions() - { - return etlDefinitions; - } - - public void setEtlDefinitions(boolean etlDefinitions) - { - this.etlDefinitions = etlDefinitions; - } - - public boolean getCustomParticipantView() - { - return customParticipantView; - } - - public void setCustomParticipantView(boolean customParticipantView) - { - this.customParticipantView = customParticipantView; - } - - public boolean getDatasetData() - { - return datasetData; - } - - public void setDatasetData(boolean datasetData) - { - this.datasetData = datasetData; - } - - public boolean getParticipantCommentSettings() - { - return participantCommentSettings; - } - - public void setParticipantCommentSettings(boolean participantCommentSettings) - { - this.participantCommentSettings = participantCommentSettings; - } - - public boolean getParticipantGroups() - { - return participantGroups; - } - - public void setParticipantGroups(boolean participantGroups) - { - this.participantGroups = participantGroups; - } - - public boolean getProtocolDocuments() - { - return protocolDocuments; - } - - public void setProtocolDocuments(boolean protocolDocuments) - { - this.protocolDocuments = protocolDocuments; - } - - public boolean getQcStateSettings() - { - return qcStateSettings; - } - - public void setQcStateSettings(boolean qcStateSettings) - { - this.qcStateSettings = qcStateSettings; - } - - public boolean getSpecimenSettings() - { - return specimenSettings; - } - - public void setSpecimenSettings(boolean specimenSettings) - { - this.specimenSettings = specimenSettings; - } - - public boolean getSpecimens() - { - return specimens; - } - - public void setSpecimens(boolean specimens) - { - this.specimens = specimens; - } - - public boolean getTreatmentData() - { - return treatmentData; - } - - public void setTreatmentData(boolean treatmentData) - { - this.treatmentData = treatmentData; - } - - public boolean getVisitMap() - { - return visitMap; - } - - public void setVisitMap(boolean visitMap) - { - this.visitMap = visitMap; - } - - public boolean getFolderTypeAndActiveModules() - { - return folderTypeAndActiveModules; - } - - public void setFolderTypeAndActiveModules(boolean folderTypeAndActiveModules) - { - this.folderTypeAndActiveModules = folderTypeAndActiveModules; - } - - public boolean getFullTextSearchSettings() - { - return fullTextSearchSettings; - } - - public void setFullTextSearchSettings(boolean fullTextSearchSettings) - { - this.fullTextSearchSettings = fullTextSearchSettings; - } - - public boolean getWebpartPropertiesAndLayout() - { - return webpartPropertiesAndLayout; - } - - public void setWebpartPropertiesAndLayout(boolean webpartPropertiesAndLayout) - { - this.webpartPropertiesAndLayout = webpartPropertiesAndLayout; - } - - public boolean getContainerSpecificModuleProperties() - { - return containerSpecificModuleProperties; - } - - public void setContainerSpecificModuleProperties(boolean containerSpecificModuleProperties) - { - this.containerSpecificModuleProperties = containerSpecificModuleProperties; - } - - public boolean getRoleAssignmentsForUsersAndGroups() - { - return roleAssignmentsForUsersAndGroups; - } - - public void setRoleAssignmentsForUsersAndGroups(boolean roleAssignmentsForUsersAndGroups) - { - this.roleAssignmentsForUsersAndGroups = roleAssignmentsForUsersAndGroups; - } - - public boolean isListDesigns() - { - return listDesigns; - } - - public void setListDesigns(boolean listDesigns) - { - this.listDesigns = listDesigns; - } - - public boolean isListData() - { - return listData; - } - - public void setListData(boolean listData) - { - this.listData = listData; - } - - public boolean getQueries() - { - return queries; - } - - public void setQueries(boolean queries) - { - this.queries = queries; - } - - public boolean getGridViews() - { - return gridViews; - } - - public void setGridViews(boolean gridViews) - { - this.gridViews = gridViews; - } - - public boolean getReportsAndCharts() - { - return reportsAndCharts; - } - - public void setReportsAndCharts(boolean reportsAndCharts) - { - this.reportsAndCharts = reportsAndCharts; - } - - public boolean getExternalSchemaDefinitions() - { - return externalSchemaDefinitions; - } - - public void setExternalSchemaDefinitions(boolean externalSchemaDefinitions) - { - this.externalSchemaDefinitions = externalSchemaDefinitions; - } - - public boolean getWikisAndTheirAttachments() - { - return wikisAndTheirAttachments; - } - - public void setWikisAndTheirAttachments(boolean wikisAndTheirAttachments) - { - this.wikisAndTheirAttachments = wikisAndTheirAttachments; - } - - public boolean getNotificationSettings() - { - return notificationSettings; - } - - public void setNotificationSettings(boolean notificationSettings) - { - this.notificationSettings = notificationSettings; - } - - public boolean getSampleTypeDesigns() - { - return sampleTypeDesigns; - } - - public void setSampleTypeDesigns(boolean sampleTypeDesigns) - { - this.sampleTypeDesigns = sampleTypeDesigns; - } - - public boolean getSampleTypeData() - { - return sampleTypeData; - } - - public void setSampleTypeData(boolean sampleTypeData) - { - this.sampleTypeData = sampleTypeData; - } - - public boolean getDataClassDesigns() - { - return dataClassDesigns; - } - - public void setDataClassDesigns(boolean dataClassDesigns) - { - this.dataClassDesigns = dataClassDesigns; - } - - public boolean getDataClassData() - { - return dataClassData; - } - - public void setDataClassData(boolean dataClassData) - { - this.dataClassData = dataClassData; - } - - public boolean getInventoryLocationsAndItems() - { - return inventoryLocationsAndItems; - } - - public void setInventoryLocationsAndItems(boolean inventoryLocationsAndItems) - { - this.inventoryLocationsAndItems = inventoryLocationsAndItems; - } - - public boolean getExperimentsAndRuns() - { - return experimentsAndRuns; - } - - public void setExperimentsAndRuns(boolean experimentsAndRuns) - { - this.experimentsAndRuns = experimentsAndRuns; - } - } - - /* - todo: explain who uses this and why - */ - @RequiresPermission(AdminPermission.class) - @IgnoresTermsOfUse - public class TrialShareExportAction extends MutatingApiAction - { - private ActionURL _successURL; - - @Override - public ApiResponse execute(TrialShareExportForm form, BindException errors) throws Exception - { - // JSONObject json = form.getJsonObject(); - ApiSimpleResponse response = new ApiSimpleResponse(); - - Container container = getContainer(); - if (container.isRoot()) - { - throw new NotFoundException(); - } - - FolderWriterImpl writer = new FolderWriterImpl(); - - Set types = new HashSet<>(); - - for (FolderDataTypes type : FolderDataTypes.values()) - { - if (type.shouldExport(form)) - types.add(type); - } - - if(types.isEmpty()) - { - types = getDefaultExportDataTypes(); - } - - // todo: super important boolean false in 17.2 replaced by PHI enum. what is new correct setting? PHI.Limited - FolderExportContext ctx = new FolderExportContext(getUser(), container, types.stream().map(FolderDataTypes::getDescription).collect(Collectors.toSet()), - "new", false, PHI.NotPHI, false, - false, false, new StaticLoggerGetter(LogManager.getLogger(FolderWriterImpl.class))); - - PipeRoot root = PipelineService.get().findPipelineRoot(container); - if (root == null || !root.isValid()) - { - throw new NotFoundException("No valid pipeline root found"); - } - File exportDir = root.resolvePath("export"); - try - { - writer.write(container, ctx, new FileSystemFile(exportDir)); - } - catch (Container.ContainerException e) - { - errors.reject(SpringActionController.ERROR_MSG, e.getMessage()); - response.put("success", false); - response.put("reason", e.getMessage()); - return response; - } - _successURL = PageFlowUtil.urlProvider(PipelineUrls.class).urlBrowse(container); - - response.put("success", true); - return response; - } - } - - @NotNull - private static Set getDefaultExportDataTypes() - { - return Set.of( - FolderDataTypes.folderTypeAndActiveModules, - FolderDataTypes.fullTextSearchSettings, - FolderDataTypes.webpartProperties, - FolderDataTypes.moduleProperties, - FolderDataTypes.qcStateSettings, - - FolderDataTypes.mvIndicators, - FolderDataTypes.study, - FolderDataTypes.assayDatasetData, - FolderDataTypes.assayDatasetDefinitions, - FolderDataTypes.assaySchedule, - FolderDataTypes.categories, - FolderDataTypes.cohortSettings, - FolderDataTypes.customParticipantView, - FolderDataTypes.sampleDatasetData, - FolderDataTypes.sampleDatasetDefinitions, - FolderDataTypes.studyDatasetData, - FolderDataTypes.studyDatasetDefinitions, - FolderDataTypes.participantCommentSettings, - FolderDataTypes.participantGroups, - FolderDataTypes.protocolDocuments, - FolderDataTypes.specimenSettings, - FolderDataTypes.specimens, - FolderDataTypes.treatmentData, - FolderDataTypes.visitMap, - FolderDataTypes.queries, - FolderDataTypes.gridViews, - FolderDataTypes.reportsAndCharts, - FolderDataTypes.externalSchemaDefinitions, - FolderDataTypes.etlDefinitions, - FolderDataTypes.listDesigns, - FolderDataTypes.listData, - FolderDataTypes.wikisAndAttachments, - FolderDataTypes.notificationSettings, - FolderDataTypes.sampleTypeDesigns, - FolderDataTypes.sampleTypeData, - FolderDataTypes.dataClassDesigns, - FolderDataTypes.dataClassData, - FolderDataTypes.inventoryLocationsAndItems, - FolderDataTypes.experiments - ); - } - - enum FolderDataTypes - { - mvIndicators("Missing value indicators", TrialShareExportForm::getMissingValueIndicators), - study("Study", TrialShareExportForm::getStudy), - assayDatasetDefinitions("Datasets: Assay Dataset Definitions", TrialShareExportForm::getAssayDatasets), - assayDatasetData("Datasets: Assay Dataset Data", TrialShareExportForm::getAssayDatasets), - assaySchedule("Assay Schedule", TrialShareExportForm::getAssaySchedule), - categories("Categories", TrialShareExportForm::getCategories), - cohortSettings("Cohort Settings", TrialShareExportForm::getCohortSettings), - customParticipantView("Custom Participant View", TrialShareExportForm::getCustomParticipantView), - sampleDatasetData("Datasets: Sample Dataset Data", TrialShareExportForm::getDatasetData), - sampleDatasetDefinitions("Datasets: Sample Dataset Definitions", TrialShareExportForm::getDatasetData), - studyDatasetData("Datasets: Study Dataset Data", TrialShareExportForm::getCrfDatasets), - studyDatasetDefinitions("Datasets: Study Dataset Definitions", TrialShareExportForm::getCrfDatasets), - etlDefinitions("ETL Definitions", TrialShareExportForm::getEtlDefinitions), - participantCommentSettings("Participant Comment Settings", TrialShareExportForm::getParticipantCommentSettings), - participantGroups("Participant Groups", TrialShareExportForm::getParticipantGroups), - protocolDocuments("Protocol Documents", TrialShareExportForm::getProtocolDocuments), - qcStateSettings(SampleStatusService.get().supportsSampleStatus() ? "Sample Status and QC State Settings" : "QC State Settings", TrialShareExportForm::getQcStateSettings), - specimenSettings("Specimen Settings", TrialShareExportForm::getSpecimenSettings), - specimens("Specimens", TrialShareExportForm::getSpecimens), - treatmentData("Treatment Data", TrialShareExportForm::getTreatmentData), - visitMap("Visit Map", TrialShareExportForm::getVisitMap), - folderTypeAndActiveModules("Folder type and active modules", TrialShareExportForm::getFolderTypeAndActiveModules), - fullTextSearchSettings("Full-text search settings", TrialShareExportForm::getFullTextSearchSettings), - webpartProperties("Webpart properties and layout", TrialShareExportForm::getWebpartPropertiesAndLayout), - moduleProperties("Container specific module properties", TrialShareExportForm::getContainerSpecificModuleProperties), - roleAssignments("Role assignments for users and groups", TrialShareExportForm::getRoleAssignmentsForUsersAndGroups), - listDesigns("List Designs", TrialShareExportForm::isListDesigns), - listData("List Data", TrialShareExportForm::isListData), - queries("Queries", TrialShareExportForm::getQueries), - gridViews("Grid Views", TrialShareExportForm::getGridViews), - reportsAndCharts("Reports and Charts", TrialShareExportForm::getReportsAndCharts), - externalSchemaDefinitions("External schema definitions", TrialShareExportForm::getExternalSchemaDefinitions), - wikisAndAttachments("Wikis and their attachments", TrialShareExportForm::getWikisAndTheirAttachments), - notificationSettings("Notification settings", TrialShareExportForm::getNotificationSettings), - sampleTypeDesigns("Sample Type Designs", TrialShareExportForm::getSampleTypeDesigns), - sampleTypeData("Sample Type Data", TrialShareExportForm::getSampleTypeData), - dataClassDesigns("Data Class Designs", TrialShareExportForm::getDataClassDesigns), - dataClassData("Data Class Data", TrialShareExportForm::getDataClassData), - inventoryLocationsAndItems("Inventory locations and items", TrialShareExportForm::getInventoryLocationsAndItems), - experiments("Experiments, Protocols, and Runs", TrialShareExportForm::getExperimentsAndRuns); - - private final String _description; - private final Function _formChecker; - - FolderDataTypes(String description, Function formChecker) - { - _description = description; - _formChecker = formChecker; - } - - public String getDescription() - { - return _description; - } - - public boolean shouldExport(TrialShareExportForm form) - { - return _formChecker.apply(form); - } - } - - public static class TrialShareExportTest - { - // ignore these export types because they won't appear in the folder export UI - private static final Set _ignoredFolderWriters = Set.of("Notebooks", "LabBooks"); - - private final Collection folderWriters = FolderSerializationRegistry.get().getRegisteredFolderWriters().stream() - .filter(fw -> !_ignoredFolderWriters.contains(fw.getDataType())) - .collect(Collectors.toList()); - - @Test - public void testDataTypes() - { - final Set expectedDataTypes = Arrays.stream(FolderDataTypes.values()).map(FolderDataTypes::getDescription).collect(Collectors.toSet()); - final Set actualDataTypes = getRegisteredDataTypes(false); - - Iterator iterator = expectedDataTypes.iterator(); - while (iterator.hasNext()) - { - String expectedDataType = iterator.next(); - if (actualDataTypes.contains(expectedDataType)) - { - iterator.remove(); - actualDataTypes.remove(expectedDataType); - } - } - - if (!expectedDataTypes.isEmpty()) - { - Assert.fail("Did not find expected data type(s): " + expectedDataTypes + ". Unaccounted for data types: " + actualDataTypes); - } - } - - @Test - public void testDefaultDataTypes() - { - final List expectedDataTypes = getDefaultExportDataTypes().stream().map(FolderDataTypes::getDescription).collect(Collectors.toList()); - final List actualDefaultDataTypes = new ArrayList<>(getRegisteredDataTypes(true)); - - // Sort to make error message more readable - Collections.sort(expectedDataTypes); - Collections.sort(actualDefaultDataTypes); - - expectedDataTypes.removeAll(actualDefaultDataTypes); - - Assert.assertTrue("TrialShareExport default data types missing expected values: " + expectedDataTypes, expectedDataTypes.isEmpty()); - } - - public Set getRegisteredDataTypes(boolean onlyDefault) - { - Set dataTypes = new HashSet<>(); - Set filteredFolderWriters; - if (onlyDefault) - filteredFolderWriters = folderWriters.stream().filter(fw -> fw.selectedByDefault(ExportType.ALL, false)).collect(Collectors.toSet()); - else - filteredFolderWriters = new HashSet<>(folderWriters); - - filteredFolderWriters.forEach(fw -> { - dataTypes.add(fw.getDataType()); - fw.getChildren(false, false) - .forEach(w -> dataTypes.add(w.getDataType())); - }); - - dataTypes.remove(null); - return dataTypes; - } - } -} diff --git a/src/org/labkey/trialshare/TrialShareModule.java b/src/org/labkey/trialshare/TrialShareModule.java deleted file mode 100644 index 8117fd2f..00000000 --- a/src/org/labkey/trialshare/TrialShareModule.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2015-2017 LabKey Corporation - * - * 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. - */ - -package org.labkey.trialshare; - -import org.jetbrains.annotations.NotNull; -import org.labkey.api.data.Container; -import org.labkey.api.module.CodeOnlyModule; -import org.labkey.api.module.FolderTypeManager; -import org.labkey.api.module.ModuleContext; -import org.labkey.api.study.SpecimenService; -import org.labkey.api.view.WebPartFactory; - -import java.util.Collection; -import java.util.Collections; -import java.util.Set; - -public class TrialShareModule extends CodeOnlyModule -{ - public static final String NAME = "TrialShare"; - - @Override - public String getName() - { - return NAME; - } - - public TrialShareModule() - { - } - - @NotNull - @Override - protected Collection createWebPartFactories() - { - return Collections.emptyList(); - } - - @Override - protected void init() - { - addController(TrialShareController.NAME, TrialShareController.class); - } - - @Override - public void doStartup(ModuleContext moduleContext) - { - FolderTypeManager.get().registerFolderType(this, new StudyITNFolderType(this)); - SpecimenService.get().registerRequestCustomizer(new DelegatingSpecimenRequestCustomizer(SpecimenService.get().getRequestCustomizer())); - } - - @Override - @NotNull - public Collection getSummary(Container c) - { - return Collections.emptyList(); - } - - @Override - @NotNull - public Set getIntegrationTests() - { - return Set.of( - TrialShareController.TrialShareExportTest.class - ); - } -} \ No newline at end of file diff --git a/test/src/org/labkey/test/tests/trialshare/ITNSpecimenTest.java b/test/src/org/labkey/test/tests/trialshare/ITNSpecimenTest.java deleted file mode 100644 index beef8690..00000000 --- a/test/src/org/labkey/test/tests/trialshare/ITNSpecimenTest.java +++ /dev/null @@ -1,215 +0,0 @@ -package org.labkey.test.tests.trialshare; - -import org.hamcrest.CoreMatchers; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.labkey.remoteapi.Connection; -import org.labkey.test.BaseWebDriverTest; -import org.labkey.test.Locator; -import org.labkey.test.TestFileUtils; -import org.labkey.test.TestTimeoutException; -import org.labkey.test.categories.Git; -import org.labkey.test.components.study.specimen.SpecimenDetailGrid; -import org.labkey.test.pages.study.specimen.ManageRequestPage; -import org.labkey.test.pages.study.specimen.ManageRequestStatusPage; -import org.labkey.test.pages.study.specimen.ShowCreateSpecimenRequestPage; -import org.labkey.test.pages.study.specimen.TypeSummaryReportPage; -import org.labkey.test.util.ApiPermissionsHelper; -import org.labkey.test.util.OptionalFeatureHelper; -import org.labkey.test.util.LogMethod; -import org.labkey.test.util.PermissionsHelper.MemberType; -import org.labkey.test.util.TestLogger; -import org.labkey.test.util.study.specimen.SpecimenHelper; -import org.openqa.selenium.NoSuchElementException; -import org.openqa.selenium.support.ui.UnexpectedTagNameException; - -import java.io.File; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; - -@Category({Git.class}) -public class ITNSpecimenTest extends BaseWebDriverTest -{ - private static final File STUDY_ARCHIVE = TestFileUtils.getSampleData("studies/LabkeyDemoStudy.zip"); - private static final String ITN_SPECIMEN_HANDLING = "ITNSpecimenHandling"; - - private static final String SPECIMEN_COORDINATOR = "specimen_coordinator@itnspecimen.test"; - private static final String MAGIC_GROUP = "Specimen Request Administrators"; - - @Override - protected void doCleanup(boolean afterTest) throws TestTimeoutException - { - super.doCleanup(afterTest); - enableITNSpecimenHandling(false); - _userHelper.deleteUsers(false, SPECIMEN_COORDINATOR); - } - - @BeforeClass - public static void setupProject() - { - ITNSpecimenTest init = (ITNSpecimenTest) getCurrentTest(); - - init.doSetup(); - } - - private void doSetup() - { - _containerHelper.createProject(getProjectName(), "Study"); - _containerHelper.enableModule("Specimen"); - importStudyFromZip(STUDY_ARCHIVE); - new SpecimenHelper(this).setupRequestStatuses(); - } - - @Before - public void preTest() - { - enableITNSpecimenHandling(true); - goToProjectHome(); - } - - @Test - public void testSpecimenReportCustomization() - { - final String primaryType = "Blood (Whole)"; - final String derivativeType1 = "PBMC Cells, Viable"; - final String derivativeType2 = "Plasma, Unknown Processing"; - - TestLogger.log("Check standard specimen report behavior to ensure Locators are accurate"); - enableITNSpecimenHandling(false); - TypeSummaryReportPage typeSummaryReportPage = TypeSummaryReportPage.beginAt(this, getProjectName()); - assertThat("Default type breakdown.", typeSummaryReportPage.getTypeBreakdown(), CoreMatchers.containsString("Show results by")); - assertTextPresent(primaryType, derivativeType1, derivativeType2); - - TestLogger.log("Verify customized specimen report behavior"); - enableITNSpecimenHandling(true); - typeSummaryReportPage = TypeSummaryReportPage.beginAt(this, getProjectName()); - try - { - typeSummaryReportPage.getTypeBreakdown(); - Assert.fail("Type breakdown select should be removed from custom ITN specimen report"); - } - catch (NoSuchElementException ignore) { /* expected exception */ } - - assertTextPresent(primaryType); - assertTextNotPresent(derivativeType1, derivativeType2); - } - - @Test - public void testSpecimenRequestCustomization() - { - SpecimenHelper specimenHelper = new SpecimenHelper(this); - clickPortalTab("Specimen Data"); - - waitAndClickAndWait(Locator.linkWithText("Urine")); - SpecimenDetailGrid specimenGrid = specimenHelper.findSpecimenDetailGrid(); - specimenGrid.checkCheckbox(0); - ShowCreateSpecimenRequestPage requestPage = specimenGrid.createNewRequest(); - - // TODO: Refactor to use SampleManagementErrorLogger after it has been moved out of sampleManagement - TestLogger.log("\"Requesting Location\" should not be available for ITN specimen requests"); - assertElementNotVisible(Locator.id("destinationLocation")); - - ManageRequestPage manageRequestPage = requestPage - .setDetails("plan", "info") // required fields - .clickCreateAndViewDetails(); - - String requestingLocation = manageRequestPage.getRequestInformation("Requesting Location"); - assertEquals("Wrong 'Requesting Location'.", "User Request", requestingLocation); - - specimenGrid = specimenHelper.findSpecimenDetailGrid(); - specimenGrid.checkCheckbox(0); - specimenGrid.clickHeaderButtonAndWait("Remove Selected"); - - TestLogger.log("Should be able to submit a request without any specimens"); - manageRequestPage = manageRequestPage - .submitRequest(); - - TestLogger.log("Validate message from 'ITNSpecimenRequestCustomizer'"); - assertElementPresent(Locator.linkWithText("trialsharesupport@immunetolerance.org")); - assertTextPresent("Thank you for your request. A representative from the ITN will be in touch with you."); - } - - @Test - public void testRequestPermissionCustomization() - { - ApiPermissionsHelper permissions = new ApiPermissionsHelper(this); - - _userHelper.createUser(SPECIMEN_COORDINATOR); - permissions.addMemberToRole(SPECIMEN_COORDINATOR, "Specimen Coordinator", MemberType.user, getProjectName()); - permissions.addMemberToRole(SPECIMEN_COORDINATOR, "Reader", MemberType.user, getProjectName()); - permissions.createGlobalPermissionsGroup(MAGIC_GROUP); - - ManageRequestStatusPage manageRequestStatusPage = ShowCreateSpecimenRequestPage.beginAt(this, getProjectName()) - .setDetails("A", "B") - .clickCreateAndViewDetails() - .submitRequest() - .clickUpdateRequest(); - - TestLogger.log("Site admin should be able to set request status"); - manageRequestStatusPage - .setStatus("Processing") - .clickSave(); - - int id = Integer.parseInt(getUrlParam("id")); - - impersonate(SPECIMEN_COORDINATOR); - { - TestLogger.log("Need to be in special group to update requrest status"); - manageRequestStatusPage = ManageRequestStatusPage.beginAt(this, getProjectName(), id); - try - { - manageRequestStatusPage.getStatus(); - Assert.fail("Only users in the correct group should see 'status' dropdown"); - } - catch (UnexpectedTagNameException ignore) { /* expected exception */ } - - String readOnlyStatus = Locator.input("status").parent().findElement(getDriver()).getText(); - assertEquals("Should see status", "Processing", readOnlyStatus); - } - stopImpersonating(); - - permissions.addUserToSiteGroup(SPECIMEN_COORDINATOR, MAGIC_GROUP); - - impersonate(SPECIMEN_COORDINATOR); - { - ManageRequestStatusPage.beginAt(this, getProjectName(), id) - .setStatus("Completed") - .clickSave(); - } - stopImpersonating(); - - String status = ManageRequestPage.beginAt(this, getProjectName(), id).getRequestInformation("Status"); - assertEquals("Final Status", "Completed", status); - } - - @LogMethod(quiet = true) - public void enableITNSpecimenHandling(boolean enable) - { - Connection cn = createDefaultConnection(false); - OptionalFeatureHelper.setOptionalFeature(cn, ITN_SPECIMEN_HANDLING, enable); - } - - @Override - protected BrowserType bestBrowser() - { - return BrowserType.CHROME; - } - - @Override - protected String getProjectName() - { - return "TrialShareSpecimenTest Project"; - } - - @Override - public List getAssociatedModules() - { - return Arrays.asList("trialShare"); - } -} diff --git a/test/src/org/labkey/test/tests/trialshare/TrialShareExportTest.java b/test/src/org/labkey/test/tests/trialshare/TrialShareExportTest.java deleted file mode 100644 index 78d189ad..00000000 --- a/test/src/org/labkey/test/tests/trialshare/TrialShareExportTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.labkey.test.tests.trialshare; - -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.labkey.remoteapi.Connection; -import org.labkey.remoteapi.SimplePostCommand; -import org.labkey.test.BaseWebDriverTest; -import org.labkey.test.WebTestHelper; -import org.labkey.test.categories.Git; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; - -@Category({Git.class}) -public class TrialShareExportTest extends BaseWebDriverTest -{ - @BeforeClass - public static void setupProject() - { - TrialShareExportTest init = (TrialShareExportTest) getCurrentTest(); - - init.doSetup(); - } - - private void doSetup() - { - _containerHelper.createProject(getProjectName(), null); - } - - @Test - public void testTrialShareExportActionDefault() throws Exception - { - String subfolder = "exportDefault"; - _containerHelper.createSubfolder(getProjectName(), subfolder); - - Connection connection = WebTestHelper.getRemoteApiConnection(); - SimplePostCommand command = new SimplePostCommand("trialShare", "trialShareExport"); - command.execute(connection, getProjectName() + "/" + subfolder); - - goToModule("FileContent"); - _fileBrowserHelper.selectFileBrowserItem("/export/folder.xml"); - List fileList = _fileBrowserHelper.getFileList(); - List expectedFiles = Arrays.asList("data-classes", "etls", "inventory", "sample-types", "wikis", "xar", "data_states.xml", "folder.xml", "pages.xml"); - assertEquals("Default export should include several folder objects", expectedFiles, fileList); - } - - @Test - public void testTrialShareExportActionCustom() throws Exception - { - String subfolder = "exportCustom"; - _containerHelper.createSubfolder(getProjectName(), subfolder); - - Connection connection = WebTestHelper.getRemoteApiConnection(); - SimplePostCommand command = new SimplePostCommand("trialShare", "trialShareExport"); - Map params = new HashMap<>(); - params.put("webpartPropertiesAndLayout", true); // Add one custom data type to override default - command.setParameters(params); - command.execute(connection, getProjectName() + "/" + subfolder); - - goToModule("FileContent"); - _fileBrowserHelper.selectFileBrowserItem("/export/folder.xml"); - List fileList = _fileBrowserHelper.getFileList(); - List expectedFiles = Arrays.asList("folder.xml", "pages.xml"); - assertEquals("Custom export should include only the specified objects", expectedFiles, fileList); - } - - @Override - protected BrowserType bestBrowser() - { - return BrowserType.CHROME; - } - - @Override - protected String getProjectName() - { - return "TrialShareExportTest Project"; - } - - @Override - public List getAssociatedModules() - { - return Arrays.asList(); - } -}