Class StreamThing

    • Field Detail

      • _logger

        protected static org.slf4j.Logger _logger
    • Method Detail

      • getEntryIterator

        @ThingworxExtensionApiMethod(since={7,0,1})
        public IDataEntryCloseableIterator<StreamEntry> getEntryIterator​(Timespan timespan)
                                                                  throws java.lang.Exception


        Returns an iterator over all entries inside this stream thing added over the provided timespan. If the timespan's start and end dates are both null, all entries will be iterated. The iterator must be closed when no longer used.
        Parameters:
        timespan - the timespan of interest
        Returns:
        a closeable iterator
        Throws:
        java.lang.Exception - if an exception occurred creating the iterator
      • validateConfiguration

        @ThingworxExtensionApiMethod(since={6,6},
                                     canOverride=true,
                                     requiresSuper=true)
        public void validateConfiguration​(ImportedEntityCollection importedEntityCollections)
                                   throws java.lang.Exception
        Description copied from class: Thing


        Validates the configuration of the thing during the import process. This method is called whenever a thing is created or modified via the REST APIs. During the validation step, there may be other associated entities (including thing shapes and templates) that are being imported. These can be accessed via the importedEntities collection if needed.

        Note that some resources belonging to the thing or other associated entities may not be available during this step in the lifecycle.

        It is required for all subclasses of Thing to call super.validateConfiguration(importedEntities) if they override this method.

        Overrides:
        validateConfiguration in class Thing
        Parameters:
        importedEntityCollections - - a typed collection of entities currently being imported
        Throws:
        java.lang.Exception - If an error occurs
      • dispose

        @ThingworxExtensionApiMethod(since={6,6},
                                     canOverride=true,
                                     requiresSuper=true)
        public void dispose()
                     throws java.lang.Exception
        Description copied from class: RootEntity


        Removes any remaining references of this entity and disposes any resources that were not cleaned up earlier in the lifecycle. This method is only invoked when the entity is in the process of deletion.

        Overrides:
        dispose in class Thing
        Throws:
        java.lang.Exception - If an error occurs
      • GetDataShape

        @ThingworxExtensionApiMethod(since={6,6})
        public java.lang.String GetDataShape()
        Service Category:
        DataShape
        Service Description:
        Get the currently assigned data shape.
        Returns:
        result Data shape name - DATASHAPENAME
      • SetDataShape

        @ThingworxExtensionApiMethod(since={6,6})
        public void SetDataShape​(java.lang.String name)
                          throws java.lang.Exception
        Service Category:
        DataShape
        Service Description:
        Sets the currently assigned data shape.
        Parameters:
        name - Data shape name - DATASHAPENAME
        Throws:
        java.lang.Exception - If an error occurs
      • DeleteStreamEntry

        @ThingworxExtensionApiMethod(since={6,6})
        public void DeleteStreamEntry​(java.lang.String streamEntryId)
                               throws java.lang.Exception
        Service Category:
        StreamEntries
        Service Description:
        Delete a specific stream entry given a stream entry ID.
        Parameters:
        streamEntryId - Stream entry ID - STRING
        Throws:
        java.lang.Exception - If an error occurs
      • GetStreamEntry

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable GetStreamEntry​(java.lang.String streamEntryId)
                                 throws java.lang.Exception
        Service Category:
        StreamEntries
        Service Description:
        Retrieve a specific stream entry given a stream entry ID.
        Parameters:
        streamEntryId - Stream entry ID - STRING
        Returns:
        result Stream entry - INFOTABLE - Aspects {isEntityDataShape:true, isStreamEntry:true}
        Throws:
        java.lang.Exception - If an error occurs
      • GetStreamEntryCount

        @ThingworxExtensionApiMethod(since={6,6})
        public java.lang.Double GetStreamEntryCount()
                                             throws java.lang.Exception
        Service Category:
        StreamEntries
        Service Description:
        Retrieve a count of stream entries.
        Returns:
        result Stream entry count - NUMBER
        Throws:
        java.lang.Exception - If an error occurs
      • GetFieldNames

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable GetFieldNames()
                                throws java.lang.Exception
        Service Category:
        Fields
        Service Description:
        Retrieve a list of field names for the data shape associated with this stream.
        Returns:
        result Field names - INFOTABLE - Aspects {dataShape:EntityList}
        Throws:
        java.lang.Exception - If an error occurs
      • GetFieldNamesByType

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable GetFieldNamesByType​(java.lang.String type)
                                      throws java.lang.Exception
        Service Category:
        Fields
        Service Description:
        Retrieve a list of field names for the data shape associated with this stream, of a specific type.
        Parameters:
        type - Base type name - BASETYPENAME
        Returns:
        result Field names - INFOTABLE - Aspects {dataShape:EntityList}
        Throws:
        java.lang.Exception - If an error occurs
      • AddStreamEntries

        @ThingworxExtensionApiMethod(since={6,6})
        public void AddStreamEntries​(InfoTable values)
                              throws java.lang.Exception
        Service Category:
        StreamEntries
        Service Description:
        Add multiple stream entries.
        Parameters:
        values - Stream entry values - INFOTABLE
        Throws:
        java.lang.Exception - If an error occurs
      • AddStreamEntry

        @ThingworxExtensionApiMethod(since={6,6})
        public void AddStreamEntry​(org.joda.time.DateTime timestamp,
                                   Location location,
                                   java.lang.String source,
                                   java.lang.String sourceType,
                                   TagCollection tags,
                                   InfoTable values)
                            throws java.lang.Exception
        Service Category:
        StreamEntries
        Service Description:
        Add a new stream entry.
        Parameters:
        timestamp - Event time (optional) - DATETIME
        location - Location of the entry (optional) - LOCATION
        source - Source of the event - STRING
        sourceType - Source type (User,Thing) - STRING
        tags - Tags (optional) - TAGS
        values - Data values - INFOTABLE
        Throws:
        java.lang.Exception - If an error occurs
      • UpdateStreamEntry

        @ThingworxExtensionApiMethod(since={6,6})
        public void UpdateStreamEntry​(java.lang.String streamEntryId,
                                      Location location,
                                      java.lang.String source,
                                      TagCollection tags,
                                      InfoTable values)
                               throws java.lang.Exception
        Service Category:
        StreamEntries
        Service Description:
        Update an existing stream entry.
        Parameters:
        streamEntryId - Stream entry ID - STRING
        location - Location of the entry (optional) - LOCATION
        source - Source of the event - STRING
        tags - Tags (optional) - TAGS
        values - Data values - INFOTABLE
        Throws:
        java.lang.Exception - If an error occurs
      • CreateValues

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable CreateValues()
                               throws java.lang.Exception
        Service Category:
        Values
        Service Description:
        Create an empty info table of the correct datashape for this stream.
        Returns:
        Values Created Infotable - INFOTABLE - Aspects {isEntityDataShape:true}
        Throws:
        java.lang.Exception - If an error occurs
      • CreateValuesWithData

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable CreateValuesWithData​(org.json.JSONObject values)
                                       throws java.lang.Exception
        Service Category:
        Values
        Service Description:
        Create an info table of the correct datashape for this stream and include data values.
        Parameters:
        values - Data values (JSON Object) - JSON
        Returns:
        Values Created Infotable - INFOTABLE - Aspects {isEntityDataShape:true}
        Throws:
        java.lang.Exception - If an error occurs
      • PurgeStreamEntries

        @ThingworxExtensionApiMethod(since={6,6})
        public void PurgeStreamEntries​(org.joda.time.DateTime startDate,
                                       org.joda.time.DateTime endDate,
                                       java.lang.Boolean immediate)
                                throws java.lang.Exception
        Service Category:
        Maintenance
        Service Description:
        Purge stream entries for a specified date range.
        Parameters:
        startDate - Start time - DATETIME
        endDate - End time - DATETIME
        immediate - Delete immediately - BOOLEAN
        Throws:
        java.lang.Exception - If an error occurs
      • GetStreamEntries

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable GetStreamEntries​(java.lang.Double maxItems,
                                          java.lang.Boolean oldestFirst)
                                   throws java.lang.Exception
        Service Category:
        Queries
        Service Description:
        Get all stream entries (without data).
        Parameters:
        maxItems - Maximum number of items to return - NUMBER
        oldestFirst - Search/sort from oldest to newest - BOOLEAN
        Returns:
        result Table entries - INFOTABLE - Aspects {isStreamEntry:true}
        Throws:
        java.lang.Exception - If an error occurs
      • GetStreamEntriesWithData

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable GetStreamEntriesWithData​(java.lang.Double maxItems,
                                                  java.lang.Boolean oldestFirst)
                                           throws java.lang.Exception
        Service Category:
        Queries
        Service Description:
        Get all stream entries (with data).
        Parameters:
        maxItems - Maximum number of items to return - NUMBER
        oldestFirst - Search/sort from oldest to newest - BOOLEAN
        Returns:
        result Table entries - INFOTABLE - Aspects {isEntityDataShape:true, isStreamEntry:true}
        Throws:
        java.lang.Exception - If an error occurs
      • GetStreamData

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable GetStreamData​(java.lang.Double maxItems,
                                       java.lang.Boolean oldestFirst)
                                throws java.lang.Exception
        Service Category:
        Queries
        Service Description:
        Get all stream data (no entry detail).
        Parameters:
        maxItems - Maximum number of items to return - NUMBER
        oldestFirst - Search/sort from oldest to newest - BOOLEAN
        Returns:
        result Table entries - INFOTABLE - Aspects {isEntityDataShape:true}
        Throws:
        java.lang.Exception - If an error occurs
      • QueryStreamEntriesWithData

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable QueryStreamEntriesWithData​(java.lang.Double maxItems,
                                                    java.lang.String source,
                                                    TagCollection tags,
                                                    TagCollection sourceTags,
                                                    org.joda.time.DateTime startDate,
                                                    org.joda.time.DateTime endDate,
                                                    java.lang.Boolean oldestFirst,
                                                    org.json.JSONObject query)
                                             throws java.lang.Exception
        Service Category:
        Queries
        Service Description:
        Query stream entries (with data), along with filter and sort criteria.
        Parameters:
        maxItems - Maximum number of items to return - NUMBER
        source - Source of this entry (optional) - STRING
        tags - Tags - TAGS
        sourceTags - Source Tags - TAGS
        startDate - Start time - DATETIME
        endDate - End time - DATETIME
        oldestFirst - Search/sort from oldest to newest - BOOLEAN
        query - Query definition - QUERY
        Returns:
        result Table entries - INFOTABLE - Aspects {isEntityDataShape:true, isStreamEntry:true}
        Throws:
        java.lang.Exception - If an error occurs
      • QueryStreamData

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable QueryStreamData​(java.lang.Double maxItems,
                                         java.lang.String source,
                                         TagCollection tags,
                                         TagCollection sourceTags,
                                         org.joda.time.DateTime startDate,
                                         org.joda.time.DateTime endDate,
                                         java.lang.Boolean oldestFirst,
                                         org.json.JSONObject query)
                                  throws java.lang.Exception
        Service Category:
        Queries
        Service Description:
        Query stream data (no stream entry details), along with filter and sort criteria.
        Parameters:
        maxItems - Maximum number of items to return - NUMBER
        source - Source of this entry (optional) - STRING
        tags - Tags - TAGS
        sourceTags - Source Tags - TAGS
        startDate - Start time - DATETIME
        endDate - End time - DATETIME
        oldestFirst - Search/sort from oldest to newest - BOOLEAN
        query - Query definition - QUERY
        Returns:
        result Table entries - INFOTABLE - Aspects {isEntityDataShape:true}
        Throws:
        java.lang.Exception - If an error occurs
      • QueryStreamEntries

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable QueryStreamEntries​(java.lang.Double maxItems,
                                            java.lang.String source,
                                            TagCollection tags,
                                            TagCollection sourceTags,
                                            org.joda.time.DateTime startDate,
                                            org.joda.time.DateTime endDate,
                                            java.lang.Boolean oldestFirst,
                                            org.json.JSONObject query)
                                     throws java.lang.Exception
        Service Category:
        Queries
        Service Description:
        Query stream entries (without data), along with filter and sort criteria.
        Parameters:
        maxItems - Maximum number of items to return - NUMBER
        source - Source of this entry (optional) - STRING
        tags - Tags - TAGS
        sourceTags - Source Tags - TAGS
        startDate - Start time - DATETIME
        endDate - End time - DATETIME
        oldestFirst - Search/sort from oldest to newest - BOOLEAN
        query - Query definition - QUERY
        Returns:
        result Table entries - INFOTABLE - Aspects {isStreamEntry:true}
        Throws:
        java.lang.Exception - If an error occurs
      • addStreamEntryImmediately

        @ThingworxExtensionApiMethod(since={6,6})
        public void addStreamEntryImmediately​(org.joda.time.DateTime timestamp,
                                              Location location,
                                              java.lang.String source,
                                              java.lang.String sourceType,
                                              TagCollection tags,
                                              ValueCollection values)
                                       throws java.lang.Exception
        Throws:
        java.lang.Exception - If an error occurs