Class WalletUtils

java.lang.Object
io.meeds.wallet.utils.WalletUtils

public class WalletUtils extends Object
Utils class to provide common tools and constants
  • Field Details

  • Method Details

    • getCurrentUserId

      public static final String getCurrentUserId()
    • getCurrentUserIdentityId

      public static final long getCurrentUserIdentityId()
    • getNotificationReceiversUsers

      public static List<String> getNotificationReceiversUsers(Wallet wallet, String excludedId)
    • getPermanentLink

      public static String getPermanentLink(Wallet wallet)
    • getIdentityById

      public static org.exoplatform.social.core.identity.model.Identity getIdentityById(long identityId)
    • getIdentityById

      public static org.exoplatform.social.core.identity.model.Identity getIdentityById(String identityId)
    • getIdentityByTypeAndId

      public static org.exoplatform.social.core.identity.model.Identity getIdentityByTypeAndId(WalletType type, String remoteId)
    • getSpacePrettyName

      public static String getSpacePrettyName(String id)
    • getSpace

      public static org.exoplatform.social.core.space.model.Space getSpace(String id)
    • computeWalletIdentity

      public static void computeWalletIdentity(Wallet wallet)
    • getRewardAdministrators

      public static Set<String> getRewardAdministrators() throws Exception
      Throws:
      Exception
    • isUserRewardingAdmin

      public static final boolean isUserRewardingAdmin(String username)
    • isUserMemberOfGroupOrUser

      public static final boolean isUserMemberOfGroupOrUser(String username, String permissionExpression)
    • getWalletLink

      public static String getWalletLink(String receiverType, String receiverId)
    • getMyWalletLink

      public static String getMyWalletLink()
    • getPermanentLink

      public static String getPermanentLink(org.exoplatform.social.core.space.model.Space space)
    • encodeString

      public static String encodeString(String content)
    • decodeString

      public static String decodeString(String content)
    • isUserSpaceManager

      public static boolean isUserSpaceManager(String id, String modifier)
    • canAccessWallet

      public static boolean canAccessWallet(Wallet wallet, String currentUser)
      Return true if user can access wallet detailed information
      Parameters:
      wallet - wallet details to check
      currentUser - user accessing wallet details
      Returns:
      true if has access, else false
    • isUserSpaceMember

      public static boolean isUserSpaceMember(String spaceId, String accesssor)
    • checkUserIsSpaceManager

      public static boolean checkUserIsSpaceManager(String spaceId, String modifier, boolean throwException) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • computeWalletFromIdentity

      public static final void computeWalletFromIdentity(Wallet wallet, org.exoplatform.social.core.identity.model.Identity identity)
    • formatTransactionHash

      public static final String formatTransactionHash(String transactionHash)
    • hideWalletOwnerPrivateInformation

      public static final void hideWalletOwnerPrivateInformation(Wallet wallet)
    • fromJsonString

      public static final <T> T fromJsonString(String value, Class<T> resultClass)
    • toJsonString

      public static final String toJsonString(Object object)
    • convertToDecimals

      public static final BigInteger convertToDecimals(double amount, int decimals)
    • convertFromDecimals

      public static final double convertFromDecimals(BigInteger amount, int decimals)
    • getSettings

      public static final GlobalSettings getSettings()
    • getGasLimit

      public static final Long getGasLimit()
    • getContractDetail

      public static final ContractDetail getContractDetail()
    • getContractAddress

      public static final String getContractAddress()
    • getNetworkId

      public static final long getNetworkId()
    • getTransactionEtherScanLink

      public static String getTransactionEtherScanLink()
    • getWebsocketURL

      public static final String getWebsocketURL()
    • formatNumber

      public static final String formatNumber(Object amount, String lang)
    • isWalletEmpty

      public static final boolean isWalletEmpty(Wallet wallet)
    • isAdminAccount

      public static final boolean isAdminAccount(String address)
    • getResourceBundleKey

      public static final String getResourceBundleKey(Locale locale, String key)
    • getLocale

      public static Locale getLocale(Wallet wallet)
    • getUserLocale

      public static final Locale getUserLocale(String username)
    • getBlockchainURLSuffix

      public static final String getBlockchainURLSuffix()
    • logStatistics

      public static final void logStatistics(TransactionDetail transactionDetail)
    • getWalletTokenAdminService

      public static final WalletTokenAdminService getWalletTokenAdminService()
    • getWalletService

      public static final WalletService getWalletService()
    • getSpaceService

      public static final org.exoplatform.social.core.space.spi.SpaceService getSpaceService()
    • formatBalance

      public static final String formatBalance(double balance, Locale locale, boolean simplified)
      Format Wallet Balance amount in currency format, without currency symbol and switch user locale.
      Parameters:
      balance - amount to format
      locale - designated locale to display balance
      simplified - if true, the fractions will be ignored when the balance is greater than 100.
      Returns:
      formatted balance in user locale
    • getListenerService

      public static final org.exoplatform.services.listener.ListenerService getListenerService()
    • broadcastTransactionReplacedEvent

      public static void broadcastTransactionReplacedEvent(TransactionDetail oldTransaction, TransactionDetail newTransaction)
    • transactionToMap

      public static Map<String,Object> transactionToMap(TransactionDetail transactionDetail)
    • generateToken

      public static String generateToken(jakarta.servlet.http.HttpSession session)
    • getToken

      public static String getToken(jakarta.servlet.http.HttpSession session)