\n");
return builder.getHtmlString();
}
@@ -192,6 +192,6 @@ private static HtmlString formatValue(String key, String value)
{
// Format GUID properties with monospace font
return StringUtils.endsWithIgnoreCase(key, "GUID") ? HtmlStringBuilder.of(HtmlString.unsafe(""))
- .append(value).append(HtmlString.unsafe("")).getHtmlString() : HtmlString.of(value);
+ .append(value).unsafeAppend("").getHtmlString() : HtmlString.of(value);
}
}
diff --git a/api/src/org/labkey/api/assay/AssayProtocolSchema.java b/api/src/org/labkey/api/assay/AssayProtocolSchema.java
index 98fbc51def6..a2a466079a5 100644
--- a/api/src/org/labkey/api/assay/AssayProtocolSchema.java
+++ b/api/src/org/labkey/api/assay/AssayProtocolSchema.java
@@ -926,7 +926,7 @@ public HtmlString getFormattedHtml(RenderContext ctx)
}
for (Map.Entry decodedVal : decodedVals.entrySet())
{
- sb.append(HtmlString.unsafe(" "));
+ sb.unsafeAppend(" ");
sb.append(StringUtils.substringAfter(decodedVal.getKey(), ThawListResolverType.NAMESPACE_PREFIX));
sb.append(" : ");
sb.append(decodedVal.getValue());
diff --git a/api/src/org/labkey/api/data/DataColumn.java b/api/src/org/labkey/api/data/DataColumn.java
index bf455df54a4..1da8fd4b1e2 100644
--- a/api/src/org/labkey/api/data/DataColumn.java
+++ b/api/src/org/labkey/api/data/DataColumn.java
@@ -569,14 +569,14 @@ public HtmlString getFormattedHtml(RenderContext ctx)
if (getRequiresHtmlFiltering())
formatted = PageFlowUtil.filter(formatted);
- if (formatted.length() == 0)
+ if (formatted.isEmpty())
formatted = " ";
else if (isPreserveNewlines())
formatted = formatted.replaceAll("\\n", " \n");
else if (value instanceof Date)
formatted = "" + formatted + "";
- hsb.append(HtmlString.unsafe(formatted));
+ hsb.unsafeAppend(formatted);
}
return hsb.getHtmlString();
diff --git a/api/src/org/labkey/api/data/DbSchema.java b/api/src/org/labkey/api/data/DbSchema.java
index 458d886ce86..e5722aa661d 100644
--- a/api/src/org/labkey/api/data/DbSchema.java
+++ b/api/src/org/labkey/api/data/DbSchema.java
@@ -858,19 +858,19 @@ OrphanedContainer VARCHAR(60) NULL
{
new SqlSelector(coreSchema, " SELECT * FROM " + tempTableName
+ " WHERE OrphanedContainer IS NOT NULL ORDER BY 1,3").forEach(rs -> {
- sbOut.append(HtmlString.unsafe(" "))
+ sbOut.unsafeAppend(" ")
.append("ERROR: ")
.append(rs.getString(1))
- .append(HtmlString.unsafe(" "))
+ .unsafeAppend(" ")
.append(rs.getString(2))
.append("." )
.append(rs.getString(3))
.append(" = ")
.append(rs.getString(4))
- .append(HtmlString.unsafe(" "))
+ .unsafeAppend(" ")
.append("Module: ")
.append(rs.getString(5))
- .append(HtmlString.unsafe(" "))
+ .unsafeAppend(" ")
.append("Container: ")
.append(rs.getString(6))
.append("\n");
diff --git a/api/src/org/labkey/api/data/MVDisplayColumn.java b/api/src/org/labkey/api/data/MVDisplayColumn.java
index aa8e673e0e0..f9546577c36 100644
--- a/api/src/org/labkey/api/data/MVDisplayColumn.java
+++ b/api/src/org/labkey/api/data/MVDisplayColumn.java
@@ -73,10 +73,10 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep
// If we have a raw value, include it in the popup
HtmlString value = super.getFormattedHtml(ctx);
- if (value.length() != 0)
- popupText.append(HtmlString.unsafe("
The value as originally entered was: '"))
+ if (!value.isEmpty())
+ popupText.unsafeAppend("
The value as originally entered was: '")
.append(value)
- .append(HtmlString.unsafe("'.
"));
+ .unsafeAppend("'.
");
out.write("");
PageFlowUtil.popupHelp(popupText.getHtmlString(), "Missing Value Indicator: " + mvIndicator).link(HtmlString.of(mvIndicator)).appendTo(out);
diff --git a/api/src/org/labkey/api/data/RenderContext.java b/api/src/org/labkey/api/data/RenderContext.java
index a4302c7d4f1..0ffbb7ce0a4 100644
--- a/api/src/org/labkey/api/data/RenderContext.java
+++ b/api/src/org/labkey/api/data/RenderContext.java
@@ -905,8 +905,8 @@ public HtmlString getErrors(String paramName)
}
uniqueErrorStrs.add(errStr);
}
- if (builder.toString().length() > 0)
- builder.append(HtmlString.unsafe(""));
+ if (!builder.isEmpty())
+ builder.unsafeAppend("");
return builder.getHtmlString();
}
diff --git a/api/src/org/labkey/api/data/views/DataViewInfo.java b/api/src/org/labkey/api/data/views/DataViewInfo.java
index f361866972e..65b101b7c33 100644
--- a/api/src/org/labkey/api/data/views/DataViewInfo.java
+++ b/api/src/org/labkey/api/data/views/DataViewInfo.java
@@ -59,6 +59,7 @@ public interface DataViewInfo
@Nullable String getSchemaName();
@Nullable String getQueryName();
@Nullable String getViewName();
+ @Nullable String getDataRegionName();
boolean isVisible(); // specifies whether this view is hidden
boolean showInDashboard(); // an optional visibility level
diff --git a/api/src/org/labkey/api/data/views/DataViewService.java b/api/src/org/labkey/api/data/views/DataViewService.java
index 453512b0217..8987aff98ee 100644
--- a/api/src/org/labkey/api/data/views/DataViewService.java
+++ b/api/src/org/labkey/api/data/views/DataViewService.java
@@ -197,6 +197,8 @@ public JSONObject toJSON(User user, DataViewInfo info)
o.put("queryName", info.getQueryName());
if (info.getViewName() != null)
o.put("viewName", info.getViewName());
+ if (info.getDataRegionName() != null)
+ o.put("dataRegionName", info.getDataRegionName());
if (info.getDefaultIconCls() != null)
o.put("defaultIconCls", info.getDefaultIconCls());
diff --git a/api/src/org/labkey/api/data/views/DefaultViewInfo.java b/api/src/org/labkey/api/data/views/DefaultViewInfo.java
index 9d284ab9aa0..9c6fc0b2756 100644
--- a/api/src/org/labkey/api/data/views/DefaultViewInfo.java
+++ b/api/src/org/labkey/api/data/views/DefaultViewInfo.java
@@ -72,6 +72,7 @@ public class DefaultViewInfo implements DataViewInfo
private String _schemaName;
private String _queryName;
private String _viewName;
+ private String _dataRegionName;
private int _displayOrder;
@@ -436,6 +437,18 @@ public void setQueryName(String queryName)
public void setViewName(String viewName) { _viewName = viewName; }
+ @Nullable
+ @Override
+ public String getDataRegionName()
+ {
+ return _dataRegionName;
+ }
+
+ public void setDataRegionName(String dataRegionName)
+ {
+ _dataRegionName = dataRegionName;
+ }
+
@Override
public int getDisplayOrder() {return _displayOrder; }
diff --git a/api/src/org/labkey/api/exp/OntologyManager.java b/api/src/org/labkey/api/exp/OntologyManager.java
index bff82b80f8e..8377f584e04 100644
--- a/api/src/org/labkey/api/exp/OntologyManager.java
+++ b/api/src/org/labkey/api/exp/OntologyManager.java
@@ -3748,7 +3748,7 @@ private static void doProjectColumnCheck(final String descriptorTable, final Str
{
fixProjectColumn(descriptorTable, uriColumn, idColumn, container, projectId, newProjectId);
msgBuilder
- .append(HtmlString.unsafe(" "))
+ .unsafeAppend(" ")
.append("Fixed inconsistent project ids found for ")
.append(descriptorTable).append(" in folder ")
.append(ContainerManager.getForId(containerId).getPath());
@@ -3756,7 +3756,7 @@ private static void doProjectColumnCheck(final String descriptorTable, final Str
}
else
msgBuilder
- .append(HtmlString.unsafe(" "))
+ .unsafeAppend(" ")
.append("ERROR: Inconsistent project ids found for ")
.append(descriptorTable).append(" in folder ").append(container.getPath());
}
diff --git a/api/src/org/labkey/api/jsp/JspBase.java b/api/src/org/labkey/api/jsp/JspBase.java
index 88ddfdd3e14..6f9b3522af2 100644
--- a/api/src/org/labkey/api/jsp/JspBase.java
+++ b/api/src/org/labkey/api/jsp/JspBase.java
@@ -16,7 +16,6 @@
package org.labkey.api.jsp;
-import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONArray;
@@ -71,9 +70,8 @@
import static org.labkey.api.util.PageFlowUtil.filter;
/**
- * Base class for nearly all JSP pages that we use.
- * This is the place to put methods that will be useful to lots
- * of pages, regardless of what they do, or what module they are in.
+ * Base class for nearly all JSP pages that we use. This is the place to put methods that will be useful to lots of
+ * pages, regardless of what they do, or what module they are in.
*
* BE VERY CAREFUL NOT TO ADD POORLY NAMED METHODS TO THIS CLASS!!!!
*
@@ -120,7 +118,7 @@ public User getUser()
// Encoded version of the context path
public HtmlString getContextPath()
{
- return HtmlString.of(_viewContext.getContextPath());
+ return h(_viewContext.getContextPath());
}
/**
@@ -132,7 +130,7 @@ public HtmlString getContextPath()
*/
public HtmlString getWebappURL(String path)
{
- return HtmlString.of(PageFlowUtil.staticResourceUrl(path));
+ return h(PageFlowUtil.staticResourceUrl(path));
}
/**
@@ -195,7 +193,7 @@ public HtmlString unsafe(CharSequence cs)
* Html escape a string.
* The name comes from Embedded Ruby.
*/
- public HtmlString h(String str)
+ public static HtmlString h(String str)
{
return HtmlString.of(str);
}
@@ -204,32 +202,32 @@ public HtmlString h(String str)
* Html escape an object.toString().
* The name comes from Embedded Ruby.
*/
- public HtmlString h(Object o)
+ public static HtmlString h(Object o)
{
- return HtmlString.of(o == null ? null : o.toString());
+ return h(o == null ? null : o.toString());
}
/**
* Html escape a string.
* The name comes from Embedded Ruby.
*/
- public HtmlString h(String str, boolean encodeSpace)
+ public static HtmlString h(String str, boolean encodeSpace)
{
return HtmlString.of(str, encodeSpace);
}
- public HtmlString h(URLHelper url)
+ public static HtmlString h(URLHelper url)
{
- return HtmlString.of(url == null ? null : url.toString());
+ return h(url == null ? null : url.toString());
}
// Note: If you have a stream, use LabKeyCollectors.toJsonArray()
- public JSONArray toJsonArray(Collection> c)
+ public static JSONArray toJsonArray(Collection> c)
{
return new JSONArray(c);
}
- public JSONObject toJsonObject(Map, ?> c)
+ public static JSONObject toJsonObject(Map, ?> c)
{
return new JSONObject(c);
}
@@ -239,7 +237,7 @@ public JSONObject toJsonObject(Map, ?> c)
* @param indentFactor Number of spaces to add to each level of indentation
* @return JavaScriptFragment holding the JSON representation
*/
- public JavaScriptFragment json(JSONArray array, int indentFactor)
+ public static JavaScriptFragment json(JSONArray array, int indentFactor)
{
return JavaScriptFragment.unsafe(array.toString(indentFactor));
}
@@ -249,7 +247,7 @@ public JavaScriptFragment json(JSONArray array, int indentFactor)
* @param indentFactor Number of spaces to add to each level of indentation
* @return JavaScriptFragment holding the JSON representation
*/
- public JavaScriptFragment json(JSONObject jsonObject, int indentFactor)
+ public static JavaScriptFragment json(JSONObject jsonObject, int indentFactor)
{
return JavaScriptFragment.unsafe(jsonObject.toString(indentFactor));
}
@@ -333,7 +331,7 @@ public JavaScriptFragment jsURL(@NotNull URLHelper url)
}
- private static final HtmlString CHECKED = HtmlString.of(" checked");
+ private static final HtmlString CHECKED = h(" checked");
/** Returns " checked" (if true) or "" (false) */
public HtmlString checked(boolean checked)
@@ -667,22 +665,16 @@ public List getErrorsForPath(String path)
return l;
}
- public String formatErrorsForPathStr(String path)
+ public @NotNull HtmlString formatErrorsForPath(String path)
{
List l = getErrorsForPath(path);
return _formatErrorList(l, false);
}
- public HtmlString formatErrorsForPath(String path)
- {
- return HtmlString.unsafe(formatErrorsForPathStr(path));
- }
-
- //Set _returnedErrors = new HashSet();
- IdentityHashMap _returnedErrors = new IdentityHashMap<>();
+ private final IdentityHashMap _returnedErrors = new IdentityHashMap<>();
// For extra credit, return list of errors not returned by formatErrorsForPath() or formatErrorForPath()
- public List getMissedErrors(String bean)
+ public @NotNull List getMissedErrors(String bean)
{
Errors errors = getErrors(bean);
ArrayList missed = new ArrayList<>();
@@ -701,60 +693,51 @@ public List getMissedErrors(String bean)
return missed;
}
- protected String formatMissedErrorsStr(String bean)
+ protected @NotNull HtmlString formatMissedErrors(String bean)
{
List l = getMissedErrors(bean);
// fieldNames==true is ugly, but these errors are probably not displayed in the right place on the form
return _formatErrorList(l, true);
}
- protected HtmlString formatMissedErrors(String bean)
- {
- return HtmlString.unsafe(formatMissedErrorsStr(bean));
- }
-
- protected HtmlString formatMissedErrors(String bean, String prefix, String suffix)
- {
- String str = formatMissedErrorsStr(bean);
- if (StringUtils.isEmpty(str))
- return HtmlString.of(str);
- else
- return HtmlString.unsafe(prefix + str + suffix);
- }
-
// If errors exist, returns formatted errors in a
with the specified colspan (or no colspan, for 0 or 1) followed by a blank line
- // If no errors, returns an empty string
- protected HtmlString formatMissedErrorsInTable(String bean, int colspan)
+ // If no errors, returns an empty HtmlString
+ protected @NotNull HtmlString formatMissedErrorsInTable(String bean, int colspan)
{
- String errorHTML = formatMissedErrorsStr(bean);
+ HtmlString errorHTML = formatMissedErrors(bean);
- if (StringUtils.isEmpty(errorHTML))
- return HtmlString.of(errorHTML);
+ if (errorHTML.isEmpty())
+ return errorHTML;
else
- return HtmlString.unsafe("\n
");
}
}
diff --git a/api/src/org/labkey/api/security/AuthenticationManager.java b/api/src/org/labkey/api/security/AuthenticationManager.java
index 50f442fc439..cbc7506b4ec 100644
--- a/api/src/org/labkey/api/security/AuthenticationManager.java
+++ b/api/src/org/labkey/api/security/AuthenticationManager.java
@@ -1584,9 +1584,9 @@ public HtmlString getImg(AuthLogoType logoType)
{
HtmlString message = HtmlString.of("Sign in using " + _configuration.getDescription());
return HtmlStringBuilder.of(HtmlString.unsafe("")).getHtmlString();
+ .unsafeAppend("\" alt=\"").append(message)
+ .unsafeAppend("\" title=\"").append(message)
+ .unsafeAppend("\" height=\"").append(logoType.getHeight()).unsafeAppend("px\">").getHtmlString();
}
}
catch (RuntimeSQLException e)
diff --git a/api/src/org/labkey/api/security/SecurityManager.java b/api/src/org/labkey/api/security/SecurityManager.java
index fdb510629ba..1540f005b4b 100644
--- a/api/src/org/labkey/api/security/SecurityManager.java
+++ b/api/src/org/labkey/api/security/SecurityManager.java
@@ -2534,9 +2534,9 @@ else if (sendMail)
if (currentUser.hasSiteAdminPermission())
{
message.append(" Click ");
- message.append(HtmlString.unsafe("here"));
+ message.unsafeAppend("\" target=\"_blank\">here");
message.append(" to change the password from the random one that was assigned.");
}
@@ -2547,9 +2547,9 @@ else if (sendMail)
{
message.append(HtmlString.BR);
message.append(email.getEmailAddress());
- message.append(HtmlString.unsafe(" was added successfully, but could not be emailed due to a failure:
"));
+ message.unsafeAppend(" was added successfully, but could not be emailed due to a failure:
");
appendMailHelpText(message, messageContentsURL, currentUser.hasRootPermission(AddUserPermission.class));
User newUser = UserManager.getUser(email);
@@ -2638,8 +2638,8 @@ private static void appendMailHelpText(HtmlStringBuilder builder, ActionURL mess
builder.append(" into an email client and send it to the user manually.");
}
- builder.append(HtmlString.unsafe(""));
- builder.append(HtmlString.unsafe("
For help on fixing your mail server settings, please consult the SMTP section of the "));
+ builder.unsafeAppend("
");
+ builder.unsafeAppend("
For help on fixing your mail server settings, please consult the SMTP section of the ");
builder.append(new HelpTopic("labkeyxml").getSimpleLinkHtml("LabKey documentation on modifying your configuration file"));
builder.append(".").append(HtmlString.BR);
}
@@ -2958,7 +2958,7 @@ public static void adminRotatePassword(ValidEmail email, BindException errors, C
catch (ConfigurationException | MessagingException e)
{
String message = "Failed to send email due to: " + e.getMessage();
- errors.addError(mailErrorHtml.length() != 0 ? new LabKeyErrorWithHtml(message, mailErrorHtml) : new LabKeyError(message));
+ errors.addError(!mailErrorHtml.isEmpty() ? new LabKeyErrorWithHtml(message, mailErrorHtml) : new LabKeyError(message));
UserManager.addToUserHistory(UserManager.getUser(email), user.getEmail() + " " + pastVerb + " the password, but sending the email failed.");
}
}
diff --git a/api/src/org/labkey/api/study/query/PublishResultsQueryView.java b/api/src/org/labkey/api/study/query/PublishResultsQueryView.java
index 4e48a6d58f8..aa33e99440c 100644
--- a/api/src/org/labkey/api/study/query/PublishResultsQueryView.java
+++ b/api/src/org/labkey/api/study/query/PublishResultsQueryView.java
@@ -707,11 +707,11 @@ public Pair getSampleMatchStatus(RenderContext ctx)
}
}
- HtmlStringBuilder builder = HtmlStringBuilder.of();
- builder.append(HtmlString.unsafe("
The Sample ID in this row does"));
+ HtmlStringBuilder builder = HtmlStringBuilder.of()
+ .unsafeAppend("
The Sample ID in this row does");
if (!isSampleMatched)
- builder.append(HtmlString.unsafe(" not"));
- builder.append(HtmlString.unsafe(" match a sample in the study.
"));
+ builder.unsafeAppend(" not");
+ builder.unsafeAppend(" match a sample in the study.