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: 0 additions & 69 deletions api/src/org/labkey/api/exp/OntologyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2561,13 +2561,11 @@ public static Pair<String, GUID> getURICacheKey(DomainDescriptor dd)
return getCacheKey(dd.getDomainURI(), dd.getContainer());
}


public static Pair<String, GUID> getCacheKey(PropertyDescriptor pd)
{
return getCacheKey(pd.getPropertyURI(), pd.getContainer());
}


public static Pair<String, GUID> getCacheKey(String uri, Container c)
{
Container proj = c.getProject();
Expand Down Expand Up @@ -2661,7 +2659,6 @@ public static PropertyDescriptor insertOrUpdatePropertyDescriptor(PropertyDescri
}
}


static final String parameters = "propertyuri,name,description,rangeuri,concepturi,label," +
"format,container,project,lookupcontainer,lookupschema,lookupquery,defaultvaluetype,hidden," +
"mvenabled,importaliases,url,urltarget,shownininsertview,showninupdateview,shownindetailsview,measure,dimension,scale," +
Expand Down Expand Up @@ -2704,71 +2701,6 @@ else if ("propertyuri".equals(p))
return new ParameterMapStatement(t.getSchema().getScope(), conn, sql, null);
}

static ParameterMapStatement getUpdateStmt(Connection conn, User user, TableInfo t) throws SQLException
{
user = null==user ? User.guest : user;
SQLFragment sql = new SQLFragment("UPDATE exp.propertydescriptor SET ");
ColumnInfo c;
String comma = "";
for (var p : parametersArray)
{
if (null == (c = t.getColumn(p)))
continue;
sql.append(comma).append(p).append("=?");
comma = ", ";
sql.add(new Parameter(p, c.getJdbcType()));
}
sql.append(", modifiedby=" + user.getUserId() + ", modified={fn now()}");
sql.append("\nWHERE propertyid=?");
sql.add(new Parameter("propertyid", JdbcType.INTEGER));
return new ParameterMapStatement(t.getSchema().getScope(), conn, sql, null);
}


public static void insertPropertyDescriptors(User user, List<PropertyDescriptor> pds) throws SQLException
{
if (null == pds || pds.isEmpty())
return;
TableInfo t = getTinfoPropertyDescriptor();
try (Connection conn = t.getSchema().getScope().getConnection();
ParameterMapStatement stmt = getInsertStmt(conn, user, t, false))
{
ObjectFactory<PropertyDescriptor> f = ObjectFactory.Registry.getFactory(PropertyDescriptor.class);
Map<String, Object> m = null;
for (PropertyDescriptor pd : pds)
{
m = f.toMap(pd, m);
stmt.clearParameters();
stmt.putAll(m);
stmt.addBatch();
}
stmt.executeBatch();
}
}


public static void updatePropertyDescriptors(User user, List<PropertyDescriptor> pds) throws SQLException
{
if (null == pds || pds.isEmpty())
return;
TableInfo t = getTinfoPropertyDescriptor();
try (Connection conn = t.getSchema().getScope().getConnection();
ParameterMapStatement stmt = getUpdateStmt(conn, user, t))
{
ObjectFactory<PropertyDescriptor> f = ObjectFactory.Registry.getFactory(PropertyDescriptor.class);
Map<String, Object> m = null;
for (PropertyDescriptor pd : pds)
{
m = f.toMap(pd, m);
stmt.clearParameters();
stmt.putAll(m);
stmt.addBatch();
}
stmt.executeBatch();
}
}


public static PropertyDescriptor insertPropertyDescriptor(PropertyDescriptor pd) throws ChangePropertyDescriptorException
{
assert pd.getPropertyId() == 0;
Expand All @@ -2779,7 +2711,6 @@ public static PropertyDescriptor insertPropertyDescriptor(PropertyDescriptor pd)
return pd;
}


//todo: we automatically update a pd to the last one in?
public static PropertyDescriptor updatePropertyDescriptor(PropertyDescriptor pd)
{
Expand Down
14 changes: 10 additions & 4 deletions api/src/org/labkey/api/exp/api/ExperimentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.assay.AssayProvider;
import org.labkey.api.attachments.AttachmentParent;
import org.labkey.api.audit.TransactionAuditProvider;
import org.labkey.api.collections.CaseInsensitiveHashSet;
import org.labkey.api.data.Container;
Expand Down Expand Up @@ -246,6 +247,15 @@ ExpRun createRunForProvenanceRecording(Container container, User user,
@Nullable
ExpData getExpData(ExpDataClass dataClass, long rowId);

/**
* Build an {@link org.labkey.api.attachments.AttachmentParent} that points at an ExpData's
* attachment storage. Useful for callers outside the experiment module (for example, module
* triggers) that need to move, read, or delete ExpData attachments without referencing
* experiment-internal classes.
*/
@NotNull
AttachmentParent getDataClassAttachmentParent(@NotNull Container container, @NotNull String dataLsid);

/**
* Get a Data with name at a specific time.
*/
Expand Down Expand Up @@ -1150,10 +1160,6 @@ List<? extends ExpProtocol> getExpProtocolsWithParameterValue(

int aliasMapRowContainerUpdate(TableInfo aliasMapTable, List<Long> dataIds, Container targetContainer);

Map<String, Integer> moveDataClassObjects(Collection<? extends ExpData> dataObjects, @NotNull Container sourceContainer, @NotNull Container targetContainer, @NotNull User user, @Nullable String userComment, @Nullable AuditBehaviorType auditBehavior) throws ExperimentException, BatchValidationException;

int moveAuditEvents(Container targetContainer, List<String> runLsids);

/**
* From a list of barcodes, find material lsids
* @param uniqueIds A list of barcodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ public Map<String, Object> moveRows(User user, Container container, Container ta

try
{
Map<String, Integer> response = ExperimentService.get().moveDataClassObjects(containerObjects.get(c), c, targetContainer, user, auditUserComment, auditType);
Map<String, Integer> response = ExperimentServiceImpl.get().moveDataClassObjects(containerObjects.get(c), c, targetContainer, user, errors, auditUserComment, auditType);
incrementCounts(allContainerResponse, response);
}
catch (ExperimentException e)
Expand Down
Loading
Loading