ðŸ–ĨïļFor Developers

This part of documentation is helpful for Developers in order to use the Product "Codewizard" and how it is working.

Good to know: depending on the product, you will find here all the details from where to start and what is needed.

Table of Content
  • Development steps and process

  1. Creating a model using Staruml (An open source software)

  2. Verifying the model

  3. Converting UML design to XML

  4. Generating the Code

  5. Running, deploying the Code

  6. Using Postman(An open source software) to access the API

  1. Create simple design for your functional requirements using Staruml

First, give the details of all the requirements using uml diagram with various classes and assocations or in xml/edmx format.

(A) If the requirements are in the xml format, you can move ahead to step-4.

(B) If you're considering uml diagram then provide all the requirements with classes and associations. Please follow all the steps.

  1. Verify the design

UML Diagram must have the following necessary things:

  • There can be n number of classes and associations in design model as needed. Classes can be of Entity Type, Complex Type or Enum Type.

  • Each and every entity type class should have the id.

  • String, Int, Long, DateTimeOffset etc. are some examples of the type of properties.

  • Provide the names for the associations and provide multiplicity to end2 in diagram

  1. Running the code

We eventually have one application for running the code, for this you need to use postman.

Use post request, inside body, you will see 'githubURL' key, provide the value which you after running 'OdataV4SpringCodeGenerator.java'.

For example:

"gitHubURL": "https://github.com/codewizard-replicacia/backend_generated_app_c887d3eb_fdc1_47a6_b821_7c486798c791.git",
"applicationServiceName": "generated_app"

  1. Access the API using Postman

You will get postman_collection file from the generated code, inside of source_code folder, check the latest generated code, click on that, look at src folder then resources,

here you will find one file named with Postman_Collection.

You can rename this and import it in Postman. Now, you will see API, you can send get, post, delete and patch requests.

Some examples of using different requests are given below:

Get Request =

url = {{host}}/{{servletname}}/ShoppingCarts

or

url = {{host}}/{{servletname}}/ShoppingCarts(id)

here you can provide the values for host and servletname as needed.

Post Request =

url = {{host}}/{{servletname}}/ShoppingCarts

body =

{
    "CartId": 63,
    "Quantity": 46,
    "Amount": 541045.78,
    "Products": [
        {
            "ProductName": "Opaline Dutta MD",
            "IconName": "Samir Gill",
            "ProductDescription": "skid"
        }
    ]
}

Get raw value of Id

{{host}}/{{servletname}}/ShoppingCarts(CartId)/CartId/$value

Get Request filter option

{{host}}/{{servletname}}/ShoppingCarts?$filter=CartId eq 63

Navigation Request(One to Many)

{{host}}/{{servletname}}/ShoppingCarts(2)/Products

Get Request expand option

{{host}}/{{servletname}}/ShoppingCarts(2)?$expand=Products

Delete Request =

URL = {{host}}/{{servletname}}/ShoppingCarts(1)

You will see no content in response after succesfully completion of request .

System Query Option 1 =

GET raw value of Any Property

URL = {{host}}/{{servletname}}/ShoppingCarts(id)/Quantity/$value

Id field value can be of type Integer like: 1,2,3.. or it may be of any other data type.

GET $filter option = gives only entity set that has quailty as assigned value in url.

URL = {{host}}/{{servletname}}/ShoppingCarts?$filter=Quantity eq 46

System Query Option 3 =

If you have enum type in your model file, there is one API:

Get $filter option on enum = {{host}}/{{servletname}}/ModelFiles?$filter=ModelType eq generated_app.ModelType'EDMX'

System Query Option 4 =

GET #orderBy option on Date field entity set = This will give the response with

URL = {{host}}/{{servletname}}/ShoppingCarts?$orderby=<<Replace with property name>> desc

Get $count option = This gives you total number of entity set.

URL = {{host}}/{{servletname}}/ShoppingCarts/$count

GET $top option = Here assign the number of entityset that you want to see from top.

URL = {{host}}/{{servletname}}/ShoppingCarts?$top=2

GET $skip option = This will skip the entity set according to the given number.

URL= {{host}}/{{servletname}}/ShoppingCarts?$skip=2

Patch Request =

URL = {{host}}/{{servletname}}/ShoppingCarts(id)

If patch request is not working, then you can see error, try removing Id property from body.

{
    "CartId":2, // Remove this id property
    "Quantity": 46,
    "Amount": 541045.78
}

Last updated