com.h3c.util.persistence.cassandra

## Class CassAbstractDao<I extends Serializable,K extends Serializable & Comparable<K>,T extends TransportObject<? super T,I>,P extends Storable<I>,F,S>

- java.lang.Object
- - com.h3c.util.persistence.cassandra.AbstractBaseDao<I,K,P,F,S>
  - - com.h3c.util.persistence.cassandra.CassAbstractDao<I,K,T,P,F,S>

- Type Parameters:
    `I` - type of the persistent object and transport object id. This type should be immutable. It is critical this type implements equals() and hashCode() correctly.
    `K` - Type of Column Name.
    `T` - Type of Transportable object
    `P` - type of the persistent/Storable object.
    `F` - type of the associated filter.
    `S` - type of the associated sort specification type.
  All Implemented Interfaces:
    Converter<P,T>, BaseDao<I,P,F,S,DataStoreContext>, Dao<I,T,P,F,S,DataStoreContext>

      public abstract class CassAbstractDao<I extends Serializable,K extends Serializable & Comparable<K>,T extends TransportObject<? super T,I>,P extends Storable<I>,F,S>
      extends AbstractBaseDao<I,K,P,F,S>
      implements Dao<I,T,P,F,S,DataStoreContext>

  The Cassandra specific abstract implementation for Dao. This implementation provides methods for create, update and delete persistence objects in the database

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected List<CfQueryOperations<I,T>>` | `cfList`

    - ### Fields inherited from class com.h3c.util.persistence.cassandra.AbstractBaseDao

      `columnDecoderProvider`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CassAbstractDao()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract T` | `conform(T oldTransport, T newTransport)`
    `P` | `create(T transportable, DataStoreContext context)` Creates a new persistent object with the data from the given transport object.
    `protected abstract P` | `createStorableInstance(T transportable)`
    `long` | `delete(F filter, DataStoreContext context)` Deletes all persistent objects matching the given filter.
    `<E extends T> Boolean` | `delete(Id<E,I> id, DataStoreContext context)` Deletes the persistent object with the given id.
    `long` | `deleteAll(DataStoreContext context)` Deletes all the persistent objects.
    `P` | `update(T transportable, DataStoreContext context)` This method is used to update existing column values.

    - ### Methods inherited from class com.h3c.util.persistence.cassandra.AbstractBaseDao

      `compareRows, count, countByFilter, find, find, findAll, findPagedRows, findRows, get, getColumnDecoder, getColumnFamilyDefinitions, getCountCf, getCountRowKey, getMainColumnFamily`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.h3c.util.persistence.BaseDao

      `count, find, find, findAll, get`

    - ### Methods inherited from interface com.h3c.util.Converter

      `convert`

- - ### Field Detail

    - #### cfList

          protected List<CfQueryOperations<I extends Serializable,T extends TransportObject<? super T,I>>> cfList

  - ### Constructor Detail

    - #### CassAbstractDao

          public CassAbstractDao()
                          throws PersistenceConnException

      Throws:
        `PersistenceConnException`

  - ### Method Detail

    - #### create

          public P create(T transportable,
                 DataStoreContext context)
                                       throws Exception

      Creates a new persistent object with the data from the given transport object.
      Specified by:
        `create` in interface `Dao<I extends Serializable,T extends TransportObject<? super T,I>,P extends Storable<I>,F,S,DataStoreContext>`
      Parameters:
        `transportable` - transport object to get the data from.
        `context` - data store context.
      Returns:
        the new created persistent object.
      Throws:
        `Exception` - in case of error in persist data to database.

    - #### update

          public P update(T transportable,
                 DataStoreContext context)
                                       throws Exception

      This method is used to update existing column values. All indexes are also updated. We use Read-Modify-Write to do this. Without Read-Modify-Write, a new index can be added but the older index remains as residue which will create undesired effects TODO: Update without Read-Modify-Write
      Specified by:
        `update` in interface `Dao<I extends Serializable,T extends TransportObject<? super T,I>,P extends Storable<I>,F,S,DataStoreContext>`
      Parameters:
        `transportable` - transport object to get the data from.
        `context` - data store context.
      Returns:
        the updated persistent object.
      Throws:
        `Exception` - in case error occurs while updating the data.

    - #### delete

          public <E extends T> Boolean delete(Id<E,I> id,
                                     DataStoreContext context)
                         throws Exception

      Description copied from interface: `Dao`
      Deletes the persistent object with the given id.
      Specified by:
        `delete` in interface `Dao<I extends Serializable,T extends TransportObject<? super T,I>,P extends Storable<I>,F,S,DataStoreContext>`
      Parameters:
        `id` - persistent object's id.
        `context` - data store context.
      Returns:
        `true` if the persistent object was found and deleted, `false` if it was not found.
      Throws:
        `Exception` - throws if delete fails to operate.

    - #### delete

          public long delete(F filter,
                    DataStoreContext context)
                      throws Exception

      Description copied from interface: `Dao`
      Deletes all persistent objects matching the given filter.
      Specified by:
        `delete` in interface `Dao<I extends Serializable,T extends TransportObject<? super T,I>,P extends Storable<I>,F,S,DataStoreContext>`
      Parameters:
        `filter` - filter.
        `context` - data store context.
      Returns:
        number of deleted objects.
      Throws:
        `Exception` - throws if delete fails to operate.

    - #### deleteAll

          public long deleteAll(DataStoreContext context)
                         throws Exception

      Description copied from interface: `Dao`
      Deletes all the persistent objects.
      Specified by:
        `deleteAll` in interface `Dao<I extends Serializable,T extends TransportObject<? super T,I>,P extends Storable<I>,F,S,DataStoreContext>`
      Parameters:
        `context` - data store context
      Returns:
        the count of entries deleted
      Throws:
        `Exception` - throws if delete fails to operate.

    - #### createStorableInstance

          protected abstract P createStorableInstance(T transportable)

    - #### conform

          protected abstract T conform(T oldTransport,
                  T newTransport)

Copyright © 2014. All Rights Reserved.