≡ModelConfig - TheGreetingCall
An example for a simple call with a field.
Github
Super Class
≡CallImpl
Interface
≡SimpleCommand
A good architecture allows you to defer framework decisions. A good architecture allows frameworks to act as plugins to the app.
Uncle Bob Martin
TheGreetingCall
Every tutorial starts with a "Hello World". So I do.
I've written a simple call
≡TheGreetingCall
to show
basic principles.
The "greeting" should be modifiable, so it contains such a field.
Furthermore one or several names should be used, so it will provided by EO and refered by "sourcePath".
To integrate the call into Eo and offer it for services one has to add
The
Java-Class of
≡TheGreetingCall
is a pure java, a pojo.
No annotation magic for a framework like the one I use on these pages.
The configurations are also just straightforward in JSON itself with a simple naming convention.
You find three editable examples in the rest of the page. For other tests you can have a
look at the
TheGreetingCallTest.java junit tests.
The unit tests show the direct java usage within EO without typed JSON.
Empty call
In the following example a path "xyz" will be specified of type "TheGreetingCall".
If you click, you will see "Hi Stranger!" is set to "xyz".
If you remove "_serializationType" you can see the hidden fields used by EO, for example the duration of
this call.
All values in the curly brackets of "xyz" will be mapped to the field values of
≡TheGreetingCall
.
With values
If we want to change the value we should set the name value to EO and then we set the sourcePath
to the fieldName "abc"
{
"abc":"Guru",
"(TheGreetingCall)/xyz":{
"sourcePath":"abc",
"greeting":"God bless you"
},
"_serializationType":"STANDARD"
}
If you click, you will see "God bless you Guru!" is set to "xyz".
Several Names
If the source is a list, automatically a list of calls will be done. "sourcePath" containing "*" triggers a loop for all names.
{
"abc":["Guru", "Motherfucker", "Saint"],
"(TheGreetingCall)/xyz":{
"sourcePath":"abc/*",
"greeting":"Damned"
},
"_serializationType":"STANDARD"
}
If you click, you will see a list of greetings beneath "xyz".
Fields
Configuration
{
"author": "Werner Diwischek",
"configModelKey": "ModelConfigObject",
"description": "An example for a simple call with a field.",
"expose": "WEB",
"fields": {
"condition": {
"configModelKey": "FieldConfigObject",
"description": "A condition for calls. ",
"expose": "WEB",
"fieldKey": "condition",
"modelKeys": "String",
"module": "elastic-objects",
"moduleScope": "main",
"naturalId": "condition",
"properties": {
"default": false,
"final": false,
"generated": false,
"jsonIgnore": false,
"max": 1000,
"min": -1,
"notNull": false,
"override": true,
"property": false,
"staticName": false,
"super": true,
"transient": false,
"unique": false
}
},
"duration": {
"configModelKey": "FieldConfigObject",
"description": "The duration of a call.",
"expose": "WEB",
"fieldKey": "duration",
"modelKeys": "Long",
"module": "elastic-objects",
"moduleScope": "main",
"naturalId": "duration",
"properties": {
"default": false,
"final": false,
"generated": false,
"jsonIgnore": false,
"max": -1,
"min": -1,
"notNull": false,
"override": true,
"property": false,
"staticName": false,
"super": true,
"transient": false,
"unique": false
}
},
"greeting": {
"configModelKey": "FieldConfigObject",
"description": "The field value for @TheGreetingCall example. ",
"expose": "NONE",
"fieldKey": "greeting",
"modelKeys": "String",
"module": "example-springboot",
"moduleScope": "main",
"naturalId": "greeting",
"properties": {
"default": false,
"final": false,
"generated": false,
"jsonIgnore": false,
"max": 15,
"min": -1,
"notNull": false,
"override": false,
"property": false,
"staticName": false,
"super": true,
"transient": false,
"unique": false
}
},
"keepCall": {
"configModelKey": "FieldConfigObject",
"description": "Will use an existing result file beforehand as template. ",
"expose": "WEB",
"fieldKey": "keepCall",
"modelKeys": "KeepCalls",
"module": "elastic-objects",
"moduleScope": "main",
"naturalId": "keepCall",
"properties": {
"default": false,
"final": false,
"generated": false,
"jsonIgnore": false,
"max": -1,
"min": -1,
"notNull": false,
"override": true,
"property": false,
"staticName": false,
"super": true,
"transient": false,
"unique": false
}
},
"logLevel": {
"configModelKey": "FieldConfigObject",
"description": "logLevel",
"expose": "WEB",
"fieldKey": "logLevel",
"modelKeys": "LogLevel",
"module": "elastic-objects",
"moduleScope": "main",
"naturalId": "logLevel",
"properties": {
"default": false,
"final": false,
"generated": false,
"jsonIgnore": false,
"max": -1,
"min": -1,
"notNull": false,
"override": true,
"property": false,
"staticName": false,
"super": true,
"transient": false,
"unique": false
}
},
"models": {
"configModelKey": "FieldConfigObject",
"description": "A string representation for a list of model keys.",
"expose": "WEB",
"fieldKey": "models",
"modelKeys": "String",
"module": "elastic-objects",
"moduleScope": "main",
"naturalId": "models",
"properties": {
"default": false,
"final": false,
"generated": false,
"jsonIgnore": false,
"max": 512,
"min": -1,
"notNull": false,
"override": true,
"property": false,
"staticName": false,
"super": true,
"transient": false,
"unique": false
}
},
"overwrite": {
"configModelKey": "FieldConfigObject",
"description": "A overwrite field flag for @Call.",
"expose": "WEB",
"fieldKey": "overwrite",
"modelKeys": "Boolean",
"module": "elastic-objects",
"moduleScope": "main",
"naturalId": "overwrite",
"properties": {
"default": false,
"final": false,
"generated": false,
"jsonIgnore": false,
"max": -1,
"min": -1,
"notNull": false,
"override": true,
"property": false,
"staticName": false,
"super": true,
"transient": false,
"unique": false
}
},
"postpend": {
"configModelKey": "FieldConfigObject",
"description": "postpend String when executed by ExecutorCallImpl",
"expose": "NONE",
"fieldKey": "postpend",
"modelKeys": "String",
"module": "elastic-objects",
"moduleScope": "main",
"naturalId": "postpend",
"properties": {
"default": false,
"final": false,
"generated": false,
"jsonIgnore": false,
"max": 256,
"min": -1,
"notNull": false,
"override": true,
"property": false,
"staticName": false,
"super": true,
"transient": false,
"unique": false
}
},
"prepend": {
"configModelKey": "FieldConfigObject",
"description": "prepend String when executed by ExecutorCallImpl",
"expose": "NONE",
"fieldKey": "prepend",
"modelKeys": "String",
"module": "elastic-objects",
"moduleScope": "main",
"naturalId": "prepend",
"properties": {
"default": false,
"final": false,
"generated": false,
"jsonIgnore": false,
"max": 256,
"min": -1,
"notNull": false,
"override": true,
"property": false,
"staticName": false,
"super": true,
"transient": false,
"unique": false
}
},
"sourcePath": {
"configModelKey": "FieldConfigObject",
"description": "A sourcePath where EO offers it's input value when the execution starts.",
"expose": "WEB",
"fieldKey": "sourcePath",
"modelKeys": "String",
"module": "elastic-objects",
"moduleScope": "main",
"naturalId": "sourcePath",
"properties": {
"default": false,
"final": false,
"generated": false,
"jsonIgnore": false,
"max": 80,
"min": -1,
"notNull": false,
"override": true,
"property": false,
"staticName": false,
"super": true,
"transient": false,
"unique": false
}
},
"startCondition": {
"configModelKey": "FieldConfigObject",
"description": "A condition for calls. ",
"expose": "WEB",
"fieldKey": "startCondition",
"modelKeys": "String",
"module": "elastic-objects",
"moduleScope": "main",
"naturalId": "startCondition",
"properties": {
"default": false,
"final": false,
"generated": false,
"jsonIgnore": false,
"max": 1000,
"min": -1,
"notNull": false,
"override": true,
"property": false,
"staticName": false,
"super": true,
"transient": false,
"unique": false
}
},
"targetPath": {
"configModelKey": "FieldConfigObject",
"description": "A targetPath where the result of the execution will be mapped. If value is \"_asString\" no mapping occured but a seralized version is returned as value to embed it in the resulting file. Path parameters could be set dynamically with =>[path]. in any combination.",
"expose": "WEB",
"fieldKey": "targetPath",
"modelKeys": "String",
"module": "elastic-objects",
"moduleScope": "main",
"naturalId": "targetPath",
"properties": {
"default": false,
"final": false,
"generated": false,
"jsonIgnore": false,
"max": 80,
"min": -1,
"notNull": false,
"override": true,
"property": false,
"staticName": false,
"super": true,
"transient": false,
"unique": false
}
}
},
"interfaces": "SimpleCommand",
"modelKey": "TheGreetingCall",
"module": "example-springboot",
"moduleScope": "main",
"naturalId": "TheGreetingCall",
"packagePath": "org.fluentcodes.projects.elasticobjects.calls.values",
"properties": {
"abstract": false,
"create": true,
"dbAnnotated": false,
"final": false
},
"superKey": "CallImpl"
}