Class ColumnConfig
- java.lang.Object
-
- com.identityworksllc.iiq.common.iterators.ColumnConfig
-
public final class ColumnConfig extends Object
A wrapper around the various ways of structuring report columns.This object produces a standard column representation that can be consumed by various ResultSet processing classes. The properties of a column that can be represented by this class are:
column
: a required string that can be parsed byColumnToken
ifEmpty
: an optional fallback column token that can be used if the first results in nullfield
: a unique name for this columnheader
: an optional header name for this columnrenderScript
: an optional Beanshell script that can be used to further render a column value
An instance of this class can be constructed from:
- A String column token (parsed by
ColumnToken
) - A Map containing any of the above column arguments
- An IIQ
ReportColumnConfig
object (e.g., from a report executor) - Another instance of this class (to copy)
If a String column token is provided, the value for
field
will be the first component of the token.An instance of ReportColumnConfig may contain vastly more properties than are used here. This implementation is not guaranteed to have the same semantics as Sailpoint’s reporting use of that class.
-
-
Field Summary
Fields Modifier and Type Field Description static String
COLUMN_TYPE_SEPARATOR
The column token derived type separator
-
Constructor Summary
Constructors Constructor Description ColumnConfig(Object rcc)
Constructs a ColumnConfig from the given input.ColumnConfig(String column, String fallbackColumn)
Constructs a ColumnConfig with a fallback property, which will be used if the main property value is null.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColumnToken
getColumnToken()
Gets the parsed column token valueString
getField()
Gets the field name of this column.String
getHeader()
Gets the header mapped for this field.String
getIfEmpty()
Returns the ‘fallback’ column token stringColumnToken
getIfEmptyColumnToken()
Gets the column token for the ifEmpty fallback columnString
getProperty()
Returns the ‘main’ column token, e.g., “col1” or “col1:boolean”.sailpoint.object.DynamicValue
getRenderDef()
ColumnConfig
withFieldName(String fieldName)
Constructs a copy of this ColumnConfig with the given field name.ColumnConfig
withHeader(String header)
Constructs a copy of this ColumnConfig with the given header.ColumnConfig
withRenderRule(sailpoint.object.Rule rule)
Constructs a copy of this ColumnConfig with the given render rule.ColumnConfig
withRenderScript(sailpoint.object.Script script)
Constructs a copy of this ColumnConfig with the given render script.
-
-
-
Field Detail
-
COLUMN_TYPE_SEPARATOR
public static final String COLUMN_TYPE_SEPARATOR
The column token derived type separator- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ColumnConfig
public ColumnConfig(Object rcc)
Constructs a ColumnConfig from the given input.The input must be a String, which will be interpreted as a column token, a ReportColumnConfig object, which will be taken as-is, a Map, or an instance of this class, which will be copied.
If you specify a Map, it must at least contain a ‘column’ value.
- Parameters:
rcc
- The input argument
-
ColumnConfig
public ColumnConfig(String column, String fallbackColumn)
Constructs a ColumnConfig with a fallback property, which will be used if the main property value is null.- Parameters:
column
- The column token to use firstfallbackColumn
- The column token to try if the first result is null (optional)
-
-
Method Detail
-
getColumnToken
public ColumnToken getColumnToken()
Gets the parsed column token value- Returns:
- The parsed column token value
-
getField
public String getField()
Gets the field name of this column.This will be the key in the Map returned from
ResultSetIterator.nextRow()
andResultSetIterator.getFieldHeaderMap()
. It is NOT used in any way for SQL.The result will be equal to:
1) The value of this object's 'field' property if
withFieldName(java.lang.String)
has been used2) the value of the wrapped ReportColumnConfig's 'field'
3) Otherwise, it will be the base name of the main column without any type tokens. If the property name is 'col1:timestamp:yyyy-MM-dd', the output of this method would be 'col1'.
All other scenarios will result in an exception.
- Returns:
- The field name
-
getHeader
public String getHeader()
Gets the header mapped for this field.You can get a mapping from field names to headers via
ResultSetIterator.getFieldHeaderMap()
.The header will be derived as, in order:
1. The header set via
withHeader(String)
. 2. The header column on the wrapped ReportColumnConfig. 3. The result ofgetField()
- Returns:
- The header for this column (never null)
-
getIfEmpty
public String getIfEmpty()
Returns the ‘fallback’ column token string- Returns:
- The column token string to use if the main column is null
-
getIfEmptyColumnToken
public ColumnToken getIfEmptyColumnToken()
Gets the column token for the ifEmpty fallback column- Returns:
- The column token, if one exists, or else null
-
getProperty
public String getProperty()
Returns the ‘main’ column token, e.g., “col1” or “col1:boolean”.The first part of this value will be the name of the column extracted from the SQL ResultSet. The remaining parts will be used for type derivation, if needed.
This will either be the value of ‘column’ or the property field on a ReportColumnConfig. This is also the value parsed as the primary column token.
- Returns:
- The column token string to read
-
getRenderDef
public sailpoint.object.DynamicValue getRenderDef()
-
withFieldName
public ColumnConfig withFieldName(String fieldName)
Constructs a copy of this ColumnConfig with the given field name.- Parameters:
fieldName
- The field name to set in the copied ColumnConfig- Returns:
- A new ColumnConfig object with the field name set to that value
-
withHeader
public ColumnConfig withHeader(String header)
Constructs a copy of this ColumnConfig with the given header.- Parameters:
header
- The header to set in the copied ColumnConfig- Returns:
- A new ColumnConfig object with the header
-
withRenderRule
public ColumnConfig withRenderRule(sailpoint.object.Rule rule)
Constructs a copy of this ColumnConfig with the given render rule.The Rule object will NOT be copied, so you must ensure that it is properly detached from the context or that the rules will always run in the context that loaded the Rule object.
- Parameters:
rule
- The rule object- Returns:
- A new ColumnConfig object with the renderRule set to the given Rule
-
withRenderScript
public ColumnConfig withRenderScript(sailpoint.object.Script script)
Constructs a copy of this ColumnConfig with the given render script.The Script object itself will also be copied to avoid caching thread-safety problems.
- Parameters:
script
- The render script- Returns:
- A new ColumnConfig object with the renderScript set to the given Script
-
-