Interface MTAttributeHeader

All Known Subinterfaces:
MTAttribute

public interface MTAttributeHeader
Header interface for attributes. An attribute is some data associated with a symbol or model. Each symbol or model can have more than one attribute, where each attribute is associated with an instance of MTAttributeType.

Attributes can describe any kind of data. The type of data, how the data input is to be done and how to validate the data is up to external mechanisms. The information needed by such external mechanisms is encapsulated in MTAttributeType and specifically MTAttributeTypeHeader.getDataType(), MTAttributeTypeHeader.getInputType() and MTAttributeTypeHeader.getRefinement(). The responsibility of this class is to provide the data in the format that the external mechanism provides given the data type and refinement.

The following is an example of a flow through all of this, stated here to give a better understanding of the intent of the different classes.

The data type "Number" is encapsulated in a class called, say, com.acme.Number. The data type has an id in the form of a string ("Number") and a refinement description that specifies possible refinements. The actual refinement that at some point will be created is up to some end user (usually a person but could be a system that automatically creates MTAttributeTypes).

The com.acme.Number will thus be a description of the data type that some other class, say NumberCreator, will use to create and edit data of that data type. To store the data in a MTRepository, or connect the data with a MTSymbol or MTModel, the NumberCreator constructs a MTAttribute and sets the data on that attribute. However, all information about the data type would be lost in this scenario. To encapsulate what a "Number" is, the NumberCreator also has to create a MTAttributeType that will contain information about the data type id ("Number"), the refinement and the input type.
Since:
5.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a MTAttribute for this attribute.
    Returns the UUID of the attribute type that this attribute belongs to.
    Returns the data in the current language.
    Returns the data in a given language.
    long
    Returns the ID of the attribute.
    Returns the UUID of the attribute.
    boolean
    Returns true if this attribute is empty in all languages.
    boolean
    Returns true if the attribute is translated in every language.
    boolean
    Returns true if the attribute is marked as translated in the given language.
  • Method Details

    • getID

      long getID()
      Returns the ID of the attribute.
      Returns:
      The ID of the attribute.
      Since:
      5.0
    • getUUID

      String getUUID()
      Returns the UUID of the attribute.
      Returns:
      The UUID of the attribute.
      Since:
      5.0
    • getData

      String getData()
      Returns the data in the current language.
      Returns:
      The data in the current language.
      Since:
      5.0
    • getData

      String getData(MTLanguageHeader language)
      Returns the data in a given language.
      Parameters:
      language - The language.
      Returns:
      The data in the language language.
      Since:
      5.0
    • getAttributeTypeUUID

      String getAttributeTypeUUID()
      Returns the UUID of the attribute type that this attribute belongs to.
      Returns:
      The UUID of the attribute's attribute type.
      Since:
      5.0
    • isTranslated

      boolean isTranslated()
      Returns true if the attribute is translated in every language.
      Returns:
      true if translated.
      Since:
      5.0
    • isTranslated

      boolean isTranslated(MTLanguage lang)
      Returns true if the attribute is marked as translated in the given language. If lang is the current default language true is always returned.
      Parameters:
      lang - the language to check for translation
      Returns:
      true if translated
      Since:
      5.0
    • isEmpty

      boolean isEmpty()
      Returns true if this attribute is empty in all languages.
      Returns:
      true if empty in all languages
      Since:
      5.0
    • expand

      Returns a MTAttribute for this attribute. Note that this might require querying the storage layer for more data.
      Returns:
      A MTAttribute representing this attribute.
      Throws:
      MTAccessException - If an MTAccessException occurs.
      Since:
      5.0