Interface PropertiesProvider

  • All Known Subinterfaces:
    EntityBroker, PropertyProvideable

    public interface PropertiesProvider
    This simple defines the methods correctly which are shared between a set of interfaces, see PropertyProvideable for more information
    Author:
    Aaron Zeckoski (aaronz@vt.edu)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      List<String> findEntityRefs​(String[] prefixes, String[] name, String[] searchValue, boolean exactMatch)
      Allows searching for entities by meta property values, at least one of the params (prefix, name, searchValue) must be set in order to do a search, (searches which return all references to all entities with properties are not allowed)
      WARNING: this search is very fast but will not actually limit by properties that are placed on the entity itself or return the entity itself and is not a substitute for an API which allows searches of your entities (e.g List getYourStuff(Search search); )
      Map<String,​String> getProperties​(String reference)
      Retrieve all meta properties for this entity as a map of name->value
      String getPropertyValue​(String reference, String name)
      Retrieve a meta property value for a specific property name on a specific entity
      void setPropertyValue​(String reference, String name, String value)
      Set a meta property value on a specific entity, setting a value to null will remove the related value from persistence, passing the name and value as null will remove all the properties for this entity from persistence
      Note: Do not use this as a substitute for storing core meta data on your actual persistent entities, this is meant to provide for the case where runtime properties need to be added to an entity, persisted, and later retrieved and should be seen as a lazy way to expand the fields of a persistent entity
    • Method Detail

      • getPropertyValue

        String getPropertyValue​(String reference,
                                String name)
        Retrieve a meta property value for a specific property name on a specific entity
        Parameters:
        reference - a globally unique reference to an entity
        name - the name (key) for this property
        Returns:
        the property value for this name and entity, null if none is set
      • getProperties

        Map<String,​String> getProperties​(String reference)
        Retrieve all meta properties for this entity as a map of name->value
        Parameters:
        reference - a globally unique reference to an entity
        Returns:
        a map of String (name) -> String (value)
      • setPropertyValue

        void setPropertyValue​(String reference,
                              String name,
                              String value)
        Set a meta property value on a specific entity, setting a value to null will remove the related value from persistence, passing the name and value as null will remove all the properties for this entity from persistence
        Note: Do not use this as a substitute for storing core meta data on your actual persistent entities, this is meant to provide for the case where runtime properties need to be added to an entity, persisted, and later retrieved and should be seen as a lazy way to expand the fields of a persistent entity
        Parameters:
        reference - a globally unique reference to an entity
        name - the name (key) for this property, if this and the value are set to null then remove all the properties for this entity from persistence
        value - the value to store for this property, if null then remove the related value from persistence
      • findEntityRefs

        List<String> findEntityRefs​(String[] prefixes,
                                    String[] name,
                                    String[] searchValue,
                                    boolean exactMatch)
        Allows searching for entities by meta property values, at least one of the params (prefix, name, searchValue) must be set in order to do a search, (searches which return all references to all entities with properties are not allowed)
        WARNING: this search is very fast but will not actually limit by properties that are placed on the entity itself or return the entity itself and is not a substitute for an API which allows searches of your entities (e.g List getYourStuff(Search search); )
        Parameters:
        prefixes - limit the search to a specific entity prefix or set of prefixes, this must be set and cannot be an empty array
        name - limit the property names to search for, can be null to return all names
        searchValue - limit the search by property values can be null to return all values, must be the same size as the name array if it is not null, (i.e. this cannot be set without setting at least one name)
        exactMatch - if true then only match property values exactly, otherwise use a "like" search
        Returns:
        a list of entity references for all entities matching the search