Class Quota
- java.lang.Object
-
- org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity<E,I>
-
- org.silverpeas.core.persistence.datasource.model.jpa.BasicJpaEntity<Quota,UniqueLongIdentifier>
-
- org.silverpeas.core.admin.quota.model.Quota
-
- All Implemented Interfaces:
Serializable
,IdentifiableEntity
@Entity public class Quota extends BasicJpaEntity<Quota,UniqueLongIdentifier> implements Serializable
- Author:
- Yohann Chastagnier
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
exists()
Indicates if the quota is well registredlong
getCount()
QuotaLoad
getLoad()
Indicates by a basic way the load of the dataBigDecimal
getLoadPercentage()
Calculates the load percentage of the quota rounded at two decimalsBigDecimal
getLoadRate()
Calculates the load rate of the quota without rounded rounded at 20 decimalslong
getMaxCount()
long
getMinCount()
String
getResourceId()
Date
getSaveDate()
QuotaType
getType()
boolean
isNotUnlimitedLoad()
boolean
isReached()
Indicates if the quota is reached or notprotected void
performBeforePersist()
Performs some treatments before this entity is persisted into a repository.protected void
performBeforeUpdate()
Performs some treatments before its counterpart in a repository is updated with the changes in this entity.void
setCount(long count)
void
setMaxCount(long maxCount)
void
setMaxCount(String maxCount)
void
setMinCount(long minCount)
void
setMinCount(String minCount)
void
setQuotaId(Long id)
void
setResourceId(String resourceId)
void
setSaveDate(Date saveDate)
void
setType(String type)
void
setType(QuotaType type)
String
toString()
void
validate()
Validates datavoid
validateBounds()
Validates count data-
Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.BasicJpaEntity
performBeforeRemove
-
Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity
equals, getId, getNativeId, hashCode, isPersisted, setId
-
-
-
-
Constructor Detail
-
Quota
public Quota()
Constructor for JPA and internal services.
-
Quota
public Quota(Quota other)
Copy constructor.- Parameters:
other
- the quota to copy.
-
-
Method Detail
-
performBeforePersist
protected void performBeforePersist()
Description copied from class:AbstractJpaEntity
Performs some treatments before this entity is persisted into a repository.- Overrides:
performBeforePersist
in classBasicJpaEntity<Quota,UniqueLongIdentifier>
-
performBeforeUpdate
protected void performBeforeUpdate()
Description copied from class:AbstractJpaEntity
Performs some treatments before its counterpart in a repository is updated with the changes in this entity.- Overrides:
performBeforeUpdate
in classBasicJpaEntity<Quota,UniqueLongIdentifier>
-
exists
public boolean exists()
Indicates if the quota is well registred- Returns:
-
validate
public void validate() throws QuotaException
Validates data- Throws:
QuotaException
-
validateBounds
public void validateBounds() throws QuotaException
Validates count data- Throws:
QuotaException
-
getLoad
public QuotaLoad getLoad()
Indicates by a basic way the load of the data- Returns:
-
isNotUnlimitedLoad
public boolean isNotUnlimitedLoad()
-
isReached
public boolean isReached()
Indicates if the quota is reached or not- Returns:
-
getLoadRate
public BigDecimal getLoadRate()
Calculates the load rate of the quota without rounded rounded at 20 decimals- Returns:
-
getLoadPercentage
public BigDecimal getLoadPercentage()
Calculates the load percentage of the quota rounded at two decimals- Returns:
-
setQuotaId
public void setQuotaId(Long id)
- Parameters:
id
- the id to set
-
getType
public QuotaType getType()
- Returns:
- the type
-
setType
public void setType(QuotaType type)
- Parameters:
type
- the type to set
-
setType
public void setType(String type)
- Parameters:
type
- the type to set
-
getResourceId
public String getResourceId()
- Returns:
- the resourceId
-
setResourceId
public void setResourceId(String resourceId)
- Parameters:
resourceId
- the resourceId to set
-
getMinCount
public long getMinCount()
- Returns:
- the minCount
-
setMinCount
public void setMinCount(long minCount)
- Parameters:
minCount
- the minCount to set
-
setMinCount
public void setMinCount(String minCount) throws QuotaException
- Parameters:
minCount
- the minCount to set- Throws:
QuotaException
-
getMaxCount
public long getMaxCount()
- Returns:
- the maxCount
-
setMaxCount
public void setMaxCount(long maxCount)
- Parameters:
maxCount
- the maxCount to set
-
setMaxCount
public void setMaxCount(String maxCount) throws QuotaException
- Parameters:
maxCount
- the maxCount to set- Throws:
QuotaException
-
getCount
public long getCount()
- Returns:
- the count
-
setCount
public void setCount(long count)
- Parameters:
count
- the count to set
-
getSaveDate
public Date getSaveDate()
- Returns:
- the saveDate
-
setSaveDate
public void setSaveDate(Date saveDate)
- Parameters:
saveDate
- the saveDate to set
-
-