Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions specimen/api-src/org/labkey/api/specimen/SpecimensPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright (c) 2021-2026 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.api.specimen;

import org.labkey.api.data.Container;
import org.labkey.api.security.User;
import org.labkey.api.study.Study;
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 org.labkey.api.view.WebPartFactory;

import java.util.ArrayList;
import java.util.List;

public class SpecimensPage extends FolderTab.PortalPage
{
public static final String PAGE_ID = "study.SPECIMENS";
public static final String SPECIMEN_TOOLS_WEBPART_NAME = "Specimen Tools"; // TODO: Move back to SpecimenToolsWebPartFactory

public SpecimensPage(String caption)
{
super(PAGE_ID, caption);
}

@Override
public boolean isSelectedPage(ViewContext viewContext)
{
return super.isSelectedPage(viewContext) ||
"specimen".equals(viewContext.getActionURL().getController());
}

@Override
public boolean isVisible(Container c, User user)
{
Study study = StudyService.get().getStudy(c);
if (study != null)
{
return SpecimenManager.get().isSpecimenModuleActive(c);
}
return false;
}

@Override
public List<Portal.WebPart> createWebParts()
{
List<Portal.WebPart> parts = new ArrayList<>();
parts.add(Portal.getPortalPart(StudyService.SPECIMEN_SEARCH_WEBPART).createWebPart());
parts.add(Portal.getPortalPart(StudyService.SPECIMEN_BROWSE_WEBPART).createWebPart());
Portal.WebPart toolsWebPart = Portal.getPortalPart(SPECIMEN_TOOLS_WEBPART_NAME).createWebPart();
toolsWebPart.setLocation(WebPartFactory.LOCATION_RIGHT);
parts.add(toolsWebPart);
return parts;
}
}
1 change: 1 addition & 0 deletions specimen/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ plugins {
}

dependencies {
BuildUtils.addLabKeyDependency(project: project, config: "apiImplementation", depProjectPath: BuildUtils.getPlatformModuleProjectPath(project.gradle, "study"), depProjectConfig: "apiJarFile")
BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: BuildUtils.getPlatformModuleProjectPath(project.gradle, "study"), depProjectConfig: "apiJarFile")
BuildUtils.addLabKeyDependency(project: project, config: "jspImplementation", depProjectPath: BuildUtils.getPlatformModuleProjectPath(project.gradle, "study"), depProjectConfig: "apiJarFile")

Expand Down
1 change: 0 additions & 1 deletion specimen/src/org/labkey/specimen/SpecimenManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.labkey.api.security.User;
import org.labkey.api.specimen.SpecimenEvent;
import org.labkey.api.specimen.SpecimenEventManager;
import org.labkey.api.specimen.SpecimenQuerySchema;
import org.labkey.api.specimen.SpecimenSchema;
import org.labkey.api.specimen.Vial;
import org.labkey.api.specimen.location.LocationImpl;
Expand Down
1 change: 0 additions & 1 deletion specimen/src/org/labkey/specimen/SpecimenModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.labkey.api.security.permissions.Permission;
import org.labkey.api.security.roles.RoleManager;
import org.labkey.api.specimen.SpecimenMigrationService;
import org.labkey.api.specimen.SpecimenQuerySchema;
import org.labkey.api.specimen.SpecimenSchema;
import org.labkey.api.specimen.SpecimensPage;
import org.labkey.api.specimen.model.SpecimenTablesProvider;
Expand Down
64 changes: 64 additions & 0 deletions specimen/src/org/labkey/specimen/SpecimenQuerySchema.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2021-2026 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.specimen;

import org.jetbrains.annotations.Nullable;
import org.labkey.api.data.ContainerFilter;
import org.labkey.api.data.TableInfo;
import org.labkey.api.query.UserSchema;
import org.labkey.api.security.User;
import org.labkey.api.study.Study;
import org.labkey.api.study.StudyService;

import java.util.Set;

