Saturday, 31 December 2022

Introduction to PlantUML

PlantUML is a java library, where it take the input in PlantUML language and generate the diagram.

 

For example, following markup defines the successful login flow sequence diagram.


@startuml
Client -> LoginServer: Enter user name
Client -> LoginServer: Enter password
Client -> LoginServer: Submit the form 
LoginServer -> ADServer: Check the credentials
ADServer -> LoginServer: Login Successful
LoginServer -> Client: Login Successful
@enduml

Above markup generate below sequence diagram.

 


PlantUML is a java library that allows you to quickly write:

a.   Sequence diagram

b.   Usecase diagram

c.    Class diagram

d.   Object diagram

e.   Activity diagram (here is the legacy syntax)

f.     Component diagram

g.   Deployment diagram

h.   State diagram

i.     Timing diagram

 

Is there any support for non-uml diagrams?

The following non-UML diagrams are also supported:

a.   JSON data

b.   YAML data

c.    Extended Backus-Naur Form (EBNF) diagram

d.   Network diagram (nwdiag)

e.   Wireframe graphical interface or UI mockups (salt)

f.     Archimate diagram

g.   Specification and Description Language (SDL)

h.   Ditaa diagram

i.     Gantt diagram

j.     MindMap diagram

k.    Work Breakdown Structure diagram (WBS)

l.     Mathematic with AsciiMath or JLaTeXMath notation

m. Entity Relationship diagram (IE/ER)

 

 

References

https://plantuml.com/

Previous                                                    Next                                                    Home

PlantUML tutorial


Introduction to PlantUML
PlantUML: setup the environment locally
PlantUML: Hello world application
PlantUML : Create a sudoku
Working with sequence diagram in PlantUML
PlantUML: Add comments to the diagram
PlantUML: how to use dotted arrow in the sequence diagram?
PlantUML: Reverse arrows to improve readability in sequence diagram
PlantUML: Declare participants in a sequence diagram
PlantUML: rename participants using as keyword in a sequence diagram
PlantUML: change the background color of a participant in sequence diagram
PlantUML: Customize the display order of participants in a sequence diagram
PlantUML: Handle long participant names in a sequence diagram
PlantUML: draw a box around some participants
PlantUML: Remove foot boxes in the sequence diagram
PlantUML: send message to self in a sequence diagram
PlantUML: configure response message below the arrow in a sequence diagram
PlantUML: Customize arrow style in a sequence diagram
PlantUML: Customize arrow color in a sequence diagram
PlantUML: add numbers to the messages in a sequence diagram
PlantUML: Format message number in a sequence diagram
PlantUML: Stop and resume numbering of messages in a sequence diagram
PlantUML: Add the title to a diagram
PlantUML: Define multi line title using title, end title keywords
PlantUML: Add header and footer to a diagram
PlantUML: Split the diagram into multiple images
PlantUML: Grouping messages
     PlantUML: alt, else: specify if-else clause in sequence diagram
     PlantUML: loop: Specify the recurring instructions
     PlantUML: Group the statements
     PlantUML: Add secondary group label
