Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1a39739
More helper methods for getting and setting createdBy/modifiedBy
labkey-susanh Oct 24, 2025
b8a2bb2
Parameterize NameExpressionDataIterator with column names
labkey-susanh Oct 28, 2025
8ac2eab
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Oct 29, 2025
e7ecdbd
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Oct 30, 2025
5b31ebd
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Nov 3, 2025
31581d3
Add method for overriding hasInsertRowsPermission
labkey-susanh Nov 4, 2025
e7eb759
Fixes for job deletion
labkey-susanh Nov 4, 2025
9cd40cd
Allow update permission check to be overridden too
labkey-susanh Nov 5, 2025
f4d200f
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Nov 6, 2025
ffc0be8
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Nov 7, 2025
db30ede
Rename EmailOption for workflow notifications
labkey-susanh Nov 9, 2025
18795fa
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Nov 9, 2025
92c548f
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Nov 11, 2025
0e9638b
Create a base class for App controller URL providers
labkey-susanh Nov 12, 2025
66682b6
Getter for date version of longs
labkey-susanh Nov 12, 2025
532ea97
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Nov 12, 2025
f34ed63
Rename assay run workflowTask to workflowTaskId since it holds a RowId
cnathe Nov 13, 2025
b3bbeaa
Change exp.ExperimentRun WorkflowTask column to reference workflow.ta…
cnathe Nov 13, 2025
3577a8d
Comment out XarExporter and XarReader handling of workflowTask for now
cnathe Nov 13, 2025
a5b13d7
update comments
cnathe Nov 13, 2025
a3c426a
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Nov 14, 2025
d0de03d
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Nov 18, 2025
b710e83
Generalize NameGenerator to work with other fields
labkey-susanh Nov 19, 2025
d74a452
Move NamePlusIdDataIterator to API for general use
labkey-susanh Nov 19, 2025
fa5448c
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Nov 19, 2025
97a4e1d
Merge branch 'develop' into fb_moveWorkflowCode
XingY Nov 20, 2025
82eefc2
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Nov 21, 2025
5365cf4
Merge branch 'develop' into fb_moveWorkflowCode
labkey-danield Nov 21, 2025
5376be8
Use this
labkey-susanh Nov 24, 2025
771597d
Remove check for isSampleWorkflow in run deletion
labkey-susanh Nov 25, 2025
51463d1
Add TODO reminder for code removal
labkey-susanh Nov 25, 2025
46160d8
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Nov 25, 2025
cc8992f
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Nov 25, 2025
3815a73
ExpObject getCreatedById() and getModifiedById() to get the id instea…
cnathe Nov 28, 2025
8851a78
Merge remote-tracking branch 'origin/develop' into fb_moveWorkflowCode
labkey-susanh Dec 1, 2025
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
4 changes: 2 additions & 2 deletions api/src/org/labkey/api/announcements/EmailOption.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public enum EmailOption
FILES_NONE(512),
FILES_INDIVIDUAL(513),
FILES_DAILY_DIGEST(514),
SAMPLEMANAGER_NONE(701),
SAMPLEMANAGER_ALL(702),
WORKFLOW_NONE(701),
WORKFLOW_ALL(702),
LABBOOK_NONE(801),
LABBOOK_ALL(802);

Expand Down
7 changes: 2 additions & 5 deletions api/src/org/labkey/api/assay/AssayRunDatabaseContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,9 @@ public String getName()
}

@Override
public @Nullable Long getWorkflowTask()
public @Nullable Long getWorkflowTaskId()
{
if (_run.getWorkflowTask() != null)
return _run.getWorkflowTask().getRowId();

return null;
return _run.getWorkflowTaskId();
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions api/src/org/labkey/api/assay/AssayRunUploadContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ enum ReImportOption

String getName();

default @Nullable Long getWorkflowTask()
default @Nullable Long getWorkflowTaskId()
{
return null;
}
Expand Down Expand Up @@ -253,7 +253,7 @@ abstract class Factory<ProviderType extends AssayProvider, FACTORY extends Facto
protected ViewContext _context;
protected String _comments;
protected String _name;
protected Long _workflowTask;
protected Long _workflowTaskId;
protected String _targetStudy;
protected Long _reRunId;
protected AssayRunUploadContext.ReImportOption _reImportOption;
Expand Down Expand Up @@ -318,9 +318,9 @@ public final FACTORY setName(String name)
return self();
}

