Skip to content

Commit

Permalink
Merge branch 'develop' into 24.12_fb_delete_participant
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-klum committed Nov 18, 2024
2 parents 64aa4b0 + 24b2c5b commit 77b0688
Show file tree
Hide file tree
Showing 116 changed files with 2,157 additions and 1,509 deletions.
20 changes: 0 additions & 20 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,6 @@ core/module.properties -text
core/resources/credits/executables.txt -text
core/resources/credits/jars.txt -text
core/resources/credits/scripts.txt -text
core/resources/credits/tomcat_jars.txt -text
core/resources/schemas/dbscripts/postgresql/core-create.sql -text
core/resources/schemas/dbscripts/postgresql/core-drop.sql -text
core/resources/schemas/dbscripts/postgresql/prop-create.sql -text
Expand All @@ -1791,7 +1790,6 @@ core/src/org/labkey/core/admin/AbstractFileSiteSettingsAction.java -text
core/src/org/labkey/core/admin/ActionsExceptionsView.java -text
core/src/org/labkey/core/admin/ActionsTsvWriter.java -text
core/src/org/labkey/core/admin/ActionsView.java -text
core/src/org/labkey/core/admin/addNewExternalRedirectHost.jsp -text
core/src/org/labkey/core/admin/admin.jsp -text
core/src/org/labkey/core/admin/AdminConsoleServiceImpl.java -text
core/src/org/labkey/core/admin/AdminController.java -text
Expand All @@ -1805,7 +1803,6 @@ core/src/org/labkey/core/admin/deleteFolder.jsp -text
core/src/org/labkey/core/admin/emailProps.jsp -text
core/src/org/labkey/core/admin/emailTest.jsp -text
core/src/org/labkey/core/admin/enabledFolderTypes.jsp -text
core/src/org/labkey/core/admin/existingExternalRedirectHosts.jsp -text
core/src/org/labkey/core/admin/exportFolder.jsp -text
core/src/org/labkey/core/admin/FileSettingsForm.java -text
core/src/org/labkey/core/admin/FilesSiteSettingsAction.java -text
Expand Down Expand Up @@ -1915,7 +1912,6 @@ core/src/org/labkey/core/security/group.jsp -text
core/src/org/labkey/core/security/groupDiagram.jsp -text
core/src/org/labkey/core/security/GroupView.java -text
core/src/org/labkey/core/security/SecurityApiActions.java -text
core/src/org/labkey/core/security/validators/PermissionsValidator.java -text
core/src/org/labkey/core/statistics/AnalyticsProviderRegistryImpl.java -text
core/src/org/labkey/core/statistics/DefaultCurveFit.java -text
core/src/org/labkey/core/statistics/NoCurveFit.java -text
Expand Down Expand Up @@ -2046,7 +2042,6 @@ experiment/src/org/labkey/experiment/api/ExpSampleTypeImpl.java -text
experiment/src/org/labkey/experiment/api/ExpSampleTypeTableImpl.java -text
experiment/src/org/labkey/experiment/api/ExpTableImpl.java -text
experiment/src/org/labkey/experiment/api/IdentifiableEntity.java -text
experiment/src/org/labkey/experiment/api/LineagePerfTest.java -text
experiment/src/org/labkey/experiment/api/LogDataType.java -text
experiment/src/org/labkey/experiment/api/MaterialProtocolInput.java -text
experiment/src/org/labkey/experiment/api/MaterialSource.java -text
Expand Down Expand Up @@ -2402,7 +2397,6 @@ pipeline/src/org/labkey/pipeline/status/StatusController.java -text
pipeline/src/org/labkey/pipeline/status/StatusDataRegion.java -text
pipeline/src/org/labkey/pipeline/trigger/PipelineTriggerManager.java -text
pipeline/src/org/labkey/pipeline/trigger/PipelineTriggerRegistryImpl.java -text
pipeline/src/org/labkey/pipeline/validators/PipelineSetupValidator.java -text
pipeline/webapp/pipeline/ImportAdvancedOptions.css -text
pipeline/webapp/pipeline/ImportAdvancedOptions.js -text
pipeline/webapp/pipeline/importAdvancedOptions.lib.xml -text
Expand Down Expand Up @@ -2747,7 +2741,6 @@ study/src/org/labkey/study/importer/SchemaTsvReader.java -text
study/src/org/labkey/study/importer/SchemaXmlReader.java -text
study/src/org/labkey/study/importer/SpecimenRefreshPipelineJob.java -text
study/src/org/labkey/study/importer/StudyImportContext.java -text
study/src/org/labkey/study/importer/StudyImporter.java -text
study/src/org/labkey/study/importer/StudyImporterFactory.java -text
study/src/org/labkey/study/importer/StudyImportFinalTask.java -text
study/src/org/labkey/study/importer/StudyImportInitialTask.java -text
Expand Down Expand Up @@ -3188,10 +3181,7 @@ wiki/module.properties -text
api/src/org/labkey/api/wiki/radeox_messages.properties -text
core/src/org/radeox/license.txt -text
core/src/META-INF/services/org.radeox.filter.Filter -text
core/src/META-INF/services/org.radeox.code.macro.SourceCodeFormatter -text
core/src/META-INF/services/org.radeox.list.macro.ListFormatter -text
core/src/META-INF/services/org.radeox.macro.Macro -text
core/src/META-INF/services/org.radeox.table.macro.Function -text
core/src/org/radeox/api/engine/context/InitialRenderContext.java -text
core/src/org/radeox/api/engine/context/InitialRenderContext.java -text
core/src/org/radeox/api/engine/context/RenderContext.java -text
Expand Down Expand Up @@ -3237,11 +3227,6 @@ core/src/org/radeox/filter/StrikeThroughFilter.java -text
core/src/org/radeox/filter/TypographyFilter.java -text
core/src/org/radeox/filter/UrlFilter.java -text
core/src/org/radeox/filter/WikiLinkFilter.java -text
core/src/org/radeox/macro/api/ApiConverter.java -text
core/src/org/radeox/macro/api/ApiDoc.java -text
core/src/org/radeox/macro/api/BaseApiConverter.java -text
core/src/org/radeox/macro/api/JavaApiConverter.java -text
core/src/org/radeox/macro/api/RubyApiConverter.java -text
core/src/org/radeox/macro/BaseLocaleMacro.java -text
core/src/org/radeox/macro/BaseMacro.java -text
core/src/org/radeox/macro/code/DefaultRegexCodeFormatter.java -text
Expand Down Expand Up @@ -3271,7 +3256,6 @@ core/src/org/radeox/macro/PluginLoader.java -text
core/src/org/radeox/macro/PluginRepository.java -text
core/src/org/radeox/macro/Preserved.java -text
core/src/org/radeox/macro/QuoteMacro.java -text
core/src/org/radeox/macro/RfcMacro.java -text
core/src/org/radeox/macro/table/AvgFunction.java -text
core/src/org/radeox/macro/table/Function.java -text
core/src/org/radeox/macro/table/FunctionLoader.java -text
Expand All @@ -3282,8 +3266,6 @@ core/src/org/radeox/macro/table/SumFunction.java -text
core/src/org/radeox/macro/table/Table.java -text
core/src/org/radeox/macro/table/TableBuilder.java -text
core/src/org/radeox/macro/TableMacro.java -text
core/src/org/radeox/macro/xref/XrefMapper.java -text
core/src/org/radeox/macro/XrefMacro.java -text
core/src/org/radeox/regex/Compiler.java -text
core/src/org/radeox/regex/JdkCompiler.java -text
core/src/org/radeox/regex/JdkMatcher.java -text
Expand All @@ -3306,7 +3288,6 @@ core/src/org/radeox/test/filter/KeyFilterTest.java -text
core/src/org/radeox/test/filter/LineFilterTest.java -text
core/src/org/radeox/test/filter/LinkTestFilterTest.java -text
core/src/org/radeox/test/filter/ListFilterTest.java -text
core/src/org/radeox/test/filter/mock/MockInterWikiRenderEngine.java -text
core/src/org/radeox/test/filter/mock/MockOldWikiRenderEngine.java -text
core/src/org/radeox/test/filter/mock/MockReplacedFilter.java -text
core/src/org/radeox/test/filter/mock/MockReplacesFilter.java -text
Expand All @@ -3327,7 +3308,6 @@ core/src/org/radeox/util/Linkable.java -text
core/src/org/radeox/util/Nameable.java -text
core/src/org/radeox/util/Service.java -text
core/src/org/radeox/util/StringBufferWriter.java -text
wiki/radeox/src/simplelog.properties -text
wiki/resources/web/wiki/internal/wikiEdit.js -text
wiki/schemas/wiki.xsd -text
wiki/src/org/labkey/wiki/BaseWikiPermissions.java -text
Expand Down
1 change: 1 addition & 0 deletions announcements/module.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Organization: LabKey
OrganizationURL: https://www.labkey.com/
License: Apache 2.0
LicenseURL: http://www.apache.org/licenses/LICENSE-2.0
SupportedDatabases: mssql, pgsql
1 change: 1 addition & 0 deletions api/module.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Organization: LabKey
OrganizationURL: https://www.labkey.com/
License: Apache 2.0
LicenseURL: http://www.apache.org/licenses/LICENSE-2.0
SupportedDatabases: mssql, pgsql
70 changes: 37 additions & 33 deletions api/src/org/labkey/api/assay/AbstractAssayProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -881,22 +881,37 @@ private Set<String> getPropertyDomains(ExpProtocol protocol)
}

