Package org.cyclos.impl.sql
Interface NativeQueryHandler
-
- All Superinterfaces:
CustomBean
- All Known Implementing Classes:
BaseNativeQueryHandlerImpl,PostgresqlQueryHandlerImpl
public interface NativeQueryHandler extends CustomBean
Single place which contains the native queries
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longcloseAccountBalances()Closes the account balances, returning the number of balances closedlongcopyLargeObject(long sourceOid)Makes a copy of the large object with the specified oid and returns the oid of the copy.voiddeleteLargeObject(long oid)Deletes the large object with the specified oid.List<InconsistentBalance>fixInconsistentAccountBalances(List<Long> previousIds)Fixes any wrong account balances, returning the account ids that were wrongNativeAccountStatusgetAccountStatus(Account account, Date date)Returns the native account status at a given datecom.querydsl.jpa.JPQLTemplatesgetJpaQueryTemplates()Returns the templates used for jpa queriesLonggetNextTransactionNumber()Returns the number used to generate the next transaction numberLonggetObjectId(long id)Returns the oid associated to the specified stored file id.SearchHandlergetSearchHandler()Returns a handler to search on the databaselonginsertAccountsPendingToCharge(AccountFeeLog log)Inserts the references for the accounts pending to charge the given account fee loglonginsertArchiveAccountFees()Inserts theBackgroundTaskExecutions for each account fee log older thanCyclosProperties.getArchiveAccountFeesDays()voidinsertBackgroundTaskExecution(String className, String context)Tries to insert a new execution of the task with the given context, in case of conflicts (the same execution already exists) then do nothing.longinsertMailings(MailingList mailingList)Inserts mailings for all users for a given mailing list messagevoidinsertReindexBackgroundTasks(Class<? extends SimpleEntity> entityClass, String indexName, int batchSize)Inserts n executions ofIndexEntitiesBackgroundTaskfor a given entityvoidinsertTransferInitialStatus(TransferType transferType, TransferStatus status)Inserts the relation for current status and a log for each transfer of the given typevoidinsertUserIncomingMessages(SendMessageDTO sendMessage, MessageOwner messageOwner, User sendingUser, OutgoingMessage outgoing)Inserts incoming messages for users for a given outgoing messagelonginsertUsersForBulkAction(Long bulkActionId, UserQuery query)Inserts a record ofBulkActionUserfor each returned user of the given querycom.mysema.commons.lang.CloseableIterator<Record>iterateRecords(RecordQuery params)Iterates record entities according to the given query parameterscom.mysema.commons.lang.CloseableIterator<Long>iterateUserIds(UserQuery query)Iterates user ids according to the given query parameterscom.mysema.commons.lang.CloseableIterator<UserWithFieldsVO>iterateUsers(UserQuery query)Iterates user entities according to the given query parametersList<Long>nextAccountIdsToClose(int maxCount, Date limit)Returns up to the maximum count of account ids to close balance.InputStreamopenLargeObject(long oid)Opens the large object associated to the specified oid.
NOTE: After read, the input stream must be closed (the large object will be closed in turn).Pair<Set<String>,Set<Long>>purgeRemovedBuiltinLanguages()Removes all languages that were pointing toBuiltinLanguages that no longer exist, returning both the language templates that no longer exist and the ids of languages that were removedlongrebuildClosedAccountBalances()Rebuilds all closed account balances from the beginningvoidsetObjectId(long storedFileId, long oid)Sets the oid to the specified stored file id.booleansupportsBlobsInReadOnlyTransactions()Returns whether the underlying database supports accessing BLOBs from pure read-only transactionsbooleantryLock(LockKey key)Attempt to acquire an exclusive lock with a given key.booleantryLock(JdbcTemplate jdbc, LockKey key)Attempt to acquire an exclusive lock with a given key using the givenJdbcTemplate.List<AccountStatusUpdateResult>updateAccountStatuses(Collection<AccountStatusUpdateParams> updates)Updates a set of account statuses.longwriteLargeObject(InputStream in)Creates a new large object reading the content from the stream and returns its oid.
NOTE: The input stream parameter won't be closed it is responsibility of the client code.
-
-
-
Method Detail
-
closeAccountBalances
long closeAccountBalances()
Closes the account balances, returning the number of balances closed
-
copyLargeObject
long copyLargeObject(long sourceOid) throws IOExceptionMakes a copy of the large object with the specified oid and returns the oid of the copy.- Throws:
IOException
-
deleteLargeObject
void deleteLargeObject(long oid)
Deletes the large object with the specified oid.
-
fixInconsistentAccountBalances
List<InconsistentBalance> fixInconsistentAccountBalances(List<Long> previousIds)
Fixes any wrong account balances, returning the account ids that were wrong
-
getAccountStatus
NativeAccountStatus getAccountStatus(Account account, Date date)
Returns the native account status at a given date
-
getJpaQueryTemplates
com.querydsl.jpa.JPQLTemplates getJpaQueryTemplates()
Returns the templates used for jpa queries
-
getNextTransactionNumber
Long getNextTransactionNumber()
Returns the number used to generate the next transaction number
-
getObjectId
Long getObjectId(long id)
Returns the oid associated to the specified stored file id. Returns null if the stored file doesn't have any associated content.
-
getSearchHandler
SearchHandler getSearchHandler()
Returns a handler to search on the database
-
insertAccountsPendingToCharge
long insertAccountsPendingToCharge(AccountFeeLog log)
Inserts the references for the accounts pending to charge the given account fee log
-
insertArchiveAccountFees
long insertArchiveAccountFees()
Inserts theBackgroundTaskExecutions for each account fee log older thanCyclosProperties.getArchiveAccountFeesDays()
-
insertBackgroundTaskExecution
void insertBackgroundTaskExecution(String className, String context)
Tries to insert a new execution of the task with the given context, in case of conflicts (the same execution already exists) then do nothing.
-
insertMailings
long insertMailings(MailingList mailingList)
Inserts mailings for all users for a given mailing list message- Returns:
- the quantity of users that the mailing list is sending
-
insertReindexBackgroundTasks
void insertReindexBackgroundTasks(Class<? extends SimpleEntity> entityClass, String indexName, int batchSize)
Inserts n executions ofIndexEntitiesBackgroundTaskfor a given entity
-
insertTransferInitialStatus
void insertTransferInitialStatus(TransferType transferType, TransferStatus status)
Inserts the relation for current status and a log for each transfer of the given type
-
insertUserIncomingMessages
void insertUserIncomingMessages(SendMessageDTO sendMessage, MessageOwner messageOwner, User sendingUser, OutgoingMessage outgoing)
Inserts incoming messages for users for a given outgoing message
-
insertUsersForBulkAction
long insertUsersForBulkAction(Long bulkActionId, UserQuery query)
Inserts a record ofBulkActionUserfor each returned user of the given query
-
iterateRecords
com.mysema.commons.lang.CloseableIterator<Record> iterateRecords(RecordQuery params)
Iterates record entities according to the given query parameters
-
iterateUserIds
com.mysema.commons.lang.CloseableIterator<Long> iterateUserIds(UserQuery query)
Iterates user ids according to the given query parameters
-
iterateUsers
com.mysema.commons.lang.CloseableIterator<UserWithFieldsVO> iterateUsers(UserQuery query)
Iterates user entities according to the given query parameters
-
nextAccountIdsToClose
List<Long> nextAccountIdsToClose(int maxCount, Date limit)
Returns up to the maximum count of account ids to close balance. Accounts that are returned:- Accounts that have never been closed yet
- Accounts whose last closing was before the given limit and the current account balance's date is newer than the last closing
-
openLargeObject
InputStream openLargeObject(long oid)
Opens the large object associated to the specified oid.
NOTE: After read, the input stream must be closed (the large object will be closed in turn).
-
purgeRemovedBuiltinLanguages
Pair<Set<String>,Set<Long>> purgeRemovedBuiltinLanguages()
Removes all languages that were pointing toBuiltinLanguages that no longer exist, returning both the language templates that no longer exist and the ids of languages that were removed
-
rebuildClosedAccountBalances
long rebuildClosedAccountBalances()
Rebuilds all closed account balances from the beginning
-
setObjectId
void setObjectId(long storedFileId, long oid)Sets the oid to the specified stored file id.
-
supportsBlobsInReadOnlyTransactions
boolean supportsBlobsInReadOnlyTransactions()
Returns whether the underlying database supports accessing BLOBs from pure read-only transactions
-
tryLock
boolean tryLock(JdbcTemplate jdbc, LockKey key)
Attempt to acquire an exclusive lock with a given key using the givenJdbcTemplate.
-
tryLock
boolean tryLock(LockKey key)
Attempt to acquire an exclusive lock with a given key. The lock will be bound to the current transaction, and will be automatically unlocked when the transaction ends.
-
updateAccountStatuses
List<AccountStatusUpdateResult> updateAccountStatuses(Collection<AccountStatusUpdateParams> updates)
Updates a set of account statuses. Must be called only after acquiring the lock on the affected accounts.
-
writeLargeObject
long writeLargeObject(InputStream in) throws IOException
Creates a new large object reading the content from the stream and returns its oid.
NOTE: The input stream parameter won't be closed it is responsibility of the client code.- Throws:
IOException
-
-