diff --git a/api/src/org/labkey/api/admin/AdminBean.java b/api/src/org/labkey/api/admin/AdminBean.java index 26921853d15..62631713f3c 100644 --- a/api/src/org/labkey/api/admin/AdminBean.java +++ b/api/src/org/labkey/api/admin/AdminBean.java @@ -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 modules; diff --git a/api/src/org/labkey/api/exp/api/ExperimentService.java b/api/src/org/labkey/api/exp/api/ExperimentService.java index 2a3ecc53443..ac7725a2922 100644 --- a/api/src/org/labkey/api/exp/api/ExperimentService.java +++ b/api/src/org/labkey/api/exp/api/ExperimentService.java @@ -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; @@ -719,10 +720,8 @@ static void validateParentAlias(Map aliasMap, Set 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. */ @@ -1297,19 +1296,15 @@ public XarImportOptions setStrictValidateExistingSampleType(boolean strictValida } } + @Deprecated // Use IntegerUtils.asLong() instead 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); } } diff --git a/api/src/org/labkey/api/util/IntegerUtils.java b/api/src/org/labkey/api/util/IntegerUtils.java index f6bc610dbe3..42218b17a33 100644 --- a/api/src/org/labkey/api/util/IntegerUtils.java +++ b/api/src/org/labkey/api/util/IntegerUtils.java @@ -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. *
- * 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}) *
* Because "Integer" is kind of ambiguous, I will use "Integral" to mean any integer type. For now, I am not including @@ -27,7 +27,7 @@ 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)) @@ -35,7 +35,7 @@ public static Long asLong(Object o) 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) diff --git a/api/src/org/labkey/api/view/DataViewSnapshotSelectionForm.java b/api/src/org/labkey/api/view/DataViewSnapshotSelectionForm.java index 80ef5e8aa5e..fd40efa3bbc 100644 --- a/api/src/org/labkey/api/view/DataViewSnapshotSelectionForm.java +++ b/api/src/org/labkey/api/view/DataViewSnapshotSelectionForm.java @@ -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 diff --git a/experiment/src/org/labkey/experiment/api/ExperimentServiceImpl.java b/experiment/src/org/labkey/experiment/api/ExperimentServiceImpl.java index 24cca6884d6..367d743da66 100644 --- a/experiment/src/org/labkey/experiment/api/ExperimentServiceImpl.java +++ b/experiment/src/org/labkey/experiment/api/ExperimentServiceImpl.java @@ -3610,6 +3610,7 @@ private void _verifyAllEdges(Container c, @Nullable Integer limit) } } + @Override public void clearAncestors(ExpRunItem runItem) { boolean isSample = runItem instanceof ExpMaterial; @@ -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 dataRowIds) { ClosureQueryHelper.clearAncestorsForDataObjects(dataRowIds); } + @Override public void clearMaterialAncestors(Collection materialRowIds) { ClosureQueryHelper.clearAncestorsForMaterials(materialRowIds); diff --git a/query/src/org/labkey/query/QueryServiceImpl.java b/query/src/org/labkey/query/QueryServiceImpl.java index 0883a1ec48d..45749c18d19 100644 --- a/query/src/org/labkey/query/QueryServiceImpl.java +++ b/query/src/org/labkey/query/QueryServiceImpl.java @@ -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(")"); } /** diff --git a/query/src/org/labkey/query/reports/AttachmentReport.java b/query/src/org/labkey/query/reports/AttachmentReport.java index 29213865e0b..bdef0864736 100644 --- a/query/src/org/labkey/query/reports/AttachmentReport.java +++ b/query/src/org/labkey/query/reports/AttachmentReport.java @@ -80,7 +80,7 @@ public String getType() @Override public boolean canEdit(User user, Container container, List 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.")); diff --git a/search/src/org/labkey/search/view/SearchWebPartFactory.java b/search/src/org/labkey/search/view/SearchWebPartFactory.java index dbb2572df00..278700f43a6 100644 --- a/search/src/org/labkey/search/view/SearchWebPartFactory.java +++ b/search/src/org/labkey/search/view/SearchWebPartFactory.java @@ -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() @@ -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); @@ -57,13 +50,13 @@ public WebPartView getWebPartView(@NotNull ViewContext portalCtx, @NotNull Po @Override - public HttpView getEditView(Portal.WebPart webPart, ViewContext context) + public JspView 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"); @@ -77,5 +70,3 @@ public static boolean includeSubfolders(Portal.WebPart part) } } } - - diff --git a/study/src/org/labkey/study/query/DatasetQueryView.java b/study/src/org/labkey/study/query/DatasetQueryView.java index d51a088d11a..556a1a16d90 100644 --- a/study/src/org/labkey/study/query/DatasetQueryView.java +++ b/study/src/org/labkey/study/query/DatasetQueryView.java @@ -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, \"" +