Class AccountsUtil

java.lang.Object
com.skava.accounts.util.AccountsUtil
All Implemented Interfaces:
Serializable

public class AccountsUtil extends Object implements Serializable
The utility class AccountsUtil consists of helper and validator methods for accounts entity.
Author:
Infosys Equinox
See Also:
  • Field Details

  • Constructor Details

    • AccountsUtil

      public AccountsUtil()
  • Method Details

    • isValidaccountType

      public static void isValidaccountType(long accountTypeId, long collectionId, AccountTypesRepository accountTypeRepository, org.springframework.context.MessageSource messageSource, String locale)
      Checks if is validaccount type.
      Parameters:
      accountTypeId - the account type id
      collectionId - the collection id
      accountTypeRepository - the account type repository
      messageSource - the message source
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
    • isValidAccount

      public static boolean isValidAccount(long accountId, long collectionId, AccountsRepository accountRepository, org.springframework.context.MessageSource messageSource, String locale)
      Checks if is valid account.
      Parameters:
      accountId - the account id
      collectionId - the collection id
      accountRepository - the account repository
      messageSource - the message source
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      Returns:
      true, if is valid account
    • isValidCostCentre

      public static boolean isValidCostCentre(long accountId, long costCentreId, CostCentreRepository costCentreRepository, org.springframework.context.MessageSource messageSource, String locale)
      Checks if is valid cost centre.
      Parameters:
      accountId - the account id
      costCentreId - the cost centre id
      costCentreRepository - the cost centre repository
      messageSource - the message source
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      Returns:
      true, if is valid cost centre
    • isValidTeam

      public static boolean isValidTeam(long teamId, long accountId, TeamRepository teamRepository, org.springframework.context.MessageSource messageSource, String locale)
      Checks if is valid team.
      Parameters:
      teamId - the team id
      accountId - the account id
      teamRepository - the team repository
      messageSource - the message source
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      Returns:
      true, if is valid team
    • getCollectionStatus

      public static CollectionStatus getCollectionStatus(Collections request)

      validateCollectionStatus

      Parameters:
      request - Instance of Collections which is used to get the collection status.
      Returns:
      collection status
    • isValidAccountSize

      public static boolean isValidAccountSize(String size, PropertiesRepository propertiesRepository, long collectionId)
      isValidAccountSize - Used to validate the account size.
      Parameters:
      size - size of the account which is to be validated.
      propertiesRepository - the properties Repository.
      collectionId - the unique identifier of the collection.
      Returns:
      a boolean value true/false
    • isValidPaymentMethod

      public static boolean isValidPaymentMethod(String paymentMethod, PropertiesRepository propertiesRepository, long collectionId)
      isValidPaymentMethod - Used to validate the payment method.
      Parameters:
      paymentMethod - the payment method that will be used by the buyers for that contract.
      propertiesRepository - the properties Repository.
      collectionId - the unique identifier of the collection.
      Returns:
      a boolean value true/false
    • getAdminOrUserId

      public static Long getAdminOrUserId(com.skava.core.auth.AuthTokenHandler authTokenHandler)
      This method will return admin userid if it is 0 then return userid
      Parameters:
      authTokenHandler - authTokenHandler
      Returns:
      long adminid or userid
    • checkIfAnyRoleOtherThanBuyerUser

      public static boolean checkIfAnyRoleOtherThanBuyerUser(com.skava.core.auth.AuthTokenHandler authTokenHandler, long collectionId)
      checkIfAnyRoleExceptBuyerUser
      Parameters:
      authTokenHandler - authTokenHandler
      collectionId - collectionId
      Returns:
      a boolean value
    • isValidSortParam

      public static boolean isValidSortParam(String sortParam)
      This method is used to validate user sort params.
      Parameters:
      sortParam - Indicates the search and sort params which is used for validating the sort and search params.
      Returns:
      boolean value.
    • isValidSortOrder

      public static boolean isValidSortOrder(String order)
      This method is used to validate the sorting order, returns TRUE if valid else FALSE.
      Parameters:
      order - Indicates the order of an user's sorting. eg : ASC or DESC
      Returns:
      boolean value
    • useParamForSort

      public static <T> com.querydsl.core.types.Expression<T> useParamForSort(String param)
      Type Parameters:
      T -
      Parameters:
      param -
      Returns: