org.silverpeas.quota.service
Class AbstractQuotaService<T extends QuotaKey>

java.lang.Object
  extended by org.silverpeas.quota.service.AbstractQuotaService<T>
All Implemented Interfaces:
QuotaService<T>
Direct Known Subclasses:
AbstractSpaceQuotaService, UserDomainQuotaService

public abstract class AbstractQuotaService<T extends QuotaKey>
extends Object
implements QuotaService<T>

Author:
Yohann Chastagnier

Constructor Summary
AbstractQuotaService()
           
 
Method Summary
 Quota get(T key)
          Gets the quota of the resource from a given quota key.
 Quota initialize(T key, long maxCount)
          Initializes the quota of the resource for the given quota key.
 Quota initialize(T key, long minCount, long maxCount)
          Initializes the quota of the resource for the given quota key.
 Quota initialize(T key, Quota quota)
          Initializes the quota of the resource for the given quota key and from an existing quota.
protected abstract  boolean isActivated()
          Indicates if the type of quota is activated
 void remove(T key)
          Removes quietly the quota of the resource from a given quota key.
 Quota verify(T key)
          Verifies if the quota is full or not enough from a given quota key.
 Quota verify(T key, AbstractQuotaCountingOffset countingOffset)
          Verifies if the quota is full or not enough from a given quota key and adding a counting offset.
protected  Quota verify(T key, Quota quota, AbstractQuotaCountingOffset countingOffset)
          Verify from a given quota
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.silverpeas.quota.service.QuotaService
getCurrentCount
 

Constructor Detail

AbstractQuotaService

public AbstractQuotaService()
Method Detail

initialize

public Quota initialize(T key,
                        long maxCount)
                 throws QuotaException
Description copied from interface: QuotaService
Initializes the quota of the resource for the given quota key.

Specified by:
initialize in interface QuotaService<T extends QuotaKey>
Returns:
Throws:
QuotaException

initialize

public Quota initialize(T key,
                        Quota quota)
                 throws QuotaException
Description copied from interface: QuotaService
Initializes the quota of the resource for the given quota key and from an existing quota.

Specified by:
initialize in interface QuotaService<T extends QuotaKey>
Returns:
Throws:
QuotaException

initialize

@Transactional(propagation=REQUIRED)
public Quota initialize(T key,
                                      long minCount,
                                      long maxCount)
                 throws QuotaException
Description copied from interface: QuotaService
Initializes the quota of the resource for the given quota key.

Specified by:
initialize in interface QuotaService<T extends QuotaKey>
Returns:
Throws:
QuotaException

get

@Transactional(propagation=REQUIRED)
public Quota get(T key)
          throws QuotaException
Description copied from interface: QuotaService
Gets the quota of the resource from a given quota key. A save operation is done if the current count has changed.

Specified by:
get in interface QuotaService<T extends QuotaKey>
Returns:
Throws:
QuotaException

verify

public Quota verify(T key)
             throws QuotaException
Description copied from interface: QuotaService
Verifies if the quota is full or not enough from a given quota key. If full then a quota full exception is throwed. If not enough then a quota not enough exception is throwed.

Specified by:
verify in interface QuotaService<T extends QuotaKey>
Returns:
the quota used by the verify treatment
Throws:
QuotaException

verify

public Quota verify(T key,
                    AbstractQuotaCountingOffset countingOffset)
             throws QuotaException
Description copied from interface: QuotaService
Verifies if the quota is full or not enough from a given quota key and adding a counting offset. If full then a quota full exception is throwed. If not enough then a quota not enough exception is throwed.

Specified by:
verify in interface QuotaService<T extends QuotaKey>
Returns:
the quota used by the verify treatment
Throws:
QuotaException

verify

protected Quota verify(T key,
                       Quota quota,
                       AbstractQuotaCountingOffset countingOffset)
                throws QuotaException
Verify from a given quota

Throws:
QuotaException

remove

@Transactional(propagation=REQUIRED)
public void remove(T key)
Description copied from interface: QuotaService
Removes quietly the quota of the resource from a given quota key.

Specified by:
remove in interface QuotaService<T extends QuotaKey>

isActivated

protected abstract boolean isActivated()
Indicates if the type of quota is activated

Returns:


Copyright © 2016 Silverpeas. All Rights Reserved.