PlantUML: Add notes to the messages in a sequence diagram
PlantUML: Add notes to the participants in a sequence diagram
PlantUML: Customize note shape
PlantUML: note over all the participants
PlantUML: Align the notes on participants at same level
PlantUML: Creol support for text formatting
PlantUML: Define diagram title using creol format
PlantUML: Divide the diagram into logical steps
PlantUML: Specify delay in a diagram
PlantUML: wrap the text using maxMessage
PlantUML: Specify a space in the diagram using |||
PlantUML: Activate and destroy the lifeline in a sequence diagram
PlantUML: Add colour to the lifeline in a sequence diagram
PlantUML: Nested lifelines in a sequence diagram
PlantUML: Create a participant
PlantUML: Short cut syntaxes for participant creation, activation, deactivation, destruction
PlantUML: Specify incoming and outgoing messages in a sequence diagram
PlantUML: short arrows in a sequence diagram
PlantUML: Anchors and duration in a sequence diagram
PlantUML: stereotypes in a sequence diagram
PlantUML: Add a spotted character in a coloured circle in stereotype
PlantUML: skinparam: change color and fonts of a drawing
PlantUML: customize padding using skinparam
PlantUML: customize the life line strategy in a sequence diagram
PlantUML: Enable strict uml while generating the diagram
PlantUML: Hide unlinked participants in a sequence diagram
PlantUML: Working with use case diagram
     PlantUML: How to define use case?
     PlantUML: How to create an actor in usecase diagram?
     PlantUML: hello world use case diagram
     PlantUML: Customize actor style to awesome man in use case diagram
     PlantUML: Customize actor style to hollow man in use case diagram
     PlantUML: Add description to the use case in a use case diagram
     PlantUML: group actors or use cases using a package
     PlantUML: long arrows in usecase diagram
     PlantUML: Add label to the arrow in a use case diagram
     PlantUML: Extending an actor in usecase diagram
     PlantUML: Extending an use case in usecase diagram
     PlantUML: Add notes to the use case diagram
     PlantUML: Add stereotype to the actor in usecase diagram
     PlantUML: Customize arrow direction in use case diagram
     PlantUML: put a dotted arrow between the objects in use case diagram
     PlantUML: Split use case diagram
     PlantUML: change use case diagram direction left to right
     PlantUML: Customize font, colors in use case diagram
     PlantUML: Draw a rectangle around usecases
     PlantUML: draw business use case
     PlantUML: draw business actor in use case diagram
     PlantUML: Change arrow style using inline notation
     PlantUML: Change objects color and style with inline style in use case diagram
     PlantUML: Working with class diagrams
     PlantUML : extension relation in class diagram
     PlantUML : Draw composition in class diagram
     PlantUML: Draw aggregation in class diagram
     PlantUML: Use dotted line in the class diagram
     PlantUML: Summary of connect symbols in a class diagram
     PlantUML: add label to a relation in class diagram
     PlantUML: Draw one to many relationship in class diagram
     PlantUML: Draw many to many relationship in class diagram
     PlantUML: Arrow to specify more meaning to the relationship label
     PlantUML: Add methods, fields to a class in class diagram
     PlantUML: Specify the visibility of members in a class
     PlantUML: Define abstract methods in a class diagram
     PlantUML: Define static fields in a class diagram
     PlantUML: define static method in a class diagram
     PlantUML: Use separators to define custom ordering of fields and methods
     PlantUML: Add stereotypes to the class
     PlantUML: Add notes to the entities in a class diagram
     PlantUML: Add connecting notes on several entities in class diagram
     PlantUML: Define note in several lines
     PlantUML: use HTML tags while defining notes
     PlantUML: Add notes to fields in a class
     PlantUML: Add notes to method in a class
     PlantUML: Add note on overloaded methods or methods with same name
     PlantUML: add notes on a link in class diagram
     PlantUML: Define abstract class
     PlantUML: Define interface in a class diagram
     PlantUML: Define an enum in a class diagram
     PlantUML: How to use non letters in class name?
     PlantUML: hide and show members in class diagram
     PlantUML: Hide and show circled character in front of class name
     PlantUML: Hide and show stereotype in a class diagram
     PlantUML: hide classes, interfaces, enums in a class diagram
     PlantUML: remove classes, interfaces, enums in a class diagram
     PlantUML: Hide unlinked classes, interfaces in a class diagram
     PlantUML: remove unlinked classes, interfaces in a class diagram
     https://self-learning-java-tutorial.blogspot.com/2023/07/plantuml-define-generics-in-class.html
     PlantUML: Customize the spot in classes, interfaces and enums
     A Guide to Defining Packages in PlantUML
     PlantUML Package Style Customization
      Defining Package Dependencies in PlantUML
     Namespaces in PlantUML Class Diagrams
     Automatic Namespace Creation in PlantUML
     
     PlantUML: How to Draw a Lollipop Interface
     How to Customize Arrow Direction in PlantUML Class Diagrams?
     How to Define Association Classes in PlantUML
     How to Change the Font and Colors in PlantUML Class Diagrams with skinparam?
     How to Customize the Color of Stereotyped Classes in PlantUML?
     How to Use Color Gradients in PlantUML?
     How to Group Classes Together in PlantUML Diagrams?
     Force Layout in PlantUML Diagrams with Hidden Links
     How to Split a PlantUML Diagram into Multiple Images?
     Using the extends keyword to specify class extension relationships in PlantUML
     PlantUML: How to Define the Implements Relationship?
     How to Customize Line Color in PlantUML Class Diagrams
     How to Customize line thickness in PlantUML class diagram?
     Customizing Link Color and Style in PlantUML Class Diagrams
     How to Customize Class Color and Style in PlantUML Using Inline Style
     How to Connect Members of Two Classes in PlantUML
