Package emissary.util
Class PayloadUtil
- java.lang.Object
-
- emissary.util.PayloadUtil
-
public class PayloadUtil extends Object
Utilities for dealing with IBaseDataObject and Lists thereof
-
-
Field Summary
Fields Modifier and Type Field Description protected static boolean
compactHistory
protected static Map<String,String>
historyPreference
static org.slf4j.Logger
logger
protected static String
NO_URL
protected static String
REDUCED_HISTORY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static void
configure()
static String
configureHistoryCase(String fileType)
Check if fileType in PayloadUtil.cfg matches current payload fileTypestatic String
getName(Object o)
Try really hard to get a meaningful name for a payload objectstatic String
getPayloadDisplayString(IBaseDataObject payload)
Generate a string about the payload objectstatic String
getPayloadDisplayString(IBaseDataObject payload, boolean oneLine)
Generate a string about the payload objectstatic String
getPayloadOneLineString(IBaseDataObject payload)
Generate a one-line string about the payload objectstatic boolean
isValidForm(String form)
Checks whether the form complies with form rules established by a regex Approved forms can contain alpha-numerics, '-', '_', '()', '/', '+'static String
printFormattedMetadata(IBaseDataObject payload)
protected static void
setFileTypeHistoryPreference(String fileType, String preference)
Check if fileType is already mapped to history preference.static org.jdom2.Document
toXml(IBaseDataObject d)
Turn the payload into an xml jdom documentstatic org.jdom2.Document
toXml(List<IBaseDataObject> list)
Turn a list of payload into an xml jdom ocumentstatic String
toXmlString(IBaseDataObject d)
Turn the payload into an xml stringstatic String
toXmlString(List<IBaseDataObject> list)
Turn the payload list into an xml string
-
-
-
Field Detail
-
logger
public static final org.slf4j.Logger logger
-
REDUCED_HISTORY
protected static final String REDUCED_HISTORY
- See Also:
- Constant Field Values
-
NO_URL
protected static final String NO_URL
- See Also:
- Constant Field Values
-
compactHistory
protected static boolean compactHistory
-
-
Method Detail
-
configure
protected static void configure()
-
setFileTypeHistoryPreference
protected static void setFileTypeHistoryPreference(String fileType, String preference)
Check if fileType is already mapped to history preference. If not, set fileType -$gt; preference in map- Parameters:
fileType
- current fileType pulled from cfgpreference
- preference associated with current cfg fileType
-
getName
public static String getName(Object o)
Try really hard to get a meaningful name for a payload object
-
getPayloadDisplayString
public static String getPayloadDisplayString(IBaseDataObject payload, boolean oneLine)
Generate a string about the payload object- Parameters:
payload
- the payload to describeoneLine
- true for a condensed one-line string
-
getPayloadDisplayString
public static String getPayloadDisplayString(IBaseDataObject payload)
Generate a string about the payload object- Parameters:
payload
- the payload to describe
-
configureHistoryCase
public static String configureHistoryCase(String fileType)
Check if fileType in PayloadUtil.cfg matches current payload fileType- Parameters:
fileType
- current payload fileType- Returns:
- string for output case
-
getPayloadOneLineString
public static String getPayloadOneLineString(IBaseDataObject payload)
Generate a one-line string about the payload object- Parameters:
payload
- the payload to describe
-
toXml
public static org.jdom2.Document toXml(IBaseDataObject d)
Turn the payload into an xml jdom document- Parameters:
d
- the payload
-
toXml
public static org.jdom2.Document toXml(List<IBaseDataObject> list)
Turn a list of payload into an xml jdom ocument- Parameters:
list
- the payload list
-
toXmlString
public static String toXmlString(IBaseDataObject d)
Turn the payload into an xml string- Parameters:
d
- the payload
-
toXmlString
public static String toXmlString(List<IBaseDataObject> list)
Turn the payload list into an xml string- Parameters:
list
- the payload list
-
printFormattedMetadata
public static String printFormattedMetadata(IBaseDataObject payload)
-
isValidForm
public static boolean isValidForm(String form)
Checks whether the form complies with form rules established by a regex Approved forms can contain alpha-numerics, '-', '_', '()', '/', '+'- Parameters:
form
- The form to be tested- Returns:
- Whether the form is Emissary compliant
-
-