Interface Dao<T extends Entity<T>>

    • Method Detail

      • find

        T find​(Entity<?> parent)
        throws ServiceFailureException
        Find the entity related to the given parent, like the Thing for a Datastream.
        Parameters:
        parent - The parent to find the singular entity for.
        Returns:
        the singular entity linked from the parent.
        Throws:
        ServiceFailureException - the operation failed
      • find

        T find​(Id id,
               Expansion expansion)
        throws ServiceFailureException
        Find an entity including referenced entities from expansion.
        Parameters:
        id - the entity's unique id
        expansion - the expansion containing which referenced entities to fetch
        Returns:
        the entity
        Throws:
        ServiceFailureException - the operation failed
      • patch

        void patch​(T entity,
                   List<com.github.fge.jsonpatch.JsonPatchOperation> patch)
            throws ServiceFailureException
        Update the given entity with the given patch. Does not update the entity object itself. To see the result, fetch it anew from the server.
        Parameters:
        entity - The entity to update on the server.
        patch - The patch to apply to the entity.
        Throws:
        ServiceFailureException - the operation failed
      • query

        Query<T> query()
        Start a query to find an entity collection.
        Returns:
        the query
      • subscribe

        MqttSubscription subscribe​(Consumer<T> handler)
                            throws MqttException
        Starts an MQTT subscription.
        Parameters:
        handler - a handler that is called upon received messages
        Returns:
        object containing information about new MQTT subscription
        Throws:
        MqttException - when subscription failed
      • subscribe

        MqttSubscription subscribe​(Predicate<T> filter,
                                   Consumer<T> handler)
                            throws MqttException
        Starts an MQTT subscription.
        Parameters:
        filter - predicate to further filter returned entities
        handler - a handler that is called upon received messages
        Returns:
        object containing information about new MQTT subscription
        Throws:
        MqttException - when subscription failed
      • subscribe

        MqttSubscription subscribe​(Consumer<T> handler,
                                   EntityProperty... properties)
                            throws MqttException
        Starts an MQTT subscription.
        Parameters:
        handler - a handler that is called upon received messages
        properties - properties to select, must be presten for entity type T
        Returns:
        object containing information about new MQTT subscription
        Throws:
        MqttException - when subscription failed
      • subscribe

        MqttSubscription subscribe​(Predicate<T> filter,
                                   Consumer<T> handler,
                                   EntityProperty... properties)
                            throws MqttException
        Starts an MQTT subscription.
        Parameters:
        filter - predicate to further filter returned entities
        handler - a handler that is called upon received messages
        properties - properties to select, must be presten for entity type T
        Returns:
        object containing information about new MQTT subscription
        Throws:
        MqttException - when subscription failed
      • unsubscribe

        void unsubscribe​(MqttSubscription subscription)
                  throws MqttException
        Stops an MQTT subscription.
        Parameters:
        subscription - contains information on subscription
        Throws:
        MqttException - when unsubscribing failed
      • unsubscribe

        void unsubscribe()
                  throws MqttException
        Stops all MQTT subscriptions.
        Throws:
        MqttException - when unsubscribing failed