Package com.storedobject.core
Class APIToken
java.lang.Object
com.storedobject.core.StoredObject
com.storedobject.core.APIToken
- All Implemented Interfaces:
Displayable,StringFiller,HasId
Represents an API token object used for managing and validating access tokens
associated with different purposes and clients in the system.
The class extends
StoredObject, allowing it to be persisted and
manipulated within the system's data model.- Author:
- Syam
-
Field Summary
Fields inherited from class com.storedobject.core.StoredObject
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanAccess(SystemUser user) Checks if the given user has access to this API token.static voidDefines the columns for the APIToken class.Retrieves the client ID associated with this instance, if applicable.Retrieves the project ID associated with this instance, if applicable.Retrieves the purpose associated with the API token.getToken()Retrieves the token associated with this API token instance.static inthints()Provides the hint value by combining multiple hint constants that indicate certain characteristics of the object.static voidAdds an index to the specifiedIndicescollection.static String[]links()Retrieves the link definitions associated with this class.voidsetClientID(String clientID) Sets the client ID associated with this API token.voidsetProjectID(String projectID) Sets the project ID associated with this API token instance.voidsetPurpose(String purpose) Sets the purpose of the API token.voidSets the token for the API.Display representation of the instance used for human-friendly display.toString()String representation of the instance.voidValidates the data for the current instance of APIToken.Methods inherited from class com.storedobject.core.StoredObject
addLink, addLink, addLink, addLink, addLink, addLink, addLink, addLink, checkCurrency, checkCurrency, checkForDuplicate, checkForDuplicate, checkTimeZone, checkTransaction, clearObjectLinks, contemporary, copy, copy, count, count, count, count, count, count, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countLinks, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, countMasters, create, created, delete, delete, delete, deleted, directUpdate, equals, exists, exists, exists, exists, exists, existsFileData, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLink, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsLinks, existsMaster, existsMaster, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, existsMasters, family, family, family, family, fill, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, getActor, getAttachment, getAttachmentId, getChildren, getContemporaryOf, getDeleted, getDeleted, getExistsCondition, getExistsCondition, getFileData, getFileData, getHistorical, getId, getKeyIndex, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getMaster, getNotExistsCondition, getNotExistsCondition, getParent, getParent, getParent, getParentId, getParentId, getParentId, getRelated, getRelated, getTransaction, getTransactionId, getTransactionIP, getUnique, getUniqueCondition, hashCode, inserted, isModified, isVirtual, list, list, list, list, list, list, list, list, list, list, list, list, list, listDeletedIds, listFileData, listFileData, listHistory, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listLinks, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listMasters, listTree, listTree, listTree, listTree, listViaQuery, listViaQuery, load, load, load, load, loadAttributesFrom, loaded, loading, makeNew, makeVirtual, migrate, migrateLink, migrateLink, moduleName, nextVersion, objectLink, objectLink, objectLink, objectLinks, objectLinks, old, person, previousVersion, previousVersion, query, query, query, query, query, query, query, query, query, query, query, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryLinks, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, queryMasters, reload, reload, reloaded, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeAllLinks, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeLink, removeReverseLinks, removeReverseLinks, save, save, save, save, save, save, save, save, save, save, save, save, save, save, save, saved, saving, setMaster, setRawValue, setTransaction, stringify, tableName, timestamp, toCode, transacting, undelete, undelete, undeleted, updated, user, userId, validate, validateChildAttach, validateChildDetach, validateChildUpdate, validateDelete, validateInsert, validateParentAttach, validateParentDetach, validateParentUpdate, validateUndelete, validateUpdate, valueEquals
-
Constructor Details
-
APIToken
public APIToken()Default constructor for the APIToken class. Initializes a new instance of the APIToken object. This constructor does not set any fields or properties and is primarily intended for creating an empty token object.
-
-
Method Details
-
columns
Defines the columns for the APIToken class.- Parameters:
columns- the column object used to define and add the required columns for the APIToken class.
-
indices
Adds an index to the specifiedIndicescollection. The index is based on the column list "lower(Purpose)".- Parameters:
indices- theIndicescollection to which the index will be added
-
hints
public static int hints()Provides the hint value by combining multiple hint constants that indicate certain characteristics of the object. Combines ObjectHint.SMALL and ObjectHint.SMALL_LIST.- Returns:
- An integer representing the bitwise combination of the hint constants ObjectHint.SMALL and ObjectHint.SMALL_LIST.
-
links
Retrieves the link definitions associated with this class. Each definition indicates the relationships or connections between this object and other entities or groups.- Returns:
- An array of strings, where each string represents a link definition in the format: "EntityName|FullyQualifiedClassName|||AttributesDescriptor".
-
setPurpose
Sets the purpose of the API token.- Parameters:
purpose- The purpose to associate with the API token.
-
getPurpose
-
setClientID
Sets the client ID associated with this API token.- Parameters:
clientID- The client identifier to be set.
-
getClientID
-
setToken
Sets the token for the API.- Parameters:
token- the token to be set
-
getProjectID
-
setProjectID
Sets the project ID associated with this API token instance.- Parameters:
projectID- The project identifier to be set.
-
getToken
-
validateData
Validates the data for the current instance of APIToken. Ensures that the required fields have appropriate non-empty values and perform any necessary validation logic.- Overrides:
validateDatain classStoredObject- Parameters:
tm- The transaction manager used to handle the validation process.- Throws:
Invalid_Value- If the value of the "purpose" or "token" field is empty or invalid.Exception- If an error occurs during the validation process.
-
canAccess
Checks if the given user has access to this API token.- Parameters:
user- The user to check for access.- Returns:
- True if the user has access, false otherwise.
-
toString
Description copied from class:StoredObjectString representation of the instance. Mostly used for logging purposes.- Overrides:
toStringin classStoredObject- Returns:
- String representation of the instance.
-
toDisplay
Description copied from class:StoredObjectDisplay representation of the instance used for human-friendly display.- Specified by:
toDisplayin interfaceDisplayable- Overrides:
toDisplayin classStoredObject- Returns:
- Display representation of the instance.
-