PlantUML: Working with Object Diagrams
     How to Model Extension Relationships in Object Diagrams with PlantUML
     
     How to Model Aggregation Relationships in Object Diagrams with PlantUML?
     How to Define Association Relationships Between Objects in PlantUML?
     How to Add Fields to Objects in PlantUML?
      PlantUML: Object Diagram with Map or Associative Array
     PlantUML: link map value to other object in object diagram
PlantUML Activity Diagram Tutorial
     How to Define the Start and Stop of a PlantUML Activity Diagram
     How to Use If-Else Conditional Statements in PlantUML Activity Diagrams
     How to Create an If-Else-If Ladder in a PlantUML Activity Diagram
     How to Apply Colors in PlantUML Activity Diagrams
     PlantUML: How to Stop an Action on an If Condition
     PlantUML: How to repeat a loop in an activity diagram
     How to insert an action in the loop return path of a PlantUML activity diagram?
     How to break a loop in a PlantUML activity diagram
     Creating a while loop in a PlantUML activity diagram
      Defining parallel processing in a PlantUML activity diagram
     How to Model Split Processing in Activity Diagrams with PlantUML
     How to Add Notes to Activities in PlantUML Activity Diagrams
     How to Add Floating Notes to PlantUML Activity Diagrams
     PlantUML: Customizing Activity Appearance
     PlantUML: Activity Diagrams Without Arrows
     PlantUML: Add Labels to Activity Diagram Arrows
     PlantUML Activity Diagram Arrows
     PlantUML: How to denote a connector in activity diagram using parentheses
     Applying Color to PlantUML Connectors
     Partitioning Activities in PlantUML Activity Diagrams
     Swimlanes: A Visual Approach to Activity Diagrams in PlantUML
     Enriching Swimlanes with Colors in PlantUML Activity Diagrams
     Removing Arrows in PlantUML with Detach and Kill Commands
     Styling Decisions: Enhancing Conditions in PlantUML Activity Diagrams
     PlantUML: A Guide to Condition End Styles
Visualizing Software Architecture: A Guide to PlantUML Component Diagrams
     Designing with PlantUML: Creating and Defining Interfaces in Component Diagrams
     PlantUML: Add labels to the arrows in component diagram
      PlantUML: add notes to the components, interfaces in a component diagram
     A Guide to Grouping Components in PlantUML
     Customizing Arrow Direction in PlantUML Component Diagrams: Up, Down, Left, and Right
     Create Component Diagrams with UML 1 Notation in PlantUML
     Creating Component Diagrams with Rectangle Notation in PlantUML
     Annotating Component Diagrams with Descriptive Text in PlantUML
     Add colors to the component in PlantUML
     Customize color, fonts of component diagram using skinparam command in PlantUML
     Hide or remove unlinked components in PlantUML
