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
2 changes: 0 additions & 2 deletions api/src/org/labkey/api/admin/AdminBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ public static class RecentUser
public static final String servletContainer = ModuleLoader.getServletContext().getServerInfo();
public static final String servletConfiguration = "Embedded";
public static final String sessionTimeout = Formats.commaf0.format(ModuleLoader.getServletContext().getSessionTimeout());
@SuppressWarnings("unused") // Available substitution property, not used directly in code
public static final String buildTime = ModuleLoader.getInstance().getCoreModule().getBuildTime();
@SuppressWarnings("unused") // Available substitution property, not used directly in code
public static final String serverStartupTime = DateUtil.formatDateTime(ContainerManager.getRoot());
public static final List<Module> modules;

Expand Down
21 changes: 8 additions & 13 deletions api/src/org/labkey/api/exp/api/ExperimentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import org.labkey.api.reader.TabLoader;
import org.labkey.api.security.User;
import org.labkey.api.services.ServiceRegistry;
import org.labkey.api.util.IntegerUtils;
import org.labkey.api.util.Pair;
import org.labkey.api.util.StringUtilsLabKey;
import org.labkey.api.view.HttpView;
Expand Down Expand Up @@ -719,10 +720,8 @@ static void validateParentAlias(Map<String, String> aliasMap, Set<String> reserv
ExpData getExpDataByURL(Path p, @Nullable Container c);

/**
* Get all ExpData for the dataFileUrl.
*
* Having more than one ExpData for the same file path doesn't happen often but is allowed.
* Some examples:
* Get all ExpData for the dataFileUrl. Having more than one ExpData for the same file path doesn't happen often but
* is allowed. Some examples:
* - The file or pipeline root may be shared by more than one container and an exp.data may be created in each container when importing assay data.
* - In the MS2 analysis pipeline, there are tools that rewrite an input file to add more data. We model them as separate exp.data.
*/
Expand Down Expand Up @@ -1297,19 +1296,15 @@ public XarImportOptions setStrictValidateExistingSampleType(boolean strictValida
}
}

@Deprecated // Use IntegerUtils.asLong() instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this method just call IntegerUtils.asLong()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably... I'm double checking with Matt just in case I'm missing something

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These methods have been updated to call their IntegerUtils counterparts

static Long asLong(Object o)
{
return null==o ? null : o.getClass() == Long.class ? (Long)o : ((Number)o).longValue();
return IntegerUtils.asLong(o);
}

@Deprecated // Use IntegerUtils.asInteger() instead
static Integer asInteger(Object o)
{
if (null == o)
return null;
if (o.getClass() == Integer.class)
return (Integer)o;
long l = ((Number)o).longValue();
if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE)
throw new IllegalArgumentException("Invalid int value: " + l);
return (int)l;
return IntegerUtils.asInteger(o);
}
}
10 changes: 5 additions & 5 deletions api/src/org/labkey/api/util/IntegerUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

/**
* This Class to help with dealing with Object that may represent an integer number (char,short,int,long). It
* is meant to fill in the small gap between Java (e.g casts and instanceof) and ConvertUtils. Hopefully, this
* is meant to fill in the small gap between Java (e.g. casts and instanceof) and ConvertUtils. Hopefully, this
* class makes it just a little easier to deal with Integer valued Numbers.
* <br>
* Unfortunately, Number does not help with detecting integer/non-integer types, so this class only handles Object
* instances that have corresponding to the primitive types. {@code boolean}, {@code byte}, {@code char},
* Unfortunately, Number does not help with detecting integer/noninteger types, so this class only handles Object
* instances that have corresponding to the primitive types. {@code boolean}, {@code byte}, {@code char},
* {@code short}, {@code int}, {@code long}, {@code float}, and {@code double})
* <br>
* Because "Integer" is kind of ambiguous, I will use "Integral" to mean any integer type. For now, I am not including
Expand All @@ -27,15 +27,15 @@ public static boolean isIntegral(Object o)
return c == Byte.class || c == Short.class || c==Integer.class || c==Long.class;
}

/** returns Numeric object as a Long. This method will throw if not Object is not Integral. */
/** returns Numeric object as a Long. This method will throw if Object is not Integral. */
public static Long asLong(Object o)
{
if (!isIntegral(o))
return (Long)o; // throw ClassCastException
return o.getClass() == Long.class ? (Long)o : Long.valueOf(((Number)o).longValue());
}

/** returns Numeric object as an Integer. This method will throw if not Object is not Integral or is out of range. */
/** returns Numeric object as an Integer. This method will throw if Object is not Integral or is out of range. */
public static Integer asInteger(Object o) throws ClassCastException
{
if (null == o)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.labkey.api.collections.LongHashSet;
import org.labkey.api.data.DataRegionSelection;

import java.util.HashSet;
import java.util.Set;

public class DataViewSnapshotSelectionForm extends DataViewSelectionForm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3610,6 +3610,7 @@ private void _verifyAllEdges(Container c, @Nullable Integer limit)
}
}

