Class ValueLine
java.lang.Object
de.hybris.platform.impex.jalo.imp.ValueLine
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe actual value object inside a value line. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHiddenLine(ValueLine line) Adds another value line mainly created by thecreateCopy()method, representing another item resolved by this value line.voidcreateCopies(int count) Creates a number of copies of this line without copying the potentially assigned item pk, unresolved flags and/or hidden value lines.Creates a copy of this value except the assigned item, unresolved flag and/or hidden value lines.dump()Produces a csv cell map to be written usingCSVWriter.write(Map)into a file for being processed in a second-pass import.Returns the actual composed type item defined by its owntype codeor the default type defined by its header (seeHeaderDescriptor.getDefaultComposedType().Gets the header descriptor this line belongs to.Gets all hidden lines.intReturns the real document line number of this value line.Returns the textual representation of the line number of this value line.In case a value line could not be completely processed during the first run this line may provide the item pk of the previously located or created item belonging to this line.Gets the original source line of this value line.Returns the own item type code of this line, ornullif no type code was defined within the first cell of this line.getUnresolved(Collection<StandardColumnDescriptor> columnDescriptors) Filters all column descriptors whose column entries of this value line are unresolved.getValueEntry(int index) Provides the value entry object for a given position.booleanChecks whether there are hidden lines stored.booleanChecks if this line contains unrecoverable error.booleanChecks if this line is either marked as completely unresolved ( viamarkUnresolved()) or owns a non-ignored value entry which has not been resolved yet.booleanisUnresolved(Collection<StandardColumnDescriptor> columnDescriptors) Same asisUnresolved()except that only value entries belonging to the given column descriptors are evaluated.booleanvoidMarks this line as unrecoverable.voidmarkUnrecoverable(String reason) voidMarks this line as being completely unresolved.voidmarkUnresolved(String reason) Marks this line as being completely unresolved.voidresolve(PK processedItemPk, Collection<StandardColumnDescriptor> processedColumns) voidresolve(Item processedItem, Collection<StandardColumnDescriptor> processedColumns) Tries to resolve this line by passing the processed item and the used columns.protected ValueLine.ValueEntryresolveMissingEntry(int index, Object resolvingValue) Marks the column value at positionindexas resolved with given value.voidsetAfterEachCode(AbstractCodeLine abstractCodeLine) voidsetComposedType(ComposedType type) voidsetConflictingItemPK(PK conflictingItemPK) voidsetTypeCode(String typeCode) protected String[]splitTypeCodeCell(String typeCodeCell) Deprecated.toString()protected ValueLine.ValueEntryunresolveMissingEntry(int index) Marks the column value at positionindexas unresolved.
-
Constructor Details
-
ValueLine
public ValueLine(HeaderDescriptor header, String firstCell, Map<Integer, String> cellValueStrings, int linenumber, String location) Creates a new value line.- Parameters:
header- header descriptor this line belongs tofirstCell- content of first cell containing the value line specific type code (maybe contains the three part text of the dumped lines)cellValueStrings- Map of all column valueslinenumber- line number of this value line within scriptlocation- location text of this value line within script (containing also the line number)
-
-
Method Details
-
createCopy
Creates a copy of this value except the assigned item, unresolved flag and/or hidden value lines.- Returns:
- a copy of this value line
-
createCopies
Creates a number of copies of this line without copying the potentially assigned item pk, unresolved flags and/or hidden value lines.- Parameters:
count- amount of copies to create- Returns:
- Collection
-
getSource
Gets the original source line of this value line.- Returns:
- original source line
-
addHiddenLine
Adds another value line mainly created by thecreateCopy()method, representing another item resolved by this value line. Used if more than one item is resolved using this value line.- Parameters:
line- value line to add
-
hasHiddenLines
public boolean hasHiddenLines()Checks whether there are hidden lines stored. If more than item was resolved by this value line, for each further item an extra value line is created and added to his one as hidden line.- Returns:
- true if hidden lines are available
-
getHiddenLines
Gets all hidden lines. If more than item was resolved by this value line, for each further item an extra value line is created and added to his one as hidden line.- Returns:
- all hidden lines stored at this value line
-
splitTypeCodeCell
@Deprecated(since="ages", forRemoval=false) protected String[] splitTypeCodeCell(String typeCodeCell) Deprecated.since ages - This method is deprecated in favor ofValueLineMetaDataclass.Splits the first cell of line into the (optional) item type code and the (optional) item pk from a possible first import run.- Parameters:
typeCodeCell- the first cell string as read by the csv parser- Returns:
- [ item type code , item pk, dumping comments ]
-
markUnresolved
public void markUnresolved()Marks this line as being completely unresolved. The line will mark all cells as read, even if some cells have been resolved by now! -
markUnresolved
Marks this line as being completely unresolved. The line will mark all cells as read, even if some cells have been resolved by now!- Parameters:
reason- reason for not resolving the line
-
getLineNumber
public int getLineNumber()Returns the real document line number of this value line.- Returns:
- line number within script
-
getLocation
Returns the textual representation of the line number of this value line.- Returns:
- location within script
-
getTypeCode
Returns the own item type code of this line, ornullif no type code was defined within the first cell of this line.- Returns:
- own type code or null if first cell was empty
-
setTypeCode
-
getComposedType
Returns the actual composed type item defined by its owntype codeor the default type defined by its header (seeHeaderDescriptor.getDefaultComposedType().- Returns:
- the composed type this value line belongs to
- Throws:
InsufficientDataException- in case this line defines a type which is unknown in the current system
-
setComposedType
-
getValueEntry
Provides the value entry object for a given position. Please note that counting starts with 1 since the first cell is reserved for holding this lines type code and item pk.- Parameters:
index- the value position ( starting at 1 )- Returns:
- the according value entry, or null if no value exists at this position
-
getHeader
Gets the header descriptor this line belongs to.- Returns:
- the header belonging to this line
-
getProcessedItemPK
In case a value line could not be completely processed during the first run this line may provide the item pk of the previously located or created item belonging to this line. With this no further searching is necessary in any second pass runs.- Returns:
- PK of processed item within second run, else null
-
dump
Produces a csv cell map to be written usingCSVWriter.write(Map)into a file for being processed in a second-pass import. Unless the complete line was markedunresolvedall cells which have been resolved by now or have no been used at all will be prefixed with theImpExConstants.Syntax.IGNORE_PREFIXtoken to skip their processing during a second pass.- Returns:
- line representation of this value line for writing to a dump file
-
getMetaData
-
isUnresolved
public boolean isUnresolved()Checks if this line is either marked as completely unresolved ( viamarkUnresolved()) or owns a non-ignored value entry which has not been resolved yet.- Returns:
- true if line is unresolved, otherwise false
-
isUnresolved
Same asisUnresolved()except that only value entries belonging to the given column descriptors are evaluated.- Parameters:
columnDescriptors- a collection ofcolumn descriptorsto define which value entries to check- Returns:
- true if line is unresolved related to given descriptor, otherwise false
-
getUnresolved
public Collection<StandardColumnDescriptor> getUnresolved(Collection<StandardColumnDescriptor> columnDescriptors) Filters all column descriptors whose column entries of this value line are unresolved.- Parameters:
columnDescriptors- a collection ofcolumn descriptorswhose value lines entries will be checked for unresolving- Returns:
- collection of those descriptors which column entries of this valu eline are unresolved
-
resolve
Tries to resolve this line by passing the processed item and the used columns. This method stores the item pk and the actual type code. Additionally it marks all values which do not belong to any used column asunused. The line stays unresolved if at least one unresolved value entry of the used columns exists! Usedump()to store this line for retrying import later on.- Parameters:
processedItem- the item created, removed or updated upon this lineprocessedColumns- the columns used to processing the given item
-
resolve
-
resolveMissingEntry
Marks the column value at positionindexas resolved with given value.- Parameters:
index- index of the column value within value lineresolvingValue- resolved value- Returns:
- the internal representation of an value entry with set resolved value
-
unresolveMissingEntry
Marks the column value at positionindexas unresolved.- Parameters:
index- index of the column value within value line- Returns:
- the internal representation of an value entry
-
markUnrecoverable
public void markUnrecoverable()Marks this line as unrecoverable. Line will be dumped but will NOT be proceeded in further passes. -
markUnrecoverable
-
isUnrecoverable
public boolean isUnrecoverable()Checks if this line contains unrecoverable error.- Returns:
- true if line is unrecoverable, otherwise false.
-
toString
-
getUnresolvedReason
-
getPlainUnresolvedReason
-
setConflictingItemPK
-
getConflictingItemPk
-
isUsingJaloOnlyFeatures
public boolean isUsingJaloOnlyFeatures() -
clearProcessedItemPK
public void clearProcessedItemPK() -
getAfterEachCode
-
setAfterEachCode
-
ValueLineMetaDataclass.