com.dslplatform.api

patterns

package patterns

Visibility
  1. Public
  2. All

Type Members

  1. trait AggregateDomainEvent[T <: AggregateRoot] extends Identifiable

    DomainEvent Domain event which should be used when there is an action to be applied on a single AggregateRoot aggregate root.

    DomainEvent Domain event which should be used when there is an action to be applied on a single AggregateRoot aggregate root.

    When DomainEvent domain event affects only a single aggregate, then we can use specialized aggregate domain event. This event can't have side effects outside aggregate, which allows it to be replayed when it's asynchronous. This is useful in write intensive scenarios to minimize write load in the database, but will increase read load, because reading aggregate will have to read all its unapplied events and apply them during reconstruction.

    AggregateDomainEvent is defined in DSL with keyword event.

    module Todo {
      aggregate Task;
      event<Task> MarkDone;
    }
    

  2. trait AggregateRoot extends Identifiable

    Aggregate root is a meaningful object in the domain.

    Aggregate root is a meaningful object in the domain. It can be viewed as a write boundary for entities and value objects that will maintain write consistency.

    Usually it represents a single table, but can span several tables and can be used like document or similar data structure. Since every aggregate is also an entity, it has a unique identification represented by its URI.

    DSL example:

    module Todo {
      aggregate Task {
        timestamp startedAt;
        timestamp? finishedAt;
        int? priority;
        Seq<Note> notes;
      }
      value Note {
        date entered;
        string remark;
      }
    }
    

  3. trait Cube[TSource <: Searchable] extends AnyRef

    Olap cube is online analytical processing concept used for extracting business intelligence.

    Olap cube is online analytical processing concept used for extracting business intelligence. At it's core it's just a grouping of data by some dimensions and aggregation of values through facts. Facts can be sum, count, distinct and various others concepts. Cube can be made from various data sources: aggregates, snowflakes, SQL, LINQ, etc...

    DSL example:

    module Finance {
      aggregate Payment {
        timestamp createdAt { versioning; }
        string account;
        money total;
        calculated int year from 'it => it.Year';
      }
    
      cube<Payment> Analysis {
        dimension account;
        dimension year;
        count createdAt;
        sum total;
      }
    }
    

  4. trait DomainEvent extends Identifiable

    Domain event represents an meaningful business event that occurred in the system.

    Domain event represents an meaningful business event that occurred in the system. It is a message that back-end system knows how to process and that will change the state of the system.

    They are preferred way of manipulating data instead of simple CUD operations (create, update, delete). Unlike AggregateDomainEvent aggregate domain event which is tied to a change in a single AggregateRoot aggregate root, domain event should be used when an action will result in modifications to multiple aggregates, external call (like sending an email) or some other action.

    By default event will be applied immediately. If async is used, event will be stored immediately but applied later.

    DomainEvent is defined in DSL with keyword event.

    module Todo {
      aggregate Task;
      event MarkDone {
        Task task;
      }
    }
    

  5. trait DomainEventStore extends AnyRef

    Service for submitting domain events to the application server.

    Service for submitting domain events to the application server.

    It should be used when Future is a preferred way of interacting with the remote server.

  6. case class History[T <: AggregateRoot](snapshots: IndexedSeq[Snapshot[T]]) extends Identifiable with Product with Serializable

    Collection of AggregateRoot aggregate root snapshots.

    Collection of AggregateRoot aggregate root snapshots. Snapshot is created whenever aggregate is created, modified or deleted if history concept is enabled.

    DSL example:

    module Blog {
      aggregate Post {
        string content;
        history;
      }
    }
    

  7. trait Identifiable extends Searchable

    Domain object uniquely represented by its URI.

    Domain object uniquely represented by its URI. Entity and snowflake are example of domain objects which are identified by its identity, instead of attributes. While entity does not implement Identifiable, aggregate root does.

  8. trait PersistableRepository[T <: AggregateRoot] extends Repository[T]

    Service for doing CRUD operations.

    Service for doing CRUD operations. It can be used for applying changes on AggregateRoot aggregate root to the remote server.

    It should be used when Future is a preferred way of interacting with the remote server or bulk operations are required.

  9. trait Report[TResult] extends AnyRef

    Report is concept for aggregating multiple calls into a single object.

    Report is concept for aggregating multiple calls into a single object. By providing search arguments and specifying queries with search predicates, order, limit and offset using LINQ data will be populated on the server.

    DSL example:

    module Blog {
      aggregate Post {
        timestamp createdAt { versioning; }
        string author;
        string content;
      }
    
      report FindPosts {
        string? byAuthor;
        date? from;
        Set<Post> postsFromAuthor 'it => it.author == byAuthor' ORDER BY createdAt;
        Array<Task> recentPosts 'it => it.createdAt >= from' LIMIT 20 ORDER BY createdAt DESC;
      }
    }
    

  10. trait Repository[T <: Identifiable] extends SearchableRepository[T]

    Service for finding Identifiable domain objects.

    Service for finding Identifiable domain objects. Finding domain objects using their URI identity is the fastest way retrieve an object from the remote server.

  11. trait Searchable extends AnyRef

    Domain object that can be queried from the remote server.

    Domain object that can be queried from the remote server. Server supports custom objects, such as SQL and LINQ objects which are not entities, but can be searched using specifications and other methods

    DSL example:

    module Legacy {
      sql Town 'SELECT id, name FROM town' {
        int id;
        string name;
      }
    }
    

  12. trait SearchableRepository[TSearchable <: Searchable] extends AnyRef

    Service for searching and counting domain objects.

    Service for searching and counting domain objects. Search can be performed using Specification specification, paged using limit and offset arguments. Custom sort can be provided using Seq of property->direction pairs.

    Specification can be declared in DSL or custom search can be built on client and sent to server.

    When permissions are applied, server can restrict which results will be returned to the client. Service should be used when Future is a preferred way of interacting with the remote server.

  13. trait ServiceLocator extends AnyRef

    Service for resolving other services.

    Service for resolving other services. One locator per project should be used.

    When multiple projects are used, locator must be passed around to resolve appropriate service.

    Custom classes can be resolved if their dependencies can be satisfied.

  14. case class Snapshot[TAggregateRoot <: AggregateRoot](URI: String, at: DateTime, action: String, value: TAggregateRoot) extends Identifiable with Product with Serializable

    Snapshot of some past state of an AggregateRoot aggregate root

  15. trait Snowflake[TAggregate <: AggregateRoot] extends Identifiable

    Snowflake schema is an concept from OLAP used for building specific query projection.

    Snowflake schema is an concept from OLAP used for building specific query projection. Join rules follow few basic principals such as single starting aggregate (entity), navigation through references/relationships. maintaining 1:1 relationship with starting entity, etc. Snowflake is a read-only projection and can be viewed as a view in the database spanning related objects.

    Lazy load can be avoided by including all related information onto the snowflake and fetching them all at once.

    DSL example:

    module Todo {
      aggregate Task {
        timestamp startedAt;
        timestamp? finishedAt;
        int? priority;
        User *user;
      }
      aggregate User {
        string name;
        string email;
      }
      snowflake TaskList {
        startedAt;
        finishedAt;
        priority;
        user.name;
        user.email as userEmail;
        order by priority asc, startedAt desc;
      }
    }
    

  16. trait Specification[TSearchable <: Searchable] extends AnyRef

    Search predicate which can be used to filter domain objects from the remote server using SearchableRepository searchable repository.

    Search predicate which can be used to filter domain objects from the remote server using SearchableRepository searchable repository.

    Specification is defined in DSL with keyword specification and a predicate. Server can convert specification to SQL query on the fly or call database function created at compile time. Other optimization techniques can be used too.

    DSL example:

    module Todo {
      aggregate Task {
          timestamp createdOn;
          specification findBetween
              'it => it.createdOn >= after && it.createdOn <= before'  {
            date after;
            date before;
          }
    }
    

  17. trait TemplaterService extends AnyRef

    Service for creating documents based on templates and data.

    Service for creating documents based on templates and data. Data can be provided or specification can be sent so data is queried on the server.

    Byte array is returned from the server which represents docx, xlsx, text or converted pdf file.

    More info about Templater library can be found at http://templater.info/

  18. abstract class TypeReference[T] extends AnyRef

Ungrouped