Package lumis.portal.monitor.impl
Class MonitorUtilInternal
- java.lang.Object
-
- lumis.portal.monitor.impl.MonitorUtilInternal
-
public class MonitorUtilInternal extends java.lang.Object
Monitor internal utilities.- Since:
- 9.0.0
- Version:
- $Revision$ $Date$
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
INVALID_COLLECT_EVENT_ID
static java.lang.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, java.lang.String serviceInstanceId)
Checks user has the required manage permissions.static ServiceInstanceConfig
checkModeViewPermission(CustomerExperienceApp app, java.lang.String serviceInstanceId)
Checks user has the required view permissions.static ServiceInstanceConfig
checkViewServiceInstancePermission(java.lang.String serviceInstanceId)
Checks user has the required view service instance permission.static java.lang.String[]
getAllEventDocumentTypeIds()
Returns the identifiers of document types of all monitor events.static int
getDayOfMonth(java.util.Date date)
Returns the day of month for a date.static int
getDayOfWeek(java.util.Date date)
Returns the day of week for a date.static Document
getDocument(IMonitorEvent event, java.util.Deque<IMonitorValuesProvider> monitoringValues)
Returns the document for the given event with the given values ornull
if some required field is missing.static DocumentTypeField
getDocumentTypeField(java.lang.String fieldId)
Returns the repository document type by raw field identifier.static java.lang.String
getDocumentTypeFieldId(java.lang.String fieldId)
Returns the normalized full field identifier.static java.lang.String
getDocumentTypeId(IMonitorEvent event)
Returns the big data document type identifier for the given event.static java.util.List<? extends java.io.Serializable>
getMonitorValuesProviderFieldValues(SessionConfig sessionConfig, IMonitorValuesProvider provider, IMonitorField field, ITransaction transaction)
Returns the value for a field from aIMonitorValuesProvider
.static int
getMonth(java.util.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(java.util.Date date)
Returns the quarter for a date.static long
getSecondsAfterMidnight(java.util.Date date)
Returns the amount of seconds after midnight for a date.static java.util.Set<java.lang.String>
getValuesToFilterProjectIdFor(ServiceInstanceConfig serviceInstance, boolean forMonitorUser)
Returns the filter values to be applied in project id field.static int
getYear(java.util.Date date)
Returns the year for a date.static void
injectCurrentEventValues(java.util.Deque<IMonitorValuesProvider> monitoringValues, MonitorHelper monitorHelper, boolean isForErrorEvent)
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 java.lang.String INVALID_COLLECT_EVENT_ID
- See Also:
- Constant Field Values
-
MONITOR_FIELD
public static final java.lang.String MONITOR_FIELD
Big data monitor field identifier.- Since:
- 9.0.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDocumentTypeFieldId
public static java.lang.String getDocumentTypeFieldId(java.lang.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(java.lang.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 java.lang.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 java.lang.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, java.util.Deque<IMonitorValuesProvider> monitoringValues) throws java.lang.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:
java.lang.Exception
- Since:
- 9.0.0
-
getMonitorValuesProviderFieldValues
public static java.util.List<? extends java.io.Serializable> getMonitorValuesProviderFieldValues(SessionConfig sessionConfig, IMonitorValuesProvider provider, IMonitorField field, ITransaction transaction) throws java.lang.Exception
Returns the value for a field from aIMonitorValuesProvider
. This method callsIMonitorValuesProvider.getValues(SessionConfig, IMonitorField, ITransaction)
and discards values as that method specifies, returning the result.- Parameters:
sessionConfig
- current session. This session is the current processing session and is not related to the session where the monitor values were collected.provider
- the provider.field
- the field.transaction
- current transaction. This transaction is the current processing transaction and is not related to where the monitor values were collected.- Returns:
- the values, or
null
if the provider does not specify value for the given field. - Throws:
java.lang.Exception
- if thrown byIMonitorValuesProvider.getValues(SessionConfig, IMonitorField, ITransaction)
- Since:
- 14.1.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(java.util.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(java.util.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(java.util.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(java.util.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(java.util.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(java.util.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 java.util.Set<java.lang.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, java.lang.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:
java.lang.IllegalArgumentException
- if the given service instance identifier isnull
or an empty string.java.lang.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, java.lang.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:
java.lang.IllegalArgumentException
- if the given service instance identifier isnull
or an empty string.java.lang.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(java.lang.String serviceInstanceId) throws PortalException
Checks user has the required view service instance permission.- Parameters:
serviceInstanceId
- the service instance identifier.- Throws:
java.lang.IllegalArgumentException
- if the given service instance identifier isnull
or an empty string.java.lang.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(java.util.Deque<IMonitorValuesProvider> monitoringValues, MonitorHelper monitorHelper, boolean isForErrorEvent)
Injects the current monitoring values in monitoring context.- Parameters:
monitoringValues
- the current monitoring valuesmonitorHelper
- the monitor helper to inject the values intoisForErrorEvent
- indicates whether the injection is being performed for an error event.- Since:
- 14.2.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
-
-