public class SpecimenQuerySchema extends UserSchema
{
public static final String SCHEMA_NAME = "Study";
public static final String LOCATION_TABLE_NAME = "Location";

private final UserSchema _studySchema;
private final Study _study;

public SpecimenQuerySchema(Study study, UserSchema studySchema)
{
super(studySchema.getName(), studySchema.getDescription(), studySchema.getUser(), studySchema.getContainer(), studySchema.getDbSchema());
_study = study;
_studySchema = studySchema;
}

public static SpecimenQuerySchema get(Study study, User user)
{
return new SpecimenQuerySchema(study, StudyService.get().getStudyQuerySchema(study, user));
}

public Study getStudy()
{
return _study;
}

@Override
public @Nullable TableInfo createTable(String name, ContainerFilter cf)
{
return _studySchema.createTable(name, cf);
}

@Override
public Set<String> getTableNames()
{
return _studySchema.getTableNames();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import org.labkey.api.query.ValidationException;
import org.labkey.api.security.User;
import org.labkey.api.settings.AppProps;
import org.labkey.api.specimen.SpecimenQuerySchema;
import org.labkey.api.specimen.SpecimenSchema;
import org.labkey.api.specimen.Vial;
import org.labkey.api.specimen.importer.RollupHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.labkey.api.query.QueryService;
import org.labkey.api.query.SchemaKey;
import org.labkey.api.query.UserSchema;
import org.labkey.api.specimen.SpecimenQuerySchema;
import org.labkey.specimen.SpecimenQuerySchema;
import org.labkey.specimen.report.SpecimenVisitReportParameters;
import org.labkey.api.study.Study;
import org.labkey.api.study.StudyService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
import org.labkey.api.security.permissions.AdminPermission;
import org.labkey.api.security.permissions.ReadPermission;
import org.labkey.api.security.permissions.UpdatePermission;
import org.labkey.api.specimen.SpecimenQuerySchema;
import org.labkey.api.specimen.SpecimenSchema;
import org.labkey.api.specimen.Vial;
import org.labkey.api.specimen.location.LocationImpl;
Expand All @@ -116,7 +115,6 @@
import org.labkey.api.specimen.model.SpecimenTablesProvider;
import org.labkey.api.study.CohortFilter;
import org.labkey.api.study.Dataset;
import org.labkey.api.study.MapArrayExcelWriter;
import org.labkey.api.study.SpecimenService;
import org.labkey.api.study.SpecimenTransform;
import org.labkey.api.study.SpecimenUrls;
Expand Down Expand Up @@ -168,6 +166,7 @@
import org.labkey.specimen.RequestedSpecimens;
import org.labkey.specimen.SpecimenManager;
import org.labkey.specimen.SpecimenModule;
import org.labkey.specimen.SpecimenQuerySchema;
import org.labkey.specimen.SpecimenRequestException;
import org.labkey.specimen.SpecimenRequestManager;
import org.labkey.specimen.SpecimenRequestStatus;
Expand Down Expand Up @@ -206,6 +205,7 @@
import org.labkey.specimen.settings.RequestNotificationSettings;
import org.labkey.specimen.settings.SettingsManager;
import org.labkey.specimen.settings.StatusSettings;
import org.labkey.specimen.study.MapArrayExcelWriter;
import org.labkey.specimen.view.NotificationBean;
import org.labkey.specimen.view.SpecimenRequestNotificationEmailTemplate;
import org.labkey.specimen.view.SpecimenSearchWebPart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
import org.labkey.api.data.TableInfo;
import org.labkey.api.query.FieldKey;
import org.labkey.api.query.QueryService;
import org.labkey.api.specimen.SpecimenQuerySchema;
import org.labkey.api.study.Study;
import org.labkey.api.study.StudyService;
import org.labkey.api.view.ActionURL;
import org.labkey.api.view.NotFoundException;
import org.labkey.api.view.ViewContext;
import org.labkey.specimen.SpecimenQuerySchema;
import org.labkey.specimen.actions.SpecimenController.PtidVisit;
import org.labkey.specimen.query.SpecimenQueryView;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.collections.CaseInsensitiveHashSet;
import org.labkey.api.pipeline.AbstractSpecimenTransformTask;
import org.labkey.api.pipeline.PipelineJob;
import org.labkey.api.pipeline.PipelineJobException;
import org.labkey.api.reader.DataLoader;
import org.labkey.api.reader.DataLoaderFactory;
import org.labkey.api.writer.PrintWriters;
import org.labkey.specimen.pipeline.AbstractSpecimenTransformTask;
import org.labkey.vfs.FileLike;

import java.io.IOException;
Expand Down
Loading
Loading