use of com.microsoft.applicationinsights.agent.internal.exporter.models.AvailabilityData in project ApplicationInsights-Java by microsoft.
the class TelemetryUtil method getProperties.
// TODO (trask) Azure SDK: can we move getProperties up to MonitorDomain, or if not, a common
// interface?
public static Map<String, String> getProperties(MonitorDomain data) {
if (data instanceof AvailabilityData) {
AvailabilityData availabilityData = (AvailabilityData) data;
Map<String, String> properties = availabilityData.getProperties();
if (properties == null) {
properties = new HashMap<>();
availabilityData.setProperties(properties);
}
return properties;
} else if (data instanceof MessageData) {
MessageData messageData = (MessageData) data;
Map<String, String> properties = messageData.getProperties();
if (properties == null) {
properties = new HashMap<>();
messageData.setProperties(properties);
}
return properties;
} else if (data instanceof MetricsData) {
MetricsData metricsData = (MetricsData) data;
Map<String, String> properties = metricsData.getProperties();
if (properties == null) {
properties = new HashMap<>();
metricsData.setProperties(properties);
}
return properties;
} else if (data instanceof PageViewData) {
PageViewData pageViewData = (PageViewData) data;
Map<String, String> properties = pageViewData.getProperties();
if (properties == null) {
properties = new HashMap<>();
pageViewData.setProperties(properties);
}
return properties;
} else if (data instanceof PageViewPerfData) {
PageViewPerfData pageViewPerfData = (PageViewPerfData) data;
Map<String, String> properties = pageViewPerfData.getProperties();
if (properties == null) {
properties = new HashMap<>();
pageViewPerfData.setProperties(properties);
}
return properties;
} else if (data instanceof RemoteDependencyData) {
RemoteDependencyData remoteDependencyData = (RemoteDependencyData) data;
Map<String, String> properties = remoteDependencyData.getProperties();
if (properties == null) {
properties = new HashMap<>();
remoteDependencyData.setProperties(properties);
}
return properties;
} else if (data instanceof RequestData) {
RequestData requestData = (RequestData) data;
Map<String, String> properties = requestData.getProperties();
if (properties == null) {
properties = new HashMap<>();
requestData.setProperties(properties);
}
return properties;
} else if (data instanceof TelemetryEventData) {
TelemetryEventData eventData = (TelemetryEventData) data;
Map<String, String> properties = eventData.getProperties();
if (properties == null) {
properties = new HashMap<>();
eventData.setProperties(properties);
}
return properties;
} else if (data instanceof TelemetryExceptionData) {
TelemetryExceptionData exceptionData = (TelemetryExceptionData) data;
Map<String, String> properties = exceptionData.getProperties();
if (properties == null) {
properties = new HashMap<>();
exceptionData.setProperties(properties);
}
return properties;
} else {
throw new IllegalArgumentException("Unexpected type: " + data.getClass().getName());
}
}
Aggregations