public class HeaderDescriptor extends AbstractDescriptor
| Modifier and Type | Class and Description |
|---|---|
static interface |
HeaderDescriptor.AttributeConstraintFilter
Filter which decides if an attribute has to be treated as mandatory and initial only.
|
protected static class |
HeaderDescriptor.DefaultAttributeConstraintFilter
Default implementation of an attribute constraint filter which decides for mandatory if the attributeis not
private and not optional and for initial only if it is not writable and and initial.
|
protected class |
HeaderDescriptor.PermittedTypeMapping
Object representing one permitted type ex- or importable by this header.
|
AbstractDescriptor.ColumnParams, AbstractDescriptor.DescriptorParams, AbstractDescriptor.HeaderParams| Constructor and Description |
|---|
HeaderDescriptor(ImpExReader reader,
java.lang.String expr,
AbstractDescriptor.DescriptorParams headerParams,
java.lang.String location,
DocumentIDRegistry docIDRegistry)
Non-parsing constructor - Creates a new header instance.
|
HeaderDescriptor(ImpExReader reader,
java.lang.String expr,
java.util.List<java.lang.String> columnExpressions,
java.lang.String location,
DocumentIDRegistry docIDRegistry)
Self-parsing constructor - Creates a new header instance.
|
HeaderDescriptor(ImpExReader reader,
java.lang.String expr,
java.util.List<java.lang.String> columnExpressions,
java.lang.String location,
DocumentIDRegistry docIDRegistry,
HeaderValidationException headerException) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addOmittedTypeMessage(PK typePK,
java.lang.String msg)
Adds an message to the omitted type messages list.
|
protected void |
adjustValuePositions()
Discovers all virtual columns and removes them from the column range
[0,x]. |
protected ComposedType |
calculateDefaultComposedType()
Calculates the top-most permitted composed type starting at configured type.
|
protected HeaderDescriptor.PermittedTypeMapping |
calculatePermittedType(ComposedType ct)
Creates a
HeaderDescriptor.PermittedTypeMapping for given composed type. |
protected java.util.Map<java.lang.String,HeaderDescriptor.PermittedTypeMapping> |
calculatePermittedTypes()
Filters any composed (sub)type which doesn't fit the currently configured columns.
|
java.util.Set<StandardColumnDescriptor> |
calculateUniqueAttributeColumns()
Gets the configured columns which are describing attributes of the default composed type (see
getDefaultComposedType()) and are unique. |
protected java.util.Set<StandardColumnDescriptor> |
calculateUniqueAttributeColumns(ComposedType targetType)
Gets all columns configured at header which are describing an attribute of given type and are unique.
|
protected HeaderCellTranslator |
createTranslator(java.lang.String expr)
Creates the translator class which parses the own definition text of this descriptor.
|
void |
debug(java.lang.String msg)
Deprecated.
since ages - use logging method
Logger#debug(Object) directly |
java.util.Map<java.lang.Integer,java.lang.String> |
dump()
Gets the header as list of Strings for dumping purposes.
|
void |
error(java.lang.String msg)
Deprecated.
since ages - use logging method
Logger#error(Object) directly |
protected ComposedType |
findConfiguredComposedType()
Tries to gather the composed type instance configured in header line.
|
java.util.List<java.lang.String> |
getAllColumnQualifiers()
Gets a list of all configured columns represented by their qualifier.
|
java.util.Set<StandardColumnDescriptor> |
getAllColumns(ComposedType targetType)
Gets all columns for given composed type.
|
java.util.List<AbstractColumnDescriptor> |
getColumns()
Gets the column descriptors configured for this header.
|
protected java.util.Collection<StandardColumnDescriptor> |
getColumnsByAttribute(AttributeDescriptor ad)
Searches the set of configured columns for columns which are describing given type attribute (which are mapped to
this descriptor).
|
java.util.Collection<AbstractColumnDescriptor> |
getColumnsByQualifier(java.lang.String qualifier)
Searches the set of configured columns for columns with given qualifier.
|
java.util.Set<StandardColumnDescriptor> |
getColumnsForCreation(ComposedType targetType)
Deprecated.
since ages - use
getColumnsForCreation(String) instead |
java.util.Set<StandardColumnDescriptor> |
getColumnsForCreation(java.lang.String targetTypeCode)
Gets all permitted columns for given composed type's code which are not
read-only
and part-of.
These columns has to be used for creation case.
|
java.util.Set<StandardColumnDescriptor> |
getColumnsForUpdate(ComposedType targetType)
Deprecated.
since ages - use
getColumnsForUpdate(String) instead. |
java.util.Set<StandardColumnDescriptor> |
getColumnsForUpdate(java.lang.String targetTypeCode)
Gets all permitted columns for given composed type's code which are not
read-only,
and inital-only
and unique columns.
These columns has to be used for update case.
|
ComposedType |
getConfiguredComposedType()
Returns the configured composed type, regardless of whether or not it is actually permitted by this header.
|
java.lang.String |
getConfiguredComposedTypeCode()
Returns the configured composed type, regardless of whether or not it is actually permitted by this header.
|
ComposedType |
getDefaultComposedType()
Gets the top-most permitted composed type starting at configured type (see
calculateDefaultComposedType()
. |
java.lang.String |
getDefaultComposedTypeCode()
Gets the top-most permitted composed type starting at configured type (see
calculateDefaultComposedType()
. |
DocumentIDRegistry |
getDocumentIDRegistry()
Returns the used registry for document id's.
|
java.util.Map<java.lang.String,java.lang.Object> |
getInterceptorRelatedParameters() |
HeaderValidationException |
getInvalidHeaderException()
Gets exception associated with invalid header or null if header is valid.
|
java.lang.String |
getLocation()
Gets the location of this header line within the read ImpExScript.
|
EnumerationValue |
getMode()
Gets the mode of this header configured at header line.
|
int |
getNumCols() |
java.lang.String |
getOmittedTypesMessages(PK typePK)
Gets a reason text for not omitting given type for this header.
|
java.util.Set<StandardColumnDescriptor> |
getPartOfColumns(ComposedType targetType)
Gets all permitted columns for given composed type which are
part-of
and not
read-only.
|
java.util.Set<StandardColumnDescriptor> |
getPartOfColumns(java.lang.String targetTypeCode)
Gets all permitted columns for given composed type's code which are
part-of
and not
read-only.
|
java.util.Set<java.lang.String> |
getPermittedTypeCodes()
Gets the codes of all types which are subtypes of the configured one and have passed all checks of the
calculatePermittedType(ComposedType) method. |
ImpExReader |
getReader()
Gets the reader instance which had created this header.
|
<T extends AbstractColumnDescriptor> |
getSpecificColumns(java.lang.Class<T> descriptor)
Returns a collection of all column descriptors instances which are instance of the given descriptor class.
|
java.lang.String |
getTypeCode()
Gets the code of the configured composed type of header.
|
java.util.Set<StandardColumnDescriptor> |
getUniqueAttributeColumns(ComposedType targetType)
Gets all columns for given composed type which are
unique.
|
java.util.Set<StandardColumnDescriptor> |
getUniqueAttributeColumns(java.lang.String targetTypeCode)
Gets all permitted columns for given composed type which are
unique.
|
void |
info(java.lang.String msg)
Deprecated.
since ages - use logging method
Logger#info(Object) directly |
boolean |
isBatchMode()
Checks if the batch modifier is set for this header.
|
boolean |
isDebugEnabled()
Deprecated.
since ages - use logging method
Logger#isDebugEnabled() directly |
boolean |
isDefaultComposedTypeSingleton()
Returns whether the default composed type
getDefaultComposedType() is a singleton. |
boolean |
isInfoEnabled()
Deprecated.
since ages - use logging method
Logger#isInfoEnabled() directly |
boolean |
isInsertMode()
Checks whether the header mode is
INSERT. |
boolean |
isInsertUpdateMode()
Checks whether the header mode is
INSERT_UPDATE. |
boolean |
isPermittedType(ComposedType ct)
Checks whether the given type is permitted by this header (is subtype of configured one and fits all checks of
calculatePermittedType(ComposedType)). |
boolean |
isPermittedType(java.lang.String code)
Checks whether the given type is permitted by this header (is subtype of configured one and fits all checks of
calculatePermittedType(ComposedType)). |
boolean |
isPermittedTypeForInsert(ComposedType ct)
Deprecated.
since ages - @deprecated use
isPermittedTypeForInsert(String) |
boolean |
isPermittedTypeForInsert(java.lang.String ct)
Checks whether the given type is permitted by this header (is subtype of configured one and fits all checks of
calculatePermittedType(ComposedType)) for inserts in INSERT_UPDATE
modes. |
boolean |
isPermittedTypeForUpdate(ComposedType ct)
Deprecated.
since ages - use
isPermittedTypeForUpdate(String) |
boolean |
isPermittedTypeForUpdate(java.lang.String ct)
Checks whether the given type is permitted by this header (is subtype of configured one and fits all checks of
calculatePermittedType(ComposedType)) for updates in INSERT_UPDATE
modes. |
boolean |
isRemoveMode()
Checks whether the header mode is
REMOVE. |
boolean |
isUpdateMode()
Checks whether the header mode is
UPDATE. |
boolean |
isValid()
True, if valid
|
void |
setColumns(java.util.List<AbstractColumnDescriptor> columnDescriptors)
Sets the columns of this header and triggers depending steps like Determination of the permitted types, the
configured columns and the correct positions of the columns.
|
java.lang.String |
toString() |
void |
validate() |
void |
warn(java.lang.String msg)
Deprecated.
since ages - use logging method
Logger#warn(Object) directly |
extractItemPathElements, extractModifiersMap, getDefinitionSrc, getDescriptorData, getDescriptorTranslator, parseColumnDescriptor, parseHeaderDescriptorpublic HeaderDescriptor(ImpExReader reader, java.lang.String expr, java.util.List<java.lang.String> columnExpressions, java.lang.String location, DocumentIDRegistry docIDRegistry) throws HeaderValidationException
reader - calling reader instance mainly for logging purposesexpr - the first record entry of the header linecolumnExpressions - list of all further records (columns) of header linelocation - current location of used readerdocIDRegistry - registry used for storing used documents IDsHeaderValidationException - error while determining and checking type and columnspublic HeaderDescriptor(ImpExReader reader, java.lang.String expr, AbstractDescriptor.DescriptorParams headerParams, java.lang.String location, DocumentIDRegistry docIDRegistry) throws HeaderValidationException
setColumns(List) later for performing these missing steps.reader - calling reader instance mainly for logging purposesexpr - the first record entry of the header lineheaderParams - already parsed params of headerlocation - current location of used readerdocIDRegistry - registry used for storing used documents IDsHeaderValidationException - error while determining and checking type and columnspublic HeaderDescriptor(ImpExReader reader, java.lang.String expr, java.util.List<java.lang.String> columnExpressions, java.lang.String location, DocumentIDRegistry docIDRegistry, HeaderValidationException headerException) throws HeaderValidationException
HeaderValidationExceptionpublic boolean isValid()
public HeaderValidationException getInvalidHeaderException()
public void setColumns(java.util.List<AbstractColumnDescriptor> columnDescriptors) throws HeaderValidationException
columnDescriptors - list of all column descriptors for this headerHeaderValidationException - error while determining and checking columnsprotected void adjustValuePositions()
throws HeaderValidationException
[0,x]. All virtual
columns are set to the position -1 * position . Furthermore it maps each column to the column
position defined by modifier 'pos' (if used). If the modifier is used for one column then it has to be used for
each other column, for avoiding position conflicts. Furthermore, the defined position has to be unique.HeaderValidationException - Modifier position is not used consequently by all or nothing columns, or two position modifiers have
the same valuepublic ImpExReader getReader()
@Deprecated public boolean isDebugEnabled()
Logger#isDebugEnabled() directly@Deprecated public void debug(java.lang.String msg)
Logger#debug(Object) directlymsg - debug message@Deprecated public boolean isInfoEnabled()
Logger#isInfoEnabled() directly@Deprecated public void info(java.lang.String msg)
Logger#info(Object) directlymsg - info message@Deprecated public void warn(java.lang.String msg)
Logger#warn(Object) directlymsg - warn message@Deprecated public void error(java.lang.String msg)
Logger#error(Object) directlymsg - error messageprotected HeaderCellTranslator createTranslator(java.lang.String expr)
AbstractDescriptorcreateTranslator in class AbstractDescriptorexpr - the definition textpublic boolean isBatchMode()
batch=true is set for header, false otherwisepublic boolean isInsertMode()
INSERT.INSERT, false otherwisepublic boolean isUpdateMode()
UPDATE.UPDATE, false otherwisepublic boolean isInsertUpdateMode()
INSERT_UPDATE.INSERT_UPDATE, false otherwisepublic boolean isRemoveMode()
REMOVE.REMOVE, false otherwisepublic java.util.List<AbstractColumnDescriptor> getColumns()
public int getNumCols()
public <T extends AbstractColumnDescriptor> java.util.Collection<T> getSpecificColumns(java.lang.Class<T> descriptor)
T - Type of column descriptors the result will contain (will be filtered)descriptor - the class of which the descriptors have top be an instance ofpublic java.lang.String getTypeCode()
protected ComposedType findConfiguredComposedType() throws HeaderValidationException
HeaderValidationException - configured type is not existent at type systempublic ComposedType getConfiguredComposedType()
getDefaultComposedType().public java.lang.String getConfiguredComposedTypeCode()
getDefaultComposedType().protected ComposedType calculateDefaultComposedType()
isPermittedType(ComposedType)) and not abstract and not jalo, it will be used, else
the subtypes will be searched until a type is found which fits the condition. The check of the subtypes is done as
in breath depth search.public ComposedType getDefaultComposedType()
calculateDefaultComposedType()
.public boolean isDefaultComposedTypeSingleton()
getDefaultComposedType() is a singleton. Does no
NullPointerException check.public java.lang.String getDefaultComposedTypeCode()
calculateDefaultComposedType()
.public java.util.Set<java.lang.String> getPermittedTypeCodes()
calculatePermittedType(ComposedType) method.public boolean isPermittedType(ComposedType ct)
calculatePermittedType(ComposedType)).ct - type to check for permitted type@Deprecated public boolean isPermittedTypeForInsert(ComposedType ct)
isPermittedTypeForInsert(String)calculatePermittedType(ComposedType)) for inserts in INSERT_UPDATE
modes.
Permits only when the type can be found in the permitted types and the type is not marked only for updates (see
also HeaderDescriptor.PermittedTypeMapping.isOnlyForUpdate()).
ct - type to check for permitted typepublic boolean isPermittedTypeForInsert(java.lang.String ct)
calculatePermittedType(ComposedType)) for inserts in INSERT_UPDATE
modes.
Permits only when the type can be found in the permitted types and the type is not marked only for updates (see
also HeaderDescriptor.PermittedTypeMapping.isOnlyForUpdate()).
ct - type to check for permitted type@Deprecated public boolean isPermittedTypeForUpdate(ComposedType ct)
isPermittedTypeForUpdate(String)calculatePermittedType(ComposedType)) for updates in INSERT_UPDATE
modes.ct - type to check for permitted typepublic boolean isPermittedTypeForUpdate(java.lang.String ct)
calculatePermittedType(ComposedType)) for updates in INSERT_UPDATE
modes.ct - type to check for permitted typepublic boolean isPermittedType(java.lang.String code)
calculatePermittedType(ComposedType)).code - code of type to check for permitted typepublic EnumerationValue getMode()
public java.util.Map<java.lang.Integer,java.lang.String> dump()
protected void addOmittedTypeMessage(PK typePK, java.lang.String msg)
calculatePermittedType(ComposedType).msg - message containing the omitted type code and reason why it was omittedprotected HeaderDescriptor.PermittedTypeMapping calculatePermittedType(ComposedType ct)
HeaderDescriptor.PermittedTypeMapping for given composed type. While creation it checks that
ImpExConstants.Enumerations.ImpExValidationModeEnum.IMPORT_RELAXED mode all checks are disabled. If an check fails, a null
will be returned and the addOmittedTypeMessage(PK, String) will be called.ct - composed type for which a mapping will be createdprotected java.util.Map<java.lang.String,HeaderDescriptor.PermittedTypeMapping> calculatePermittedTypes()
public void validate()
throws HeaderValidationException
validate in class AbstractDescriptorHeaderValidationException@Deprecated public java.util.Set<StandardColumnDescriptor> getColumnsForUpdate(ComposedType targetType)
getColumnsForUpdate(String) instead.targetType - type for which the columns for update are neededpublic java.util.Set<StandardColumnDescriptor> getColumnsForUpdate(java.lang.String targetTypeCode)
targetTypeCode - type code for which the columns for update are needed@Deprecated public java.util.Set<StandardColumnDescriptor> getColumnsForCreation(ComposedType targetType)
getColumnsForCreation(String) insteadtargetType - type for which the columns for creation are neededpublic java.util.Set<StandardColumnDescriptor> getColumnsForCreation(java.lang.String targetTypeCode)
targetTypeCode - type coce for which the columns for creation are neededpublic java.util.Set<StandardColumnDescriptor> getPartOfColumns(ComposedType targetType)
targetType - type for which the part-of columns are neededpublic java.util.Set<StandardColumnDescriptor> getPartOfColumns(java.lang.String targetTypeCode)
targetTypeCode - type for which the part-of columns are neededpublic java.util.Set<StandardColumnDescriptor> getAllColumns(ComposedType targetType)
targetType - type for which the all columns are neededpublic java.util.Set<StandardColumnDescriptor> getUniqueAttributeColumns(ComposedType targetType)
targetType - type for which the unique columns are neededpublic java.util.Set<StandardColumnDescriptor> getUniqueAttributeColumns(java.lang.String targetTypeCode)
targetTypeCode - code of type for which the unique columns are neededprotected java.util.Set<StandardColumnDescriptor> calculateUniqueAttributeColumns(ComposedType targetType)
targetType - type to which all configured unique columns will be returnedpublic java.util.Set<StandardColumnDescriptor> calculateUniqueAttributeColumns()
getDefaultComposedType()) and are unique.public java.util.List<java.lang.String> getAllColumnQualifiers()
protected java.util.Collection<StandardColumnDescriptor> getColumnsByAttribute(AttributeDescriptor ad)
ad - descriptor to which all configured columns are neededpublic java.util.Collection<AbstractColumnDescriptor> getColumnsByQualifier(java.lang.String qualifier)
qualifier - qualifier of resulting columnspublic java.lang.String getLocation()
public DocumentIDRegistry getDocumentIDRegistry()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getOmittedTypesMessages(PK typePK)
public java.util.Map<java.lang.String,java.lang.Object> getInterceptorRelatedParameters()
Copyright © 2018 SAP SE. All Rights Reserved.