Java Low-Code Solution SDK Components

  • SDK consists of two main packages under src/main/generated source folder

    • Api which holds all API layer schema models, controllers and delegate classes.
    • Domain which holds classes for all Entities, services, commands, events and agents that is modeled in domain layer.
  • Solution engineer can use these classes through some available facade classes and services.

  • Below are the main SDK components that can be used by solution engineer to help implementing solution stubs logic.

Attention: Components are grouped under the namespace that they are modeled.

Entity Builder Facade

Groups all Entity builders by domain namespace prefix.

Entity builder can be used to create an Entity (Root Entity / Entity).

 
 // Declare Entity Builder Facade
 @Autowired
 EntityBuilderFacade entityBuilder;
  
 // Create a customer entity that exists in a domain namespace prefixed by cc.
 Customer customer = entityBuilder.cc.customer()
        .setCustomerId("Customer Id")
        .setCustomerName("Joh Doe")
        .setAmixCard(new AmixCard("some id", CardType.debit))
        .build(); 
Tip: Entity Builder Facade is also accessible in solution stub classes (services, commands, agents) derived from their base classes.

Event Builder Facade

Groups all Event builders by domain namespace prefix.

Event builder can be used to create an Event.

 
// Declare Event Builder Facade
@Autowired
EventBuilderFacade eventBuilder;  

// Create a SucessEvent that exists in a domain namespace prefixed by cc.
SucessEvent event = eventBuilder.cc.sucessEvent().setPayload(payloadEntity).build();
Tip: Event Builder Facade is also accessible in solution stub classes (services, commands, agents) derived from their base classes.

Repository Facade

Groups all Root Entity Repositories by domain namespace prefix.

Repository can be used to do database CRUD operations for a Root Entity.

 
// Declare Repository facade
@Autowired
RepositoryFacade  repo;

// Build a credit card root entity that exists in a domain namespace prefixed by cc.
CreditCard creditCard = entityBuilder.cc.creditCard()
    .setBankName("MyBank")
    .setCardType(CardType.debit)
    .setCustomer(customer)
    .setIssueDate(OffsetDateTime.now())
    .build();

// Save a credit card root entity.
creditCard = repo.cc.creditCard.save(creditCard);

// Retrieve all credit card root entities
List<CreditCard> cards = repo.cc.creditCard.findAll();

// Update credit card root entity
creditCard.setCardType(CardType.credit);
repo.cc.creditCard.save(creditCard);

// Delete credit card root entity
repo.cc.creditCard.delete(creditCard);

//Count all credit card root entities
long count = repo.cc.creditCard.count();

Tip: Root Entity Repositories extend spring class SimpleMongoRepository, so it supports all database operation provided by SimpleMongoRepository
Tip: Repository Facade is also accessible in solution stub classes (services, commands, agents) derived from their base classes.

Command Facade

Groups all Root Entity commands by domain namespace prefix.

Each root entity with commands will get a service class that will be implemented by solution engineer to provide commands logic.

 
// Declare Command Facade
@Autowired
CommandFacade commands;  

// Execute root entity credit card activateCard command logic.
commands.cc.creditCard.activateCard(creditCardInstrance);

Service Facade

Groups all domain services by domain namespace prefix.

Each Service will get a service class that will be implemented by solution engineer to provide service logic.

 
// Declare Service Facade
@Autowired
ServiceFacade services;  

// Execute getCustomer service logic.
Customer customer = services.cc.getCustomer(serviceInputEntity);

Event Producer Service

Publish domain events to Kafka topics.

Each Domain Event is assigned to a Kafka topic, event producer service can be used by solution engineer to publish events.

 
// Declare Event Prodcuer Service
@Autowired
EventProducerService eventProdcuer;

// Declare entity builder
@Autowired
EntityBuilderFacade entityBuilder;  

// Create payload entity
SuccessEventPayload payloadEntity = entityBuilder.cc.successEventPayload().build();

// Create domain event
SucessEvent event = eventBuilder.cc.sucessEvent().setPayload(payloadEntity).build();

// Publish a domain event.
eventProdcuer.publish(event);
Tip: Dedicated event publish function(s) are available within solution stubs (services, commands, agents) that are configured to publish events.