Skip to content

Commit ebec1e9

Browse files
(Integer)
1 parent a75d181 commit ebec1e9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

ehr/src/org/labkey/ehr/EHRManager.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@
109109
import java.util.Set;
110110
import java.util.TreeSet;
111111

112+
import static org.labkey.api.exp.api.ExperimentService.asInteger;
113+
import static org.labkey.api.exp.api.ExperimentService.asLong;
114+
112115
public class EHRManager
113116
{
114117
private static final EHRManager _instance = new EHRManager();
@@ -315,7 +318,7 @@ public List<String> ensureStudyQCStates(Container c, final User u, final boolean
315318
row.put("publicdata", qc[2]);
316319
row = Table.insert(u, ti, row);
317320

318-
qcMap.put((String)row.get("label"), (Integer)row.get("rowid"));
321+
qcMap.put((String)row.get("label"), asInteger(row.get("rowid")));
319322

320323
shouldClearCache = true;
321324
}
@@ -1111,24 +1114,24 @@ private void updatePropertyURI(Domain d, PropertyDescriptor pd) throws SQLExcept
11111114

11121115
//find propertyId
11131116
TableSelector ts = new TableSelector(propertyDescriptor, Collections.singleton("propertyid"), new SimpleFilter(FieldKey.fromString("PropertyURI"), pd.getPropertyURI()), null);
1114-
Integer[] ids = ts.getArray(Integer.class);
1117+
Long[] ids = ts.getArray(Long.class);
11151118
if (ids.length == 0)
11161119
{
11171120
throw new SQLException("Unknown propertyURI: " + pd.getPropertyURI());
11181121
}
1119-
int propertyId = ids[0];
1122+
long propertyId = ids[0];
11201123

11211124
//first ensure the propertyURI exists
11221125
SQLFragment sql = new SQLFragment("select propertyid from exp.propertydomain p where domainId = ? AND propertyid in (select propertyid from exp.propertydescriptor pd where pd.name " + (expSchema.getSqlDialect().isPostgreSQL() ? "ilike" : "like") + " ?)", d.getTypeId(), pd.getName());
11231126
SqlSelector selector = new SqlSelector(expSchema.getScope(), sql);
1124-
List<Integer> oldIds = new ArrayList<>();
1127+
List<Long> oldIds = new ArrayList<>();
11251128

11261129
try (TableResultSet results = selector.getResultSet())
11271130
{
11281131
while (results.next())
11291132
{
11301133
Map<String, Object> row = results.getRowMap();
1131-
oldIds.add((Integer) row.get("propertyid"));
1134+
oldIds.add(asLong(row.get("propertyid")));
11321135
}
11331136
}
11341137

@@ -1171,7 +1174,7 @@ private void updatePropertyURI(Domain d, PropertyDescriptor pd) throws SQLExcept
11711174
executor.execute(updateSql, propertyId, d.getTypeId(), oldIds, minSort);
11721175

11731176
oldIds.remove(propertyId);
1174-
for (Integer id : oldIds)
1177+
for (Long id : oldIds)
11751178
{
11761179
PropertyDescriptor toDelete = OntologyManager.getPropertyDescriptor(id);
11771180
if (toDelete != null)

0 commit comments

Comments
 (0)