Quick Introduction to Deployment diagram in PlantUML
     PlantUML: nestable elements in the deployment diagram
     PlantUML: Add description to the deployment diagram elements
     PlantUML: Actor in a deployment diagram
     PlantUML: component element in Deployment diagram
     PlantUML: interface element in deployment diagram
     PlantUML: link the elements of deployment diagram
     PlantUML: Customize the element position using left, right, up and down in deployment diagram
     PlantUML: Add label to the arrows in a deployment diagram
     PlantUML: Supported line or arrow styles in a deployment diagram
     PlantUML: Add color to the arrow in a deployment diagram
     PlantUML: customize line thickness in a deployment diagram
     PlantUML: Mix arrow style, color and thickness in a deployment diagram
     PlantUML: Use inline style to customize arrow color, style in a deployment diagram
     PlantUML: Customize element color, style in deployment diagram using inline style
     PlantUML: round the corner of rectangle in deployment diagram
     PlantUML: Round the corners of elements in a diagram
     PlantUML: Apply styles for each element separately in deployment diagram
PlantUML: Working with state diagram
     PlantUML: Add description to the states in a state diagram
     PlantUML: Composite state in state diagram
     PlantUML: History state in uml diagram
     PlantUML: fork and join in state diagram
     PlantUML: concurrent state in state diagram
     PlantUML: conditional state in state diagram
     PlantUML: entry and exit points in state diagram
     PlantUML: expansion input and output points in state diagram
     PlantUML: Force arrow direction to left, right, up, down in state diagram
     PlantUML: Customize arrow color, style and thickness in activity diagram
     PlantUML: Add notes to an activity in activity diagram
     PlantUML: add note on links in state diagram
     PlantUML: add inline color to the states in state diagram
     PlantUML: Cusotmize colors, fonts in state diagram using skinparam command
PlantUML: Working with JSON data
     PlantUML: Highlight some parts of the json document
      PlantUML: Customize style or rendering of json document using style tag
PlantUML: working with yaml document
     PlantUML: Highlight some parts of the yaml document
     PlantUML: Customize style or rendering of yaml document using style tag
PlantUML: asciimath support
PlantUML: mathematics support using JLaTeXMath notation
PlantUML: zoom the diagram using scale command
PlantUML: Customize title font, color using skinparam command
PlantUML: creol formatting to customize diagram title
PlantUML: Add caption under the diagram
PlantUML: Customize caption color, font using style tag
PlantUML: Add legend to the diagram
PlantUML: Customize color, font of legend using style tag
PlantUML: customize legend font, color using skinparam command
PlantUML: emphasizing the text using creole
PlantUML: numbered lists using creole syntax
PlantUML: Creole bulleted list
PlantUML: escape creole characters
PlantUML: Creole horizontal lines
PlantUML: Creole headings
PlantUML: mix html and creole
PlantUML: creole table
PlantUML: Use code tag to display programming code
PlantUML : apply colors to creole table cells
PlantUML: build a tree using Creole
PlantUML: embed special Unicode characters
PlantUML: Use icons from OpenIconic
PlantUML: Define a variable
PlantUML: preprocessing: conditional statements
PlantUML: Boolean built in functions
PlantUML: preprocessing: while loops support
PlantUML: preprocessing: procedures
PlantUML: define function and return the value
PlantUML: Declare default values to procedure, function parameters
PlantUML: keyword arguments
PlantUML: Include files or url using !include, !include_many, !include_once directives
Reuse plantuml data using !includeURL directive
PlantUML: Include sub part of a file
PlantUML: global variables
Enable log messages in plantuml diagram
PlantUML: take memory dump
PlantUML: customize look and feel using themes
PlantUML: Get all the standard color names
PlantUML: Print all the supported types
PlantUML: print all the supported keywords
PlantUML: Print supported fonts in your system
PlantUML: Quick guide to skinparam command
PlantUML: print list of supported skinparams
PlantUML: use skinparam to customize activity diagram font, colors
PlantUML: use skinparam to set activity background color
PlantUML: set color for single activity in activity diagram
PlantUML: skinparam: Set activity bar color

