Class TrackerMethods
- java.lang.Object
-
- io.toro.martini.TrackerMethods
-
public final class TrackerMethods extends Object
Contains one-liners for searching, adding, and updating (type/properties/state) Tracker documents.
-
-
Constructor Summary
Constructors Constructor Description TrackerMethods(io.toro.martini.tracker.TrackerService trackerService, BiFunction<String,Document,Tracker> asyncTrackerFactory, io.toro.martini.tracker.TrackerFactory trackerFactory, io.toro.martini.tracker.TrackerIndexSearchService trackerSearchService, io.toro.martini.tracker.TrackerSearch trackerSearch, io.toro.martini.tracker.TrackerRepository trackerRepository, io.toro.martini.tracker.DocumentMapper documentMapper)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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, 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 filename, 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 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
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 documentTypeName)
Get a list of Tracker documents under a specific document type.static Document.State
getDocumentState(String stateId)
Get a Tracker document state.static GloopModel
getDocumentStateByStateId(String stateId)
Get a Tracker document state by state id.static Document.Type
getDocumentType(String documentTypeName)
Get a Tracker document type.static GloopModel
getTrackerDocument(String internalId)
Get a Tracker document.static GloopModel
getTrackerDocumentStateContent(String documentStateId)
Get the content of a Tracker document state.static String
loadContextFromDocumentState(String 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)
Use search tracker when solr indexing is enabled.static GloopModel
searchTracker(String internalId, String externalId, String documentTypeId, String stateName, String senderId, String receiverId, LocalDateTime startDate, LocalDateTime endDate, String userName, int pageSize, int page, String pagingState)
Use to search for tracker documents on Cassandra, DynamoDB and Nitrite Datastore based on the given search parametersstatic GloopModel
updateDocument(GloopModel document)
Updates an existing document's properties based on whether the property is populated or not.
-
-
-
Constructor Detail
-
TrackerMethods
TrackerMethods(io.toro.martini.tracker.TrackerService trackerService, @Qualifier("autoSynchronizeTrackerFactory") BiFunction<String,Document,Tracker> asyncTrackerFactory, io.toro.martini.tracker.TrackerFactory trackerFactory, io.toro.martini.tracker.TrackerIndexSearchService trackerSearchService, io.toro.martini.tracker.TrackerSearch trackerSearch, @Qualifier("syncMartiniTrackerRepository") io.toro.martini.tracker.TrackerRepository trackerRepository, io.toro.martini.tracker.DocumentMapper documentMapper)
-
-
Method Detail
-
getDocument
public static Document getDocument(String internalId)
Get a Tracker document.
Example usage:
def document = 'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.getDocument()
- Parameters:
internalId
- ID of the document to fetch- Returns:
- the document; null if not found
- Since:
- 1.0
-
getDocumentsFromDocType
public static List<Document> getDocumentsFromDocType(String documentTypeName)
Get a list of Tracker documents under a specific document type.
Example usage:
def documents = 'HTTP'.getDocumentsFromDocType()
- Parameters:
documentTypeName
- ID of the document type- Returns:
- list of documents under a specified document type
- Since:
- 1.0
-
getDocumentType
public static Document.Type getDocumentType(String documentTypeName)
Get a Tracker document type.
Example usage:
def type = 'HTTP'.getDocumentType()
- Parameters:
documentTypeName
- ID of the document type- Returns:
- the document type; null if not found
- Since:
- 1.0
-
getDocumentState
public static Document.State getDocumentState(String stateId)
Get a Tracker document state.
Example usage:
def state = 112019.getDocumentState()
- Parameters:
stateId
- ID of the document state- Returns:
- the document state; null if not found
- Since:
- 1.0
-
getDocumentStateByStateId
@GloopObjectParameter("output{\n documentState#io.toro.martini.tracker.DocumentState{\n}\n}") public static GloopModel getDocumentStateByStateId(String stateId)
Get a Tracker document state by state id.
- Parameters:
stateId
- ID of the document state- Returns:
- the gloop model containing the result; null if not found
- Since:
- 1.0
-
addDocumentState
public static String addDocumentState(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String stateName)
Add a new state to a Tracker document.
Example usage:
'fc9430b7-0b2f-11ea-a17f-e95de32a2b5f'.addDocumentState( 'Started' )
Standard state names in Martini are:
- Started
- Stopped
- Error
- Finished
- Received
- Request Sent
- Response Received
- the HTTP response code of the tracked transaction
- Parameters:
internalId
- ID of the documentstateName
- the name of the state to add- Returns:
- the modified document's ID
- Throws:
IllegalStateException
- if there's no document found with the provided ID- Since:
- 1.0
-
addDocumentState
public 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 )
- Parameters:
internalId
- ID of the documentstateName
- the name of the state to addcontent
- content of the state to add- Returns:
- the modified document's ID
- Throws:
IllegalStateException
- if there's no document found with the provided ID- Since:
- 1.0
-
addDocumentState
public 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 )
- Parameters:
internalId
- ID of the documentstateName
- the name of the state to addcontent
- content of the state to addfilename
- the file name of the content- Returns:
- the modified document's ID
- Throws:
IllegalStateException
- if there's no document found with the provided ID- Since:
- 1.1
-
addDocumentState
public 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 )
- Parameters:
internalId
- ID of the documentstateName
- the name of the state to addcontent
- content of the state to add in bytes- Returns:
- the modified document's ID
- Throws:
IllegalStateException
- if there's no document found with the provided ID- Since:
- 1.0
-
addDocumentState
public 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 )
- Parameters:
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 indexed- Returns:
- the modified document's ID
- Throws:
IllegalStateException
- if there's no document found with the provided ID- Since:
- 1.0
-
addDocumentState
public 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 )
- Parameters:
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 indexed- Returns:
- the modified document's ID
- Throws:
IllegalStateException
- if there's no document found with the provided ID- Since:
- 1.1
-
addDocumentState
public 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 )
- Parameters:
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 indexed- Returns:
- the modified document's ID
- Throws:
IllegalStateException
- if there's no document found with the provided ID- Since:
- 1.1
-
addContextAsDocumentState
public 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.
- Parameters:
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 indexed- Returns:
- the modified document's ID
- Throws:
IOException
- if there's an error while creating the context- Since:
- 1.1
- See Also:
TrackerMethods#loadContextFromDocumentState(java.lang.Long, java.util.List, io.toro.gloop.engine.GloopExecutionContext)
-
loadContextFromDocumentState
public static String loadContextFromDocumentState(@GloopParameter(allowNull=false) String 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.
- Parameters:
stateId
- state ID of the documentnames
- root-level properties to read from Avro. If null or empty, all properties will be read.- Returns:
- the modified document's ID
- Throws:
IOException
- if there's an error while creating the context- Since:
- 1.1
- See Also:
addContextAsDocumentState(java.lang.String, java.lang.String, java.lang.String, java.util.List, boolean, io.toro.gloop.engine.GloopExecutionContext)
-
addDocumentException
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 ) }
- Parameters:
internalId
- ID of the documentex
- the exception to save as a state; may be null- Returns:
- the modified document's ID
- Since:
- 1.0
-
addDocumentLog
public 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}" )
- Parameters:
internalId
- ID of the documentmessage
- the message to log- Returns:
- the modified document's ID
- Since:
- 1.0
-
addDocumentLog
public 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}" )
- Parameters:
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.- Returns:
- the modified document's ID
- Throws:
IllegalStateException
- if there's no document found with the provided ID- Since:
- 1.0
-
addDocumentProperty
public 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)' )
- Parameters:
document
- the Tracker documentpropertyName
- the name of the property to addpropertyValue
- the value of the property to add- Returns:
- the modified document's ID
- Throws:
IllegalArgumentException
- ifdocument
is nullIllegalStateException
- ifdocument
does not exist within Martini- Since:
- 1.0
-
addDocumentProperty
public 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)' )
- Parameters:
internalId
- ID of the documentpropertyName
- the name of the property to addpropertyValue
- the value of the property to add- Returns:
- the modified document's ID
- Throws:
IllegalArgumentException
- ifdocument
is nullIllegalStateException
- ifdocument
does not exist within Martini- Since:
- 1.0
-
getDocumentProperty
public static String getDocumentProperty(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String propertyName)
Get the value of a named property stored under a Tracker document.- Parameters:
internalId
- the ID of the documentpropertyName
- the name of the property to get- Returns:
- the value of the property; null if not found
- Since:
- 1.0.2
-
getDocumentProperties
@GloopObjectParameter("documentProperties{\n documentProperties#io.toro.martini.tracker.DocumentProperty[]{\n }\n}") public static GloopModel getDocumentProperties(@GloopParameter(allowNull=false) String internalId)
Get all the properties of a particular Tracker document.- Parameters:
internalId
- the ID of the document- Returns:
- the document properties, or empty if none found
- Since:
- 1.0.2
-
addParentDocument
public 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 )
- Parameters:
internalId
- the ID of the child documentparentInternalId
- the ID of the parent document- Since:
- 1.0
-
removeParentDocument
public static boolean removeParentDocument(String internalId, String parentInternalId)
Remove the parent document of a document.
Example usage:
def childId = ... def parentId = ... childId.removeParentDocument( parentId )
- Parameters:
internalId
- the ID of the child documentparentInternalId
- the ID of the parent document to remove- Returns:
- true if a parent document has been removed; false otherwise
- Since:
- 1.0
-
addChildDocument
public 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 )
- Parameters:
internalId
- the ID of the parent documentchildInternalId
- the ID of the child document
-
removeChildDocument
public static boolean removeChildDocument(String internalId, String childInternalId)
Remove the child document of a document.
Example usage:
def childId = ... def parentId = ... parentId.removeChildDocument( childId )
- Parameters:
internalId
- the ID of the parent documentchildInternalId
- the ID of the child document- Returns:
- true if a child document has been removed; false otherwise
- Since:
- 1.0
-
addDocument
public 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' )
- Parameters:
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 state- Returns:
- the added document's internal ID
- Since:
- 1.0
-
addDocument
public 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 )
- Parameters:
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 bytes- Returns:
- the added document's internal ID
- Since:
- 1.0
-
addDocument
public 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 )
- Parameters:
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- Returns:
- the added document's internal ID
- Since:
- 1.0
-
addDocument
public 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 )
- Parameters:
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 document- Returns:
- the added document's internal ID
- Since:
- 1.0
-
addDocument
public 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 )
- Parameters:
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 document- Returns:
- the added document's internal ID
- Since:
- 1.0
-
addDocument
public 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 )
- Parameters:
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 document- Returns:
- the added document's internal ID
- Since:
- 1.1
-
addDocument
public 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 )
- Parameters:
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 document- Returns:
- the added document's internal ID
- Since:
- 1.1
-
addDocument
public 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("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 )
- Parameters:
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 document- Returns:
- the added document's internal ID
- Since:
- 1.4
-
addDocument
public 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 )
- Parameters:
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- Returns:
- the added document's internal ID
- Since:
- 1.0
-
getTrackerDocument
@GloopObjectParameter("output{\n trackerDocument#io.toro.martini.tracker.Document{\n }\n}") public static GloopModel getTrackerDocument(@GloopParameter(allowNull=false) String internalId)
Get a Tracker document.- Parameters:
internalId
- ID of the document to fetch- Returns:
- the document; null if not found
-
getTrackerDocumentStateContent
@GloopObjectParameter("output{\ntrackerDocumentStateContent#io.toro.martini.tracker.DocumentStateContent{\n}\n}") public static GloopModel getTrackerDocumentStateContent(@GloopParameter(allowNull=false) String documentStateId)
Get the content of a Tracker document state.- Parameters:
documentStateId
- the ID of the document state- Returns:
- the content of the document state
-
searchTracker
public 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()
- Parameters:
query
- the search query to use- Returns:
- the search results
-
searchTracker
public 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('documentTypeId', 'senderId', 'receiverId')
- Parameters:
query
- the search query to usefacets
- the facets to include in the search results- Returns:
- the search results
-
searchTracker
@GloopObjectParameter("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="0",allowNull=false) int page)
Use search tracker when solr indexing is enabled. Search for indexed tracker documents on based on the given query and search parameters.- Parameters:
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- Returns:
- gloop model representing the results
-
searchTracker
@GloopObjectParameter("output{\nsearchResult#io.toro.martini.tracker.SearchResult{\n}\n}") public static GloopModel searchTracker(String internalId, String externalId, String documentTypeId, String stateName, String senderId, String receiverId, LocalDateTime startDate, LocalDateTime endDate, String userName, @GloopParameter(defaultValue="10",allowNull=false) int pageSize, @GloopParameter(defaultValue="0",allowNull=false) int page, String pagingState)
Use to search for tracker documents on Cassandra, DynamoDB and Nitrite Datastore based on the given search parameters- Parameters:
internalId
- internalId of document to findexternalId
- externalId of document to finddocumentTypeId
- documentTypeId of document to findstateName
- stateName of document to findsenderId
- senderId of document to findreceiverId
- receiverId of document to findstartDate
- display document containing local date and time from this date. (e.g format * yyyy-MM-ddTHH:mm:ss )endDate
- display document containing local date and time till this date. (e.g format yyyy-MM-ddTHH:mm:ss )userName
- username of document to findpageSize
- number of results to display in a pagepage
- page number of results to displaypagingState
- paging state for next page- Returns:
- gloop model representing the results
-
updateDocument
@GloopObjectParameter("output{\n trackerDocument#io.toro.martini.tracker.Document{\n }\n}") public static GloopModel updateDocument(@GloopObjectParameter("document#io.toro.martini.tracker.Document{\n}") GloopModel document)
Updates an existing document's properties based on whether the property is populated or not. This method will only update the properties that are populated in the input and will leave the existing value of those properties that are not populated.- Parameters:
document
- the document holding the new values. The document'sinternalId
is required.- Returns:
- the updated document with the new values
- Since:
- 1.1
-
deleteDocument
public static void deleteDocument(String internalId)
Delete a Tracker document by ID.- Parameters:
internalId
- the ID of the document to delete- Since:
- 1.0
-
deleteDocuments
public static long deleteDocuments(LocalDateTime start, LocalDateTime end)
- Parameters:
start
- the start limit of the search query, defaults to no limit ifnull
end
- the end limit of the search query, defaults to no limit ifnull
- Returns:
- number of documents deleted
- Since:
- 1.1
-
-