Package io.jmix.core

Class ReferenceToEntitySupport

java.lang.Object
io.jmix.core.ReferenceToEntitySupport

@Component("core_ReferenceToEntitySupport") public class ReferenceToEntitySupport extends Object
Utility class to provide common functionality for entities with different type of primary keys
  • Field Details

    • metadataTools

      @Autowired protected MetadataTools metadataTools
    • metadata

      @Autowired protected Metadata metadata
  • Constructor Details

    • ReferenceToEntitySupport

      public ReferenceToEntitySupport()
  • Method Details

    • getReferenceId

      public Object getReferenceId(Object entity)
      Parameters:
      entity - entity
      Returns:
      entity id to store in database
    • getReferenceIdForLink

      @Nullable public Object getReferenceIdForLink(Object entity)
      Parameters:
      entity - entity
      Returns:
      entity id for links
    • getReferenceIdPropertyName

      public String getReferenceIdPropertyName(MetaClass metaClass)
      Parameters:
      metaClass - of entity
      Returns:
      metaProperty name for storing corresponding primary key in the database
    • getPrimaryKeyForLoadingEntity

      public String getPrimaryKeyForLoadingEntity(MetaClass metaClass)
      Parameters:
      metaClass - of entity
      Returns:
      metaProperty name for loading entity from database by primary key stored in the database
    • getPrimaryKeyForLoadingEntityFromLink

      public String getPrimaryKeyForLoadingEntityFromLink(MetaClass metaClass)
      Parameters:
      metaClass - of entity
      Returns:
      metaProperty name for loading entity from database by primary key for links