Previous                                                    Next                                                    Home

Setup Micronaut CLI on Mac, unix based platform

Step 1: Open terminal and execute below command to install sdkman.

curl -s https://get.sdkman.io | bash

 

On successful installation of sdkman, you will get below message in the terminal.

All done!


You are subscribed to the STABLE channel.

Please open a new terminal, or run the following in the existing one:

    source "/Users/krishna/.sdkman/bin/sdkman-init.sh"

Then issue the following command:

    sdk help

Enjoy!!!

Open a new terminal or type the command:
$ source "$HOME/.sdkman/bin/sdkman-init.sh"

In my case I executed below command to initialize sdkman.

source "/Users/krishna/.sdkman/bin/sdkman-init.sh"

Execute the command ‘sdk help’ to get the help of sdk command line tool.

bash-3.2$ sdk help
==== BROADCAST =================================================================
* 2022-09-22: springboot 2.6.12 available on SDKMAN! https://github.com/spring-projects/spring-boot/releases/tag/v2.6.12
* 2022-09-21: neo4jmigrations 1.12.0 available on SDKMAN! https://github.com/michael-simons/neo4j-migrations/releases/tag/1.12.0
* 2022-09-21: micronaut 3.7.0 available on SDKMAN!
================================================================================

NAME
    sdk - The command line interface (CLI) for SDKMAN!

SYNOPSIS
    sdk <subcommand> [candidate] [version]

DESCRIPTION
    SDKMAN! is a tool for managing parallel versions of multiple JVM related
    Software Development Kits on most Unix based systems. It provides a
    convenient Command Line Interface (CLI) and API for installing, switching,
    removing and listing Candidates.

SUBCOMMANDS & QUALIFIERS
    help         [subcommand]
    install      <candidate> [version] [path]
    uninstall    <candidate> <version>
    list         [candidate]
    use          <candidate> <version>
    config       no qualifier
    default      <candidate> [version]
    home         <candidate> <version>
    env          [init|install|clear]
    current      [candidate]
    upgrade      [candidate]
    version      no qualifier
    broadcast    no qualifier
    offline      [enable|disable]
    selfupdate   [force]
    update       no qualifier
    flush        [tmp|broadcast|metadata|version]

EXAMPLES
    sdk install java 17.0.0-tem
    sdk help install

Step 2: Install latest stable version of micronaut by executing below command.

sdk install micronaut

Once the installation is successful, execute the below command from terminal.

 

mn --version

bash-3.2$ mn --version
Micronaut Version: 3.7.0

That’s it you are done with Micronaut CLI setup in your system.

 

References

https://micronaut.io/download/

 


 

Previous                                                    Next                                                    Home

Introduction to Micronaut

Mincronaut is A MODERN, JVM-BASED, FULL-STACK FRAMEWORK FOR BUILDING MODULAR, EASILY TESTABLE MICROSERVICE AND SERVERLESS APPLICATIONS.

Previous                                                    Next                                                    Home

Micronaut core tutorial

      Introduction to Micronaut
      Setup Micronaut CLI on Mac, unix based platform
      Micronaut: Hello world application using Micronaut CLI
      Micronaut hello world application in Eclipse
      Test Micronaut app with Micronaut client

 

Previous                                                    Next                                                    Home

Hibernate 6: Get hibernate dialect

Approach 1: Using SessionFactory.

Dialect dialect1 = ((SessionFactoryImplementor) SESSION_FACTORY).getJdbcServices().getDialect();

 

Approach 2: Using Hibernate session.

Dialect dialect2 = ((SessionFactoryImplementor) session.getSessionFactory()).getJdbcServices().getDialect();

Find the below working application.

 

