pl.edu.agh.cast.importer.base.stat
Class ErrorsLog

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<Integer,List<AbstractErrorLogData>>
          extended by pl.edu.agh.cast.importer.base.stat.ErrorsLog
All Implemented Interfaces:
Serializable, Cloneable, Map<Integer,List<AbstractErrorLogData>>

public class ErrorsLog
extends HashMap<Integer,List<AbstractErrorLogData>>

Errors log, which extends a HashMap, mapping row numbers to errors that had occurred within the rows. It contains a List of AbstractErrorLogData for every row number.

Author:
AGH CAST Team
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
ErrorsLog()
          The default constructor.
 
Method Summary
 List<AbstractErrorLogData> allValues()
          Retrieves all error log data held within the errors log, regardless of the keys (row numbers) they are associated with.
 List<AbstractErrorLogData> append(Integer key, AbstractErrorLogData value)
          Associates the specified error value with the specified key (row number) in this map.
 List<AbstractErrorLogData> append(Integer key, List<AbstractErrorLogData> values)
          Associates the specified error values with the specified key (row number) in this map.
 void clear()
          
 int getErroneousRowsCount()
          Retrieves the number of all errant data rows.
 List<AbstractErrorLogData> getErrorsByType(ErrorType type)
          Retrieves errors that are of specified error type.
 int getErrorsCount()
          Retrieves the number of errors of type ERROR.
 Map<ErrorType,Integer> getErrorTypesWithOccurrences()
          Retrieves error types mapped to the number of its occurrences.
 int getWarningsCount()
          Retrieves the number of errors of type WARNING.
 boolean isRedoAvailable()
          Checks whether the redo operation is available.
 boolean isUndoAvailable()
          Checks whether the undo operation is available.
 Set<Integer> keySet()
          
 Map<Integer,List<AbstractErrorLogData>> redoOperation()
          Redoes row index to errors map removal operation by removing again the map that had previously been removed and restored with use of an undo operation.
 List<AbstractErrorLogData> remove(Object obj)
          
 void removeErrors(Map<Integer,List<AbstractErrorLogData>> errorsMap)
          Delegate method with default ignored flag set to true.
 void removeErrors(Map<Integer,List<AbstractErrorLogData>> errorsMap, boolean ignored)
          Removes row index to errors map and saves it to an undo cache in order for an undo operation to be available (if the ignored flag is not set), or saves the errors to the ignored errors cache in order for them to be available if the ignored option is turned off.
 void restoreIgnoredError(int rowIndex)
          Restores the errors for a row of specified index.
 void setHeaderRowIdx(int headerRowIdx)
           
 Map<Integer,List<AbstractErrorLogData>> undoOperation()
          Undoes row index to errors map removal operation by restoring the row index to errors map, which was removed last.
 
Methods inherited from class java.util.HashMap
clone, containsKey, containsValue, entrySet, get, isEmpty, put, putAll, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

ErrorsLog

public ErrorsLog()
The default constructor.

Method Detail

append

public List<AbstractErrorLogData> append(Integer key,
                                         AbstractErrorLogData value)
Associates the specified error value with the specified key (row number) in this map. If the map previously contained a mapping for this key (row number), the new value is appended to the already existing list of errors.

Parameters:
key - the key being a row number
value - the value being an error information
Returns:
the list of errors associated with the given key (row number)

append

public List<AbstractErrorLogData> append(Integer key,
                                         List<AbstractErrorLogData> values)
Associates the specified error values with the specified key (row number) in this map. If the map previously contained a mapping for this key (row number), the new values are appended to the already existing list of errors.

Parameters:
key - the key being a row number
values - the values the being error informations
Returns:
the list of errors associated with the given key (row number)

allValues

public List<AbstractErrorLogData> allValues()
Retrieves all error log data held within the errors log, regardless of the keys (row numbers) they are associated with. Ignores the errors of the header row.

Returns:
all log data

undoOperation

public Map<Integer,List<AbstractErrorLogData>> undoOperation()
Undoes row index to errors map removal operation by restoring the row index to errors map, which was removed last.

Returns:
row index to errors map, which had been restored

redoOperation

public Map<Integer,List<AbstractErrorLogData>> redoOperation()
Redoes row index to errors map removal operation by removing again the map that had previously been removed and restored with use of an undo operation.

Returns:
row index to errors map, which had been removed again

removeErrors

public void removeErrors(Map<Integer,List<AbstractErrorLogData>> errorsMap,
                         boolean ignored)
Removes row index to errors map and saves it to an undo cache in order for an undo operation to be available (if the ignored flag is not set), or saves the errors to the ignored errors cache in order for them to be available if the ignored option is turned off.

Parameters:
errorsMap - the row index to errors map
ignored - flag indicating whether the removed errors should be ignored (or deleted)

removeErrors

public void removeErrors(Map<Integer,List<AbstractErrorLogData>> errorsMap)
Delegate method with default ignored flag set to true.

See Also:
removeErrors(Map, boolean)

restoreIgnoredError

public void restoreIgnoredError(int rowIndex)
Restores the errors for a row of specified index.

Parameters:
rowIndex - the row index whose errors are to be restored

keySet

public Set<Integer> keySet()

Specified by:
keySet in interface Map<Integer,List<AbstractErrorLogData>>
Overrides:
keySet in class HashMap<Integer,List<AbstractErrorLogData>>
See Also:
HashMap.keySet()

remove

public List<AbstractErrorLogData> remove(Object obj)

Specified by:
remove in interface Map<Integer,List<AbstractErrorLogData>>
Overrides:
remove in class HashMap<Integer,List<AbstractErrorLogData>>
See Also:
HashMap.remove(java.lang.Object)

clear

public void clear()

Specified by:
clear in interface Map<Integer,List<AbstractErrorLogData>>
Overrides:
clear in class HashMap<Integer,List<AbstractErrorLogData>>
See Also:
HashMap.clear()

getErroneousRowsCount

public int getErroneousRowsCount()
Retrieves the number of all errant data rows.

Returns:
the errant rows count

getWarningsCount

public int getWarningsCount()
Retrieves the number of errors of type WARNING.

Returns:
the warnings count

getErrorsCount

public int getErrorsCount()
Retrieves the number of errors of type ERROR.

Returns:
the errors count

getErrorTypesWithOccurrences

public Map<ErrorType,Integer> getErrorTypesWithOccurrences()
Retrieves error types mapped to the number of its occurrences.

Returns:
map which contains error types with number of their occurrences

getErrorsByType

public List<AbstractErrorLogData> getErrorsByType(ErrorType type)
Retrieves errors that are of specified error type.

Parameters:
type - the error type
Returns:
errors of specified type

isUndoAvailable

public boolean isUndoAvailable()
Checks whether the undo operation is available.

Returns:
true if undo available, false otherwise

isRedoAvailable

public boolean isRedoAvailable()
Checks whether the redo operation is available.

Returns:
true if redo available, false otherwise

setHeaderRowIdx

public void setHeaderRowIdx(int headerRowIdx)


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.