Interface AQueryBuilder


  • public interface AQueryBuilder
    To phrase queries to the AssetManager.

    Implementations are supposed to be immutable so that one builder can be safely used in a concurrent environment.

    • Method Detail

      • select

        ASelectQuery select​(Target... target)
        Determine what should be included in the result records, i.e. what will actually be fetched from the database. If no target is given, only the media package ID (ARecord.getMediaPackageId()) is fetched.

        Use targets to reduce the amount of database IO, e.g. if you're not interested in the attached properties do not select them. Or, on the other hand if you want to work with properties only, do not select the snapshot (snapshot()).

        Please note that a result record always represents a snapshot accompanied by the properties of the whole episode. That means that always snapshots are being selected. In case a property target is given, it only means that those properties are added to the result set. Please also note that properties are stored per episode, not per snapshot.

        See Also:
        ARecord
      • delete

        ADeleteQuery delete​(String owner,
                            Target target)
        Create a new deletion query.

        The query will only affect snapshots owned by the given owner. If the target is a property the owner parameter will be ignored since properties belong to the whole episode and not to individual snapshots.

        Parameters:
        owner - the name of the owner or the empty string
      • mediaPackageId

        Predicate mediaPackageId​(String mpId)
        Create a predicate to match an snapshot's media package ID.
      • mediapackageId

        Field<String> mediapackageId()
        Get the snapshot's "mediaPackageId" field. Use it to create a predicate.
      • seriesId

        Field<String> seriesId()
        Get the snapshot's "seriesId" field. Use it to create a predicate.
      • organizationId

        Predicate organizationId​(String orgId)
        Deprecated.
        use organizationId().eq(orgId) instead
        Create a predicate to match a snapshot's organization ID.
      • organizationId

        Field<String> organizationId()
        Get the snapshot's "organizationId" field. Use it to create a predicate.
      • owner

        Field<String> owner()
        Get the snapshot's "owner" field. Use it to create a predicate.
      • hasPropertiesOf

        Predicate hasPropertiesOf​(String namespace)
        Create a predicate that matches all snapshots with properties of the given namespace.
      • hasProperties

        Predicate hasProperties()
        Create a predicate that matches all snapshots with properties.
      • archived

        Field<Date> archived()
        Get the snapshot's "archived" field. Use it to create a predicate.
      • version

        VersionField version()
        Get the snapshot's "version" field. Use it to create a predicate.
      • property

        <A> PropertyField<A> property​(Value.ValueType<A> ev,
                                      String namespace,
                                      String name)
        Create a field to query properties. Each parameter may be wild carded with the empty string.
        Parameters:
        namespace - the namespace or "" to select all namespaces
        name - the property name or "" to select all property names
      • snapshot

        Target snapshot()
        Select or delete a snapshot.
      • propertiesOf

        Target propertiesOf​(String... namespace)
        Select or delete all properties that belong to the given namespaces. Use an empty list of arguments to handle all properties of the media package.
      • properties

        Target properties​(PropertyName... fqn)
        Select or delete all given properties. Use an empty list of arguments to handle all properties of the media package.
      • nothing

        Target nothing()
        The zero element of Target. Selecting nothing just selects nothing.
      • always

        Predicate always()
        The zero element of Predicate. An empty predicate does nothing.