Step 1: Create new maven project ‘hibernate-get-dialect’.

 

Step 2: Update pom.xml with maven dependencies.

 

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.sample.app</groupId>
    <artifactId>hibernate-get-dialect</artifactId>
    <version>1</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <java.version>15</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>

    </properties>

    <dependencies>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.4.1</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>6.1.2.Final</version>
        </dependency>

        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>javax.persistence-api</artifactId>
            <version>2.2</version>
        </dependency>


    </dependencies>
</project>

Step 3: Create hibernate.cfg.xml file under src/main/resources folder.

 

hibernate.cfg.xml

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>

    <session-factory>

        <!-- Database Connection settings -->
        <property name="connection.driver_class">org.postgresql.Driver</property>
        <property name="connection.url">jdbc:postgresql://127.0.0.1:5432/test</property>
        <property name="connection.username">postgres</property>
        <property name="connection.password">postgres</property>

        <!-- Enable the logging of all the generated SQL statements to the console -->
        <property name="show_sql">true</property>

        <!-- Format the generated SQL statement to make it more readable, -->
        <property name="format_sql">true</property>

        <!-- Hibernate will put comments inside all generated SQL statements to 
            hint what’s the generated SQL trying to do -->
        <property name="use_sql_comments">false</property>

        <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>

        <property name="hbm2ddl.auto">update</property>


    </session-factory>

</hibernate-configuration>

Step 4: Define main application class.

 

App.java

package com.sample.app;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.NationalizationSupport;
import org.hibernate.engine.spi.SessionFactoryImplementor;

public class App {
    private static final SessionFactory SESSION_FACTORY = buildSessionFactory();

    private static SessionFactory buildSessionFactory() {
        try {

            final StandardServiceRegistry standardRegistry = new StandardServiceRegistryBuilder()
                    .configure("hibernate.cfg.xml").build();

            final Metadata metaData = new MetadataSources(standardRegistry).getMetadataBuilder().build();

            return metaData.getSessionFactoryBuilder().build();

        } catch (Throwable ex) {
            throw new ExceptionInInitializerError(ex);
        }

    }
    
    private static void printNationalizationSupportInfo(Dialect dialect) {
        NationalizationSupport nationalizationSupport = dialect.getNationalizationSupport();
        
        System.out.println("\n\nnationalizationSupport.getCharVariantCode() : " + nationalizationSupport.getCharVariantCode());
        System.out.println("nationalizationSupport.getClobVariantCode() : " + nationalizationSupport.getClobVariantCode());
        System.out.println("nationalizationSupport.getLongVarcharVariantCode() : " + nationalizationSupport.getLongVarcharVariantCode());
        System.out.println("nationalizationSupport.getVarcharVariantCode() : " + nationalizationSupport.getVarcharVariantCode());

    }

    public static void main(final String args[]) {
        Dialect dialect1 = ((SessionFactoryImplementor) SESSION_FACTORY).getJdbcServices().getDialect();
        printNationalizationSupportInfo(dialect1);
        
        try(Session session = SESSION_FACTORY.openSession()){
            Dialect dialect2 = ((SessionFactoryImplementor) session.getSessionFactory()).getJdbcServices().getDialect();
            printNationalizationSupportInfo(dialect2);
        }
        

    }
}

Total project structure looks like below.




Run App.java, you will see below messages in the console.

nationalizationSupport.getCharVariantCode() : 1
nationalizationSupport.getClobVariantCode() : 2005
nationalizationSupport.getLongVarcharVariantCode() : -1
nationalizationSupport.getVarcharVariantCode() : 12


nationalizationSupport.getCharVariantCode() : 1
nationalizationSupport.getClobVariantCode() : 2005
nationalizationSupport.getLongVarcharVariantCode() : -1
nationalizationSupport.getVarcharVariantCode() : 12

You can download complete working application from this link.


 

Previous                                                    Next                                                    Home