Package com.boomi.connector.api
Class RequestUtil
- java.lang.Object
-
- com.boomi.connector.api.RequestUtil
-
public class RequestUtil extends Object
Utility methods for handling requests.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATOM_DATE_FORMAT
date format used internally by the Boomi Atom
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ClassLoader
getCurrentContextClassLoader()
Returns the ClassLoader for the current thread (callsThread.getContextClassLoader()
).static <T> Iterable<List<T>>
pageIterable(Iterable<T> iterable, int connectorMaxPageSize, AtomConfig config)
Returns an Iterable which generates "pages" of elements from the given Iterable.static <T> Iterable<List<T>>
pageIterable(Iterable<T> iterable, AtomConfig config)
Returns an Iterable which generates "pages" of elements from the given Iterable.static Date
parseAtomDateString(String dateStr)
Returns a Date parsed from a date string formatted using the Boomi Atom internal date format "yyyyMMdd HHmmss.SSS".static void
setCurrentContextClassLoader(ClassLoader loader)
Sets the context ClassLoader of the current thread (callsThread.setContextClassLoader(java.lang.ClassLoader)
).
-
-
-
Field Detail
-
ATOM_DATE_FORMAT
public static final String ATOM_DATE_FORMAT
date format used internally by the Boomi Atom- See Also:
- Constant Field Values
-
-
Method Detail
-
parseAtomDateString
public static Date parseAtomDateString(String dateStr) throws ParseException
Returns a Date parsed from a date string formatted using the Boomi Atom internal date format "yyyyMMdd HHmmss.SSS". Useful for handling date strings passed into a connector as query parameters.- Parameters:
dateStr
- the date string to parse, may benull
- Returns:
- a valid Date, or
null
if the given date string was blank ornull
- Throws:
ParseException
-
setCurrentContextClassLoader
public static void setCurrentContextClassLoader(ClassLoader loader)
Sets the context ClassLoader of the current thread (callsThread.setContextClassLoader(java.lang.ClassLoader)
). Note, however, that this call is made with the security context of the Connector SDK only, and therefore will succeed when a direct call to will fail.- Parameters:
loader
- the new context ClassLoader for the current thread
-
getCurrentContextClassLoader
public static ClassLoader getCurrentContextClassLoader()
Returns the ClassLoader for the current thread (callsThread.getContextClassLoader()
).- Returns:
- the context ClassLoader for the current thread
-
pageIterable
public static <T> Iterable<List<T>> pageIterable(Iterable<T> iterable, int connectorMaxPageSize, AtomConfig config)
Returns an Iterable which generates "pages" of elements from the given Iterable. The pageSize is the minimum of the given connectorPageSize and the AtomConfig maximum page size.- Parameters:
iterable
- source Iterable of elementsconnectorMaxPageSize
- max connector page sizeconfig
- atom configuration- Returns:
- Iterable which generates pages of elements
-
pageIterable
public static <T> Iterable<List<T>> pageIterable(Iterable<T> iterable, AtomConfig config)
Returns an Iterable which generates "pages" of elements from the given Iterable. The pageSize is the AtomConfig maximum page size.- Parameters:
iterable
- source Iterable of elementsconfig
- atom configuration- Returns:
- Iterable which generates pages of elements
-
-