Annotation Overview


Elide exposes data models using a set of annotations. To describe relational modeling, we rely on the well-adopted JPA annotations. For exposition and security, we rely on custom Elide annotations. A comprehensive list of supported Elide annotations is below.

  • Description

Enables audit logging for a particular package, class, method, or field whenever a specified action takes place via Elide. It takes advantage of Elide's Audit logging capabilities.

  • Application Level
  • Class
  • Field
  • Method
  • Package
  • Parameters
  • action
    • Description: The set of performed action(s) upon which audit should be triggered.
    • Type:Action[]
    • Required: false
    • Default Value: {Action.CREATE, Action.UPDATE, Action.DELETE}
  • logExpressions
    • Description: Unified expression language expressions that will be evaluated and substituted into the logging template.
    • Type:String[]
    • Required: false
    • Default Value: ""
  • logStatement
    • Description: Logging string template passed to audit logger for fired audit event.
    • Type:String
    • Required: false
    • Default Value: ""
  • operation
    • Description: Operation code to pass to audit logger for fired audit event.
    • Type:Integer
    • Required: false
    • Default Value: -1

@Audits

  • Description

Enables a set of audit logging annotations to be applied to a particular package, class, method, or field whenever a specified action takes place through Elide.

  • Application Level
  • Class
  • Field
  • Method
  • Package
  • Parameters
  • value
    • Description: A set of @Audit annotations.
    • Type:Audit[]
    • Required: true
    • Default Value:None

@ComputedAttribute

  • Description

Marks a method or field as a computed attribute that should be exposed via Elide regardless of whether or not it is marked as Transient.

  • Application Level
  • Field
  • Method
  • Parameters
  • None

@ComputedRelationship

  • Description

Marks a method or field as a computed relationship that should be exposed via Elide regardless of whether or not it is marked as Transient.

  • Application Level
  • Field
  • Method
  • Parameters
  • None

@CreatePermission

  • Description

Define security rules for creating an object through Elide. See the security section for more information.

  • Application Level
  • Class
  • Field
  • Method
  • Package
  • Parameters
  • expression
    • Description: A security expression parsed by Elide security. See the security section for more information.
    • Type:String
    • Required: true
    • Default Value:None

@DeletePermission

  • Description

Define security rules for deleting an object through Elide. See the security section for more information.

  • Application Level
  • Class
  • Field
  • Method
  • Package
  • Parameters
  • expression
    • Description: A security expression parsed by Elide security. See the security section for more information.
    • Type:String
    • Required: true
    • Default Value:None

@Exclude

  • Description

Marks that a given field or entity should not be exposed through Elide.

  • Application Level
  • Class
  • Field
  • Method
  • Package
  • Parameters
  • None

@Include

  • Description

Marks that a given entity should be exposed through Elide.

  • Application Level
  • Class
  • Package
  • Parameters
  • rootLevel
    • Description: Whether or not the entity is accessible as a "rootable" entity. Namely, if this collection of objects can be queried directly or whether or not it must be queried through a relationship.
    • Type:Boolean
    • Required: false
    • Default Value: false
  • type
    • Description: The API-exposed name for a particular entity type.
    • Type:String
    • Required: false
    • Default Value:Camel-cased name of the entity class

@OnCreatePostCommit

  • Description

A lifecycle hook that executes on a create action after the transaction has committed successfully.

  • Application Level
  • Method
  • Parameters
  • None

@OnCreatePreCommit

  • Description

A lifecycle hook that executes on a create action after security has run, but before the transaction has committed.

  • Application Level
  • Method
  • Parameters
  • None

@OnCreatePreSecurity

  • Description

A lifecycle hook that executes on a create action before the security checks have run.

  • Application Level
  • Method
  • Parameters
  • None

@OnDeletePostCommit

  • Description

A lifecycle hook that executes on a delete action after the transaction has committed successfully.

  • Application Level
  • Method
  • Parameters
  • None

@OnDeletePreCommit

  • Description

A lifecycle hook that executes on a delete action after security has run, but before the transaction has committed.

  • Application Level
  • Method
  • Parameters
  • None

@OnDeletePreSecurity

  • Description

A lifecycle hook that executes on a delete action before the security checks have run.

  • Application Level
  • Method
  • Parameters
  • None

@OnReadPostCommit

  • Description

A lifecycle hook that executes on a read action after the transaction has committed successfully.

  • Application Level
  • Method
  • Parameters
  • None

@OnReadPreCommit

  • Description

A lifecycle hook that executes on a read action after security has run, but before the transaction has committed.

  • Application Level
  • Method
  • Parameters
  • None

@OnReadPreSecurity

  • Description

A lifecycle hook that executes on a read action before the security checks have run.

  • Application Level
  • Method
  • Parameters
  • None

@OnUpdatePostCommit

  • Description

A lifecycle hook that executes on a update action after the transaction has committed successfully.

  • Application Level
  • Method
  • Parameters
  • None

@OnUpdatePreCommit

  • Description

A lifecycle hook that executes on a update action after security has run, but before the transaction has committed.

  • Application Level
  • Method
  • Parameters
  • None

@OnUpdatePreSecurity

  • Description

A lifecycle hook that executes on a update action before the security checks have run.

  • Application Level
  • Method
  • Parameters
  • None

@Paginate

  • Description

Apply specific pagination rules to a specific entity.

  • Application Level
  • Class
  • Parameters
  • countable
    • Description: Whether or not the API will respond to request for page totals of this entity type.
    • Type:Boolean
    • Required: false
    • Default Value: true
  • defaultLimit
    • Description: If the client does not specify a page size, this is the number of elements that will be returned.
    • Type:Integer
    • Required: false
    • Default Value: 500
  • maxLimit
    • Description: The maximum number of records a user can request at a given time for a particular entity.
    • Type:Integer
    • Required: false
    • Default Value: 10000

@ReadPermission

  • Description

Define security rules for reading an object through Elide. See the security section for more information.

  • Application Level
  • Class
  • Field
  • Method
  • Package
  • Parameters
  • expression
    • Description: A security expression parsed by Elide security. See the security section for more information.
    • Type:String
    • Required: true
    • Default Value:None

@SharePermission

  • Description

Enable sharing permissions on an object through Elide. See the security section for more information.

  • Application Level
  • Class
  • Method
  • Package
  • Parameters
  • shareable
    • Description: Enable or disable shareability for an object. Shareable permissions are evaluated identically to an entity's read permissions. See the security section for more information.
    • Type:Boolean
    • Required: false
    • Default Value: true

@UpdatePermission

  • Description

Define security rules for updating an object through Elide. See the security section for more information.

  • Application Level
  • Class
  • Field
  • Method
  • Package
  • Parameters
  • expression
    • Description: A security expression parsed by Elide security. See the security section for more information.
    • Type:String
    • Required: true
    • Default Value:None

原文: http://elide.io/pages/guide/15-annotations.html