/**
  * Obtains the currently authenticated principal, or an authentication request token.
  *
  * @return the Authentication or null if no authentication information is available
  */
 public SystemUserEntity getAuthentication() {
   SystemUserEntity context = systemUserEntityThreadLocal.get();
   if (context != null)
     LOG.debug(
         "SecurityContext of user ".concat(context.getUserName()).concat(" has been gotten."));
   return context;
 }
  @SuppressWarnings({"unchecked"})
  public Object execute(Object o) throws G16CommonBusinessException, HibernateEXC {
    Map<Integer, SystemUserEntity> map = (Map<Integer, SystemUserEntity>) o;
    SystemUserEntity argument = map.get(0);
    /** the username should be ACTIVE */
    argument.setStatus(SystemUserEntity.StatusTypeEnumeration.ACTIVE);

    LOG.info(
        "An attemp for login occured by username="******"; and status is=")
            .concat(argument.getStatus()));
    argument.setPassword(SecurityAlgorithm.encrypt(argument.getPassword()));
    /**
     * Checks the 1) username should be the same as user has been entered 2) password should be the
     * same as user has been entered 3) status should be active.
     */
    return Expression.and(
        Expression.and(
            Expression.eq("userName", argument.getUserName()),
            Expression.eq("password", argument.getPassword())),
        Expression.eq("status", argument.getStatus()));
  }