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 booleancompactHistoryprotected static Map<String,String>historyPreferencestatic org.slf4j.Loggerloggerprotected static StringNO_URLprotected static StringREDUCED_HISTORY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static voidconfigure()static StringconfigureHistoryCase(String fileType)Check if fileType in PayloadUtil.cfg matches current payload fileTypestatic StringgetName(Object o)Try really hard to get a meaningful name for a payload objectstatic StringgetPayloadDisplayString(IBaseDataObject payload)Generate a string about the payload objectstatic StringgetPayloadDisplayString(IBaseDataObject payload, boolean oneLine)Generate a string about the payload objectstatic StringgetPayloadOneLineString(IBaseDataObject payload)Generate a one-line string about the payload objectstatic booleanisValidForm(String form)Checks whether the form complies with form rules established by a regex Approved forms can contain alpha-numerics, '-', '_', '()', '/', '+'static StringprintFormattedMetadata(IBaseDataObject payload)protected static voidsetFileTypeHistoryPreference(String fileType, String preference)Check if fileType is already mapped to history preference.static org.jdom2.DocumenttoXml(IBaseDataObject d)Turn the payload into an xml jdom documentstatic org.jdom2.DocumenttoXml(List<IBaseDataObject> list)Turn a list of payload into an xml jdom ocumentstatic StringtoXmlString(IBaseDataObject d)Turn the payload into an xml stringstatic StringtoXmlString(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
-
-