public class KeepUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static io.vertx.core.json.JsonObject |
addEtag(io.vertx.core.json.JsonObject source,
java.util.Calendar dateSource)
Adds a standardized ETAG to a JsonObject based on a provided Calendar value
|
static io.vertx.core.json.JsonObject |
addEtag(io.vertx.core.json.JsonObject source,
java.time.OffsetDateTime dateSource)
Adds a standardized ETAG to a JsonObject based on a provided Calendar value
|
static double |
calcRunTimeSecondsDbl(long startTime) |
static java.lang.String |
cleanupApiName(java.lang.String curApiName)
removes special characters from API names
|
static io.vertx.core.json.JsonArray |
cleanupJSResults(io.vertx.core.json.JsonArray raw) |
static io.vertx.core.json.JsonObject |
fromDateRange(com.hcl.domino.data.DominoDateRange range)
Converts a date range into a JSON object
|
static java.time.OffsetDateTime |
fromIsoDate(java.lang.String isoString) |
static java.lang.String |
generateAppIdOrSecret()
Generates key for Application ID or Secret
|
static java.lang.Object |
getAsJson(java.lang.String jsonString)
Removes all blank lines from a String and converts it to JSON, if possible
|
static io.vertx.core.buffer.Buffer |
getBufferFromResource(java.lang.String resourceName)
Loads a Classpath resource into a buffer
|
static java.util.Map<java.lang.String,io.vertx.core.json.JsonObject> |
getEnabledJsonFromConfig(java.lang.String key,
io.vertx.core.json.JsonObject config)
Returns all JsonObjects where the JsonObject has a property active with the vaue “true” - used to switch on/off elements
|
static java.util.Set<java.lang.String> |
getEnabledValuesFromConfig(java.lang.String key,
io.vertx.core.json.JsonObject config)
Returns all keys where the value is “true” - used to switch on/off features
|
static io.vertx.core.json.JsonArray |
getEnvironmentParamsToRead()
Names all parameters that can be overwritten / defined by environment variables
|
static java.lang.String |
getIcon(java.lang.String iconName)
Provides one of our lovely database icons
|
static io.vertx.core.json.JsonObject |
getJsonFromResource(java.lang.String resourceName) |
static io.vertx.core.json.JsonObject |
getJsonObjectFromMap(java.util.Map<java.lang.String,java.lang.String> source) |
static java.lang.Throwable |
getKeepException(java.lang.Throwable incomingThrowable)
Helper function to turn any Throwable into a KeepException for proper processing on return to client
|
static java.util.Map<java.lang.String,java.lang.String> |
getMapFromResource(java.lang.String resourceName) |
static java.util.Map<java.lang.String,java.lang.String> |
getMapFromResource(java.lang.String resourceName,
java.lang.String separator) |
static io.vertx.core.http.HttpServerOptions |
getServerOptions(java.lang.String portType,
int portDefault,
io.vertx.core.json.JsonObject config)
Constructing options for HTTP server
|
static java.lang.String |
getStringFromFile(java.lang.String fileName) |
static java.lang.String |
getStringFromResource(java.lang.String resourceName) |
static java.lang.String |
hashString(java.lang.String source)
Produces a light hash of an incoming string
|
static java.lang.String |
isoDate(com.hcl.domino.data.DominoDateTime dDT)
Returns a date as ISO formatted string
|
static java.lang.String |
isoDate(java.time.OffsetDateTime value)
Returns a OffsetDateTime as ISO formatted string
|
static io.vertx.core.Future<io.vertx.core.json.JsonObject> |
loadConfiguration(io.vertx.core.Vertx vertx,
java.lang.String configDirName)
Retrieves config based on value is increating priority: - Default config from Jar - config from command line - environment parameters
|
static boolean |
looksLikeAnUnid(java.lang.String candidate)
Checks if a given String looks like an UNID: - 32 characters long - contains ony HEX characters 0-9 A-F
|
static java.lang.String |
replaceNamedVars(java.lang.String source,
io.vertx.core.json.JsonObject dqlVars)
Poor man’s query parameter replacement Special handling: replace ‘ with ’’ to avoid injections
|
static boolean |
seemsValidXmlFile(java.io.File xmlFile)
Check if a file is valid xml
|
static java.lang.String |
timediff(java.util.Date theEnd,
java.util.Date startDate) |
static java.lang.String |
timediff(long diff) |
static void |
writeTextItemEmptyIfNull(com.hcl.domino.data.Document note,
java.lang.String itemName,
java.lang.Object itemValue)
Writes an Item to a Note, replaces null with an empty string
|
public static io.vertx.core.json.JsonObject addEtag(io.vertx.core.json.JsonObject source,
java.util.Calendar dateSource)
Adds a standardized ETAG to a JsonObject based on a provided Calendar value
source - JsonObject that needs the ETAG addeddateSource - Calendar with the Date/Time for the eTagpublic static io.vertx.core.json.JsonObject addEtag(io.vertx.core.json.JsonObject source,
java.time.OffsetDateTime dateSource)
Adds a standardized ETAG to a JsonObject based on a provided Calendar value
source - JsonObject that needs the ETAG addeddateSource - Calendar with the Date/Time for the eTagpublic static double calcRunTimeSecondsDbl(long startTime)
startTime - public static java.lang.String cleanupApiName(java.lang.String curApiName)
removes special characters from API names
curApiName - public static io.vertx.core.json.JsonArray cleanupJSResults(io.vertx.core.json.JsonArray raw)
raw - JsonArray with results, might contain “Json ready strings”public static io.vertx.core.json.JsonObject fromDateRange(com.hcl.domino.data.DominoDateRange range)
Converts a date range into a JSON object
range - DominoDateRangepublic static java.time.OffsetDateTime fromIsoDate(java.lang.String isoString)
isoString - public static java.lang.String generateAppIdOrSecret()
Generates key for Application ID or Secret
public static java.lang.Object getAsJson(java.lang.String jsonString)
Removes all blank lines from a String and converts it to JSON, if possible
jsonString - to convertpublic static io.vertx.core.buffer.Buffer getBufferFromResource(@Nonnull
java.lang.String resourceName)
Loads a Classpath resource into a buffer
resourceName - name of the resourcepublic static java.util.Map<java.lang.String,io.vertx.core.json.JsonObject> getEnabledJsonFromConfig(@Nonnull
java.lang.String key,
@Nonnull
io.vertx.core.json.JsonObject config)
Returns all JsonObjects where the JsonObject has a property active with the vaue “true” - used to switch on/off elements
key - config - public static java.util.Set<java.lang.String> getEnabledValuesFromConfig(java.lang.String key,
io.vertx.core.json.JsonObject config)
Returns all keys where the value is “true” - used to switch on/off features
key - config - public static io.vertx.core.json.JsonArray getEnvironmentParamsToRead()
Names all parameters that can be overwritten / defined by environment variables
public static java.lang.String getIcon(java.lang.String iconName)
Provides one of our lovely database icons
iconName - public static io.vertx.core.json.JsonObject getJsonFromResource(@Nonnull
java.lang.String resourceName)
resourceName - public static io.vertx.core.json.JsonObject getJsonObjectFromMap(java.util.Map<java.lang.String,java.lang.String> source)
source - a Map with key/value pairspublic static java.lang.Throwable getKeepException(java.lang.Throwable incomingThrowable)
Helper function to turn any Throwable into a KeepException for proper processing on return to client
incomingThrowable - public static java.util.Map<java.lang.String,java.lang.String> getMapFromResource(@Nonnull
java.lang.String resourceName)
resourceName - Name of resource to be read, separated by “=”public static java.util.Map<java.lang.String,java.lang.String> getMapFromResource(@Nonnull
java.lang.String resourceName,
java.lang.String separator)
resourceName - Name of resource to be readseparator - separator for key/value, “=” if null, values must not contain separatorpublic static io.vertx.core.http.HttpServerOptions getServerOptions(java.lang.String portType,
int portDefault,
io.vertx.core.json.JsonObject config)
Constructing options for HTTP server
portType - which port constant to use to retrieve from configportDefault - default port, if nothing in configconfig - config from which to retrieve the portpublic static java.lang.String getStringFromFile(@Nonnull
java.lang.String fileName)
fileName - public static java.lang.String getStringFromResource(@Nonnull
java.lang.String resourceName)
resourceName - public static java.lang.String hashString(java.lang.String source)
Produces a light hash of an incoming string
source - public static java.lang.String isoDate(com.hcl.domino.data.DominoDateTime dDT)
Returns a date as ISO formatted string
dDT - public static java.lang.String isoDate(java.time.OffsetDateTime value)
Returns a OffsetDateTime as ISO formatted string
value - public static io.vertx.core.Future<io.vertx.core.json.JsonObject> loadConfiguration(@Nonnull
io.vertx.core.Vertx vertx,
@Nonnull
java.lang.String configDirName)
Retrieves config based on value is increating priority: - Default config from Jar - config from command line - environment parameters
vertx - configDirName - public static boolean looksLikeAnUnid(java.lang.String candidate)
Checks if a given String looks like an UNID: - 32 characters long - contains ony HEX characters 0-9 A-F
candidate - the String to checkpublic static java.lang.String replaceNamedVars(java.lang.String source,
io.vertx.core.json.JsonObject dqlVars)
Poor man’s query parameter replacement Special handling: replace ‘ with ’’ to avoid injections
source - dqlVars - public static boolean seemsValidXmlFile(java.io.File xmlFile)
Check if a file is valid xml
xmlFile - public static java.lang.String timediff(java.util.Date theEnd,
java.util.Date startDate)
theEnd - startDate - public static java.lang.String timediff(long diff)
diff - public static void writeTextItemEmptyIfNull(com.hcl.domino.data.Document note,
java.lang.String itemName,
java.lang.Object itemValue)
Writes an Item to a Note, replaces null with an empty string
note - Document to write toitemName - Item name to write toitemValue - Item value, might be null