Order's Love with Entity FW

Showcase the usage of entity-fw in Order 

Palanivelrajan B

May 23 2019

Feature List

  • Response Templates
  • Getter/Setter Override
  • Get Old Value
  • Readonly attributes
  • EntityMerge (RESET Vs Merge)
  • Rest API modes
  • Rest Query Language
  • Change Events
  • Change Event Group
  • Change Event Priority
  • Mod Types

 

Response Template

  • Provides easy way to limit the data returned by the rest api.
  • Can be saved upfront and reused.
  • Can also be provided as in "inline" option in the search api.

Response Template

Getter / Setter Override

  • Provides ability to return a different value for the template field
  • Can also be used to as "Virtual" / "Computed" fields
  • Setter can be used to transform the incoming date before saving it in the DB

 

Getter / Setter Override

Old Value

  • Gives the previous value of the attribute before transaction started
  • Useful to find out incremental/delta changes

 

Read Only Attributes

  • Prevents updates to the attribute from external system.
  • Can only be updated in the owning application in Service layer
  • Typically used to protect computed fields like status, aggregated data etc.

 

Entity Merge vs Reset

  • Determines how entity fw deals with child entities.
  • Merge : Does a partial update
  • Reset : Replaces what is provided in the incoming document

Rest API Modes

  • Used to control how the generated code will generate the controller
  • Can be used to create readonly entities, readUpdate and All

Rest Query Language

  • Rest API can take query string, that will be converted to JPA query.
  • Internally uses querydsl to create predicate
  • Query option on child entities limited.

Change Events

  • Supports event driven programming in Cloud Platform
  • All modifications in entity raises events.
  • Application code can register handlers/listeners to the events.
  • FW will call all the registered events in a order of priority.

Change Events

Key API's

  • Register handlers: This ties an event with a handler(business logic) . This is done by com.manh.cp.fw.entity.domain.change.ChangeEventManager#registerChangeActions

 

  • Register Change Event : Add the change event to the stack. The event keeps track of the entity that raised it and an optional priority com.manh.cp.fw.entity.domain.change.ChangeEventManager#addChangeEvent(com.manh.cp.fw.entity.domain.change.ChangeEventType, com.manh.cp.fw.entity.domain.entity.DomainEntity, int)

 

Change Events

Key API's

  • Process Change Event: Takes one item from the queue and invokes the registered handlers com.manh.cp.fw.entity.domain.change.ChangeEventManager#processChangeEvents

 

 

Change Events

Questions

Thanks You...

* OM team is hiring. We have couple of software engineering positions open. If you want contribute to OMS come talk to me. 
Made with Slides.com