Class MonitorUtilInternal


  • public class MonitorUtilInternal
    extends Object
    Monitor internal utilities.
    Since:
    9.0.0
    Version:
    $Revision: 24476 $ $Date: 2021-04-28 11:28:23 -0300 (Wed, 28 Apr 2021) $
    • Constructor Detail

      • MonitorUtilInternal

        public MonitorUtilInternal()
    • Method Detail

      • getDocumentTypeFieldId

        public static String getDocumentTypeFieldId​(String fieldId)
        Returns the normalized full field identifier.
        Parameters:
        fieldId - the raw field identifier.
        Returns:
        the normalized full field identifier.
        Since:
        9.0.0
      • getDocumentTypeId

        public static String getDocumentTypeId​(IMonitorEvent event)
        Returns the big data document type identifier for the given event.
        Parameters:
        event - the event.
        Returns:
        the big data document type identifier for the given event.
        Since:
        11.1.0
      • getAllEventDocumentTypeIds

        public static String[] getAllEventDocumentTypeIds()
        Returns the identifiers of document types of all monitor events.
        Returns:
        the identifiers.
        Since:
        12.5.0
      • getDocument

        public static Document getDocument​(IMonitorEvent event,
                                           Deque<IMonitorValuesProvider> monitoringValues)
                                    throws Exception
        Returns the document for the given event with the given values or null if some required field is missing.
        Parameters:
        event - the event.
        monitoringValues - the values.
        Returns:
        the document for the given event with the given values or null if some required field is missing.
        Throws:
        Exception
        Since:
        9.0.0
      • updateDocumentType

        public static void updateDocumentType​(MonitorEvent event)
        Updates the document type of the given event. Does not create one if it doesn't exist yet.
        Parameters:
        event - the event.
        Since:
        10.2.0
      • getSecondsAfterMidnight

        public static long getSecondsAfterMidnight​(Date date)
        Returns the amount of seconds after midnight for a date.
        Parameters:
        date - the date for getting seconds after midnight.
        Returns:
        the amount of seconds after midnight for the given date.
        Since:
        10.2.0
      • getDayOfWeek

        public static int getDayOfWeek​(Date date)
        Returns the day of week for a date.
        Parameters:
        date - the date for getting day of week.
        Returns:
        the day of week for the given date.
        Since:
        10.2.0
      • getDayOfMonth

        public static int getDayOfMonth​(Date date)
        Returns the day of month for a date.
        Parameters:
        date - the date for getting day of month.
        Returns:
        the day of month for the given date.
        Since:
        12.2.0
      • getMonth

        public static int getMonth​(Date date)
        Returns the month for a date.
        Parameters:
        date - the date for getting month from.
        Returns:
        the month for the given date.
        Since:
        12.2.0
      • getQuarter

        public static int getQuarter​(Date date)
        Returns the quarter for a date.
        Parameters:
        date - the date for getting quarter from.
        Returns:
        the quarter for the given date.
        Since:
        12.2.0
      • getYear

        public static int getYear​(Date date)
        Returns the year for a date.
        Parameters:
        date - the date for getting year from.
        Returns:
        the year for the given date.
        Since:
        12.2.0
      • refreshMonitorIndices

        public static void refreshMonitorIndices()
                                          throws PortalException
        Refreshes all monitor indices.
        Throws:
        PortalException
        Since:
        12.2.0
      • setUserInfoIfPresent

        public static void setUserInfoIfPresent​(boolean isTrusted,
                                                boolean affectTrusted,
                                                MonitorUser monitorUser,
                                                org.json.simple.JSONObject sourceFields)
                                         throws PortalException
        Update monitor user fields if key field presents in JSON.
        Parameters:
        isTrusted - whether the info is trusted or not.
        affectTrusted - case info is untrusted, should erase trusted.
        monitorUser - the monitor user that will be updated.
        sourceFields - a JSON with source key and values.
        Throws:
        PortalException
        Since:
        12.3.0
      • setUserInfoIfPresent

        public static void setUserInfoIfPresent​(boolean isTrusted,
                                                boolean affectTrusted,
                                                MonitorUser monitorUser,
                                                org.json.simple.JSONObject sourceFields,
                                                org.json.simple.JSONObject customAttributes)
                                         throws PortalException
        Update monitor user fields if key field presents in JSON.
        Parameters:
        isTrusted - whether the info is trusted or not.
        affectTrusted - case info is untrusted, should erase trusted.
        monitorUser - the monitor user that will be updated.
        sourceFields - a JSON with source key and values.
        customAttributes - the custom attributes.
        Throws:
        PortalException
        Since:
        12.3.0
      • setUserDefaultAttributesIfPresents

        public static void setUserDefaultAttributesIfPresents​(boolean isTrusted,
                                                              boolean affectTrusted,
                                                              MonitorUser monitorUser,
                                                              org.json.simple.JSONObject sourceFields)
        Update monitor user default fields if key field presents in JSON.
        Parameters:
        isTrusted - whether the info is trusted or not.
        affectTrusted - case info is untrusted, should erase trusted.
        monitorUser - the monitor user that will be updated.
        sourceFields - a JSON with source key and values.
        Since:
        14.0.0
      • getPrivacyFilter

        public static ISearchQueryFilter getPrivacyFilter​(ServiceInstanceConfig analyticsServiceInstance,
                                                          DocumentTypeField acceptedPurposetsTypeField)
                                                   throws PortalException
        Returns the privacy term part filter.
        Parameters:
        analyticsServiceInstance - the service instance of analytics.
        acceptedPurposetsTypeField - big data privacy term field .
        Returns:
        the privacy term part filter.
        Throws:
        PortalException
        Since:
        12.3.0
      • getProjectIdFilter

        public static ISearchQueryFilter getProjectIdFilter​(ServiceInstanceConfig serviceInstance,
                                                            boolean forMonitorUser)
                                                     throws PortalException
        Returns a search query filter to filter the data with the appropriated area tags.
        Parameters:
        serviceInstance - the service instance
        forMonitorUser - indicates whether the filter will be used in monitor user index
        Returns:
        a search query filter to filter the data with the appropriated area tags.
        Throws:
        PortalException
        Since:
        12.4.0
      • getValuesToFilterProjectIdFor

        public static Set<String> getValuesToFilterProjectIdFor​(ServiceInstanceConfig serviceInstance,
                                                                boolean forMonitorUser)
                                                         throws PortalException
        Returns the filter values to be applied in project id field.
        Parameters:
        serviceInstance - the service instance
        forMonitorUser - indicates whether the filter will be used in monitor user index
        Returns:
        the filter values to be applied in project id field.
        Throws:
        PortalException
        Since:
        12.4.0
      • injectCurrentEventValues

        public static void injectCurrentEventValues​(Deque<IMonitorValuesProvider> monitoringValues,
                                                    MonitorHelper monitorHelper)
        Injects the current monitoring values in monitoring context.
        Parameters:
        monitoringValues - the current monitoring values
        monitorHelper - the monitor helper to inject the values into
        Since:
        14.0.0
      • setUserCustomAttributesByPkIfPresents

        public static void setUserCustomAttributesByPkIfPresents​(boolean isTrusted,
                                                                 boolean affectTrusted,
                                                                 MonitorUser monitorUser,
                                                                 org.json.simple.JSONObject sourceFields)
                                                          throws PortalException
        Update monitor user custom fields if key field presents in JSON.
        Parameters:
        isTrusted - whether the info is trusted or not.
        affectTrusted - case info is untrusted, should erase trusted.
        monitorUser - the monitor user that will be updated.
        sourceFields - a JSON with source key and values.
        Throws:
        PortalException
        Since:
        14.0.0