public final FACTORY setWorkflowTask(Long workflowTask)
public final FACTORY setWorkflowTaskId(Long workflowTaskId)
{
_workflowTask = workflowTask;
_workflowTaskId = workflowTaskId;
return self();
}

Expand Down
8 changes: 4 additions & 4 deletions api/src/org/labkey/api/assay/AssayRunUploadContextImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class AssayRunUploadContextImpl<ProviderType extends AssayProvider> imple
private final ViewContext _context;
private final String _comments;
private final String _name;
private final Long _workflowTask;
private final Long _workflowTaskId;
private final String _targetStudy;
private final Long _reRunId;
private final ReImportOption _reImportOption;
Expand Down Expand Up @@ -114,7 +114,7 @@ private AssayRunUploadContextImpl(Factory<ProviderType> factory)
_logger = factory._logger;

_name = factory._name;
_workflowTask = factory._workflowTask;
_workflowTaskId = factory._workflowTaskId;
_comments = factory._comments;

_rawRunProperties = factory._rawRunProperties == null ? emptyMap() : unmodifiableMap(factory._rawRunProperties);
Expand Down Expand Up @@ -279,9 +279,9 @@ public String getName()
}

@Override
public @Nullable Long getWorkflowTask()
public @Nullable Long getWorkflowTaskId()
{
return _workflowTask;
return _workflowTaskId;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/assay/DefaultAssayRunCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public Pair<ExpExperiment, ExpRun> saveExperimentRun(
auditEvent.addDetail(TransactionAuditProvider.TransactionDetail.ImportFileName, primaryFile.getName());
run = AssayService.get().createExperimentRun(context.getName(), context.getContainer(), protocol, null == primaryFile ? null : primaryFile.toNioPathForRead().toFile());
run.setComments(context.getComments());
run.setWorkflowTaskId(context.getWorkflowTask());
run.setWorkflowTaskId(context.getWorkflowTaskId());

exp = saveExperimentRun(context, exp, run, false, transactionDetails);

Expand Down
10 changes: 5 additions & 5 deletions api/src/org/labkey/api/assay/actions/AssayRunUploadForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public class AssayRunUploadForm<ProviderType extends AssayProvider> extends Prot
protected Map<DomainProperty, String> _runProperties = null;
private String _comments;
private String _name;
private Long _workflowTask;
private Long _workflowTaskId;
private String _dataCollectorName;
private boolean _multiRunUpload;
private String _uploadStep;
Expand Down Expand Up @@ -214,14 +214,14 @@ public void setName(String name)
}

@Override
public @Nullable Long getWorkflowTask()
public @Nullable Long getWorkflowTaskId()
{
return _workflowTask;
return _workflowTaskId;
}

public void setWorkflowTask(Long workflowTask)
public void setWorkflowTaskId(Long workflowTaskId)
{
_workflowTask = workflowTask;
_workflowTaskId = workflowTaskId;
}

public String getDataCollectorName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class AssayRunAsyncContext<ProviderType extends AssayProvider> implements
private String _containerId;
private String _runName;
private String _runComments;
private Long _runWorkflowTask;
private Long _runWorkflowTaskId;
private ActionURL _actionURL;
private Map<String, FileLike> _uploadedData;
private Set<FileLike> _uploadedPropertyFiles;
Expand Down Expand Up @@ -111,7 +111,7 @@ public AssayRunAsyncContext(AssayRunUploadContext<ProviderType> originalContext)
_targetStudy = originalContext.getTargetStudy();
_runName = originalContext.getName();
_runComments = originalContext.getComments();
_runWorkflowTask = originalContext.getWorkflowTask();
_runWorkflowTaskId = originalContext.getWorkflowTaskId();
_container = originalContext.getContainer();
if (_container != null)
_containerId = _container.getId();
Expand Down Expand Up @@ -298,9 +298,9 @@ public String getName()
}

@Override
public @Nullable Long getWorkflowTask()
public @Nullable Long getWorkflowTaskId()
{
return _runWorkflowTask;
return _runWorkflowTaskId;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void doWork()
// Create the basic run
_run = AssayService.get().createExperimentRun(_context.getName(), getContainer(), _context.getProtocol(), _primaryFile);
_run.setComments(_context.getComments());
_run.setWorkflowTaskId(_context.getWorkflowTask());
_run.setWorkflowTaskId(_context.getWorkflowTaskId());
// remember which job created the run so we can show this run on the job details page
_run.setJobId(PipelineService.get().getJobId(getUser(), getContainer(), getJobGUID()));

Expand Down
35 changes: 35 additions & 0 deletions api/src/org/labkey/api/data/CreatedModified.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import org.json.JSONObject;
import org.labkey.api.security.User;
import org.labkey.api.security.UserManager;

import java.util.Date;

Expand All @@ -22,6 +23,12 @@ public Long getCreated()
return _created;
}

