Class DBScannerConvertEncryption

java.lang.Object
overit.geocall.basic.bl.encryption.DBScannerConvertEncryption
All Implemented Interfaces:
DBScanner

public class DBScannerConvertEncryption extends Object implements DBScanner
This scanner allows to convert the encryption of values storage in the database. It converts only the values inside the columns specified in the input of the constructor. It uses the decryptKey to decrypt value and encryptKey to encrypt value. The two keys can be empty to manage the value in clear, but they must not be null. If there is an error with one value, all the conversions will be rollback and a SQLException will be thrown. It uses the ResultSet to looping on the table, so it doesn't load in memory all rows of the table.
  • Constructor Details

    • DBScannerConvertEncryption

      public DBScannerConvertEncryption(String decryptKey, String encryptKey, List<String> columns)
      Constructor of this database scanner.
      Parameters:
      decryptKey - the key to decrypt the value storage in the database. It could be empty to manage the value in clear, * but it must not be null
      encryptKey - the key to encrypt the value after the decryption. It could be empty to manage the value in clear, but it must not be null
      columns - the List of strings that defines which columns contains the encrypted values.
  • Method Details

    • scan

      public void scan(DBCursor dbc) throws SQLException
      Description copied from interface: DBScanner
      Applies this function to the given argument.
      Specified by:
      scan in interface DBScanner
      Parameters:
      dbc - the cursor opend over the statement
      Throws:
      SQLException - in case of an sql error
    • isForUpdate

      public boolean isForUpdate()
      Description copied from interface: DBScanner
      Explicit the needing of the "update" grant to update the ResultSet. The grant is read only of default.
      Specified by:
      isForUpdate in interface DBScanner
      Returns:
      if the DBScanner needs the "update" grant return true, otherwise false. The default is false