Class GcPersistableHelper

java.lang.Object
edu.internet2.middleware.grouperClient.jdbc.GcPersistableHelper

public class GcPersistableHelper extends Object
  • Constructor Details

    • GcPersistableHelper

      public GcPersistableHelper()
  • Method Details

    • oracleStandardNameFromJava

      public static String oracleStandardNameFromJava(String javaName)
      Get the oracle underscore name e.g. javaNameHere -> JAVA_NAME_HERE.
      Parameters:
      javaName - is the java convention name.
      Returns:
      the oracle underscore name based on the java name.
    • columnName

      public static String columnName(Field field)
      Get the name of the column to store the field value in from the Persistable annotation or field name.
      Parameters:
      field - is the field to get the name from.
      Returns:
      the column name.
    • isPrimaryKey

      public static boolean isPrimaryKey(Field field)
      Whether the field is a primary key, check Persistable annotation if there is one on the field, default false.
      Parameters:
      field - is the field to check.
      Returns:
      true if so.
    • isCompoundPrimaryKey

      public static boolean isCompoundPrimaryKey(Field field)
      Whether the field is a compound primary key, check Persistable annotation if there is one on the field, default false.
      Parameters:
      field - is the field to check.
      Returns:
      true if so.
    • tableName

      public static String tableName(Class<? extends Object> clazz)
      Get the name of the database table to store the object in from the Persistable annotation or the class name.
      Parameters:
      clazz - is the field to check.
      Returns:
      true if so.
    • defaultUpdate

      public static boolean defaultUpdate(Class<? extends Object> clazz)
      If the table is like a status table and default to update
      Parameters:
      clazz - is the field to check.
      Returns:
      true if so.
    • hasPersistableAnnotation

      public static boolean hasPersistableAnnotation(Class<? extends Object> clazz)
      Whether the class has at least one Persistable(Field or Class) annnotation on the class itself or on any field.
      Parameters:
      clazz - is the field to check.
      Returns:
      true if so.
    • heirarchicalFields

      public static List<Field> heirarchicalFields(Class<?> clazz)
      A list of heirachical fields from the entire object structure.
      Parameters:
      clazz - is the child class.
      Returns:
      the list.
    • isSelect

      public static boolean isSelect(Field field, Class<?> clazz)
      Whether the field should be selected from the database, check Persistable field and class level annotations.
      Parameters:
      field - is the field to check.
      clazz - is teh type of object we are checking.
      Returns:
      true if so.
    • isPersist

      public static boolean isPersist(Field field, Class<?> clazz)
      Whether the field should be persisted to the database, check Persistable field and class level annotations.
      Parameters:
      field - is the field to check.
      clazz - is teh type of object we are checking.
      Returns:
      true if so.
    • findPersistableClassAnnotation

      public static GcPersistableClass findPersistableClassAnnotation(Class<? extends Object> clazz)
      Find the PersistableClass annotation on the class, or parent classes, return null if there is not one.
      Parameters:
      clazz - is the class to find it on.
      Returns:
      the annotation or null.
    • findPersistableAnnotation

      public static GcPersistableField findPersistableAnnotation(Field field)
      Find the Persistable annotation on the field, return null if there is not one.
      Parameters:
      field - is the field to find it on.
      Returns:
      the annotation or null.
    • primaryKeyField

      public static Field primaryKeyField(Class<? extends Object> clazz)
      Get the field that has been specified as the primary key - will return null if the class has compound column primary keys.
      Parameters:
      clazz - is the class to check for the field on.
      Returns:
      the primary key field.
    • compoundPrimaryKeyFields

      public static List<Field> compoundPrimaryKeyFields(Class<? extends Object> clazz)
      Get the fields that have been specified as compound primary key fields.
      Parameters:
      clazz - is the class to check for the field on.
      Returns:
      the primary key field.
    • primaryKeySequenceName

      public static String primaryKeySequenceName(Field primaryKeyField)
      Get the sequence name for the primary key field.
      Parameters:
      primaryKeyField - is the field with the annotation for primary key and sequence on it.
      Returns:
      the sequence name or a failure.
    • primaryKeyManuallyAssigned

      public static boolean primaryKeyManuallyAssigned(Field primaryKeyField)
      Whether the primary key is manually assigned.
      Parameters:
      primaryKeyField - is the field with the annotation for primary key and sequence on it.
      Returns:
      the sequence name or a failure.