@Override
public List<Pair<Domain, Map<DomainProperty, Object>>> getDomains(ExpProtocol protocol)
public @NotNull List<Domain> getDomains(ExpProtocol protocol)
{
List<Pair<Domain, Map<DomainProperty, Object>>> domains = new ArrayList<>();
List<Domain> domains = new ArrayList<>();
for (String uri : getPropertyDomains(protocol))
{
Domain domain = PropertyService.get().getDomain(protocol.getContainer(), uri);
if (domain != null)
{
Map<DomainProperty, Object> values = DefaultValueService.get().getDefaultValues(domain.getContainer(), domain);
domains.add(new Pair<>(domain, values));
}
domains.add(domain);
}
sortDomainList(domains);

// Rely on the assay provider to return a list of default domains in the right order (Collections.sort() is
// stable so that domains that haven't been inserted and have id 0 stay in the same order), and rely on the fact
// that they get inserted in the same order, so they will have ascending ids.
domains.sort(Comparator.comparing(Domain::getTypeId));

return domains;
}

@Override
public @NotNull List<Pair<Domain, Map<DomainProperty, Object>>> getDomainsAndDefaultValues(ExpProtocol protocol)
{
List<Pair<Domain, Map<DomainProperty, Object>>> domainAndDefaultValues = new ArrayList<>();
for (Domain domain : getDomains(protocol))
{
Map<DomainProperty, Object> values = DefaultValueService.get().getDefaultValues(domain.getContainer(), domain);
domainAndDefaultValues.add(Pair.of(domain, values));
}

return domainAndDefaultValues;
}

