Skip to content

Commit 3080753

Browse files
committed
Merge remote-tracking branch 'origin/develop' into fb_sourceDIB
2 parents edca844 + 94d5b9e commit 3080753

5 files changed

Lines changed: 59 additions & 115 deletions

File tree

api/src/org/labkey/api/exp/OntologyManager.java

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2561,13 +2561,11 @@ public static Pair<String, GUID> getURICacheKey(DomainDescriptor dd)
25612561
return getCacheKey(dd.getDomainURI(), dd.getContainer());
25622562
}
25632563

2564-
25652564
public static Pair<String, GUID> getCacheKey(PropertyDescriptor pd)
25662565
{
25672566
return getCacheKey(pd.getPropertyURI(), pd.getContainer());
25682567
}
25692568

2570-
25712569
public static Pair<String, GUID> getCacheKey(String uri, Container c)
25722570
{
25732571
Container proj = c.getProject();
@@ -2661,7 +2659,6 @@ public static PropertyDescriptor insertOrUpdatePropertyDescriptor(PropertyDescri
26612659
}
26622660
}
26632661

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

2707-
static ParameterMapStatement getUpdateStmt(Connection conn, User user, TableInfo t) throws SQLException
2708-
{
2709-
user = null==user ? User.guest : user;
2710-
SQLFragment sql = new SQLFragment("UPDATE exp.propertydescriptor SET ");
2711-
ColumnInfo c;
2712-
String comma = "";
2713-
for (var p : parametersArray)
2714-
{
2715-
if (null == (c = t.getColumn(p)))
2716-
continue;
2717-
sql.append(comma).append(p).append("=?");
2718-
comma = ", ";
2719-
sql.add(new Parameter(p, c.getJdbcType()));
2720-
}
2721-
sql.append(", modifiedby=" + user.getUserId() + ", modified={fn now()}");
2722-
sql.append("\nWHERE propertyid=?");
2723-
sql.add(new Parameter("propertyid", JdbcType.INTEGER));
2724-
return new ParameterMapStatement(t.getSchema().getScope(), conn, sql, null);
2725-
}
2726-
2727-
2728-
public static void insertPropertyDescriptors(User user, List<PropertyDescriptor> pds) throws SQLException
2729-
{
2730-
if (null == pds || pds.isEmpty())
2731-
return;
2732-
TableInfo t = getTinfoPropertyDescriptor();
2733-
try (Connection conn = t.getSchema().getScope().getConnection();
2734-
ParameterMapStatement stmt = getInsertStmt(conn, user, t, false))
2735-
{
2736-
ObjectFactory<PropertyDescriptor> f = ObjectFactory.Registry.getFactory(PropertyDescriptor.class);
2737-
Map<String, Object> m = null;
2738-
for (PropertyDescriptor pd : pds)
2739-
{
2740-
m = f.toMap(pd, m);
2741-
stmt.clearParameters();
2742-
stmt.putAll(m);
2743-
stmt.addBatch();
2744-
}
2745-
stmt.executeBatch();
2746-
}
2747-
}
2748-
2749-
2750-
public static void updatePropertyDescriptors(User user, List<PropertyDescriptor> pds) throws SQLException
2751-
{
2752-
if (null == pds || pds.isEmpty())
2753-
return;
2754-
TableInfo t = getTinfoPropertyDescriptor();
2755-
try (Connection conn = t.getSchema().getScope().getConnection();
2756-
ParameterMapStatement stmt = getUpdateStmt(conn, user, t))
2757-
{
2758-
ObjectFactory<PropertyDescriptor> f = ObjectFactory.Registry.getFactory(PropertyDescriptor.class);
2759-
Map<String, Object> m = null;
2760-
for (PropertyDescriptor pd : pds)
2761-
{
2762-
m = f.toMap(pd, m);
2763-
stmt.clearParameters();
2764-
stmt.putAll(m);
2765-
stmt.addBatch();
2766-
}
2767-
stmt.executeBatch();
2768-
}
2769-
}
2770-
2771-
27722704
public static PropertyDescriptor insertPropertyDescriptor(PropertyDescriptor pd) throws ChangePropertyDescriptorException
27732705
{
27742706
assert pd.getPropertyId() == 0;
@@ -2779,7 +2711,6 @@ public static PropertyDescriptor insertPropertyDescriptor(PropertyDescriptor pd)
27792711
return pd;
27802712
}
27812713

2782-
27832714
//todo: we automatically update a pd to the last one in?
27842715
public static PropertyDescriptor updatePropertyDescriptor(PropertyDescriptor pd)
27852716
{

api/src/org/labkey/api/exp/api/ExperimentService.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.jetbrains.annotations.NotNull;
2222
import org.jetbrains.annotations.Nullable;
2323
import org.labkey.api.assay.AssayProvider;
24+
import org.labkey.api.attachments.AttachmentParent;
2425
import org.labkey.api.audit.TransactionAuditProvider;
2526
import org.labkey.api.collections.CaseInsensitiveHashSet;
2627
import org.labkey.api.data.Container;
@@ -248,6 +249,15 @@ ExpRun createRunForProvenanceRecording(Container container, User user,
248249
@Nullable
249250
ExpData getExpData(ExpDataClass dataClass, long rowId);
250251

252+
/**
253+
* Build an {@link org.labkey.api.attachments.AttachmentParent} that points at an ExpData's
254+
* attachment storage. Useful for callers outside the experiment module (for example, module
255+
* triggers) that need to move, read, or delete ExpData attachments without referencing
256+
* experiment-internal classes.
257+
*/
258+
@NotNull
259+
AttachmentParent getDataClassAttachmentParent(@NotNull Container container, @NotNull String dataLsid);
260+
251261
/**
252262
* Get a Data with name at a specific time.
253263
*/
@@ -1152,10 +1162,6 @@ List<? extends ExpProtocol> getExpProtocolsWithParameterValue(
11521162

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

1155-
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;
1156-
1157-
int moveAuditEvents(Container targetContainer, List<String> runLsids);
1158-
11591165
/**
11601166
* From a list of barcodes, find material lsids
11611167
* @param uniqueIds A list of barcodes

experiment/src/org/labkey/experiment/api/ExpDataClassDataTableImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ public Map<String, Object> moveRows(User user, Container container, Container ta
12211221

12221222
try
12231223
{
1224-
Map<String, Integer> response = ExperimentService.get().moveDataClassObjects(containerObjects.get(c), c, targetContainer, user, auditUserComment, auditType);
1224+
Map<String, Integer> response = ExperimentServiceImpl.get().moveDataClassObjects(containerObjects.get(c), c, targetContainer, user, errors, auditUserComment, auditType);
12251225
incrementCounts(allContainerResponse, response);
12261226
}
12271227
catch (ExperimentException e)

0 commit comments

Comments
 (0)