Class AnalyticsUtils

java.lang.Object
io.meeds.analytics.utils.AnalyticsUtils

public class AnalyticsUtils extends Object
  • Field Details

    • MAX_BULK_DOCUMENTS

      public static final short MAX_BULK_DOCUMENTS
      See Also:
    • VALUES_SEPARATOR

      public static final String VALUES_SEPARATOR
      See Also:
    • FIELD_ID

      public static final String FIELD_ID
      The document id, written by the storage as a fixed field.
      See Also:
    • FIELD_IS_ANALYTICS

      public static final String FIELD_IS_ANALYTICS
      See Also:
    • FIELD_ERROR_MESSAGE

      public static final String FIELD_ERROR_MESSAGE
      See Also:
    • FIELD_ERROR_CODE

      public static final String FIELD_ERROR_CODE
      See Also:
    • FIELD_STATUS

      public static final String FIELD_STATUS
      See Also:
    • FIELD_OPERATION

      public static final String FIELD_OPERATION
      See Also:
    • FIELD_SUB_MODULE

      public static final String FIELD_SUB_MODULE
      See Also:
    • FIELD_MODULE

      public static final String FIELD_MODULE
      See Also:
    • FIELD_SPACE_ID

      public static final String FIELD_SPACE_ID
      See Also:
    • FIELD_DURATION

      public static final String FIELD_DURATION
      See Also:
    • FIELD_USER_ID

      public static final String FIELD_USER_ID
      See Also:
    • FIELD_TIMESTAMP

      public static final String FIELD_TIMESTAMP
      See Also:
    • FIELD_ACTIVITY_TYPE

      public static final String FIELD_ACTIVITY_TYPE
      The activity type a stream post or comment event carries as a parameter.
      See Also:
    • ALTERNATIVE_FIELD_SUFFIX

      public static final String ALTERNATIVE_FIELD_SUFFIX
      See Also:
    • STATISTIC_ORIGIN

      public static final String STATISTIC_ORIGIN
      Keyword parameter the websocket path stamps on every event it records, so that a query tells a browser event from a server one; a server emitter never sets it.
      See Also:
    • STATISTIC_ORIGIN_WEBSOCKET

      public static final String STATISTIC_ORIGIN_WEBSOCKET
      The one value of STATISTIC_ORIGIN.
      See Also:
    • RESERVED_PARAMETER_NAMES

      public static final Pattern RESERVED_PARAMETER_NAMES
      The parameter names a page may never set on a websocket event: every field the storage writes as a fixed field but the space, which the listener resolves itself, the origin and the collaborative-activity field, each with its alternative names.
    • ALTERNATIVE_PARAMETER_NAMES

      public static final Pattern ALTERNATIVE_PARAMETER_NAMES
      Every parameter name carrying the storage's own alternative-name suffix, which no page has a reason to send.
    • SPACE_PARAMETER_NAMES

      public static final Pattern SPACE_PARAMETER_NAMES
      The parameters of the space family a page may send, read once by the websocket listener to resolve the space, then dropped.
    • SPACE_ATTRIBUTES

      public static final List<SpaceStatisticAttribute> SPACE_ATTRIBUTES
      The attributes stamped on an event for its space, the only ones ever written: a page value sent under one of these names is dropped on the websocket path, and the typed writer of each keeps its Elasticsearch mapping (a long for a count or a time, never a keyword).
    • SPACE_ATTRIBUTE_NAMES

      public static final Set<String> SPACE_ATTRIBUTE_NAMES
      The names of SPACE_ATTRIBUTES.
    • DEFAULT_INDEX_PREFIX

      public static final String DEFAULT_INDEX_PREFIX
      Default of analytics.es.index.prefix, the weekly index name prefix
      See Also:
    • MAX_ALTERNATIVE_FIELD_COUNT

      public static final int MAX_ALTERNATIVE_FIELD_COUNT
      See Also:
    • FIELD_MODIFIER_USER_SOCIAL_ID

      public static final String FIELD_MODIFIER_USER_SOCIAL_ID
      See Also:
    • FIELD_SOCIAL_IDENTITY_ID

      public static final String FIELD_SOCIAL_IDENTITY_ID
      See Also:
    • FILE_SPACES_ACTIVITY_TYPE

      public static final String FILE_SPACES_ACTIVITY_TYPE
      See Also:
    • ACTIVITY_COMMENT

      public static final String ACTIVITY_COMMENT
      See Also:
    • PROFILE_PROPERTIES

      public static final String PROFILE_PROPERTIES
      See Also:
    • EXTERNAL_USER_SOURCE

      public static final String EXTERNAL_USER_SOURCE
      See Also:
    • PROPERTIES

      public static final String PROPERTIES
      See Also:
    • COMPUTED_CHART_LABEL

      public static final List<String> COMPUTED_CHART_LABEL
    • DATE_FORMATTER

      public static final DateTimeFormatter DATE_FORMATTER
    • DEFAULT_FIELDS

      public static final List<String> DEFAULT_FIELDS
    • YEAR_WEEK

      public static final DateTimeFormatter YEAR_WEEK
    • YEAR_MONTH

      public static final DateTimeFormatter YEAR_MONTH
    • YEAR_MONTH_DATE_HOUR

      public static final DateTimeFormatter YEAR_MONTH_DATE_HOUR
  • Method Details

    • getYearMonthDayHour

      public static final String getYearMonthDayHour(long timestamp)
    • getYearMonthDayHour

      public static final String getYearMonthDayHour(LocalDateTime date)
    • getYearMonthDay

      public static final String getYearMonthDay(long timestamp)
    • getYearMonthDay

      public static final String getYearMonthDay(LocalDateTime date)
    • getYearMonth

      public static final String getYearMonth(long timestamp)
    • getYearMonth

      public static final String getYearMonth(LocalDateTime date)
    • getYearWeek

      public static final String getYearWeek(long timestamp)
    • getYearWeek

      public static final String getYearWeek(LocalDateTime date)
    • toJsonString

      public static final String toJsonString(Object object)
    • compueLabel

      public static final String compueLabel(String chartKey, String chartValue)
    • fromJsonString

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

      public static long timeToMilliseconds(LocalDateTime time)
    • fixJSONStringFormat

      public static final String fixJSONStringFormat(String jsonString)
    • collectionToJSONString

      public static final String collectionToJSONString(String value)
    • getJsonNode

      public static com.fasterxml.jackson.databind.JsonNode getJsonNode(com.fasterxml.jackson.databind.JsonNode jsonNode, int i, String... keys)
    • addStatisticData

      public static void addStatisticData(StatisticData statisticData)
    • getUserIdentityId

      public static long getUserIdentityId(String username)
    • getSpaceByPrettyName

      public static org.exoplatform.social.core.space.model.Space getSpaceByPrettyName(String prettyName)
    • getSpaceById

      public static org.exoplatform.social.core.space.model.Space getSpaceById(String spaceId)
    • getIdentity

      public static org.exoplatform.social.core.identity.model.Identity getIdentity(String identityIdString)
    • getIdentityId

      public static long getIdentityId(String identityId)
    • getIdentity

      public static org.exoplatform.social.core.identity.model.Identity getIdentity(String providerId, String remoteId)
    • getIdentityId

      public static long getIdentityId(String providerId, String remoteId)
    • getUserIdentityId

      public static long getUserIdentityId(org.exoplatform.services.security.ConversationState currentState)
    • getCurrentUserIdentityId

      public static long getCurrentUserIdentityId()
    • isUnkownUser

      public static boolean isUnkownUser(String username)
    • getUsername

      public static String getUsername(org.exoplatform.services.security.ConversationState currentState)
    • formatDate

      public static String formatDate(long timeInMilliseconds)
    • addSpaceStatistics

      public static void addSpaceStatistics(StatisticData statisticData, org.exoplatform.social.core.space.model.Space space)
    • addActivityStatisticsData

      public static void addActivityStatisticsData(StatisticData statisticData, org.exoplatform.social.core.activity.model.ExoSocialActivity activity)
    • addCategoryStatistics

      public static void addCategoryStatistics(StatisticData statisticData, long categoryId)
    • addCategoryStatistics

      public static void addCategoryStatistics(StatisticData statisticData, io.meeds.social.category.model.Category category)
    • addCategoryLinkStatistics

      public static void addCategoryLinkStatistics(StatisticData statisticData, io.meeds.social.category.model.CategoryObject categoryObject)
    • convertFieldName

      public static void convertFieldName(Supplier<String> supplier, Consumer<String> consumer, Set<StatisticFieldMapping> mappings, boolean isAggregation)
    • getAlternativeFieldName

      public static String getAlternativeFieldName(String fieldName, int alternativeIndex)
    • getBaseFieldName

      public static String getBaseFieldName(String fieldName)
    • sortByAnalyticsDate

      @Deprecated(since="7.3.0", forRemoval=true) public static com.fasterxml.jackson.databind.node.ObjectNode sortByAnalyticsDate(org.json.JSONObject input)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 7.3.0, for removal: assumes the default index prefix, which made the mapping read return nothing on a deployment with a custom analytics.es.index.prefix (EXO-90504). Use sortByAnalyticsDate(JSONObject, String) with the configured prefix.
    • sortByAnalyticsDate

      public static com.fasterxml.jackson.databind.node.ObjectNode sortByAnalyticsDate(org.json.JSONObject input, String indexPrefix)
      Sorts the indices of an Elasticsearch _mapping response by the date carried in their name, oldest first.
      Parameters:
      input - the _mapping response, keyed by index name
      indexPrefix - the configured analytics.es.index.prefix; an index whose name is not <prefix>_yyyy-MM-dd is left out
      Returns:
      the same entries, in ascending date order