@Override
public Pair<ExpProtocol, List<Pair<Domain, Map<DomainProperty, Object>>>> getAssayTemplate(User user, Container targetContainer)
{
Expand All @@ -905,14 +920,6 @@ public Pair<ExpProtocol, List<Pair<Domain, Map<DomainProperty, Object>>>> getAss
return new Pair<>(copy, createDefaultDomains(targetContainer, user));
}

protected void sortDomainList(List<Pair<Domain, Map<DomainProperty, Object>>> domains)
{
// Rely on the assay provider to return a list of default domains in the right order (Collections.sort() is
// stable so that domains that haven't been inserted and have id 0 stay in the same order), and rely on the fact
// that they get inserted in the same order, so they will have ascending ids.
domains.sort(Comparator.comparingInt(pair -> pair.getKey().getTypeId()));
}

@Override
public Pair<ExpProtocol, List<Pair<Domain, Map<DomainProperty, Object>>>> getAssayTemplate(User user, Container targetContainer, ExpProtocol toCopy)
{
Expand All @@ -925,7 +932,7 @@ public Pair<ExpProtocol, List<Pair<Domain, Map<DomainProperty, Object>>>> getAss
}
copy.setObjectProperties(copiedProps);

List<Pair<Domain, Map<DomainProperty, Object>>> originalDomains = getDomains(toCopy);
List<Pair<Domain, Map<DomainProperty, Object>>> originalDomains = getDomainsAndDefaultValues(toCopy);
List<Pair<Domain, Map<DomainProperty, Object>>> copiedDomains = new ArrayList<>(originalDomains.size());
for (Pair<Domain, Map<DomainProperty, Object>> domainInfo : originalDomains)
{
Expand Down Expand Up @@ -1113,18 +1120,15 @@ public ModelAndView createResultDetailsView(ViewContext context, ExpProtocol pro
@Override
public void deleteProtocol(ExpProtocol protocol, User user, @Nullable final String auditUserComment) throws ExperimentException
{
List<Pair<Domain, Map<DomainProperty, Object>>> domainInfos = getDomains(protocol);
List<Domain> domains = new ArrayList<>();
for (Pair<Domain, Map<DomainProperty, Object>> domainInfo : domainInfos)
domains.add(domainInfo.getKey());
List<Domain> domains = getDomains(protocol);

Set<Container> defaultValueContainers = new HashSet<>();
defaultValueContainers.add(protocol.getContainer());
defaultValueContainers.addAll(protocol.getExpRunContainers());
clearDefaultValues(defaultValueContainers, domains);
for (Pair<Domain, Map<DomainProperty, Object>> domainInfo : domainInfos)

for (Domain domain : domains)
{
Domain domain = domainInfo.getKey();
for (DomainProperty prop : domain.getProperties())
{
prop.delete();
Expand Down Expand Up @@ -1537,12 +1541,14 @@ private NavTree getManageMenuNavTree(ViewContext context, ExpProtocol protocol)
{
Container protocolContainer = protocol.getContainer();
Container contextContainer = context.getContainer();

NavTree manageMenu = new NavTree(MANAGE_ASSAY_DESIGN_LINK);

final AssayUrls assayUrls = Objects.requireNonNull(PageFlowUtil.urlProvider(AssayUrls.class));
final ExperimentUrls experimentUrls = Objects.requireNonNull(PageFlowUtil.urlProvider(ExperimentUrls.class));

if (allowUpdate(context, protocol))
{
ActionURL editURL = PageFlowUtil.urlProvider(AssayUrls.class).getDesignerURL(protocolContainer, protocol, false, context.getActionURL());
ActionURL editURL = assayUrls.getDesignerURL(protocolContainer, protocol, false, context.getActionURL());
if (editURL != null)
{
var child = manageMenu.addChild("Edit assay design","");
Expand All @@ -1552,32 +1558,30 @@ private NavTree getManageMenuNavTree(ViewContext context, ExpProtocol protocol)
child.setScript("if (window.confirm('This assay is defined in the " + protocolContainer.getPath() + " folder. Would you still like to edit it?')) { window.location = " + jsString(editURL.toString()) + "; } return false;");
}

ActionURL copyURL = PageFlowUtil.urlProvider(AssayUrls.class).getChooseCopyDestinationURL(protocol, protocolContainer);
ActionURL copyURL = assayUrls.getChooseCopyDestinationURL(protocol, protocolContainer);
if (copyURL != null)
manageMenu.addChild("Copy assay design", copyURL.toString());
}

if (allowDelete(context, protocol))
{
manageMenu.addChild("Delete assay design", PageFlowUtil.urlProvider(ExperimentUrls.class).getDeleteProtocolURL(protocol, PageFlowUtil.urlProvider(AssayUrls.class).getAssayListURL(contextContainer)));
manageMenu.addChild("Delete assay design", experimentUrls.getDeleteProtocolURL(protocol, assayUrls.getAssayListURL(contextContainer)));
}

ActionURL exportURL = PageFlowUtil.urlProvider(ExperimentUrls.class).getExportProtocolURL(protocolContainer, protocol);
ActionURL exportURL = experimentUrls.getExportProtocolURL(protocolContainer, protocol);
manageMenu.addChild("Export assay design", exportURL.toString());

if (contextContainer.hasPermission(context.getUser(), AdminPermission.class))
{
List<Pair<Domain, Map<DomainProperty, Object>>> domainInfos = getDomains(protocol);
if (!domainInfos.isEmpty())
List<Domain> domains = getDomains(protocol);
if (!domains.isEmpty())
{
NavTree setDefaultsTree = new NavTree(SET_DEFAULT_VALUES_LINK);
AssayUrls urls = PageFlowUtil.urlProvider(AssayUrls.class);
for (Pair<Domain, Map<DomainProperty, Object>> domainInfo : domainInfos)
for (Domain domain : domains)
{
Domain domain = domainInfo.getKey();
if (allowDefaultValues(domain) && !domain.getProperties().isEmpty())
{
ActionURL url = urls.getSetDefaultValuesAssayURL(contextContainer, getName(), domain, context.getActionURL());
ActionURL url = assayUrls.getSetDefaultValuesAssayURL(contextContainer, getName(), domain, context.getActionURL());
setDefaultsTree.addChild(domain.getName(), url);
}
}
Expand Down
1 change: 0 additions & 1 deletion api/src/org/labkey/api/assay/AssayDomainService.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package org.labkey.api.assay;

import org.labkey.api.gwt.client.assay.AssayException;
import org.labkey.api.gwt.client.assay.model.GWTProtocol;
import org.labkey.api.query.ValidationException;

Expand Down
4 changes: 3 additions & 1 deletion api/src/org/labkey/api/assay/AssayProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ default String getLabel()

List<ParticipantVisitResolverType> getParticipantVisitResolverTypes();

List<Pair<Domain, Map<DomainProperty, Object>>> getDomains(ExpProtocol protocol);
@NotNull List<Domain> getDomains(ExpProtocol protocol);

@NotNull List<Pair<Domain, Map<DomainProperty, Object>>> getDomainsAndDefaultValues(ExpProtocol protocol);

Pair<ExpProtocol, List<Pair<Domain, Map<DomainProperty, Object>>>> getAssayTemplate(User user, Container targetContainer);

Expand Down
5 changes: 0 additions & 5 deletions api/src/org/labkey/api/assay/AssayService.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,6 @@ ParticipantVisitResolver createResolver(User user, ExpRun run, @Nullable ExpProt
*/
<FlagType extends ExpQCFlag> List<FlagType> getFlags(AssayProvider provider, int runId, Class<FlagType> cls);

/**
* Returns the TableInfo for the given assay domain based on the assay domain ID.
*/
TableInfo getTableInfoForDomainId(User user, Container container, int domainId, @Nullable ContainerFilter cf);

void onBeforeAssayResultDelete(Container container, User user, ExpRun run, Map<String, Object> resultRow);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.labkey.api.assay;

import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.labkey.api.collections.CollectionUtils;
import org.labkey.api.data.Container;
Expand Down Expand Up @@ -173,7 +174,7 @@ private Map<String, FileLike> getFilesFromRequest(ContextType context, Type type
Map<String, FileLike> result = CollectionUtils.enforceValueClass(new LinkedHashMap<>(), FileLike.class);
for (int i = 0; i < paths.length; i++)
{
result.put(names[i], pipelineRoot.resolvePathToFileLike(paths[i]));
result.put(names[i], pipelineRoot.resolvePathToFileLike(StringUtils.replace(paths[i],"\\","/")));
}
return result;
}
Expand Down
28 changes: 21 additions & 7 deletions api/src/org/labkey/api/data/DbScope.java
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,9 @@ public synchronized boolean release(Connection conn)
{
log(() -> 1 == _refCount ? "Releasing connection [1]: " + conn.toString() : "Attempting to decrease count of connection [" + _refCount + "]: " + conn.toString());

if (_conn == null)
throw new ConnectionAlreadyReleaseException("Connection has already been nulled out, but was passed: " + conn);

if (_conn != conn)
throw new IllegalStateException("Incorrect Connection: " + conn + " vs. " + _conn);

Expand All @@ -1174,6 +1177,19 @@ public synchronized boolean release(Connection conn)
}
}

/**
* Special case for when the connection being closed doesn't match the expected
* connection for this thread, to help scenarios that are prone to race conditions
* (like killing pipeline jobs) ignore it.
*/
public static class ConnectionAlreadyReleaseException extends IllegalStateException
{
public ConnectionAlreadyReleaseException(String s)
{
super(s);
}
}

private void log(Supplier<String> supplier)
{
if (LOG.isDebugEnabled())
Expand Down Expand Up @@ -2080,7 +2096,6 @@ public static void clearFailedDbScopes()
*/
public static void closeAllConnectionsForCurrentThread()
{
Thread thread = getEffectiveThread();
for (DbScope scope : getInitializedDbScopes())
{
TransactionImpl t = scope.getCurrentTransactionImpl();
Expand All @@ -2097,7 +2112,11 @@ public static void closeAllConnectionsForCurrentThread()
{
LOG.warn("Forcing close of still-pending transaction object. Current stack is ", new Throwable());
LOG.warn("Forcing close of still-pending transaction object started at ", t._creation);
t.close(thread);
t.close();
}
catch (ConnectionAlreadyReleaseException ignored)
{
// The code in another thread has already released the connection
}
catch (Exception x)
{
Expand Down Expand Up @@ -2566,11 +2585,6 @@ public String getId()

@Override
public void close()
{
close(getEffectiveThread());
}

public void close(Thread thread)
{
if (_closesToIgnore == 0)
{
Expand Down
Loading

0 comments on commit 77b0688

Please sign in to comment.