Application Models

SDK implements a set of core models designed to jump-start development with the most common features needed in a supply chain application. The application model features in the One Network SDK allow you to create models that are unique to the requirements of your application. Application models have all the same capabilities as core models including state machines, workflows, issue computations, integration points, etc.

You use Studio to create models using a visual interface. Once created, your application models reside as files in the models folder in your module project.


Procedure 4.20. To Create a New Model:

  1. Click File | New | Model.
    images/download/attachments/144835154/modeling_33-version-1-modificationdate-1645042400000-api-v2.png

  2. Verify the project you are working with appears in the Project box. If if does not, you can browse for it by clicking the folder icon.

  3. Supply a unique name for your model.

  4. Click Finish.


Procedure 4.21. To Add a New Field to an Application Model:

  1. Locate the file you wish to use in the models folder and double-click to open it.

  2. Go to the Fields tab within the Model Editor.

  3. Click the Add button.

  4. Type a name for your field in the ensuing dialog box.
    images/download/attachments/144835154/modeling_35-version-1-modificationdate-1645042420000-api-v2.png

  5. Define the data type for your field and click OK.

  6. Based on which data type you selected, the area below the field list allows you to fine-tune your selections. For example, in the figure below we've just added a string field. There are additional options for configuring the string field.
    images/download/attachments/144835154/modeling_36-version-1-modificationdate-1645042444000-api-v2.png images/download/attachments/144835154/modeling_34-version-1-modificationdate-1645042451000-api-v2.png

    Don't forget, after you save your new model, you need to build your project before you will see the new or updated models on the server

Procedure 4.22. To Change a Field Definition

Important

Since changing a field definition directly affects the database, you should perform ant clean build to see the new changes in effect. Use the Ant clean task to wipe the module's database structure followed by the default Ant build task to re-generate the artifacts dependent on the model definition.

  1. Open the model file in Studio

  2. Click the field and make your changes.

  3. Click the Save button on the toolbar to save your changes.