All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.ebean.config.dbplatform.AbstractDbEncrypt Maven / Gradle / Ivy

There is a newer version: 15.8.0
Show newest version
package io.ebean.config.dbplatform;

import java.sql.Types;

/**
 * Base type for DB platform specific Encryption.
 * 

* DB specific classes that extend this need to set their specific encryption * functions for varchar, date and timestamp. If they are left null then that is * treated as though that data type can not be encrypted in the DB and will * instead use java client encryption. */ public abstract class AbstractDbEncrypt implements DbEncrypt { /** * The encryption function for all String types (VARCHAR, CLOB, LONGVARCHAR, * CHAR). */ protected DbEncryptFunction varcharEncryptFunction; /** * The encryption function for all Date types (java.sql.Date, Joda Date * types). */ protected DbEncryptFunction dateEncryptFunction; /** * The encryption function for all Timestamp types (java.sql.Timestamp, * java.util.Date, java.util.Calendar, Joda DateTime types etc). */ protected DbEncryptFunction timestampEncryptFunction; /** * Return the DB encryption function for the given JDBC type. *

* Null is returned if DB encryption of the type is not supported. *

*/ @Override public DbEncryptFunction getDbEncryptFunction(int jdbcType) { switch (jdbcType) { case Types.VARCHAR: case Types.CLOB: case Types.CHAR: case Types.LONGVARCHAR: return varcharEncryptFunction; case Types.DATE: return dateEncryptFunction; case Types.TIMESTAMP: return timestampEncryptFunction; default: return null; } } /** * Return the DB stored type for encrypted properties. */ @Override public int getEncryptDbType() { return Types.VARBINARY; } /** * Generally encrypt function binding the data before the key (except h2). */ @Override public boolean isBindEncryptDataFirst() { return true; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy