Collector Helper

@Service
open class CollectorHelper : ApplicationsHelper

The CollectorHelper class is useful to collect all the issues and analytics data sent by the Ametista Engine

Author

N7ghtm4r3 - Tecknobit

See also

EquinoxItemsHelper
ResourcesManager

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
private val _IN_CLAUSE_: String = " IN "
Link copied to clipboard
val _VALUES_: String = " VALUES "
Link copied to clipboard
val _WHERE_: String = " WHERE "
Link copied to clipboard
APPLICATION_ICONS_FOLDER the folder where the icons pics will be saved
Link copied to clipboard
@Autowired
protected open var applicationsRepository: ApplicationsRepository
applicationsRepository instance for the application repository
Link copied to clipboard
Link copied to clipboard
val COMMA: String = ","
Link copied to clipboard
DEFAULT_PLATFORMS_FILTER the default value of the platforms filter
Link copied to clipboard
val DELETE_FROM_: String = "DELETE FROM "
Link copied to clipboard
@Autowired
private open var devicesRepository: DevicesRepository
devicesRepository instance for the device repository
Link copied to clipboard
protected open var entityManager: EntityManager
Link copied to clipboard
EXCEPTION_NAME_PATTERN the pattern to validate the exception names values
Link copied to clipboard
private val EXCEPTION_NAME_REGEX: String = "\b(\w+Exception)\b"
EXCEPTION_NAME_REGEX regex to validate the exception name
Link copied to clipboard
@Autowired
private open var issuesRepository: IssuesRepository
issuesRepository instance for the issues repository
Link copied to clipboard
Link copied to clipboard
@Autowired
protected open var performanceRepository: PerformanceRepository
performanceRepository instance for the performance repository
Link copied to clipboard
val PROFILES_DIRECTORY: String = "profiles"
Link copied to clipboard
Link copied to clipboard
val RESOURCES_KEY: String = "resources"
Link copied to clipboard
val RESOURCES_PATH: String = "resources/"
Link copied to clipboard
val SINGLE_QUOTE: String = "'"
Link copied to clipboard
private val timeFormatter: TimeFormatter
timeFormatter helps to format the temporal value with the specific "dd/MM/yyyy" pattern

Functions

Link copied to clipboard
open fun applicationExists(applicationId: String): Boolean
Method to get whether the application is present in the database
Link copied to clipboard
protected open fun batchDelete(table: String, values: List<List<out Any>>, columns: Array<String>)
Link copied to clipboard
protected open fun batchInsert(command: EquinoxItemsHelper.InsertCommand, table: String, values: List<out Any>, batchQuery: EquinoxItemsHelper.BatchQuery, columns: Array<String>)
Link copied to clipboard
private open fun calculateAnalyticValue(analytic: PerformanceAnalytic, value: Double, currentDate: Long)
Method to calculate and store the value of an analytic
Link copied to clipboard
open fun collectAnalytic(applicationId: String, appVersion: String, platform: Platform, type: PerformanceAnalytic.PerformanceAnalyticType, hPayload: JsonHelper)
Method to collect an analytic for an application and its platform version
Link copied to clipboard
open fun collectIssue(applicationId: String, appVersion: String, platform: Platform, hPayload: JsonHelper)
Method to collect a new issue occurred in the application
Link copied to clipboard
open fun connectPlatform(applicationId: String, platform: Platform)
Method to connect a new platform for the application
Link copied to clipboard
open fun createAppIcon(icon: MultipartFile, applicationId: String): String
Method to create the pathname for an icon pic
Link copied to clipboard
open fun createProfileResource(resource: MultipartFile, resourceId: String): String
Link copied to clipboard
open fun createResource(resource: MultipartFile, resourcesDirectory: String, resourceId: String): String
Link copied to clipboard
open fun deleteAppIcon(applicationId: String): Boolean
Method to delete an icon pic
Link copied to clipboard
open fun deleteApplication(applicationId: String)
Method to delete an existing application
Link copied to clipboard
Link copied to clipboard
open fun deleteResource(resourcesDirectory: String, resourceId: String): Boolean
Link copied to clipboard
Method to edit an existing application
Link copied to clipboard
Method to get whether the application is present in the database
Link copied to clipboard
open fun getApplications(page: Int, pageSize: Int, name: String, platforms: List<String>): PaginatedResponse<AmetistaApplication>
Method to get the applications list registered in the system
Link copied to clipboard
private open fun getCurrentDate(): Long
Method to get the current date formatted with the timeFormatter
Link copied to clipboard
private open fun getIssueName(issue: String): String
Method to get with the EXCEPTION_NAME_PATTERN the name of the issue
Link copied to clipboard
open fun <T : IssueAnalytic?> getIssues(application: AmetistaApplication, page: Int, pageSize: Int, platform: Platform, filters: Set<String>): PaginatedResponse<T>
Method to get the issues related to an application
Link copied to clipboard
open fun getPerformanceData(applicationId: String, platform: Platform, filters: JsonHelper): PerformanceData
Method to get the performance data of an application
Link copied to clipboard
open fun getSuffixResource(resource: MultipartFile): String
Link copied to clipboard
open fun getVersionSamples(applicationId: String, platform: Platform, analyticType: PerformanceAnalytic.PerformanceAnalyticType): List<String>
Method to get all the available versions target for a specific analytic
Link copied to clipboard
private open fun incrementAnalyticValue(analytic: PerformanceAnalytic, incrementValue: Int, currentDate: Long)
Method to increment and store the value of an analytic
Link copied to clipboard
private open fun manageIssuesPerSessionAnalytic(applicationId: String, appVersion: String, platform: Platform)
Method to calculate the ISSUES_PER_SESSION rate and save it
Link copied to clipboard
Method to save and add in the system a new application
Link copied to clipboard
private open fun saveDevice(hDevice: JsonHelper): String
Method to save a new device in the system if not already exists
Link copied to clipboard
open fun saveResource(resource: MultipartFile, path: String)
Link copied to clipboard
private open fun storeAnalytic(applicationId: String, appVersion: String, platform: Platform, type: PerformanceAnalytic.PerformanceAnalyticType, value: Double)
Method to store an analytic for an application and its platform version
Link copied to clipboard
private open fun storeLaunchTime(applicationId: String, appVersion: String, platform: Platform, hPayload: JsonHelper)
Method to collect a LAUNCH_TIME analytic
Link copied to clipboard
protected open fun <V> syncBatch(container: EquinoxItemsHelper.SyncBatchContainer, table: String, targetId: String, updatedData: List<V>, batchQuery: EquinoxItemsHelper.BatchQuery)
Link copied to clipboard
private open fun updateAnalytic(updatesRefreshed: Int, updatedValue: Double, analytic: PerformanceAnalytic, currentDate: Long)
Method to update and then store the updated analytic