de.unikassel.android.sdcframework.persistence
Class DeleteSamplesStrategy

Package class diagram package DeleteSamplesStrategy
java.lang.Object
  extended by de.unikassel.android.sdcframework.util.AbstractChainWorker<PersistentStorageManager>
      extended by de.unikassel.android.sdcframework.persistence.AbstractDatabaseFullStrategy
          extended by de.unikassel.android.sdcframework.persistence.DeleteSamplesStrategy
All Implemented Interfaces:
DatabaseFullStrategy, ChainWorker<PersistentStorageManager>

public final class DeleteSamplesStrategy
extends AbstractDatabaseFullStrategy

Implementation of a the database full strategy which does delete old samples.

This strategy does delete the configured count of samples in the database. Normally the oldest samples will be selected first, but if configured, the oldest samples with lowest priority will be preferred for deletion.


Field Summary
protected  int countToDelete
          The count of samples to delete
protected  boolean lowestPriorityFirst
          The count of samples to delete
 
Constructor Summary
DeleteSamplesStrategy(int countToDelete, boolean lowestPriorityFirst)
          Constructor
 
Method Summary
 int getCountToDelete()
          Getter for the record count to delete
 Object isDeletingPriorityBased()
          Getter for the priority basted deletion flag
 boolean process(PersistentStorageManager storageManager)
          Processing method of the worker
 
Methods inherited from class de.unikassel.android.sdcframework.util.AbstractChainWorker
doWork, getSuccessor, setSuccessor, withSuccessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.unikassel.android.sdcframework.util.facade.ChainWorker
doWork, getSuccessor, setSuccessor, withSuccessor
 

Field Detail

countToDelete

protected final int countToDelete
The count of samples to delete


lowestPriorityFirst

protected final boolean lowestPriorityFirst
The count of samples to delete

Constructor Detail

DeleteSamplesStrategy

public DeleteSamplesStrategy(int countToDelete,
                             boolean lowestPriorityFirst)
Constructor

Parameters:
countToDelete - the count of samples to delete
lowestPriorityFirst - if true the oldest samples with lowest priority will be deleted first
Method Detail

getCountToDelete

public final int getCountToDelete()
Getter for the record count to delete

Returns:
the the record count to delete

process

public final boolean process(PersistentStorageManager storageManager)
Description copied from class: AbstractChainWorker
Processing method of the worker

Overrides:
process in class AbstractDatabaseFullStrategy
Parameters:
storageManager - the client
Returns:
true if successful

isDeletingPriorityBased

public Object isDeletingPriorityBased()
Getter for the priority basted deletion flag

Returns:
true if deletion is done for samples with lowest priority first. Otherwise it is done for the oldest samples