public final class TrackerMethods extends Object
Contains one-liners for searching, adding, and updating (type/properties/state) Tracker documents.
| Modifier and Type | Method and Description |
|---|---|
static void |
addChildDocument(String internalId,
String childInternalId)
Add a document as a child of another document.
|
static String |
addDocument(String internalId,
String externalId,
String documentTypeId,
String senderId,
String receiverId,
String stateName)
Add a new Tracker document.
|
static String |
addDocument(String internalId,
String externalId,
String documentTypeId,
String senderId,
String receiverId,
String stateName,
byte[] content)
Add a new Tracker document.
|
static String |
addDocument(String internalId,
String externalId,
String documentTypeId,
String senderId,
String receiverId,
String stateName,
byte[] content,
Map<String,String> properties)
Add a new Tracker document.
|
static String |
addDocument(String internalId,
String externalId,
String documentTypeId,
String senderId,
String receiverId,
String stateName,
Map<String,String> properties)
Add a new Tracker document.
|
static String |
addDocument(String internalId,
String externalId,
String documentTypeId,
String senderId,
String receiverId,
String stateName,
String content)
Add a new Tracker document.
|
static String |
addDocument(String internalId,
String externalId,
String documentTypeId,
String senderId,
String receiverId,
String stateName,
String content,
Map<String,String> properties)
Add a new Tracker document.
|
static String |
addDocumentException(String internalId,
Exception ex)
Add a new Error state to a Tracker document, with the provided exception as the state's content.
|
static String |
addDocumentLog(String internalId,
String message)
Add a new log message to a Tracker document.
|
static String |
addDocumentLog(String internalId,
String messageType,
String message)
Add a new log message to a Tracker document.
|
static String |
addDocumentProperty(Document document,
String propertyName,
String propertyValue)
Add a new property to a Tracker document.
|
static String |
addDocumentProperty(String internalId,
String propertyName,
String propertyValue)
Add a new property to a Tracker document.
|
static String |
addDocumentState(String internalId,
String stateName)
Add a new state to a Tracker document.
|
static String |
addDocumentState(String internalId,
String stateName,
byte[] content)
Add a new state to a Tracker document.
|
static String |
addDocumentState(String internalId,
String stateName,
byte[] content,
boolean index)
Add a new state to a Tracker document.
|
static String |
addDocumentState(String internalId,
String stateName,
String content)
Add a new state to a Tracker document.
|
static void |
addParentDocument(String internalId,
String parentInternalId)
Add another document as a parent to a document.
|
static void |
deleteDocument(String internalId)
Delete a Tracker document by ID.
|
static Document |
getDocument(String internalId)
Get a Tracker document.
|
static io.toro.gloop.object.property.GloopModel |
getDocumentProperties(String internalId)
Get all the properties of a particular Tracker document.
|
static String |
getDocumentProperty(String internalId,
String propertyName)
Get the value of a named property stored under a Tracker document.
|
static List<Document> |
getDocumentsFromDocType(String documentTypeId)
Get a list of Tracker documents under a specific document type.
|
static Document.State |
getDocumentState(Long stateId)
Get a Tracker document state.
|
static Document.Type |
getDocumentType(String documentTypeId)
Get a Tracker document type.
|
static io.toro.gloop.object.property.GloopModel |
getTrackerDocument(String internalId)
Get a Tracker document.
|
static io.toro.gloop.object.property.GloopModel |
getTrackerDocumentStateContent(Long documentStateId)
Get the content of a Tracker document state.
|
static boolean |
removeChildDocument(String internalId,
String childInternalId)
Remove the child document of a document.
|
static boolean |
removeParentDocument(String internalId,
String parentInternalId)
Remove the parent document of a document.
|
static io.toro.martini.tracker.DocumentSearchResult |
searchTracker(String query)
Execute a search against the Tracker search index.
|
static io.toro.martini.tracker.DocumentSearchResult |
searchTracker(String query,
String... facets)
Execute a search against the Tracker search index, with facets.
|
static io.toro.gloop.object.property.GloopModel |
searchTracker(String query,
String[] externalId,
String[] documentTypeId,
String[] stateName,
String[] senderId,
String[] receiverId,
Date startDate,
Date endDate,
String[] year,
String[] month,
String[] day,
String[] userName,
int pageSize,
int page)
Search for indexed tracker documents based on the given query and search parameters.
|
public static Document getDocument(String internalId)
Get a Tracker document.
Example usage:
def document = 'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.getDocument()
internalId - ID of the document to fetchpublic static List<Document> getDocumentsFromDocType(String documentTypeId)
Get a list of Tracker documents under a specific document type.
Example usage:
def documents = 'HTTP'.getDocumentsFromDocType()
documentTypeId - ID of the document typepublic static Document.Type getDocumentType(String documentTypeId)
Get a Tracker document type.
Example usage:
def type = 'HTTP'.getDocumentType()
documentTypeId - ID of the document typepublic static Document.State getDocumentState(Long stateId)
Get a Tracker document state.
Example usage:
def state = 112019.getDocumentState()
stateId - ID of the document statepublic static String addDocumentState(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String stateName)
Add a new state to a Tracker document. The state will be indexed.
Example usage:
'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocumentState( 'Started' )
Standard state names in Martini are:
internalId - ID of the documentstateName - the name of the state to addIllegalStateException - if there's no document found with the provided IDpublic static String addDocumentState(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String stateName, @GloopParameter(allowNull=false) String content)
Add a new state to a Tracker document. The state will be indexed.
Example usage:
String stateContent = writeAttributes( response ) 'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocumentState( 'Response Received', stateContent )
internalId - ID of the documentstateName - the name of the state to addcontent - content of the state to addIllegalStateException - if there's no document found with the provided IDpublic static String addDocumentState(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String stateName, byte[] content)
Add a new state to a Tracker document. The state will be indexed.
Example usage:
byte[] stateContent = writeAttributes( response ).getBytes() 'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocumentState( 'Response Received', stateContent )
internalId - ID of the documentstateName - the name of the state to addcontent - content of the state to add in bytesIllegalStateException - if there's no document found with the provided IDpublic static String addDocumentState(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String stateName, byte[] content, @GloopParameter(allowNull=false,defaultValue="false") boolean index)
Add a new state to a Tracker document.
Example usage:
byte[] stateContent = writeAttributes( response ).getBytes() 'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocumentState( 'Response Received', stateContent, true )
internalId - ID of the documentstateName - the name of the state to addcontent - content of the state to add in bytesindex - flag determining whether or not the state will be indexedIllegalStateException - if there's no document found with the provided IDpublic static String addDocumentException(@GloopParameter(allowNull=false) String internalId, Exception ex)
Add a new Error state to a Tracker document, with the provided exception as the state's content. The exception message and stacktrace are written into a simple XML format, and indexed in Tracker.
Example usage:
try {
// ...
} catch ( Exception exception ) {
'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocumentException( exception )
}
internalId - ID of the documentex - the exception to save as a state; may be nullpublic static String addDocumentLog(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String message)
Add a new log message to a Tracker document. Message is assumed to be at the INFO level.
Example usage:
'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocumentLog( "Startup completed in ${duration}" )
internalId - ID of the documentmessage - the message to logpublic static String addDocumentLog(@GloopParameter(allowNull=false) String internalId, @GloopParameter(choices={"TRACE","DEBUG","INFO","WARN","ERROR"},allowNull=false) String messageType, @GloopParameter(allowNull=false) String message)
Add a new log message to a Tracker document.
Example usage:
'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocumentLog( 'INFO', "Startup completed in ${duration}" )
internalId - ID of the documentmessage - the message to logmessageType - the type of the message to log; choose from the following types:
TRACE, DEBUG, INFO, WARN, ERROR.IllegalStateException - if there's no document found with the provided IDpublic static String addDocumentProperty(Document document, String propertyName, String propertyValue)
Add a new property to a Tracker document.
Example usage:
document.addDocumentProperty( 'Martini_Server', 'Martini Runtime@21ebef48dc84:8080 (172.18.0.9)' )
document - the Tracker documentpropertyName - the name of the property to addpropertyValue - the value of the property to addIllegalArgumentException - if document is nullIllegalStateException - if document does not exist within Martinipublic static String addDocumentProperty(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String propertyName, @GloopParameter(allowNull=false) String propertyValue)
Add a new property to a Tracker document.
Example usage:
'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocumentProperty( 'Martini_Server',
'Martini Runtime@21ebef48dc84:8080 (172.18.0.9)' )
internalId - ID of the documentpropertyName - the name of the property to addpropertyValue - the value of the property to addIllegalArgumentException - if document is nullIllegalStateException - if document does not exist within Martinipublic static String getDocumentProperty(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String propertyName)
internalId - the ID of the documentpropertyName - the name of the property to get@GloopObjectParameter(value="documentProperties{\n documentProperties#io.toro.martini.tracker.DocumentProperty[]{\n }\n}")
public static io.toro.gloop.object.property.GloopModel getDocumentProperties(@GloopParameter(allowNull=false)
String internalId)
internalId - the ID of the documentpublic static void addParentDocument(@GloopParameter(allowNull=false)
String internalId,
@GloopParameter(allowNull=false)
String parentInternalId)
Add another document as a parent to a document.
Example usage:
def childId = ... def parentId = ... childId.addParentDocument( parentId )
internalId - the ID of the child documentparentInternalId - the ID of the parent documentpublic static boolean removeParentDocument(String internalId, String parentInternalId)
Remove the parent document of a document.
Example usage:
def childId = ... def parentId = ... childId.removeParentDocument( parentId )
internalId - the ID of the child documentparentInternalId - the ID of the parent document to removepublic static void addChildDocument(@GloopParameter(allowNull=false)
String internalId,
@GloopParameter(allowNull=false)
String childInternalId)
Add a document as a child of another document.
Example usage:
def childId = ... def parentId = ... parentId.addChildDocument( childId )
internalId - the ID of the parent documentchildInternalId - the ID of the child documentpublic static boolean removeChildDocument(String internalId, String childInternalId)
Remove the child document of a document.
Example usage:
def childId = ... def parentId = ... parentId.removeChildDocument( childId )
internalId - the ID of the parent documentchildInternalId - the ID of the child documentpublic static String addDocument(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String externalId, @GloopParameter(allowNull=false) String documentTypeId, @GloopParameter(allowNull=false,defaultValue="Anonymous") String senderId, @GloopParameter(allowNull=false,defaultValue="Anonymous") String receiverId, @GloopParameter(allowNull=false) String stateName)
Add a new Tracker document.
Example usage:
'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocument( '1574210862581',
'Scheduler',
'local',
'Unset',
'Started' )
internalId - the internal ID of the documentexternalId - the external ID of the documentdocumentTypeId - the ID of the document type to use for the documentsenderId - the ID of the senderreceiverId - the ID of the receiverstateName - the name of the document's initial statepublic static String addDocument(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String externalId, @GloopParameter(allowNull=false) String documentTypeId, @GloopParameter(allowNull=false,defaultValue="Anonymous") String senderId, @GloopParameter(allowNull=false,defaultValue="Anonymous") String receiverId, @GloopParameter(allowNull=false) String stateName, byte[] content)
Add a new Tracker document.
Example usage:
byte[] stateContent = ...
'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocument( '1574210862581',
'Scheduler',
'local',
'Unset',
'Started',
stateContent )
internalId - the internal ID of the documentexternalId - the external ID of the documentdocumentTypeId - the ID of the document type to use for the documentsenderId - the ID of the senderreceiverId - the ID of the receiverstateName - the name of the document's initial statecontent - content of the initial state in bytespublic static String addDocument(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String externalId, @GloopParameter(allowNull=false) String documentTypeId, @GloopParameter(allowNull=false,defaultValue="Anonymous") String senderId, @GloopParameter(allowNull=false,defaultValue="Anonymous") String receiverId, @GloopParameter(allowNull=false) String stateName, @GloopParameter(allowNull=false) String content)
Add a new Tracker document.
Example usage:
def stateContent = ...
'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocument( '1574210862581',
'Scheduler',
'local',
'Unset',
'Started',
stateContent )
internalId - the internal ID of the documentexternalId - the external ID of the documentdocumentTypeId - the ID of the document type to use for the documentsenderId - the ID of the senderreceiverId - the ID of the receiverstateName - the name of the document's initial statecontent - content of the initial statepublic static String addDocument(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String externalId, @GloopParameter(allowNull=false) String documentTypeId, @GloopParameter(allowNull=false,defaultValue="Anonymous") String senderId, @GloopParameter(allowNull=false,defaultValue="Anonymous") String receiverId, @GloopParameter(allowNull=false) String stateName, Map<String,String> properties)
Add a new Tracker document.
Example usage:
def properties = writeAttributes( endpoint )
'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocument( '1574210862581',
'Scheduler',
'local',
'Unset',
'Started',
properties )
internalId - the internal ID of the documentexternalId - the external ID of the documentdocumentTypeId - the ID of the document type to use for the documentsenderId - the ID of the senderreceiverId - the ID of the receiverstateName - the name of the document's initial stateproperties - the properties of the documentpublic static String addDocument(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String externalId, @GloopParameter(allowNull=false) String documentTypeId, @GloopParameter(allowNull=false,defaultValue="Anonymous") String senderId, @GloopParameter(allowNull=false,defaultValue="Anonymous") String receiverId, @GloopParameter(allowNull=false) String stateName, byte[] content, Map<String,String> properties)
Add a new Tracker document.
Example usage:
byte[] stateContent = ...
def properties = writeAttributes( endpoint )
'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocument( '1574210862581',
'Scheduler',
'local',
'Unset',
'Started',
stateContent,
properties )
internalId - the internal ID of the documentexternalId - the external ID of the documentdocumentTypeId - the ID of the document type to use for the documentsenderId - the ID of the senderreceiverId - the ID of the receiverstateName - the name of the document's initial statecontent - content of the initial state in bytesproperties - the properties of the documentpublic static String addDocument(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String externalId, @GloopParameter(allowNull=false) String documentTypeId, @GloopParameter(allowNull=false,defaultValue="Anonymous") String senderId, @GloopParameter(allowNull=false,defaultValue="Anonymous") String receiverId, @GloopParameter(allowNull=false) String stateName, @GloopParameter(allowNull=false) String content, Map<String,String> properties)
Add a new Tracker document.
Example usage:
def stateContent = ...
def properties = writeAttributes( endpoint )
'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocument( '1574210862581',
'Scheduler',
'local',
'Unset',
'Started',
stateContent,
properties )
internalId - the internal ID of the documentexternalId - the external ID of the documentdocumentTypeId - the ID of the document type to use for the documentsenderId - the ID of the senderreceiverId - the ID of the receiverstateName - the name of the document's initial statecontent - content of the initial stateproperties - the properties of the document@GloopObjectParameter(value="output{\ntrackerDocument#io.toro.martini.tracker.Document{\n}\n}")
public static io.toro.gloop.object.property.GloopModel getTrackerDocument(@GloopParameter(allowNull=false)
String internalId)
throws ToroException
internalId - ID of the document to fetchToroException@GloopObjectParameter(value="output{\ntrackerDocumentStateContent#io.toro.martini.tracker.DocumentStateContent{\n}\n}")
public static io.toro.gloop.object.property.GloopModel getTrackerDocumentStateContent(@GloopParameter(allowNull=false)
Long documentStateId)
throws ToroException
documentStateId - the ID of the document stateToroExceptionpublic static io.toro.martini.tracker.DocumentSearchResult searchTracker(String query) throws ToroException
Execute a search against the Tracker search index.
Example usage:
def query = '*:*' def results = query.searchTracker()
query - the search query to useToroExceptionpublic static io.toro.martini.tracker.DocumentSearchResult searchTracker(String query, String... facets) throws ToroException
Execute a search against the Tracker search index, with facets.
Example usage:
def query = '*:*'
def results = query.searchTracker('documentTypeName', 'senderId', 'receiverId')
query - the search query to usefacets - the facets to include in the search resultsToroException@GloopObjectParameter(value="output{\nsearchResult#io.toro.martini.tracker.SearchResult{\n}\n}")
public static io.toro.gloop.object.property.GloopModel searchTracker(@GloopParameter(defaultValue="*:*",allowNull=false)
String query,
String[] externalId,
String[] documentTypeId,
String[] stateName,
String[] senderId,
String[] receiverId,
Date startDate,
Date endDate,
String[] year,
String[] month,
String[] day,
String[] userName,
@GloopParameter(defaultValue="10",allowNull=false)
int pageSize,
@GloopParameter(defaultValue="1",allowNull=false)
int page)
throws ToroException
query - Solr query to be performed; default value is *:*, which selects all documentsexternalId - externalIds of documents to finddocumentTypeId - documentTypeIds of documents to findstateName - stateNames of documents to findsenderId - senderIds of documents to findreceiverId - receiverIds of documents to findstartDate - display documents containing timestamp from this dateendDate - display documents containing timestamps till this dateyear - years of documents to findmonth - string representation of months of documents to find, may be short name
(e.g. JAN, FEB) or full month name (e.g. JANUARY, FEBRUARY)day - days of documents to finduserName - usernames of documents to findpageSize - number of results to display in a pagepage - page number of results to displayToroExceptionpublic static void deleteDocument(String internalId)
internalId - the ID of the document to deleteCopyright © 2020. All rights reserved.