Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The entity implementation implements the entity interface described above. To identify that this Java class contains the definition of an Entity, four specific Entity annotations must be added to the header of the class.

  1. @Entity: First, the @Entity annotation must be added to the class header to identify the class as definition of an entity. The annotation

    takes no arguments.

    can take one argument: websiteSpecific. To make @Entity website specific, the syntax is:

    Code Block
    themeEclipse
    @Entity(websiteSpecific=true)



  2. @Interfaces: Secondly, the interface that is associated with this entity must be defined using the @Interfaces annotation. It takes the full classname (including package) of the associated interface as argument.
  3. @Namespace: Thirdly, the namespace for this entity must be defined for this entity using the @Namespace annotation. The annotation takes two arguments, the prefix and the URI.

    Note

    The plugin defines one namespace and URI for all classes contained by the plugin, including the entity. Usually the namespace and URI are defined in the Activator of the plugin or a Java class containing all constants, like IDs, namespace and URI.



  4. @Nodetype: Finally, when the Entity will be stored inside the JCR, the @NodeType annotation should be used to define the node type, super type and mixin node types of the node that represents the entity in the JCR. The @NodeType annotation takes four arguments; name, registerNodeType, supertype and mixin.

...