Package com.storedobject.core
Class TransactionManager
java.lang.Object
com.storedobject.core.TransactionManager
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static interface
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Check whether accounting system is enabled or not.boolean
actionAllowed
(String action) checkType
(StoredObject host, Id id, Class<? extends StoredObject> objectClass) checkType
(StoredObject host, Id id, Class<? extends StoredObject> objectClass, boolean allowEmpty) checkTypeAny
(StoredObject host, Id id, Class<? extends StoredObject> objectClass) checkTypeAny
(StoredObject host, Id id, Class<? extends StoredObject> objectClass, boolean allowEmpty) static TransactionManager
create
(Device device, Properties loginProperties) Create a new Pseudo-transaction.Create a new DB transaction.createTransaction
(Logic logic, PseudoTransaction pseudoTransaction) Create a new transaction for a given logic.<D extends Date>
Ddate
(D dateGMT) Convert a date/date-time value from GMT to local.<D extends Date>
DdateGMT
(D date) Convert a date/date-time value from local to GMT.void
forgotPassword
(char[] newPassword, String newUser) Format the date as per the locale of the user.Gets Session Id.int
Get the time difference in minutes.getUser()
Get the working date.boolean
Checks if the login method requires two-factor authentication.boolean
Checks if the login method is auto login.boolean
Checks if the login method is biometric-based.boolean
Checks if the login method is cross-server login.static boolean
boolean
Checks if the login method is password-based.void
Log something.void
Log something with a specific error.boolean
<D extends Date,
P extends AbstractPeriod<D>>
Pperiod
(P periodGMT) Convert a period value from GMT to local.<D extends Date,
P extends AbstractPeriod<D>>
PperiodGMT
(P period) Convert a period value from local to GMT.void
reinit
(char[] password) boolean
setEntity
(SystemEntity entity) void
Set a logger so that you can get the logged text to your own destination.void
setWorkingDate
(Date workingDate) Sets the working date for the entity.int
transact
(Logic logic, PseudoTransaction pseudoTransaction, TransactionManager.Transact transact) int
transact
(Logic logic, TransactionManager.Transact transact) int
transact
(TransactionManager.Transact transact) int
transactControl
(TransactionManager.TransactControl transactControl) int
transactControlPsuedo
(TransactionManager.TransactControl transactControl) int
transactPsuedo
(TransactionManager.Transact transact) boolean
verify
(char[] password) boolean
verify
(char[] password, int authenticatorCode)
-
Constructor Details
-
TransactionManager
-
-
Method Details
-
reinit
-
getSession
-
getDevice
-
needsApprovals
public boolean needsApprovals() -
actionAllowed
-
create
-
createTransaction
public Transaction createTransaction(Logic logic, PseudoTransaction pseudoTransaction) throws Exception Create a new transaction for a given logic. Depending on the approval count of the logic, either a DB transaction or a Pseudo-transaction will be created.- Parameters:
logic
- LogicpseudoTransaction
- Pseudo-transaction to be attached to this transaction.- Returns:
- Newly created transaction.
- Throws:
Exception
- Any exception.
-
createTransaction
Create a new DB transaction.- Returns:
- Newly created transaction.
- Throws:
Exception
- Any exception.
-
createPseudoTransaction
Create a new Pseudo-transaction.- Returns:
- Newly created transaction.
-
forgotPassword
-
verify
public boolean verify(char[] password) -
verify
public boolean verify(char[] password, int authenticatorCode) -
getUser
-
setEntity
-
getEntity
-
getCurrency
-
getCountry
-
transact
public int transact(Logic logic, PseudoTransaction pseudoTransaction, TransactionManager.Transact transact) throws Exception - Throws:
Exception
-
transact
- Throws:
Exception
-
transact
- Throws:
Exception
-
transactPsuedo
- Throws:
Exception
-
transactControl
- Throws:
Exception
-
transactControlPsuedo
public int transactControlPsuedo(TransactionManager.TransactControl transactControl) throws Exception - Throws:
Exception
-
format
-
date
Convert a date/date-time value from GMT to local.- Type Parameters:
D
- Date/date-time type.- Parameters:
dateGMT
- GMT value.- Returns:
- Local value.
-
dateGMT
Convert a date/date-time value from local to GMT.- Type Parameters:
D
- Date/date-time type.- Parameters:
date
- Local value.- Returns:
- GMT value.
-
periodGMT
Convert a period value from local to GMT.- Type Parameters:
D
- Date/date-time type.P
- Period type.- Parameters:
period
- Local value.- Returns:
- GMT value.
-
period
Convert a period value from GMT to local.- Type Parameters:
D
- Date/date-time type.P
- Period type.- Parameters:
periodGMT
- Local value.- Returns:
- Local value.
-
getTimeDifference
public int getTimeDifference()Get the time difference in minutes.- Returns:
- Time difference.
-
checkType
public Id checkType(StoredObject host, Id id, Class<? extends StoredObject> objectClass) throws Exception - Throws:
Exception
-
checkType
public Id checkType(StoredObject host, Id id, Class<? extends StoredObject> objectClass, boolean allowEmpty) throws Exception - Throws:
Exception
-
checkTypeAny
public Id checkTypeAny(StoredObject host, Id id, Class<? extends StoredObject> objectClass) throws Exception - Throws:
Exception
-
checkTypeAny
public Id checkTypeAny(StoredObject host, Id id, Class<? extends StoredObject> objectClass, boolean allowEmpty) throws Exception - Throws:
Exception
-
isMultiTenant
public static boolean isMultiTenant() -
log
Log something.- Parameters:
anything
- Anything, including exceptions, to be logged.
-
log
-
isPasswordLogin
public boolean isPasswordLogin()Checks if the login method is password-based.- Returns:
- true if the login method is password-based, false otherwise.
-
is2FactorLogin
public boolean is2FactorLogin()Checks if the login method requires two-factor authentication.- Returns:
- true if the login method requires two-factor authentication, false otherwise.
-
isBiometricLogin
public boolean isBiometricLogin()Checks if the login method is biometric-based.- Returns:
- true if the login method is biometric-based, false otherwise.
-
isCrossServerLogin
public boolean isCrossServerLogin()Checks if the login method is cross-server login.- Returns:
- true if the login method is cross-server login, false otherwise.
-
isAutoLogin
public boolean isAutoLogin()Checks if the login method is auto login.- Returns:
- true if the login method is auto login, false otherwise.
-
setLogger
-
getWorkingDate
-
setWorkingDate
-
accounting
public static boolean accounting()Check whether accounting system is enabled or not.- Returns:
- True/false.
-