Class DynamicViewEntityAttributeProvider

java.lang.Object
io.jmix.dynmodelflowui.impl.DynamicViewEntityAttributeProvider

@Component("dynmod_DynamicViewEntityAttributeProvider") public class DynamicViewEntityAttributeProvider extends Object
Lists the attributes reachable through entity in a behavior handler expression, so the Admin UI can offer them as code completion.

Two sources are combined. Current metadata is authoritative and allows nested paths, since it holds the entity as applied — including its already applied dynamic attributes. The attributes declared in the edited model are added at the first level, so an attribute added in this editing session is offered before the model is applied. A dynamic entity that has never been applied has no MetaClass, so only its declared attributes are offered, and only at the first level.

  • Field Details

    • metadata

      @Autowired protected Metadata metadata
  • Constructor Details

    • DynamicViewEntityAttributeProvider

      public DynamicViewEntityAttributeProvider()
  • Method Details

    • getAttributes

      public List<DynamicViewEntityAttributeProvider.AttributeInfo> getAttributes(@Nullable DynamicEntityModel entity, List<String> path)
      Returns the attributes available at the given path, distinct by name and sorted case-insensitively. Never throws: an entity or a path that cannot be resolved yields an empty list.
      Parameters:
      entity - the entity that owns the edited view, null when unknown
      path - the reference attributes traversed after entity, empty for entity.
    • resolvePath

      protected @Nullable MetaClass resolvePath(MetaClass metaClass, List<String> path)
      Walks the path from the given class through reference attributes.
      Returns:
      the class the path ends at, or null when a segment is unknown or is not a reference
    • declaredTypeName

      protected @Nullable String declaredTypeName(DynamicAttributeModel attribute)
      The type of an attribute that only exists in the edited model. A reference reports the entity it points to and an enum attribute its enumeration, since neither has a Java class yet.
    • simpleName

      protected @Nullable String simpleName(@Nullable String className)
    • firstNotBlank

      protected @Nullable String firstNotBlank(@Nullable String... values)