Package lumis.portal.monitor.impl
Class MonitorUtilInternal
- java.lang.Object
-
- lumis.portal.monitor.impl.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) $
-
-
Field Summary
Fields Modifier and Type Field Description static String
INVALID_COLLECT_EVENT_ID
static String
MONITOR_FIELD
Big data monitor field identifier.
-
Constructor Summary
Constructors Constructor Description MonitorUtilInternal()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ServiceInstanceConfig
checkModeManagePermission(CustomerExperienceApp app, String serviceInstanceId)
Checks user has the required manage permissions.static ServiceInstanceConfig
checkModeViewPermission(CustomerExperienceApp app, String serviceInstanceId)
Checks user has the required view permissions.static ServiceInstanceConfig
checkViewServiceInstancePermission(String serviceInstanceId)
Checks user has the required view service instance permission.static String[]
getAllEventDocumentTypeIds()
Returns the identifiers of document types of all monitor events.static int
getDayOfMonth(Date date)
Returns the day of month for a date.static int
getDayOfWeek(Date date)
Returns the day of week for a date.static Document
getDocument(IMonitorEvent event, Deque<IMonitorValuesProvider> monitoringValues)
Returns the document for the given event with the given values ornull
if some required field is missing.static DocumentTypeField
getDocumentTypeField(String fieldId)
Returns the repository document type by raw field identifier.static String
getDocumentTypeFieldId(String fieldId)
Returns the normalized full field identifier.static String
getDocumentTypeId(IMonitorEvent event)
Returns the big data document type identifier for the given event.static int
getMonth(Date date)
Returns the month for a date.static ISearchQueryFilter
getPrivacyFilter(ServiceInstanceConfig analyticsServiceInstance, DocumentTypeField acceptedPurposetsTypeField)
Returns the privacy term part filter.static ISearchQueryFilter
getProjectIdFilter(ServiceInstanceConfig serviceInstance, boolean forMonitorUser)
Returns a search query filter to filter the data with the appropriated area tags.static int
getQuarter(Date date)
Returns the quarter for a date.static long
getSecondsAfterMidnight(Date date)
Returns the amount of seconds after midnight for a date.static Set<String>
getValuesToFilterProjectIdFor(ServiceInstanceConfig serviceInstance, boolean forMonitorUser)
Returns the filter values to be applied in project id field.static int
getYear(Date date)
Returns the year for a date.static void
injectCurrentEventValues(Deque<IMonitorValuesProvider> monitoringValues, MonitorHelper monitorHelper)
Injects the current monitoring values in monitoring context.static void
refreshMonitorIndices()
Refreshes all monitor indices.static void
setUserCustomAttributesByPkIfPresents(boolean isTrusted, boolean affectTrusted, MonitorUser monitorUser, org.json.simple.JSONObject sourceFields)
Update monitor user custom fields if key field presents in JSON.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.static void
setUserInfoIfPresent(boolean isTrusted, boolean affectTrusted, MonitorUser monitorUser, org.json.simple.JSONObject sourceFields)
Update monitor user fields if key field presents in JSON.static void
setUserInfoIfPresent(boolean isTrusted, boolean affectTrusted, MonitorUser monitorUser, org.json.simple.JSONObject sourceFields, org.json.simple.JSONObject customAttributes)
Update monitor user fields if key field presents in JSON.static void
updateDocumentType(MonitorEvent event)
Updates the document type of the given event.
-
-
-
Field Detail
-
INVALID_COLLECT_EVENT_ID
public static final String INVALID_COLLECT_EVENT_ID
- See Also:
- Constant Field Values
-
MONITOR_FIELD
public static final String MONITOR_FIELD
Big data monitor field identifier.- Since:
- 9.0.0
- See Also:
- Constant Field Values
-
-
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
-
getDocumentTypeField
public static DocumentTypeField getDocumentTypeField(String fieldId) throws PortalObjectNotFoundException
Returns the repository document type by raw field identifier.- Parameters:
fieldId
- the raw field identifier.- Returns:
- the repository document type by raw field identifier.
- Throws:
PortalObjectNotFoundException
- Since:
- 12.2.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 ornull
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 instanceforMonitorUser
- 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 instanceforMonitorUser
- 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
-
checkModeViewPermission
public static ServiceInstanceConfig checkModeViewPermission(CustomerExperienceApp app, String serviceInstanceId) throws PortalException
Checks user has the required view permissions.- Parameters:
app
- the customer app to which the permission should be checked.serviceInstanceId
- the service instance identifier.- Throws:
IllegalArgumentException
- if the given service instance identifier isnull
or an empty string.IllegalArgumentException
- if the given service instance identifier refers to a service other than customer experience.PortalObjectNotFoundException
- if no service instance was found with the given identifier.PortalException
- if some error occur during the service instance reading.AccessDeniedException
- if the user doesn't have the requested permission.- Since:
- 12.5.0
-
checkModeManagePermission
public static ServiceInstanceConfig checkModeManagePermission(CustomerExperienceApp app, String serviceInstanceId) throws PortalException
Checks user has the required manage permissions.- Parameters:
app
- the customer app to which the permission should be checked.serviceInstanceId
- the service instance identifier.- Throws:
IllegalArgumentException
- if the given service instance identifier isnull
or an empty string.IllegalArgumentException
- if the given service instance identifier refers to a service other than customer experience.PortalObjectNotFoundException
- if no service instance was found with the given identifier.PortalException
- if some error occur during the service instance reading.AccessDeniedException
- if the user doesn't have the requested permission.- Since:
- 12.5.0
-
checkViewServiceInstancePermission
public static ServiceInstanceConfig checkViewServiceInstancePermission(String serviceInstanceId) throws PortalException
Checks user has the required view service instance permission.- Parameters:
serviceInstanceId
- the service instance identifier.- Throws:
IllegalArgumentException
- if the given service instance identifier isnull
or an empty string.IllegalArgumentException
- if the given service instance identifier refers to a service other than customer experience.PortalObjectNotFoundException
- if no service instance was found with the given identifier.PortalException
- if some error occur during the service instance reading.AccessDeniedException
- if the user doesn't have the requested permission.- Since:
- 12.5.0
-
injectCurrentEventValues
public static void injectCurrentEventValues(Deque<IMonitorValuesProvider> monitoringValues, MonitorHelper monitorHelper)
Injects the current monitoring values in monitoring context.- Parameters:
monitoringValues
- the current monitoring valuesmonitorHelper
- 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
-
-