@Override
public void clearAncestors(ExpRunItem runItem)
{
boolean isSample = runItem instanceof ExpMaterial;
Expand All @@ -3619,16 +3620,19 @@ public void clearAncestors(ExpRunItem runItem)
clearDataAncestors(List.of(runItem.getRowId()));
}

@Override
public void repopulateAncestors()
{
ClosureQueryHelper.truncateAndRecreate();
}

@Override
public void clearDataAncestors(Collection<Long> dataRowIds)
{
ClosureQueryHelper.clearAncestorsForDataObjects(dataRowIds);
}

@Override
public void clearMaterialAncestors(Collection<Long> materialRowIds)
{
ClosureQueryHelper.clearAncestorsForMaterials(materialRowIds);
Expand Down
22 changes: 10 additions & 12 deletions query/src/org/labkey/query/QueryServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -385,18 +385,16 @@ private static SQLFragment getColumnInSql(@NotNull FieldKey fieldKey, Object val

SQLFragment fromSql = t.getFromSQL("_");

SQLFragment sqlFragment = new SQLFragment()
.append("(").appendIdentifier(col.getAlias())
.append(")")
.append(negate ? " NOT" : "")
.append(" IN (")
.append(" SELECT ")
.append(t.getColumns().get(0).getValueSql("_"))
.append(" FROM ")
.append(fromSql)
.append(")");

return sqlFragment;
return new SQLFragment()
.append("(").appendIdentifier(col.getAlias())
.append(")")
.append(negate ? " NOT" : "")
.append(" IN (")
.append(" SELECT ")
.append(t.getColumns().get(0).getValueSql("_"))
.append(" FROM ")
.append(fromSql)
.append(")");
}

/**
Expand Down
2 changes: 1 addition & 1 deletion query/src/org/labkey/query/reports/AttachmentReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public String getType()
@Override
public boolean canEdit(User user, Container container, List<ValidationError> errors)
{
// disallow a non site admin user from editing a server AttachmentReport
// disallow a non-site-admin user from editing a server AttachmentReport
if (StringUtils.isNotEmpty(getFilePath()) && !container.hasPermission(user, AdminOperationsPermission.class))
{
errors.add(new SimpleValidationError("You must be an administrator in order to edit this report."));
Expand Down
17 changes: 4 additions & 13 deletions search/src/org/labkey/search/view/SearchWebPartFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,13 @@
import org.jetbrains.annotations.NotNull;
import org.labkey.api.data.BooleanFormat;
import org.labkey.api.view.AlwaysAvailableWebPartFactory;
import org.labkey.api.view.HttpView;
import org.labkey.api.view.JspView;
import org.labkey.api.view.Portal;
import org.labkey.api.view.Portal.WebPart;
import org.labkey.api.view.ViewContext;
import org.labkey.api.view.WebPartFactory;
import org.labkey.api.view.WebPartView;

import java.text.ParseException;

/**
* User: adam
* Date: Jan 19, 2010
* Time: 2:03:13 PM
*/
public class SearchWebPartFactory extends AlwaysAvailableWebPartFactory
{
public SearchWebPartFactory()
Expand All @@ -41,7 +34,7 @@ public SearchWebPartFactory()
}

@Override
public WebPartView<?> getWebPartView(@NotNull ViewContext portalCtx, @NotNull Portal.WebPart webPart)
public SearchWebPart getWebPartView(@NotNull ViewContext portalCtx, @NotNull WebPart webPart)
{
boolean includeSubfolders = includeSubfolders(webPart);

Expand All @@ -57,13 +50,13 @@ public WebPartView<?> getWebPartView(@NotNull ViewContext portalCtx, @NotNull Po


@Override
public HttpView<?> getEditView(Portal.WebPart webPart, ViewContext context)
public JspView<WebPart> getEditView(WebPart webPart, ViewContext context)
{
return new JspView<>("/org/labkey/search/view/customizeSearchWebPart.jsp", webPart);
}


public static boolean includeSubfolders(Portal.WebPart part)
public static boolean includeSubfolders(WebPart part)
{
String value = part.getPropertyMap().get("includeSubfolders");

Expand All @@ -77,5 +70,3 @@ public static boolean includeSubfolders(Portal.WebPart part)
}
}
}


8 changes: 3 additions & 5 deletions study/src/org/labkey/study/query/DatasetQueryView.java
Original file line number Diff line number Diff line change
Expand Up @@ -594,13 +594,11 @@ private MenuButton createQCStateButton()
}

boolean addSeparator = false;

if (getContainer().hasPermission(getUser(), QCAnalystPermission.class))
{
if (!addSeparator)
{
addSeparator = true;
button.addSeparator();
}
addSeparator = true;
button.addSeparator();
ActionURL updateAction = new ActionURL(StudyController.UpdateQCStateAction.class, getContainer());
updateAction.addReturnUrl(getViewContext().getActionURL());
button.addMenuItem("Update state of selected rows", "if (verifySelected(" + DataRegion.getJavaScriptObjectReference(getDataRegionName()) + ".form, \"" +
Expand Down