@JsonIgnore
public Date getCreatedDate()
{
return _created == null ? null : new Date(_created);
}

public void setCreated(Long created)
{
_created = created;
Expand All @@ -42,17 +49,34 @@ public JSONObject getCreatedBy()
return _createdBy.getUserProps();
}

@JsonIgnore
public User getCreatedByUser()
{
return _createdBy;
}

public void setCreatedBy(User createdBy)
{
_createdBy = createdBy;
}

public void setCreatedBy(int createdById)
{
_createdBy = UserManager.getUser(createdById);
}

@JsonProperty("modified")
public Long getModified()
{
return _modified;
}

@JsonIgnore
public Date getModifiedDate()
{
return _modified == null ? null : new Date(_modified);
}

public void setModified(Long modified)
{
_modified = modified;
Expand All @@ -73,8 +97,19 @@ public JSONObject getModifiedBy()
return _modifiedBy.getUserProps();
}

@JsonIgnore
public User getModifiedByUser()
{
return _modifiedBy;
}

public void setModifiedBy(User modifiedBy)
{
_modifiedBy = modifiedBy;
}

public void setModifiedBy(int modifiedById)
{
_modifiedBy = UserManager.getUser(modifiedById);
}
}
6 changes: 6 additions & 0 deletions api/src/org/labkey/api/data/NameGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,12 @@ public NameGeneratorState createState(boolean incrementSampleCounts)
return new NameGeneratorState(this, incrementSampleCounts, _expressionSummary.sampleSummary);
}

@NotNull
public NameGeneratorState createState(boolean incrementSampleCounts, String nameField)
{
return new NameGeneratorState(this, incrementSampleCounts, _expressionSummary.sampleSummary, nameField);
}

