java.lang.Object
org.exoplatform.perkstore.service.utils.Utils

public class Utils extends Object
  • Field Details

  • Method Details

    • fromString

      public static <T> T fromString(Class<T> type, String value) throws org.exoplatform.ws.frameworks.json.impl.JsonException
      Throws:
      org.exoplatform.ws.frameworks.json.impl.JsonException
    • transformToString

      public static String transformToString(Object object)
    • timeToMilliseconds

      public static long timeToMilliseconds(LocalDateTime time)
    • addIdentityMembersFromProfiles

      public static final void addIdentityMembersFromProfiles(Collection<Profile> profiles, Collection<String> profilesRemoteIds)
    • addIdentityIdsFromProfiles

      public static void addIdentityIdsFromProfiles(List<Profile> permissionsProfiles, List<Long> permissions)
    • getIdentityIdByType

      public static String getIdentityIdByType(org.exoplatform.social.core.identity.model.Identity receiverIdentity)
    • 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(String type, String remoteId)
    • isSpaceType

      public static boolean isSpaceType(String type)
    • isUserType

      public static boolean isUserType(String type)
    • isGroupType

      public static boolean isGroupType(String type)
    • getIdentityTypeByProviderId

      public static String getIdentityTypeByProviderId(String providerId)
    • getIdentityProviderIdByType

      public static String getIdentityProviderIdByType(String type)
    • getSpace

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

      public static ProductOrder fromEntity(ProductOrderEntity entity)
    • toEntity

      public static ProductOrderEntity toEntity(ProductEntity productEntity, ProductOrder order)
    • formatTransactionHash

      public static final String formatTransactionHash(String transactionHash)
    • fromEntity

      public static Product fromEntity(ProductEntity entity)
    • toEntity

      public static ProductEntity toEntity(Product product)
    • getOrderPeriodicity

      public static ProductOrderPeriodType getOrderPeriodicity(String orderPeriodicity)
    • getTechnicalId

      public static long getTechnicalId(Profile profile)
    • refreshProfile

      public static void refreshProfile(Profile profile)
    • toProfile

      public static Profile toProfile(String type, String id)
    • toProfile

      public static Profile toProfile(long identityId)
    • getCurrentUserId

      public static final String getCurrentUserId()
    • getCurrentUserLocale

      public static final Locale getCurrentUserLocale() throws Exception
      Throws:
      Exception
    • getI18NMessage

      public static final String getI18NMessage(String messageKey) throws Exception
      Throws:
      Exception
    • getUserLocale

      public static final Locale getUserLocale(String username) throws Exception
      Throws:
      Exception
    • computeOrderDeliverStatus

      public static final void computeOrderDeliverStatus(ProductOrder order, double refundedQuantity, double deliveredQuantity)
    • computeOrderPaymentStatus

      public static final void computeOrderPaymentStatus(ProductOrder order, boolean transactionSuccess)
    • computeErrorResponse

      public static final javax.ws.rs.core.Response computeErrorResponse(org.exoplatform.services.log.Log log, PerkStoreException e, String operationDescription, String username, Object objectToDisplay)
    • displayErrorLog

      public static final void displayErrorLog(org.exoplatform.services.log.Log log, String operationDescription, String username, Object objectToDisplay, PerkStoreException e)
    • getErrorJSONFormat

      public static final String getErrorJSONFormat(PerkStoreException e) throws org.json.JSONException
      Throws:
      org.json.JSONException
    • getApplicationAccessUsersList

      public static final boolean getApplicationAccessUsersList(Set<String> recipientUsers, GlobalSettings globalSettings)
    • getProductAccessUsersList

      public static final boolean getProductAccessUsersList(Set<String> recipientUsers, Product product, GlobalSettings globalSettings)
    • getProductManagersUsersList

      public static final void getProductManagersUsersList(Set<String> adminUsers, Product product, GlobalSettings globalSettings) throws Exception
      Throws:
      Exception
    • isUserAdmin

      public static final boolean isUserAdmin(String username) throws Exception
      Throws:
      Exception
    • hasPermission

      public static final boolean hasPermission(String username, List<Long> identityIds) throws Exception
      Throws:
      Exception
    • getPermissionExpression

      public static final String getPermissionExpression(org.exoplatform.social.core.identity.model.Identity identity)
    • isUserMemberOf

      public static final boolean isUserMemberOf(String username, List<Profile> permittedProfiles)
    • isUserMemberOf

      public static final boolean isUserMemberOf(String username, String permissionExpression) throws Exception
      Throws:
      Exception