Class UserTypeUtil

java.lang.Object
overit.geocall.base.util.UserTypeUtil

public class UserTypeUtil extends Object
Collection of utility to retrieve and manage the user type from its StaticView.
  • Method Details

    • getStatic

      public static StaticView getStatic(Object caller)
      Utility to retrieve the StaticView of user types' table. This method uses the factory logic to instantiate the StaticView. The view is ordered on DAOUserTypes.ORDERING column
      Parameters:
      caller - Reference to object that calls this utility. The caller must contain a reference to the Identity
      Returns:
      The StaticView of user types' table
      See Also:
    • getUserTypes

      public static DBView getUserTypes(Object caller)
      Utility to retrieve the DBView of user types' table. This method uses the factory logic to instantiate the StaticView and retrieve the DBView from that with only the visible user types.
      Parameters:
      caller - Reference to object that calls this utility. The caller must contain a reference to the Identity
      Returns:
      The DBView of the StaticView of user types' table
      See Also:
    • getUserTypes

      public static DBView getUserTypes(Object caller, boolean filterDeleted)
      Utility to retrieve the DBView of user types' table. This method uses the factory logic to instantiate the StaticView and retrieve the DBView from that. The filterDeleted allow to decide to fill the DBView with all records of user types' table or fill with only the ones that are visible.
      Parameters:
      caller - Reference to object that calls this utility. The caller must contain a reference to the Identity
      filterDeleted - false to obtain all the records, true for only the ones that are visible
      Returns:
      The DBView of the StaticView of user types' table
      See Also:
    • getDefaultUserType

      public static Long getDefaultUserType(Object caller)
      Retrieve the default user type. It is the first type of the user types' table ordered by the order column. The method instances the StaticView of user types' table using the factory logic to retrieve the default user type and extracts only the visible user types.
      Parameters:
      caller - Reference to object that calls this utility. The caller must contain a reference to the Identity
      Returns:
      the id of the default user type
      See Also:
    • getDefaultUserType

      public static Long getDefaultUserType(DBView dbView)
      Retrieve the default user type from the DBView passed in input. The default user type is the first row of the DBView in input without change its order.
      Parameters:
      dbView - DBView of user types' StaticView
      Returns:
      the id of the default user type
    • invalidateUserTypes

      public static void invalidateUserTypes(Object caller)
      Utility to invalidate the user types' StaticView
      Parameters:
      caller - Reference to object that calls this utility. The caller must contain a reference to the Identity
    • isUserTypeSuper

      public static boolean isUserTypeSuper(Long userType, PoolKit pk) throws DAException
      Return if the user type in input has the server.administration grant.
      Parameters:
      userType - id of the user type to check.
      pk - instance of the PoolKit.
      Returns:
      true if the user type has the server.administration grant, otherwise false
      Throws:
      DAException - in case of a db error.
    • isUserTypeCompanyAdmin

      public static boolean isUserTypeCompanyAdmin(Long userType, PoolKit pk) throws DAException
      Return if the user type in input has the company.administration grant.
      Parameters:
      userType - id of the user type to check.
      pk - instance of the PoolKit.
      Returns:
      true if the user type has the company.administration grant, otherwise false
      Throws:
      DAException - in case of a db error.
    • isUserTypeSuper

      public static boolean isUserTypeSuper(Long userType, DBView dbv) throws DAException
      Return if the user type in input has the server.administration grant.
      Parameters:
      userType - id of the user type to check.
      dbv - a DBView of all the user types with the server.administration grant.
      Returns:
      true if the user type has the server.administration grant, otherwise false
      Throws:
      DAException - in case of a db error.
    • isUserTypeCompanyAdmin

      public static boolean isUserTypeCompanyAdmin(Long userType, DBView dbv) throws DAException
      Return if the user type in input has the company.administration grant.
      Parameters:
      userType - id of the user type to check.
      dbv - a DBView of all the user types with the company.administration grant.
      Returns:
      true if the user type has the company.administration grant, otherwise false
      Throws:
      DAException - in case of a db error.
    • fetchSuperUserTypes

      public static DBView fetchSuperUserTypes(PoolKit pk) throws DAException
      Returns a DBView of all the user types with the server.administration grant.
      Parameters:
      pk - instance of the PoolKit.
      Returns:
      a DBView of all the user types with the server.administration grant.
      Throws:
      DAException - in case of a db error.
    • fetchCompanyAdminUserTypes

      public static DBView fetchCompanyAdminUserTypes(PoolKit pk) throws DAException
      Returns a DBView of all the user types with the company.administration grant.
      Parameters:
      pk - instance of the PoolKit.
      Returns:
      a DBView of all the user types with the company.administration grant.
      Throws:
      DAException - in case of a db error.