Class BTSaveUserChanges
- All Implemented Interfaces:
Serializable,Tool
@Deprecated(since="13.0",
forRemoval=true)
public class BTSaveUserChanges
extends BusinessTask<Void>
Deprecated, for removal: This API element is subject to removal in a future version.
Task used to save a copy of the user information into a table containing the historic user's data.
In particular, it requires the user identifier on which a change has been made, starting from which the information is
extracted from the registry table, compared with the most recent status saved in the history table, therefore,
only if there is any variation in any of the specific fields, a new record is added to the history.
This record will contain the user's data, the date on which the modification took place and the reference to the
user authorizing the modification (potentially different from the modified user).
It is mandatory to provide the user identification key by invoking the
Here is a code snippet that illustrate a typical use of this task inside a custom task:
It is mandatory to provide the user identification key by invoking the
setUser(long) method before starting the task.Here is a code snippet that illustrate a typical use of this task inside a custom task:
public class DATOperation {
protected void body() throws DAException, DAValidateException {
PooledConnection conn = getConnection(POOL,"...");
execute(conn);
saveUserChanges(conn);
commit(conn);
}
protected void saveUserChanges(PooledConnection conn) {
long userId=1L;
boolean isPasswordChanged = true;
try {
DATSaveUserChanges dat = Factory.make(DATSaveUserChanges.class, this);
dat.setUser(userId); // mandatory
dat.setPasswordChanged(isPasswordChanged); // optional
dat.execute(conn);
} catch (DAValidateException|DAException e) {
// cannot register the user's change
}
}
}
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanDeprecated, for removal: This API element is subject to removal in a future version.protected LongDeprecated, for removal: This API element is subject to removal in a future version. -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidDeprecated, for removal: This API element is subject to removal in a future version.Implements this method to write the specific task logic to handle the input parameter.protected booleanisChanged(HashGetter previousValues, String previousField, HashGetter currentValues, String currentField) Deprecated, for removal: This API element is subject to removal in a future version.protected booleanisChangedSinceLastTime(HashGetter previousValues, HashGetter userData, Set<Long> roles) Deprecated, for removal: This API element is subject to removal in a future version.protected voidsaveChanges(DAOUserChanges dao, PoolKit pk, HashGetter userData, Set<Long> roles) Deprecated, for removal: This API element is subject to removal in a future version.voidsetPasswordChanged(boolean passwordChanged) Deprecated, for removal: This API element is subject to removal in a future version.Used to notify a change to the password field.voidsetUser(long user) Deprecated, for removal: This API element is subject to removal in a future version.Used to indicate the user that will be modified.Methods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Field Details
-
_user
Deprecated, for removal: This API element is subject to removal in a future version. -
_passwordChanged
protected boolean _passwordChangedDeprecated, for removal: This API element is subject to removal in a future version.
-
-
Constructor Details
-
BTSaveUserChanges
public BTSaveUserChanges()Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
setUser
public void setUser(long user) Deprecated, for removal: This API element is subject to removal in a future version.Used to indicate the user that will be modified. For the correct operation of the task it is mandatory to invoke this method before execute the task.- Parameters:
user- user identification key
-
setPasswordChanged
public void setPasswordChanged(boolean passwordChanged) Deprecated, for removal: This API element is subject to removal in a future version.Used to notify a change to the password field. If not invoked, no changes will be registered to the password field.- Parameters:
passwordChanged- boolean flag indicating if the password has been changed (true) or not (false).
-
body
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:BusinessTaskImplements this method to write the specific task logic to handle the input parameter.- Specified by:
bodyin classBusinessTask<Void>- Parameters:
i- the object upon which the task will works onpk- the poolkit containing the reference to the database connection that can be used- Throws:
DAException- in case of database errorDAValidateException- in case of database validation error
-
isChangedSinceLastTime
protected boolean isChangedSinceLastTime(HashGetter previousValues, HashGetter userData, Set<Long> roles) Deprecated, for removal: This API element is subject to removal in a future version. -
isChanged
protected boolean isChanged(HashGetter previousValues, String previousField, HashGetter currentValues, String currentField) Deprecated, for removal: This API element is subject to removal in a future version. -
saveChanges
protected void saveChanges(DAOUserChanges dao, PoolKit pk, HashGetter userData, Set<Long> roles) throws DAValidateException, DAException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
DAValidateExceptionDAException
-