Interface NativeQueryHandler

    • Method Detail

      • closeAccountBalances

        long closeAccountBalances()
        Closes the account balances, returning the number of balances closed
      • copyLargeObject

        long copyLargeObject​(long sourceOid)
                      throws IOException
        Makes a copy of the large object with the specified oid and returns the oid of the copy.
        Throws:
        IOException
      • countUsersByUrl

        List<Pair<String,​Long>> countUsersByUrl()
        Groups all non removed nor purged members and brokers (not admins) by each root URL defined in the configurations.
        Returns:
      • 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
      • getAccountBalanceHistory

        List<BalanceEntryVO> getAccountBalanceHistory​(Long accountId,
                                                      List<Date> timepoints)
        Returns the account balance on each of the given timepoints, plus the current status as the last result
      • getDbLockHandler

        DbLockHandler getDbLockHandler()
        Returns the handler for the db_lock. Don't confuse this with tryLock(LockKey), which has a key. This one is for the database itself, so 2 instances don't use the same database.
      • 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.
      • getRunningVacuumStart

        Date getRunningVacuumStart()
        Returns the date when the vacuum started if there is a running vacuum. Otherwise it returns null.
      • getSearchHandler

        SearchHandler getSearchHandler()
        Returns a handler to search on the database
      • insertBackgroundTaskExecution

        long insertBackgroundTaskExecution​(BaseBackgroundTaskScheduling<?> scheduling)
        Insert or updates a background task execution for the given type and context. Returns the id of the created / updated background task execution.
      • insertReindexBackgroundTasks

        long insertReindexBackgroundTasks​(Class<? extends SimpleEntity> entityClass,
                                          String indexName,
                                          int batchSize)
        Inserts n executions of IndexEntitiesBackgroundTask for a given entity, returning the number of inserted tasks
      • insertTransferInitialStatus

        void insertTransferInitialStatus​(TransferType transferType,
                                         TransferStatus status)
        Inserts the relation for current status and a log for each transfer of the given type
      • insertUserAccountFeeLogs

        long insertUserAccountFeeLogs​(AccountFeeLog log)
        Inserts into the users_account_fee_logs table, for each users that should be charged (has a product that enables the given fee)
      • 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 of BulkActionUser for 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:
        1. Accounts that have never been closed yet
        2. 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 to BuiltinLanguages 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​(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.
      • userAccounts

        Map<UserAccountType,​IUserAccount> userAccounts​(User user,
                                                             Collection<UserAccountType> accountTypes,
                                                             boolean withNumberOnly,
                                                             Integer limit)
        Returns either all accounts (when accountType is null / empty) or filtered by type, both physical and pending user accounts, for a specific user. May also only return accounts with numbers, and optionally limits the number of results. IMPORTANT: the entities contained in the resulting map are not attached to the persisted context, be aware if you need to modify some of them.
      • vacuum

        void vacuum()
        Performs a vacuum and then an analyze for the database.
      • 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