public final class TrackerMethods extends Object
Contains one-liners for searching, adding, and updating (type/properties/state) Tracker documents.
Constructor and Description |
---|
TrackerMethods(io.toro.martini.tracker.TrackerService trackerService,
BiFunction<String,Document,Tracker> asyncTrackerFactory,
io.toro.martini.tracker.TrackerFactory trackerFactory,
io.toro.martini.tracker.TrackerSearchService trackerSearchService,
io.toro.martini.tracker.TrackerRepository trackerRepository,
io.toro.martini.tracker.DocumentMapper documentMapper) |
Modifier and Type | Method and Description |
---|---|
static void |
addChildDocument(String internalId,
String childInternalId)
Add a document as a child of another document.
|
static String |
addContextAsDocumentState(String internalId,
String stateName,
String filename,
List<String> names,
boolean index,
GloopExecutionContext context)
Add the Gloop Variable Context as a new state to a Tracker document, written as an
Apache Avro data file.
|
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 filename,
boolean async,
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,
String filename,
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,
String 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,
String filename,
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 String |
addDocumentState(String internalId,
String stateName,
String filename,
byte[] content,
boolean index)
Add a new state to a Tracker document.
|
static String |
addDocumentState(String internalId,
String stateName,
String filename,
String content)
Add a new state to a Tracker document.
|
static String |
addDocumentState(String internalId,
String stateName,
String filename,
String content,
boolean index)
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 long |
deleteDocuments(LocalDateTime start,
LocalDateTime end)
|
static Document |
getDocument(String internalId)
Get a Tracker document.
|
static 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 GloopModel |
getTrackerDocument(String internalId)
Get a Tracker document.
|
static GloopModel |
getTrackerDocumentStateContent(Long documentStateId)
Get the content of a Tracker document state.
|
static Long |
loadContextFromDocumentState(Long stateId,
List<String> names,
GloopExecutionContext context)
Load the Gloop Variable Context from the given 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 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.
|
static GloopModel |
updateDocument(GloopModel document)
Updates an existing document's properties based on whether the property is populated or not.
|
TrackerMethods(io.toro.martini.tracker.TrackerService trackerService, @Qualifier(value="autoSynchronizeTrackerFactory") BiFunction<String,Document,Tracker> asyncTrackerFactory, io.toro.martini.tracker.TrackerFactory trackerFactory, io.toro.martini.tracker.TrackerSearchService trackerSearchService, io.toro.martini.tracker.TrackerRepository trackerRepository, io.toro.martini.tracker.DocumentMapper documentMapper)
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, @GloopParameter(allowNull=false) String filename, @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', 'sample-output.xml', stateContent )
internalId
- ID of the documentstateName
- the name of the state to addcontent
- content of the state to addfilename
- the file name of the contentIllegalStateException
- 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 addDocumentState(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String stateName, @GloopParameter(allowNull=false) String filename, @GloopParameter(allowNull=false) String 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 addfilename
- the file name of the contentcontent
- content of the state to addindex
- flag determining whether or not the state will be indexedIllegalStateException
- 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 filename, 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, 'output.xml', true )
internalId
- ID of the documentstateName
- the name of the state to addfilename
- the file name of the contentcontent
- 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 addContextAsDocumentState(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String stateName, @GloopParameter(allowNull=false,defaultValue="GloopContext.avro") String filename, List<String> names, @GloopParameter(allowNull=false,defaultValue="false") boolean index, GloopExecutionContext context) throws IOException
Add the Gloop Variable Context as a new state to a Tracker document, written as an Apache Avro data file.
internalId
- ID of the documentstateName
- the name of the state to addfilename
- the file name of the contentnames
- root-level properties to save. If null or empty, all properties will be savedindex
- flag determining whether or not the state will be indexedIOException
- if there's an error while creating the contextloadContextFromDocumentState(java.lang.Long, java.util.List,
io.toro.gloop.engine.GloopExecutionContext)
public static Long loadContextFromDocumentState(@GloopParameter(allowNull=false) Long stateId, List<String> names, GloopExecutionContext context) throws IOException
Load the Gloop Variable Context from the given Tracker document state. Warning: This will overwrite any existing properties. The variables this adds to the context will not appear at code-time in Martini.
stateId
- state ID of the documentnames
- root-level properties to read from Avro. If null or empty, all properties will be read.IOException
- if there's an error while creating the contextaddContextAsDocumentState(java.lang.String, java.lang.String, java.lang.String,
java.util.List, boolean, io.toro.gloop.engine.GloopExecutionContext)
public 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 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 filename, @GloopParameter(allowNull=false) String 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', 'contents', 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 statefilename
- the file name of the contentcontent
- 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 filename, 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, 'output.xml', 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 statefilename
- the file name of the contentcontent
- 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 filename, @GloopParameter(value="true") boolean async, 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, 'output.xml', 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 statefilename
- the file name of the contentasync
- whether to persist the tracker document on a separate threadcontent
- 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{\n trackerDocument#io.toro.martini.tracker.Document{\n }\n}") public static GloopModel getTrackerDocument(@GloopParameter(allowNull=false) String internalId)
internalId
- ID of the document to fetch@GloopObjectParameter(value="output{\ntrackerDocumentStateContent#io.toro.martini.tracker.DocumentStateContent{\n}\n}") public static GloopModel getTrackerDocumentStateContent(@GloopParameter(allowNull=false) Long documentStateId)
documentStateId
- the ID of the document statepublic static io.toro.martini.tracker.DocumentSearchResult searchTracker(String query)
Execute a search against the Tracker search index.
Example usage:
def query = '*:*' def results = query.searchTracker()
query
- the search query to usepublic static io.toro.martini.tracker.DocumentSearchResult searchTracker(String query, String... facets)
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 results@GloopObjectParameter(value="output{\nsearchResult#io.toro.martini.tracker.SearchResult{\n}\n}") public static 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)
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 display@GloopObjectParameter(value="output{\n trackerDocument#io.toro.martini.tracker.Document{\n }\n}") public static GloopModel updateDocument(@GloopObjectParameter(value="document#io.toro.martini.tracker.Document{\n}") GloopModel document)
document
- the document holding the new values.
The document's internalId
is required.public static void deleteDocument(String internalId)
internalId
- the ID of the document to deletepublic static long deleteDocuments(LocalDateTime start, LocalDateTime end)
start
- the start limit of the search query, defaults to no limit if null
end
- the end limit of the search query, defaults to no limit if null
Copyright © 2021. All rights reserved.