Class EntityResolver

  • All Implemented Interfaces:
    OBNotSingleton, OBProvidable
    Direct Known Subclasses:

    public class EntityResolver
    extends Object
    implements OBNotSingleton
    The entity resolver will resolve an entity name and id to a business object. The resolver will first try to find the business object in the database in the accessible clients and organizations using the id and the content of the mapping table (AD_REF_DATA_LOADED table). If not found then unique constraints are used to find matching objects in the database. If then still no existing object is found then a new object is created and based on the accesslevel of the Entity the client and organization are set.
    • Constructor Detail

      • EntityResolver

        public EntityResolver()
    • Method Detail

      • resolve

        public BaseOBObject resolve​(String entityName,
                                    String id,
                                    boolean referenced,
                                    boolean filterOrgs)
        Searches for an entity using the entityname and the id, first the internal cache is searched and then the database. Depending if the entity is searched for as a reference or as a main object (in the root of the xml) the search is differs. If no existing object can be found then new one is created..
        entityName - the name of the entity searched for
        id - the id, can be null
        referenced - if the entity is searched because it is refered to or if it is in the root of the xml
        an existing or a new entity
      • setClientOrganization

        protected void setClientOrganization​(BaseOBObject bob)
      • setClientOrganizationZero

        protected void setClientOrganizationZero()
      • getClient

        protected Client getClient()
      • setClient

        protected void setClient​(Client client)
      • getOrganization

        protected Organization getOrganization()
      • setOrganization

        protected void setOrganization​(Organization organization)
      • isOptionCreateReferencedIfNotFound

        protected boolean isOptionCreateReferencedIfNotFound()
      • setOptionCreateReferencedIfNotFound

        public void setOptionCreateReferencedIfNotFound​(boolean optionCreateReferencedIfNotFound)
        This option controls if referenced objects (through an association) must exist in the database.
        optionCreateReferencedIfNotFound - if true then referenced objects are allowed to not exist in the database, meaning that they a new object is created for a reference
      • getClientZero

        protected Client getClientZero()
      • getOrganizationZero

        protected Organization getOrganizationZero()
      • exchangeObjects

        public void exchangeObjects​(BaseOBObject prevObject,
                                    BaseOBObject newObject)
        Replace an object in the cache with another one. The new one is then found when using the id of the old one. The id of the previous one can be local to the xml.
        prevObject - the object current in the data cache
        newObject - the new object which can then be found under the old object