Class LogQuery

java.lang.Object
com.avoka.tm.query.LogQuery

public class LogQuery extends Object

Provides a log value object query class.

Examples

Please find the log query examples listValues and listJson with type ErrorLog.

Log Query List Example

This Groovy example shows how to list error logs sorted by name, with the result set limited to a maximum of 50 records.

 import com.avoka.tm.query.*
 import com.avoka.tm.vo.*

 List<Log> logs = new LogQuery()
     .setLogType("ErrorLog)
     .addOrderByAsc("name")
     .setFetchLimit(50)
     .listValues()

 // In JSON format
 String logJson = new LogQuery()
     .setLogType("ErrorLog)
     .addOrderByAsc("name")
     .setFetchLimit(50)
     .listJson()  

Log Query First Example

This Groovy example shows how to get first audit log matching certain criteria.

 import com.avoka.tm.query.*
 import com.avoka.tm.vo.*

 Log log = new LogQuery()
     .setLogType("AuditLog")
     .setId(1L)
     .firstValue()

 //By name criteria
 Log log = new LogQuery()
      .setLogType("AuditLog")
      .setName("testName")
      .firstValue() 

Log Query Count Example

This Groovy example shows how to count all Event Logs.

 import com.avoka.tm.query.*

 int eventLogCount = new LogQuery()
     .setLogType("EventLog")
     .count()  
Since:
23.4.0
See Also:
  • Constructor Details

    • LogQuery

      public LogQuery()
  • Method Details

    • setId

      public LogQuery setId(Long id)
      Set the log id (PK) query parameter.
      Parameters:
      id - the log id (PK) query parameter
      Returns:
      the log query
    • setName

      public LogQuery setName(String name)
      Set the log name query parameter.
      Parameters:
      name - the log name query parameter
      Returns:
      the log query
    • setLogType

      public LogQuery setLogType(String logType)
      Set the log type query parameter.
      Parameters:
      logType - the log type query parameter
      Returns:
      the log query
    • setUserName

      public LogQuery setUserName(String userName)
      Set the log userName query parameter.
      Parameters:
      userName - the log userName query parameter
      Returns:
      the log query
    • setErrorType

      public LogQuery setErrorType(String errorType)
      Set the log errorType query parameter.
      Parameters:
      errorType - the log errorType query parameter
      Returns:
      the log query
    • setSubmissionId

      public LogQuery setSubmissionId(Long submissionId)
      Set the log submissionId query parameter.
      Parameters:
      submissionId - the log submissionId query parameter
      Returns:
      the log query
    • setEventType

      public LogQuery setEventType(String eventType)
      Set the log eventType query parameter.
      Parameters:
      eventType - the log eventType query parameter
      Returns:
      the log query
    • setServiceId

      public LogQuery setServiceId(Long serviceId)
      Set the log serviceId query parameter.
      Parameters:
      serviceId - the log serviceId query parameter
      Returns:
      the log query
    • setFormId

      public LogQuery setFormId(Long formId)
      Set the log formId query parameter.
      Parameters:
      formId - the log formId query parameter
      Returns:
      the log query
    • setEntityName

      public LogQuery setEntityName(String entityName)
      Set the log entityName query parameter.
      Parameters:
      entityName - the log entityName query parameter
      Returns:
      the log query
    • setUserId

      public LogQuery setUserId(Long userId)
      Set the log userId query parameter.
      Parameters:
      userId - the log userId query parameter
      Returns:
      the log query
    • setFetchLimit

      public LogQuery setFetchLimit(int fetchLimit)
      Set the query fetch limit to limit the maximum number of records returned. The default query fetch limit is 100 records.
      Parameters:
      fetchLimit - the query fetch limit
      Returns:
      the log query
    • addOrderByAsc

      public LogQuery addOrderByAsc(String orderProperty)
      Add the sort order by ascending to the query.
      Parameters:
      orderProperty - the property to sort by (required)
      Returns:
      the Log query
    • addOrderByDesc

      public LogQuery addOrderByDesc(String orderProperty)
      Add the sort order by descending to the query.
      Parameters:
      orderProperty - the property to sort by (required)
      Returns:
      the Log query
    • count

      public int count()
      Execute a select count query and return the total number of records selected by the query.
      Returns:
      the total number of records selected by the query
    • listValues

      public List<Log> listValues()
      Execute the log query and return a list of log value objects.
      Returns:
      execute the log query and return a list of log value objects
    • listJson

      public String listJson()
      Execute the query and return a Log JSON array list.
      Returns:
      execute the query and return a Log JSON array list
    • firstValue

      public Log firstValue()
      Execute the query and return the first Log value object for the query.
      Returns:
      execute the query and return the first Log value object for the query
    • firstJson

      public String firstJson()
      Execute the query and return the first Log JSON value.
      Returns:
      execute the query and return the first Log JSON value