public final class TrackerMethods extends Object
A TORO utility class Tracker related operations.
Makes it easy to add, search, update documents ( type/properties/state ) from the tracker database
Modifier and Type | Method and Description |
---|---|
static void |
addChildDocument(String internalId,
String childInternalId)
Adds a child document to an existing document
|
static String |
addDocument(String internalId,
String externalId,
String documentTypeId,
String senderId,
String receiverId,
String stateName)
|
static String |
addDocument(String internalId,
String externalId,
String documentTypeId,
String senderId,
String receiverId,
String stateName,
byte[] content)
Add Document to Tracker Database.
|
static String |
addDocument(String internalId,
String externalId,
String documentTypeId,
String senderId,
String receiverId,
String stateName,
byte[] content,
Map<String,String> properties)
Add Document to Tracker Database.
|
static String |
addDocument(String internalId,
String externalId,
String documentTypeId,
String senderId,
String receiverId,
String stateName,
Map<String,String> properties)
Add Document to Tracker Database.
|
static String |
addDocument(String internalId,
String externalId,
String documentTypeId,
String senderId,
String receiverId,
String stateName,
String content)
Add Document to Tracker Database.
|
static String |
addDocument(String internalId,
String externalId,
String documentTypeId,
String senderId,
String receiverId,
String stateName,
String content,
Map<String,String> properties)
Add Document to Tracker Database.
|
static String |
addDocumentException(String internalId,
Exception ex)
Deprecated.
Will be removed in 4.0
|
static String |
addDocumentLog(String internalId,
String message)
Add Document Log to Tracker Database.
|
static String |
addDocumentLog(String internalId,
String messageType,
String message)
Add Document Log to Tracker Database.
|
static String |
addDocumentProperty(Document document,
String propertyName,
String propertyValue)
Add Document Property to Tracker Database.
|
static String |
addDocumentProperty(String internalId,
String propertyName,
String propertyValue)
Add Document Property to Tracker Database.
|
static String |
addDocumentState(String internalId,
String stateName)
Add Document State to Tracker Database.
|
static String |
addDocumentState(String internalId,
String stateName,
byte[] content)
Add Document State to Tracker Database.
|
static String |
addDocumentState(String internalId,
String stateName,
byte[] content,
boolean index)
Add Document State to Tracker Database.
|
static String |
addDocumentState(String internalId,
String stateName,
String content)
Add Document State to Tracker Database.
|
static void |
addParentDocument(String internalId,
String parentInternalId)
Adds a parent document to an existing document
|
static void |
deleteDocument(String internalId) |
static Document |
getDocument(String internalId)
Get a tracker document from the database.
|
static List<Document> |
getDocumentsFromDocType(String documentTypeId)
Get a list of tracker documents under a documentType from the database.
|
static Document.State |
getDocumentState(Long stateId)
Get a tracker document state from the database.
|
static Document.Type |
getDocumentType(String documentTypeId)
Get a tracker document type from the database.
|
static io.toro.gloop.object.property.GloopModel |
getTrackerDocument(String internalId) |
static io.toro.gloop.object.property.GloopModel |
getTrackerDocumentStateContent(Long documentStateId) |
static boolean |
removeChildDocument(String internalId,
String childInternalId)
Removes then child document on an existing document
|
static boolean |
removeParentDocument(String internalId,
String parentInternalId)
Removes the parent document on an existing document
|
static io.toro.martini.tracker.DocumentSearchResult |
searchTracker(String query)
|
static io.toro.martini.tracker.DocumentSearchResult |
searchTracker(String query,
String... facets)
Search 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 from the database.
Example usage:
def document = '4324234523512-654645435'.getDocument( )
internalId
- ID of the Documentpublic static List<Document> getDocumentsFromDocType(String documentTypeId)
Get a list of tracker documents under a documentType from the database.
Example usage:
def document = '4324234523512-654645435'.getDocumentsFromDocType( )
documentTypeId
- ID of the DocumentTypepublic static Document.Type getDocumentType(String documentTypeId)
Get a tracker document type from the database.
Example usage:
def document = '4324234523512-654645435'.getDocumentType( )
documentTypeId
- of the DocumentTypepublic static Document.State getDocumentState(Long stateId)
Get a tracker document state from the database.
Example usage:
def documentState = 12345.getDocumentState( )
stateId
- ID of the DocumentStatepublic static String addDocumentState(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String stateName)
Add Document State to Tracker Database. DocumentState will not be indexed by default in the database.
Example usage:
'4324234523512-654645435'.addDocumentState( "Started" )
internalId
- ID of the DocumentStatestateName
- The current state of the Document. Example state: Started, Stopped, and Errorpublic static String addDocumentState(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String stateName, @GloopParameter(allowNull=false) String content)
Add Document State to Tracker Database. DocumentState will be indexed by default in the database.
Example usage:
'4324234523512-654645435'.addDocumentState( "Started", "This is an example Content" )
internalId
- ID of the DocumentStatestateName
- The state of the Document. Example state: Started, Stopped, and Errorcontent
- Data Content in String of the DocumentStatepublic static String addDocumentState(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String stateName, byte[] content)
Add Document State to Tracker Database. DocumentState will be indexed by default in the database.
Example usage:
'4324234523512-654645435'.addDocumentState( "Started", "This is an example Content".getBytes() )
internalId
- ID of the DocumentStatestateName
- The state of the Document. Example state: Started, Stopped, and Errorcontent
- Data Content in byte array of the DocumentStatepublic static String addDocumentState(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String stateName, byte[] content, @GloopParameter(allowNull=false,defaultValue="false") boolean index)
Add Document State to Tracker Database.
Example usage:
'4324234523512-654645435'.addDocumentState( "Started", "example-output.xml" ,"This is an example Content".getBytes() )
internalId
- ID of the DocumentStatestateName
- The state of the Document. Example state: Started, Stopped, and Errorcontent
- Data Content in byte array of the DocumentStateIllegalStateException
- if there's no tracker associated to internalId
@Deprecated public static String addDocumentException(@GloopParameter(allowNull=false) String internalId, Exception ex)
Add Exception to Tracker Database.
Example usage:
} catch ( Exception ex ) { '4324234523512-654645435'.addDocumentException( ex ) }
The exception message and stacktrace are written into a simple XML format, and indexed in tracker
internalId
- ID of the DocumentStateex
- Exception to be savedpublic static String addDocumentLog(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String message)
Add Document Log to Tracker Database.
Example usage:
'4324234523512-654645435'.addDocumentLog( "This is an example logging message")
internalId
- ID of the DocumentLogmessage
- The message of the 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 Document Log to Tracker Database.
Example usage:
'4324234523512-654645435'.addDocumentLog( 'DEBUG' ,"This is an example logging message" )
internalId
- ID of the DocumentLogmessage
- The message of the logmessageType
- The messageType of the log Available type: TRACE
DEBUG
INFO
WARN
ERROR
IllegalStateException
- if there's no tracker associated to internalId
public static String addDocumentProperty(Document document, String propertyName, String propertyValue)
Add Document Property to Tracker Database.
Example usage:
document.addDocumentProperty( "ExampleProperty", "ExampleValue" )
document
- Tracker documentpropertyName
- Property name of the DocumentpropertyValue
- Property value of the Documentpublic static String addDocumentProperty(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String propertyName, @GloopParameter(allowNull=false) String propertyValue)
Add Document Property to Tracker Database.
Example usage:
'4324234523512-654645435'.addDocumentProperty( "ExampleProperty" ,"ExampleValue" )
internalId
- ID of the Document PropertypropertyName
- Property name of the DocumentpropertyValue
- Property value of the DocumentIllegalStateException
- if there's no tracker associated to internalId
public static void addParentDocument(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String parentInternalId)
Example usage:
"the-existing-document-id".addParentDocument("parent-document-id-here")
internalId
- parentInternalId
- public static boolean removeParentDocument(String internalId, String parentInternalId)
Example usage:
"the-existing-document-id".removeParentDocument("parent-document-id-here")
internalId
- parentInternalId
- public static void addChildDocument(@GloopParameter(allowNull=false) String internalId, @GloopParameter(allowNull=false) String childInternalId)
Example usage:
"the-existing-document-id".addChildDocument("parent-document-id-here")
internalId
- childInternalId
- public static boolean removeChildDocument(String internalId, String childInternalId)
Example usage:
"the-existing-document-id".removeChildDocument("parent-document-id-here")
internalId
- childInternalId
- 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 Document to Tracker Database. Document will not be indexed by default in the database.
Example usage:
'4324234523512-654645435'.addDocument( "888402-234256721" ,"ExampleDocumentType", "ExampleSender", "ExampleReceiver", "Started" )
internalId
- Internal ID of the DocumentexternalId
- External ID of the DocumentdocumentTypeId
- Document type of the documentsenderId
- Id of the senderreceiverId
- Id of the receiverstateName
- The state of the Document. Example state: Started, Stopped, and Errorpublic 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 Document to Tracker Database.
Example usage:
def content = "This is an example byte array content" '4324234523512-654645435'.addDocument( "888402-234256721" ,"ExampleDocumentType", "ExampleSender", "ExampleReceiver", "Started", content.getBytes() )
internalId
- Internal ID of the DocumentexternalId
- External ID of the DocumentdocumentTypeId
- Document type of the documentsenderId
- Id of the senderreceiverId
- Id of the receiverstateName
- The state of the Document. Example state: Started, Stopped, and Errorcontent
- Data Content in byte array 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)
Add Document to Tracker Database.
Example usage:
def content = "This is an example string content" '4324234523512-654645435'.addDocument( "888402-234256721" ,"ExampleDocumentType", "ExampleSender", "ExampleReceiver", "Started", content )
internalId
- Internal ID of the DocumentexternalId
- External ID of the DocumentdocumentTypeId
- Document type of the documentsenderId
- Id of the senderreceiverId
- Id of the receiverstateName
- The state of the Document. Example state: Started, Stopped, and Errorcontent
- Data Content in byte array 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, Map<String,String> properties)
Add Document to Tracker Database. Document will not be indexed by default in the database.
Example usage:
def properties = ["type" : "document", "name" : "ExampleMap"] '4324234523512-654645435'.addDocument( "888402-234256721" ,"ExampleDocumentType", "ExampleSender", "ExampleReceiver", "Started", properties )
internalId
- Internal ID of the DocumentexternalId
- External ID of the DocumentdocumentTypeId
- Document type of the documentsenderId
- Id of the senderreceiverId
- Id of the receiverstateName
- The state of the Document. Example state: Started, Stopped, and Errorproperties
- Map of String propertiespublic 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)
Example usage:
def properties = ["type" : "ExampleDoc", "name" : "ExampleMap"] def content = "This is an example byte array content" '4324234523512-654645435'.addDocument( "888402-234256721" ,"ExampleDocumentType", "ExampleSender", "ExampleReceiver", "Processed", content.getBytes(), properties )
internalId
- Internal ID of the DocumentexternalId
- External ID of the DocumentdocumentTypeId
- Document type of the documentsenderId
- Id of the senderreceiverId
- Id of the receiverstateName
- The state of the Document. Example state: Started, Stopped, and Errorcontent
- Data Content in byte array of the documentproperties
- Map of String propertiespublic 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 Document to Tracker Database. Document will not be indexed by default in the database.
Example usage:
def properties = ["type" : "ExampleDoc", "name" : "ExampleMap"] def content = "This is an example byte array content" '4324234523512-654645435'.addDocument( "888402-234256721" ,"ExampleDocumentType", "ExampleSender", "ExampleReceiver", "Processed", content, properties )
internalId
- Internal ID of the DocumentexternalId
- External ID of the DocumentdocumentTypeId
- Document type of the documentsenderId
- Id of the senderreceiverId
- Id of the receiverstateName
- The state of the Document. Example state: Started, Stopped, and Errorcontent
- Data Content in byte array of the documentproperties
- Map of String properties@GloopObjectParameter(value="output{\ntrackerDocument#io.toro.martini.tracker.Document{\n}\n}") @GloopComment(value="Get Tracker Document") public static io.toro.gloop.object.property.GloopModel getTrackerDocument(@GloopParameter(allowNull=false) String internalId) throws ToroException
ToroException
@GloopObjectParameter(value="output{\ntrackerDocumentStateContent#io.toro.martini.tracker.DocumentStateContent{\n}\n}") @GloopComment(value="Get Tracker Document State Content") public static io.toro.gloop.object.property.GloopModel getTrackerDocumentStateContent(@GloopParameter(allowNull=false) Long documentStateId) throws ToroException
ToroException
public static io.toro.martini.tracker.DocumentSearchResult searchTracker(String query) throws ToroException
query
- The search query to useToroException
public static io.toro.martini.tracker.DocumentSearchResult searchTracker(String query, String... facets) throws ToroException
Search Tracker Search Index, with facets
Example usage:
def searchResult = '*:*'.searchTracker('facet1', 'facet2')
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}") @GloopComment(value="Search for indexed tracker documents based on the given query and search parameters.") 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 performedexternalId
- 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
- months of documents to findday
- days of documents to finduserName
- usernames of documents to findpageSize
- number of results to display in a pagepage
- page number of results to displayToroException
public static void deleteDocument(String internalId)
Copyright © 2019. All rights reserved.