Skip to content
Open
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
3 changes: 2 additions & 1 deletion snd/api-src/org/labkey/api/snd/SNDDomainKind.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.labkey.api.snd;

import org.jetbrains.annotations.NotNull;
import org.labkey.api.data.CompareType;
import org.labkey.api.data.Container;
import org.labkey.api.data.SQLFragment;
Expand Down Expand Up @@ -72,7 +73,7 @@ public boolean ensurePropertyLookup()
}

@Override
public Set<String> getReservedPropertyNames(Domain domain, User user)
public @NotNull Set<String> getReservedPropertyNames(Domain domain, User user)
{
Set<String> result = new HashSet<>();
result.add("Description");
Expand Down
5 changes: 2 additions & 3 deletions snd/src/org/labkey/snd/PackageUserSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down Expand Up @@ -223,7 +222,7 @@ protected void initializeColumns()
@Override
protected SQLFragment getFromSQLExpanded(String alias, Set<FieldKey> cols)
{
boolean hasEventDataColumn = cols.stream().anyMatch(fk -> eventDataCols.contains(fk.getParts().get(0)));
boolean hasEventDataColumn = cols.stream().anyMatch(fk -> eventDataCols.contains(fk.getParts().getFirst()));
return getFromSQLJoin(alias, hasEventDataColumn);
}

Expand Down Expand Up @@ -419,7 +418,7 @@ protected void initializeColumns()
List<QueryException> errors = new ArrayList<>();
queryTableInfo = qdef.getTable(_snd, errors, false);
if (!errors.isEmpty())
throw errors.get(0);
throw errors.getFirst();
if (null == queryTableInfo)
throw new QueryException("Unexpected error compiling query");

Expand Down
25 changes: 0 additions & 25 deletions snd/src/org/labkey/snd/SNDContainerListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,15 @@

package org.labkey.snd;

import org.jetbrains.annotations.NotNull;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerManager.ContainerListener;
import org.labkey.api.data.DbScope;
import org.labkey.api.data.SimpleFilter;
import org.labkey.api.data.Table;
import org.labkey.api.security.User;

import java.beans.PropertyChangeEvent;
import java.util.Collection;
import java.util.Collections;

public class SNDContainerListener implements ContainerListener
{
@Override
public void containerCreated(Container c, User user)
{
}

@Override
public void containerDeleted(Container c, User user)
Expand All @@ -59,20 +50,4 @@ public void containerDeleted(Container c, User user)
transaction.commit();
}
}

@Override
public void propertyChange(PropertyChangeEvent evt)
{
}

@Override
public void containerMoved(Container c, Container oldParent, User user)
{
}

