Class EntityBase

java.lang.Object
mc.core.model.base.EntityBase
All Implemented Interfaces:
Serializable, IBaseEntity, ICoreEntity, IEntity, ISortableEntity
Direct Known Subclasses:
ComplexEntity, SimpleEntity, TypeEntity

@MappedSuperclass public abstract class EntityBase extends Object implements IEntity, ISortableEntity
Baseclass for most entity classes except the most simple ones.
Fields:
  • name and description: Resources, mulitilanguage text used as main display fields.
  • internalDescription: internal identifier that is known in the system since id is created by database. Sholid by unique within subclass
  • namespace: if entities need to be differentiated by namespace, currently not used
  • collection: used mainly by ICollectionManaged entities to reference collection in which entity resides
  • isSystem: signal that entity is internal and in most cases sholid not be displayed or changed by user
  • prio: generally used for ordering entities of same kind
See Also:
  • Field Details

  • Constructor Details

    • EntityBase

      public EntityBase()
    • EntityBase

      public EntityBase(EntityBase source)
      copy constructor. source EntityBase must be attached to persistence context
  • Method Details

    • getDescription

      public Resource getDescription()
      Specified by:
      getDescription in interface IEntity
      Returns:
      Description of entity in multiple locales. Might be null.
    • getName

      public Resource getName()
      Specified by:
      getName in interface IEntity
      Returns:
      Name of entity in multiple locales. Might be null.
    • getNamespace

      public String getNamespace()
    • getCollection

      public Collection getCollection()
      Returns:
      Primary collection the object is associated with.
    • setDescription

      public void setDescription(Resource description)
    • setInternalDescription

      public void setInternalDescription(String internalDescription)
      Specified by:
      setInternalDescription in interface IEntity
      Parameters:
      internalDescription - Identifier of entity (meaningful in combination with the entity class). Must be unique if internalDescription property is defined as unique.
    • setName

      public void setName(Resource name)
    • setName

      public void setName(String name, Locale locale)
      WARNING: use only if entity is new (transient). will throw exception for persistent entity or resource
    • setDescription

      public void setDescription(String descr, Locale locale)
      WARNING: use only if entity is new (transient). will throw exception for persistent entity or resource
    • setNamespace

      public void setNamespace(String namespace)
    • setCollection

      public void setCollection(Collection collection)
    • getIsSystem

      public boolean getIsSystem()
    • setIsSystem

      public void setIsSystem(boolean system)
    • getPrio

      public int getPrio()
      Specified by:
      getPrio in interface IEntity
      Specified by:
      getPrio in interface ISortableEntity
      Returns:
      Sort key used when ordering entities.
    • setPrio

      public void setPrio(int prio)
      Specified by:
      setPrio in interface ISortableEntity
    • getInternalDescription

      public String getInternalDescription()
      Specified by:
      getInternalDescription in interface IEntity
      Returns:
      Unique identifier in combination with entity class if internalDescription property is defined as unique. Might be null.
    • getFlag

      public boolean getFlag(int mask)
    • setFlag

      public void setFlag(boolean value, int mask)
    • getName

      public String getName(Locale locale)
      Returns:
      Name of entity given locale. Returns null if no translation in given locale exists.
    • getDescription

      public String getDescription(Locale locale)
      Returns:
      Description of entity given locale. Returns null if no translation in given locale exists.
    • equals

      public boolean equals(Object another)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      for logging/debugging
      Overrides:
      toString in class Object