public String generateName(@NotNull NameGeneratorState state, @NotNull Map<String, Object> rowMap) throws NameGenerationException
{
return state.nextName(rowMap, null, null, null, null);
Expand Down
9 changes: 8 additions & 1 deletion api/src/org/labkey/api/data/NameGeneratorState.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,19 @@ public class NameGeneratorState implements AutoCloseable
protected final Map<Long, ExpData> dataCache = new LongHashMap<>();
protected final RemapCache renameCache;
private final Map<String, Map<String, Object>> objectPropertiesCache = new HashMap<>();
private final String _nameField;

public NameGeneratorState(@NotNull NameGenerator nameGenerator, boolean incrementSampleCounts, NameGenerator.SampleNameExpressionSummary expressionSummary)
{
this(nameGenerator, incrementSampleCounts, expressionSummary, "Name");
}

public NameGeneratorState(@NotNull NameGenerator nameGenerator, boolean incrementSampleCounts, NameGenerator.SampleNameExpressionSummary expressionSummary, String nameField)
{
_nameGenerator = nameGenerator;
_incrementSampleCounts = incrementSampleCounts;
_container = nameGenerator.getContainer();
_nameField = nameField;

DbSequence sampleCounterSequence;
DbSequence rootCounterSequence;
Expand Down Expand Up @@ -274,7 +281,7 @@ private String genName(@NotNull Map<String, Object> rowMap,
}

// If a name is already provided, just use it as is
Object currNameObj = rowMap.get("Name");
Object currNameObj = rowMap.get(_nameField);
if (currNameObj != null)
{
String currName = currNameObj.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,32 @@ public class NameExpressionDataIterator extends WrapperDataIterator
private final Map<String, Pair<NameGenerator, NameGeneratorState>> _nameGeneratorMap = new HashMap<>();
private final Map<String, String> _newNames = new HashMap<>();
private final Integer _nameCol;
private final String _nameColName;
private final Integer _expressionCol;
private final TableInfo _parentTable;
private final Container _container;
private final Function<String, Long> _getNonConflictCountFn;
private final String _counterSeqPrefix;
private boolean _allowUserSpecifiedNames = true; // whether manual names specification is allowed or only name expression generation
private final List<Supplier<Map<String, Object>>> _extraPropsFns = new ArrayList<>();
private Map<String, String> _importAliases;
private final Map<String, String> _importAliases;

public NameExpressionDataIterator(DataIterator di, DataIteratorContext context, @Nullable TableInfo parentTable, @Nullable Container container, Function<String, Long> getNonConflictCountFn, String counterSeqPrefix, @Nullable Map<String, String> importAliases)
{
this(di, context, parentTable, container, getNonConflictCountFn, counterSeqPrefix, importAliases, "name", "nameExpression");
}

public NameExpressionDataIterator(DataIterator di, DataIteratorContext context, @Nullable TableInfo parentTable, @Nullable Container container, Function<String, Long> getNonConflictCountFn, String counterSeqPrefix, @Nullable Map<String, String> importAliases, String nameColName, String expressionColName)
{
super(DataIteratorUtil.wrapMap(di, false));
_context = context;
_parentTable = parentTable;
_importAliases = importAliases;

Map<String, Integer> map = DataIteratorUtil.createColumnNameMap(di);
_nameCol = map.get("name");
_expressionCol = map.get("nameExpression");
_nameColName = nameColName;
_nameCol = map.get(nameColName);
_expressionCol = map.get(expressionColName);
assert _nameCol != null;
assert _expressionCol != null;

Expand Down Expand Up @@ -90,7 +97,7 @@ private BatchValidationException getErrors()
private void addNameGenerator(String nameExpression)
{
NameGenerator nameGen = new NameGenerator(nameExpression, _parentTable, false, _importAliases, _container, _getNonConflictCountFn, _counterSeqPrefix);
NameGeneratorState state = nameGen.createState(false);
NameGeneratorState state = nameGen.createState(false, _nameColName);
_nameGeneratorMap.put(nameExpression, Pair.of(nameGen, state));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,26 @@ public class NameExpressionDataIteratorBuilder implements DataIteratorBuilder
{
final DataIteratorBuilder _pre;
private final TableInfo _parentTable;
private final String _nameColumnName;
private final String _nameExpressionColumnName;

public NameExpressionDataIteratorBuilder(DataIteratorBuilder pre, TableInfo parentTable)
{
this(pre, parentTable, "name", "nameExpression");
}

public NameExpressionDataIteratorBuilder(DataIteratorBuilder pre, TableInfo parentTable, String nameColumn, String nameExpressionColumn)
{
_pre = pre;
_parentTable = parentTable;
_nameColumnName = nameColumn;
_nameExpressionColumnName = nameExpressionColumn;
}

@Override
public DataIterator getDataIterator(DataIteratorContext context)
{
DataIterator pre = _pre.getDataIterator(context);
return LoggingDataIterator.wrap(new NameExpressionDataIterator(pre, context, _parentTable, null, null, null, null));
return LoggingDataIterator.wrap(new NameExpressionDataIterator(pre, context, _parentTable, null, null, null, null, _nameColumnName, _nameExpressionColumnName));
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
package org.labkey.assay.plate.query;
package org.labkey.api.dataiterator;

import org.apache.commons.lang3.StringUtils;
import org.labkey.api.collections.CaseInsensitiveHashMap;
import org.labkey.api.data.Container;
import org.labkey.api.data.NameGenerator;
import org.labkey.api.data.NameGeneratorState;
import org.labkey.api.data.TableInfo;
import org.labkey.api.dataiterator.DataIterator;
import org.labkey.api.dataiterator.DataIteratorContext;
import org.labkey.api.dataiterator.DataIteratorUtil;
import org.labkey.api.dataiterator.MapDataIterator;
import org.labkey.api.dataiterator.WrapperDataIterator;
import org.labkey.api.query.BatchValidationException;
import org.labkey.api.query.ValidationException;

Expand Down
2 changes: 2 additions & 0 deletions api/src/org/labkey/api/exp/api/ExpObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ default void setComment(User user, String comment, boolean index) throws Validat
}

User getCreatedBy();
Integer getCreatedById();
Date getCreated();
User getModifiedBy();
Integer getModifiedById();
Date getModified();

void save(User user) throws BatchValidationException;
Expand Down
1 change: 1 addition & 0 deletions api/src/org/labkey/api/exp/api/ExpProtocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ static boolean isSampleWorkflowTaskProtocol(String lsid)
return lsid.contains(ExperimentService.SAMPLE_MANAGEMENT_TASK_PROTOCOL_PREFIX);
}

// TODO remove this and its relatives once the workflow folder import/export rewrite has happened.
static boolean isSampleWorkflowProtocol(String lsid)
{
return isSampleWorkflowTaskProtocol(lsid) || isSampleWorkflowJobProtocol(lsid);
Expand Down
Loading