Class BulkOperationResults<K,​V extends Exception>

  • Type Parameters:
    K - unique keys for the logs.
    V - type of the stored informations

    public class BulkOperationResults<K,​V extends Exception>
    extends Object
    Returning type for a bulk db interaction with errors. This wrapper is storing them with a matching object ID.
    • Constructor Detail

      • BulkOperationResults

        public BulkOperationResults()
    • Method Detail

      • getErrorMap

        public Map<K,​V> getErrorMap()
        Returning a list of current errors as map. If there are no errors the result will be empty.
        Returns:
        map of errors which can't be null.
      • addError

        public void addError​(K objectId,
                             V error)
        Adding an appearing error to the map and list them by a unique ID as key.
        Parameters:
        objectId - unique key of a entity.
        error - occurred error of a interaction with the entity
      • containsErrors

        public boolean containsErrors()
        Returning the status of a bulk-error-log.
        Returns:
        true if there are logged errors.
      • getErrorForId

        public V getErrorForId​(K idKey)
        Returns the stored error for a unique ID or NULL if there is no error stored or ID invalid.
        Parameters:
        idKey - which is mapped with an error
        Returns:
        stored error for ID
      • getFailedIds

        public List<K> getFailedIds()
        Returns the IDs of the Object with failed requests.
        Returns:
        a List of IDs that could not be processed successfully.
      • clearErrors

        public void clearErrors()
        Clearing the map - all entries will be removed.
      • addAllErrors

        public void addAllErrors​(BulkOperationResults<? extends K,​? extends V> log)
        Add all errors from another BulkOperationResult to this.
        Parameters:
        log - the other log
      • mapBulkOperationResults

        public BulkOperationResults<K,​Exception> mapBulkOperationResults()
        Map from any exception type to Exception.
        Returns:
        map of errors which can't be null.