Class EAV


  • public class EAV
    extends java.lang.Object
    EAV wrapper for the actual EAV implementation.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  EAV.AttributeAndType
      Handy class to pair an attribute and its type.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.lang.ClassLoader classLoader
      Classloader used to instantiate attribute type implementations.
      protected com.antiaction.raptor.sql.DBWrapper db
      DB layer implementation.
      static int DOMAIN_TREE_ID
      tree id for DomainConfiguration attributes and types.
      protected static EAV instance
      Singleton instance.
      static int SNAPSHOT_TREE_ID
      tree id for SparseFullHarvest attributes and types.
    • Constructor Summary

      Constructors 
      Constructor Description
      EAV()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static int compare​(java.util.List<EAV.AttributeAndType> antList1, java.util.List<EAV.AttributeAndType> antList2)
      Compare two lists containing attributes and their types.
      static java.util.Set<java.lang.String> getAttributeNames​(int tree_id)
      Get list of attribute names for a specific tree_id
      java.util.List<EAV.AttributeAndType> getAttributesAndTypes​(int tree_id, int entity_id)
      Returns a list of attributes and their type for a given entity id and tree id.
      java.util.List<com.antiaction.raptor.dao.AttributeTypeBase> getAttributeTypes​(int tree_id)
      Returns a list of attribute types for the given tree id.
      static EAV getInstance()  
      void insertAttribute​(com.antiaction.raptor.dao.AttributeBase attribute)
      Insert attribute into database.
      void saveAttribute​(com.antiaction.raptor.dao.AttributeBase attribute)
      Update existing attribute.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • classLoader

        protected static java.lang.ClassLoader classLoader
        Classloader used to instantiate attribute type implementations.
      • instance

        protected static EAV instance
        Singleton instance.
      • db

        protected com.antiaction.raptor.sql.DBWrapper db
        DB layer implementation. MSSQL is more like SQL92.
    • Constructor Detail

      • EAV

        public EAV()
    • Method Detail

      • getInstance

        public static EAV getInstance()
        Returns:
        an instance of this class.
      • insertAttribute

        public void insertAttribute​(com.antiaction.raptor.dao.AttributeBase attribute)
        Insert attribute into database.
        Parameters:
        attribute - attribute to insert into database
      • saveAttribute

        public void saveAttribute​(com.antiaction.raptor.dao.AttributeBase attribute)
        Update existing attribute.
        Parameters:
        attribute - attribute to update in database
      • getAttributeTypes

        public java.util.List<com.antiaction.raptor.dao.AttributeTypeBase> getAttributeTypes​(int tree_id)
        Returns a list of attribute types for the given tree id.
        Parameters:
        tree_id - tree id to look for attribute types in
        Returns:
        a list of attribute types for the given tree id
      • getAttributesAndTypes

        public java.util.List<EAV.AttributeAndTypegetAttributesAndTypes​(int tree_id,
                                                                          int entity_id)
                                                                   throws java.sql.SQLException
        Returns a list of attributes and their type for a given entity id and tree id.
        Parameters:
        tree_id - tree id to look in
        entity_id - entity to look for
        Returns:
        a list of attributes and their type for a given entity id and tree id.
        Throws:
        java.sql.SQLException - if an SQL exception occurs while querying the database
      • compare

        public static int compare​(java.util.List<EAV.AttributeAndType> antList1,
                                  java.util.List<EAV.AttributeAndType> antList2)
        Compare two lists containing attributes and their types.
        Parameters:
        antList1 -
        antList2 -
        Returns:
        the result of comparing two lists containing attributes and their types
      • getAttributeNames

        public static java.util.Set<java.lang.String> getAttributeNames​(int tree_id)
        Get list of attribute names for a specific tree_id
        Parameters:
        tree_id - a given tree_id
        Returns:
        list of attribute names for a specific tree_id