Class QuotaDBManager
java.lang.Object
edu.ucsb.nceas.metacat.dataone.quota.QuotaDBManager
Represents a class to manipulate the usages table for the quota service in the postgresql database
- Author:
- tao
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
createUsage
(org.dataone.bookkeeper.api.Usage usage, Date date) Create a usage record in the usages table with the given date as the reported date If the date is null, it will create a usage record without the reported datestatic ResultSet
Get the result set from the table which haven't been reported to the bookkeeper server.static int
lookupRemoteUsageId
(int quotaId, String instanceId) Find the remote usage id in the local database for the given quota id and instance idstatic void
setReportedDateAndRemoteId
(int localId, Date date, int remoteId) Set the reported date and remote id for a given usage local id
-
Field Details
-
TABLE
- See Also:
-
USAGELOCALID
- See Also:
-
USAGEREMOTEID
- See Also:
-
QUOTAID
- See Also:
-
INSTANCEID
- See Also:
-
QUANTITY
- See Also:
-
STATUS
- See Also:
-
DATEREPORTED
- See Also:
-
OBJECT
- See Also:
-
NODEID
- See Also:
-
QUOTASUBJECT
- See Also:
-
QUOTATYPE
- See Also:
-
REQUESTOR
- See Also:
-
-
Constructor Details
-
QuotaDBManager
public QuotaDBManager()
-
-
Method Details
-
createUsage
public static void createUsage(org.dataone.bookkeeper.api.Usage usage, Date date) throws SQLException Create a usage record in the usages table with the given date as the reported date If the date is null, it will create a usage record without the reported date- Parameters:
usage
- the usage will be record into the db tabledate
- the reported date associated with the usage. If it is null, the reported date will be blank in the table- Throws:
SQLException
-
setReportedDateAndRemoteId
public static void setReportedDateAndRemoteId(int localId, Date date, int remoteId) throws SQLException Set the reported date and remote id for a given usage local id- Parameters:
localId
- the local id of the usage will be setdate
- the date to report to the bookkeeper serverremoteId
- the remote id will be set- Throws:
SQLException
-
getUnReportedUsages
Get the result set from the table which haven't been reported to the bookkeeper server. The indication is the reported date is null in the usages table- Returns:
- the result set which usages which haven't been reported to the bookkeeper server
- Throws:
SQLException
-
lookupRemoteUsageId
Find the remote usage id in the local database for the given quota id and instance id- Parameters:
quotaId
- the quota id associated with the usageinstanceId
- the instance id associated with the usage- Returns:
- the remote usage id. If it is -1, which means there is no remote usage id found.
- Throws:
SQLException
-