Interface RelationModel

All Superinterfaces:
ModelElement, ModuleTracker
All Known Implementing Classes:
DefaultRelationModel, RelationModelImpl

public interface RelationModel extends ModelElement, ModuleTracker
This interface describes a nice-extended relation.

A relation is identified by it's source-entity and its name. So a relation has no 'unique'-name. For example there can be a relation from 'Address' to 'Event' called 'relSubscribedTo'. And a relation from 'Address' to 'Newsletter' also called 'relSubscribedTo'. So the getName() is only identifying together with the EntityModel.getName()

  • Method Details

    • getSourceEntity

      EntityModel getSourceEntity()
      The source-entity.

      Example: relation from 'Address' to 'Event' it's the 'Address'.

    • getTargetEntity

      EntityModel getTargetEntity()
      The source-entity.

      Example: relation from 'Address' to 'Event' it's the 'Event'.

    • getName

      String getName()
      Returns:
      The name of the Relation, for example "relPrincipalAddress".
    • isToMany

      boolean isToMany()
      Returns:
      Tells whether this is a to-one or a to-many relation.
    • isTargetRequired

      boolean isTargetRequired()
    • getLink

      String getLink()
    • getReverse

      RelationModel getReverse()
      Get the reverse-relation.

      For example the relation is 'Address' to 'Event' called 'relSubscribedTo'. This getter will the return the reverse-relation, 'Event' to 'Address' called 'relSubcribers'

      So in the end, the call "relation.getReverse().getReverse()" will return 'relation'. Its circular referncing.

    • isReverse

      boolean isReverse()
      Tells if this model is the reverse-view or a relation.
      Returns:
      true if reverse-view
    • setLink

      void setLink(String link)
      Parameters:
      link - the link, non-null
      Throws:
      IllegalStateException - when trying to set this value after reading the mode.
      See Also:
    • setMany

      void setMany(boolean sourceIsMany)
      Parameters:
      sourceIsMany - true/false
      Throws:
      IllegalStateException - when trying to set this value after reading the mode.
      See Also:
    • setRequired

      void setRequired(boolean sourceRequired)
      Parameters:
      sourceRequired - true/false
      Throws:
      IllegalStateException - when trying to set this value after reading the mode.
      See Also:
    • setName

      void setName(String name)
      Parameters:
      name - The name of the relation.
      Throws:
      IllegalStateException - when trying to set this value after reading the mode.
      See Also:
    • setSourceEntity

      void setSourceEntity(EntityModel sourceEntity)
      Parameters:
      sourceEntity - the source-entity, non-null
      Throws:
      IllegalStateException - when trying to set this value after reading the mode.
      See Also:
    • setTargetEntity

      void setTargetEntity(EntityModel targetEntity)
      Parameters:
      targetEntity - the target-entity, non-null
      Throws:
      IllegalStateException - when trying to set this value after reading the mode.
      See Also:
    • setReverseRelation

      void setReverseRelation(RelationModel reverse)
      Parameters:
      reverse - the the reverse relation.
      Throws:
      IllegalStateException - when trying to set this value after reading the mode.
      See Also:
    • setReverse

      void setReverse(boolean reverse)
      Parameters:
      reverse - the reverse relation
      Throws:
      IllegalStateException - when trying to set this value after reading the mode.
      See Also:
    • putSelector

      void putSelector(String name, Selector selector)
    • getSelector

      Selector getSelector(String name)
    • getSelectors

      Map<String,Selector> getSelectors()
    • hasNonEmptyValidator

      boolean hasNonEmptyValidator()
      Returns:
      Tells if this field model has a validator, a GroupValidator to be precise, which has at least one entry.
      See Also:
    • getValidator

      GroupValidator getValidator()
      Returns:
      Returns the outermost group validator which may be empty.
      See Also:
    • setValidator

      void setValidator(AndGroupValidator validator)
      Sets the primary validator which may contain real validation validators and other groups.

      Method for the startup process.

      Parameters:
      validator - The group validator.
    • getLabel

      DisplayValue getLabel()
      The label of this relation
      Returns:
      .
    • isPropagatingLock

      boolean isPropagatingLock()
      If the getSourceEntity() is locked, does this lock propagate over the relation to all target-entities?
      Returns:
      .
    • getDeleteBehavior

      DeleteBehavior getDeleteBehavior()
      Returns:
      Returns a description how entities behave when they are deleted.
    • getDisplayOrder

      int getDisplayOrder()
      Returns the number of display priority. The lower the higher ;-)
      Returns:
      -1 means don't display, 0 means no config set (fall back to defaults), >=1 otherwise.
    • setDisplayOrder

      void setDisplayOrder(int displayOrder)
    • setLabel

      void setLabel(DisplayValue label)
      Parameters:
      label - the label, non-null
      Throws:
      IllegalStateException - when trying to set this value after reading the mode. See ModelElement
    • getDocumentation

      LinkedHashMap<String,String> getDocumentation()
      Returns the content of the documentation element of the RelationModel tag as a LinkedHashMap, divided by the AppModules extending the base RelationModel and contributing the documentation. The contents of the map are ordered according to the loading sequence of the AppModules.
      Returns:
      The LinkedHashMap containg the RelationModel's documentation tag.
    • addDocumentation

      void addDocumentation(String definingModule, String documentation)
      Adds documentation for the RelationModel, contributed by the defining AppModule.
      Parameters:
      definingModule - the string representation of the AppModule contributing the documentation
      documentation - the documentation for the RelationModel
    • setPropagatingLock

      void setPropagatingLock(boolean isPropagatingLock)
      Parameters:
      isPropagatingLock - do the related entitis get locked, if the source-entity is locked?
      Throws:
      IllegalStateException - when trying to set this value after reading the mode. See ModelElement
    • setDeleteBehavior

      void setDeleteBehavior(DeleteBehavior deleteBehavior)
      Parameters:
      deleteBehavior - set the deletion-behavior, non-null
      Throws:
      IllegalStateException - when trying to set this value after reading the mode. See ModelElement
    • setDefaultValue

      void setDefaultValue(DefaultValueDescriptor value)
    • getDefaultValue

      DefaultValueDescriptor getDefaultValue()
    • isSystemRelation

      boolean isSystemRelation()
      Returns:
      true if the relation is marked as generated by the system
    • setAsSystemRelation

      void setAsSystemRelation(boolean systemRelation)
      mark the relation as generated by the system system relation are ignored in GenerateMissingFormModelProvider
    • setDefaultComponentConfig

      void setDefaultComponentConfig(RelationModel.DefaultComponentConfig componentConfig)
      set the default component config for this relation
    • getDefaultComponentConfig

      Optional<RelationModel.DefaultComponentConfig> getDefaultComponentConfig()