Package com.seeq.utilities
Class SeeqStrings
java.lang.Object
com.seeq.utilities.SeeqStrings
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionA variant of Guava's Preconditions formatter that substitutes each{}
intemplate
with an argument.static String
getGuidString
(UUID guid) Convert a GUID to its uppercase string representationstatic UUID
Some interfaces, such as the BatchSignalDriver specify a String id, but internally many connectors useUUID
* ids to store the data.static String
removeHtml
(String html) Removes HTML from the passed string using the OWASP Java HTML Sanitizer.static String
sanitizeHtml
(String html) Sanitizes the passed string using the OWASP Java HTML Sanitizer.
-
Field Details
-
EMPTY_GUID
- See Also:
-
-
Constructor Details
-
SeeqStrings
public SeeqStrings()
-
-
Method Details
-
format
A variant of Guava's Preconditions formatter that substitutes each{}
intemplate
with an argument. Intended to match Slf4j's style. These are matched by position: the first{}
getsargs[0]
, etc. If there are more arguments than place holders, the unmatched arguments will be appended to the end of the formatted message in square braces.- Parameters:
template
- A string containing 0 or more{}
place holders. null is treated as "null".args
- The arguments to be substituted into the message template. Arguments are converted to strings usingString.valueOf(Object)
. Arguments can be null.
-
parseUUID
Some interfaces, such as the BatchSignalDriver specify a String id, but internally many connectors useUUID
* ids to store the data. This method should be used to parse data ids into UUIDs as it will ensure that if the * id is not a UUID it will be converted into one. See CRAB-8909.- Parameters:
id
- A string ID to encode as a UUID using an MD5 hash.- Returns:
- The UUID encoding of the string id.
-
getGuidString
Convert a GUID to its uppercase string representation- Parameters:
guid
- TheUUID
to convert to a string representation- Returns:
- An uppercase string representation of the GUID
-
sanitizeHtml
Sanitizes the passed string using the OWASP Java HTML Sanitizer. This will filter out script blocks, make sure only certain attributes are allowed, add rel attribute to links specifying the browser not to pass on any information etc.- Parameters:
html
- The string to sanitize- Returns:
- The sanitized string
-
removeHtml
Removes HTML from the passed string using the OWASP Java HTML Sanitizer. This should only leave plaintext.- Parameters:
html
- The string to de-html- Returns:
- The de-htmled string
-