@NotNull @Override
public Collection<String> canMove(Container c, Container newParent, User user)
{
return Collections.emptyList();
}
}
36 changes: 18 additions & 18 deletions snd/src/org/labkey/snd/SNDManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public Object getLookupDisplayValue(User u, Container c, String schema, String t
QueryUpdateService lookupQus = getQueryUpdateService(tableInfo);

Map<String, Object> keyRow = new HashMap<>();
String pk = tableInfo.getPkColumnNames().get(0); // Only handling single value pks
String pk = tableInfo.getPkColumnNames().getFirst(); // Only handling single value pks
keyRow.put(pk, key);

List<Map<String, Object>> pkRows = new ArrayList<>();
Expand All @@ -265,7 +265,7 @@ public Object getLookupDisplayValue(User u, Container c, String schema, String t
if (rows == null || rows.isEmpty())
return null;

return rows.get(0).get(tableInfo.getTitleColumn());
return rows.getFirst().get(tableInfo.getTitleColumn());
}

/**
Expand All @@ -284,7 +284,7 @@ public Object normalizeLookupValue(User u, Container c, String schema, String ta
String pk;
if (tableInfo.getPkColumnNames() != null)
{
pk = tableInfo.getPkColumnNames().get(0); // Only handling single value pks
pk = tableInfo.getPkColumnNames().getFirst(); // Only handling single value pks
}
else
{
Expand All @@ -300,7 +300,7 @@ public Object normalizeLookupValue(User u, Container c, String schema, String ta
if (lookupRows.isEmpty())
return null;

return lookupRows.get(0);
return lookupRows.getFirst();
}

/**
Expand Down Expand Up @@ -726,7 +726,7 @@ public static SuperPackage getTopLevelSuperPkgForPkg(Container c, User u, Intege
SqlSelector selector = new SqlSelector(schema.getDbSchema(), sql);

if (selector.getArrayList(SuperPackage.class).size() == 1)
return selector.getArrayList(SuperPackage.class).get(0);
return selector.getArrayList(SuperPackage.class).getFirst();
else
return null;
}
Expand Down Expand Up @@ -905,7 +905,7 @@ public boolean isDescendent(Container c, User u, int topLevelSuperPkgId, int pkg
sql.append(" WHERE SuperPkgId = ?");
sql.add(topLevelSuperPkgId);
SqlSelector selector = new SqlSelector(schema.getDbSchema(), sql);
Integer topLevelPkgId = selector.getArrayList(Integer.class).get(0);
Integer topLevelPkgId = selector.getArrayList(Integer.class).getFirst();

sql = new SQLFragment("SELECT * FROM ");
sql.append(SNDSchema.NAME + "." + SNDSchema.SUPERPKGS_FUNCTION_NAME + "(?)");
Expand Down Expand Up @@ -945,7 +945,7 @@ private SuperPackage getFullSuperPackage(Container c, User u, int superPkgId, bo
List<Package> pkgs = getPackages(c, u, pkgIds, true, true, true, errors);
if (!pkgs.isEmpty())
{
superPackage.setPkg(pkgs.get(0));
superPackage.setPkg(pkgs.getFirst());
}
}

Expand Down Expand Up @@ -982,7 +982,7 @@ else if (includeFullSubpackages)
{
pkgIds = new ArrayList<>();
pkgIds.add(sPkg.getPkgId());
childPkg = getPackages(c, u, pkgIds, true, true, true, errors).get(0);
childPkg = getPackages(c, u, pkgIds, true, true, true, errors).getFirst();
sPkg.setPkg(childPkg);
}
}
Expand Down Expand Up @@ -1362,7 +1362,7 @@ private boolean isValidReferenceId(Container c, User u, Project project, boolean

if (!rows.isEmpty())
{
Map<String, Object> row = rows.get(0);
Map<String, Object> row = rows.getFirst();
if ((Integer) row.get("ReferenceId") != project.getReferenceId() && Boolean.parseBoolean((String) row.get("HasEvent")))
{
errors.addRowError(new ValidationException("This is an in use project. Reference Id cannot be changed."));
Expand Down Expand Up @@ -1752,7 +1752,7 @@ public String getProjectObjectId(Container c, User u, Project project, BatchVali
if (!selector.exists())
return null;

return selector.getArrayList(String.class).get(0);
return selector.getArrayList(String.class).getFirst();
}

/**
Expand Down Expand Up @@ -2257,7 +2257,7 @@ private String getProjectObjectId(Container c, User u, Event event)
event.setException(new ValidationException("Project|revision not found: " + event.getProjectIdRev()));
}

return !results.isEmpty() ? results.get(0) : null;
return !results.isEmpty() ? results.getFirst() : null;
}
}
}
Expand Down Expand Up @@ -2513,7 +2513,7 @@ private String insertExpObjectProperties(Container c, User u, Event event, Event
List<ValidationException> validationExceptions = validateProperty(c, u, propertyDescriptor, objectProperty);
if (!validationExceptions.isEmpty())
{
attributeData.setException(event, validationExceptions.get(0)); // just handling on exception
attributeData.setException(event, validationExceptions.getFirst()); // just handling on exception
}
else
{
Expand Down Expand Up @@ -2649,7 +2649,7 @@ private Package getPackageForSuperPackage(Container c, User u, int superPkgId, B
List<Integer> pkgIds = Lists.newArrayList(selector.getObject(Integer.class));


return getPackages(c, u, pkgIds, false, false, true, errors).get(0);
return getPackages(c, u, pkgIds, false, false, true, errors).getFirst();
}

/**
Expand Down Expand Up @@ -3063,7 +3063,7 @@ public int updateNarrativeCache(Container container, User user, Set<Integer>cach

if (cacheData.size() > MAX_MERGE_ROWS)
{
log.info("More than " + MAX_MERGE_ROWS + " rows. Truncating narrative cache");
log.info("More than {} rows. Truncating narrative cache", MAX_MERGE_ROWS);
clearNarrativeCache(container, user, errors);
if (isUpdate)
log.info("Not automatically populating narrative cache. Must refresh manually.");
Expand Down Expand Up @@ -3202,7 +3202,7 @@ public void populateNarrativeCache(Container c, User u, List<Integer> eventIds,
rows.add(row);
int currentCount = count.incrementAndGet();
if (logger != null && currentCount % 1000 == 0) {
logger.info(currentCount + " narratives generated.");
logger.info("{} narratives generated.", currentCount);
}
});
try (DbScope.Transaction tx = sndSchema.getDbSchema().getScope().ensureTransaction()) {
Expand Down Expand Up @@ -3637,7 +3637,7 @@ public List<Map<String, Object>> getActiveProjects(Container c, User u, ArrayLis
try
{
String pk, title;
pk = luTi.getPkColumnNames().get(0); // Only handling single value pks
pk = luTi.getPkColumnNames().getFirst(); // Only handling single value pks
title = luTi.getTitleColumn();

if (pk != null)
Expand Down Expand Up @@ -3961,7 +3961,7 @@ private Map<Integer, SuperPackage> getBulkSuperPkgs(Container c, User u, List<GW
List<Integer> packageIds = Collections.singletonList(pkgId);
List<Package> packages = getBulkPackages(c, u, packageIds, pkgQus, packageExtraFields, fullTreeSuperPkgs, childrenByParentId, pkgCategoriesByPkgId, lookups, true, true, true, errors);
if (!packages.isEmpty()) {
superPackage.setPkg(packages.get(0));
superPackage.setPkg(packages.getFirst());
}
superPackage.setChildPackages(childrenByTopLevelPkgId.get(pkgId));
}
Expand Down Expand Up @@ -4008,7 +4008,7 @@ private Map<Integer, List<SuperPackage>> getBulkChildSuperPkgs (Container c, Use
.forEach((SuperPackage superPackage) -> {
if (includeFullSubpackages) {
List<Integer> packageIds = Collections.singletonList(superPackage.getPkgId());
superPackage.setPkg(getBulkPackages(c, u, packageIds, pkgQus, packageExtraFields, allSuperPackages, childrenByParentId, pkgCategoriesByPkgId, lookups, true, true, true, errors).get(0));
superPackage.setPkg(getBulkPackages(c, u, packageIds, pkgQus, packageExtraFields, allSuperPackages, childrenByParentId, pkgCategoriesByPkgId, lookups, true, true, true, errors).getFirst());
}
if (superPackage.getParentSuperPkgId().intValue() == root.getSuperPkgId().intValue()) {
children.add(addChildren(superPackage, superPackages));
Expand Down
8 changes: 0 additions & 8 deletions snd/src/org/labkey/snd/SNDModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.audit.AuditLogService;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerManager;
import org.labkey.api.exp.api.ExperimentService;
import org.labkey.api.exp.property.PropertyService;
Expand Down Expand Up @@ -130,13 +129,6 @@ public QuerySchema createSchema(final DefaultSchema schema, Module module)
});
}

@Override
@NotNull
public Collection<String> getSummary(Container c)
{
return Collections.emptyList();
}

@Override
@NotNull
public Set<String> getSchemaNames()
Expand Down
4 changes: 2 additions & 2 deletions snd/src/org/labkey/snd/SNDServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,11 @@ private JSONArray lookupValuesToJson(Container c, User u, String schema, String

if (!table.getPkColumnNames().isEmpty())
{
pk = table.getPkColumnNames().get(0);
pk = table.getPkColumnNames().getFirst();

if (title == null)
{
title = table.getPkColumnNames().get(0);
title = table.getPkColumnNames().getFirst();
}
}

Expand Down
5 changes: 1 addition & 4 deletions snd/src/org/labkey/snd/pipeline/SNDDataHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.labkey.snd.pipeline;

import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.Logger;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlOptions;
Expand Down Expand Up @@ -55,8 +54,6 @@
import org.txbiomed.snd.SuperPackagesType;
import org.txbiomed.snd.USDACategoryType;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
Expand Down Expand Up @@ -145,7 +142,7 @@ private void parseAndSavePackages(@NotNull ExportDocument.Export export, @NotNul
{
Package pkg = parsePackage(packageType, info); //convert auto-generated objects/tokens to SND's Package objects
sndService.savePackage(info.getContainer(), info.getUser(), pkg, null,false, true); //save to db
log.info("Saving package: " + packageType.getId() + "-" + packageType.getDescription());
log.info("Saving package: {}-{}", packageType.getId(), packageType.getDescription());
}
}

Expand Down
14 changes: 7 additions & 7 deletions snd/src/org/labkey/snd/query/AttributeDataTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ private int insertObject(Container c, User u, String uri, List<ObjectProperty> p
OntologyManager.insertProperties(c, u, uri, true, properties);
inserted += props.size();
if (inserted % 10000 < props.size())
logger.info("Inserted/updated " + inserted + " rows.");
logger.info("Inserted/updated {} rows.", inserted);
}
catch (ValidationException e)
{
logger.error(e.getMessage() + " PkgId " + pkgId, e);
logger.error("{} PkgId {}", e.getMessage(), pkgId, e);
throw UnexpectedException.wrap(e, e.getMessage() + "For PkgId: " + pkgId + ".\n");
}

Expand Down Expand Up @@ -292,11 +292,11 @@ else if (stringValue != null)
{
if (pd.getLookupSchema() != null && pd.getLookupQuery() != null)
{
logger.info("Value null for property " + pd.getName() + ". Value skipped. Verify lookup " + pd.getLookupSchema() + "." + pd.getLookupQuery() + " contains " + stringValue);
logger.info("Value null for property {}. Value skipped. Verify lookup {}.{} contains {}", pd.getName(), pd.getLookupSchema(), pd.getLookupQuery(), stringValue);
}
else
{
logger.info("Value null for property " + pd.getName() + ". Value skipped.");
logger.info("Value null for property {}. Value skipped.", pd.getName());
}
}

Expand Down Expand Up @@ -347,7 +347,7 @@ else if (stringValue != null)
}

OntologyManager.clearPropertyCache();
logger.info("End updating exp.ObjectProperty. Inserted/Updated " + inserted + " rows.");
logger.info("End updating exp.ObjectProperty. Inserted/Updated {} rows.", inserted);

_sndManager.updateNarrativeCache(container, user, cacheEventIds, logger);

Expand All @@ -373,7 +373,7 @@ public int mergeRows(User user, Container container, DataIteratorBuilder rows, B
if (distinctEventIds.size() >= max_merge_rows)
{
data.clear();
log.info("More than " + max_merge_rows + " rows. using importRows method.");
log.info("More than {} rows. using importRows method.", max_merge_rows);
return importRows(user, container, rows, errors, configParameters, extraScriptContext);
}
log.info("Merging rows.");
Expand Down Expand Up @@ -444,7 +444,7 @@ public List<Map<String, Object>> deleteRows(User user, Container container, List
deleteObjProp.append("and propertyId = ?");
deleteObjProp.add(propertyId);
executor.execute(deleteObjProp);
log.info("Deleting a row in exp.ObjectProperty with objectId = " + objectId + ", and propertyId = " + propertyId);
log.info("Deleting a row in exp.ObjectProperty with objectId = {}, and propertyId = {}", objectId, propertyId);

//narrative cache to update
cacheData.add((Integer) row.get("EventId"));
Expand Down
Loading
Loading