Class BTSaveUserChanges

java.lang.Object
overit.geocall.bl.BusinessTask<Void>
overit.geocall.basic.bl.user.task.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 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

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected Long
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    body(Void i, PoolKit pk)
    Deprecated, 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 boolean
    isChanged(HashGetter previousValues, String previousField, HashGetter currentValues, String currentField)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected boolean
    isChangedSinceLastTime(HashGetter previousValues, HashGetter userData, Set<Long> roles)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected void
    saveChanges(DAOUserChanges dao, PoolKit pk, HashGetter userData, Set<Long> roles)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    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.
    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.

    Methods inherited from class overit.geocall.bl.BusinessTask

    start, start, startAlone, startInBackground

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • _user

      protected Long _user
      Deprecated, for removal: This API element is subject to removal in a future version.
    • _passwordChanged

      protected boolean _passwordChanged
      Deprecated, 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

      protected void body(Void i, PoolKit pk) throws DAException, DAValidateException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from class: BusinessTask
      Implements this method to write the specific task logic to handle the input parameter.
      Specified by:
      body in class BusinessTask<Void>
      Parameters:
      i - the object upon which the task will works on
      pk - the poolkit containing the reference to the database connection that can be used
      Throws:
      DAException - in case of database error
      DAValidateException - 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:
      DAValidateException
      DAException