Package org.languagetool.server
Class DatabaseAccessOpenSource
java.lang.Object
org.languagetool.server.DatabaseAccess
org.languagetool.server.DatabaseAccessOpenSource
Encapsulate database access. Will do nothing if database access is not configured.
- Since:
- 4.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate static final Stringprivate static final PatternFields inherited from class org.languagetool.server.DatabaseAccess
sqlSessionFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) boolean(package private) boolean(package private) voidaddWordBatch(List<String> words, Long userId, String groupName) add words in sql batch mode, no auto commit for better performance with large lists also suppresses uniqueness checksvoidcreateAndFillTestTables(boolean mysql, List<String> skipStatements) For unit tests only!voidFor unit tests only!(package private) booleandeleteWord(String word, Long userId) (package private) booleandeleteWord(String word, Long userId, String groupName) (package private) booleandeleteWordBatch(List<String> words, Long userId, String groupName) remove words in sql batch mode, no auto commit for better performance with large lists also suppresses uniqueness checks(package private) List<DictGroupEntry> getDictGroups(Long userId) get all dictionary groups belonging to a user(package private) ExtendedUserInfogetExtendedUserInfo(long userId) Get more general information on a user.(package private) ExtendedUserInfogetExtendedUserInfo(String user) Get more general information on a user Expects access to already be authorized(package private) LonggetOrCreateClientId(String client) (package private) LonggetOrCreateDictGroup(Long userId, String groupName) get or create a group with this name if it doesn't exist(package private) LonggetRules(UserLimits limits, Language lang, List<String> groups) (package private) Long(package private) UserInfoEntrygetUserInfoWithAddonToken(String username, String apiKey) (package private) UserInfoEntrygetUserInfoWithApiKey(String username, String apiKey) (package private) UserInfoEntrygetUserInfoWithPassword(String username, String password) (package private) LonggetUserRequestCount(Long userId) getWords(UserLimits limits, List<String> groups, int offset, int limit) (package private) voidFor tests, to avoid waiting for the invalidation period.(package private) voidprivate voidvalidateWord(String word) Methods inherited from class org.languagetool.server.DatabaseAccess
createAndFillTestTables, createAndFillTestTables, execute, executeStatement, getInstance, init, isReady, reset, shutdownCompact
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
NON_PREMIUM_MSG
- See Also:
-
WHITESPACE_PATTERN
-
dbLoggingCache
-
-
Constructor Details
-
DatabaseAccessOpenSource
-
-
Method Details
-
invalidateCaches
void invalidateCaches()Description copied from class:DatabaseAccessFor tests, to avoid waiting for the invalidation period.- Specified by:
invalidateCachesin classDatabaseAccess
-
addWord
- Specified by:
addWordin classDatabaseAccess
-
deleteWord
- Specified by:
deleteWordin classDatabaseAccess
-
deleteWordBatch
Description copied from class:DatabaseAccessremove words in sql batch mode, no auto commit for better performance with large lists also suppresses uniqueness checks- Specified by:
deleteWordBatchin classDatabaseAccess
-
addWordBatch
Description copied from class:DatabaseAccessadd words in sql batch mode, no auto commit for better performance with large lists also suppresses uniqueness checks- Specified by:
addWordBatchin classDatabaseAccess
-
getUserInfoWithPassword
- Specified by:
getUserInfoWithPasswordin classDatabaseAccess
-
getExtendedUserInfo
Description copied from class:DatabaseAccessGet more general information on a user Expects access to already be authorized- Specified by:
getExtendedUserInfoin classDatabaseAccess- Parameters:
user- email address of user- Returns:
- POJO with user information
-
getExtendedUserInfo
Description copied from class:DatabaseAccessGet more general information on a user. Expects access to already be authorized.- Specified by:
getExtendedUserInfoin classDatabaseAccess- Parameters:
userId- user id- Returns:
- POJO with more user information
-
getUserInfoWithApiKey
- Specified by:
getUserInfoWithApiKeyin classDatabaseAccess
-
getUserInfoWithAddonToken
- Specified by:
getUserInfoWithAddonTokenin classDatabaseAccess
-
invalidateUserInfoCache
- Specified by:
invalidateUserInfoCachein classDatabaseAccess
-
getUserRequestCount
- Specified by:
getUserRequestCountin classDatabaseAccess
-
getWords
-
addWord
-
getUserId
-
deleteWord
-
getOrCreateServerId
Long getOrCreateServerId()- Specified by:
getOrCreateServerIdin classDatabaseAccess- Since:
- 4.3
-
getOrCreateClientId
- Specified by:
getOrCreateClientIdin classDatabaseAccess- Since:
- 4.3
-
getDictGroups
Description copied from class:DatabaseAccessget all dictionary groups belonging to a user- Specified by:
getDictGroupsin classDatabaseAccess
-
getOrCreateDictGroup
Description copied from class:DatabaseAccessget or create a group with this name if it doesn't exist- Specified by:
getOrCreateDictGroupin classDatabaseAccess- Returns:
- id of the created/existing group
-
validateWord
-
createAndFillTestTables
For unit tests only!- Specified by:
createAndFillTestTablesin classDatabaseAccess
-
deleteTestTables
public void deleteTestTables()For unit tests only!- Specified by:
deleteTestTablesin classDatabaseAccess
-
getWords
- Specified by:
getWordsin classDatabaseAccess- Parameters:
limits- user account and settings for e.g. cachinggroups- names of dictionaries to be fetched, or null for default dictionaryoffset- use offset with limit for an ordered list of words in the dictionary, or RowBounds.NO_ROW_OFFSETlimit- use limit with offset for an ordered list of words in the dictionary, or use RowBounds.NO_ROW_LIMIT- Returns:
- a list of words from the user's dictionary (complete, or from the given range)
-
getRules
- Specified by:
getRulesin classDatabaseAccess- Parameters:
limits- user account and settings for e.g. cachinglang- language of rules to fetch; fetches global rules and language-specific rules for that languagegroups- names of groups of rules to be fetched, or null for default set of rules- Returns:
- a list of user rules (complete, or from the given range)
-