Wizzi schema wfjob
Exports
execFile
Element | Tag | Super | Flags |
---|---|---|---|
wfjob | wfjob |
Description
The root element of the wfjob schema.
Attributes
Name | Tag | Type | Default | Inherited | Flags | Description |
---|---|---|---|---|---|---|
modelsBaseFolder | models-base-folder | string | string |
The base path for the source models used by this "wfjob".
|
||
destBaseFolder | dest-base-folder | string | string |
The base folder path for the generated artifacts.
|
||
title | title | string | string |
A short description of the job.
|
Relations
Name | Role | Cardinality | Inherited | Flags | Description |
---|---|---|---|---|---|
comment | comments | one-to-many | |||
require | requires | one-to-many | |||
model | models | one-to-many | |||
line | lines | one-to-many | |||
production | productions | one-to-many | |||
execFile | execFiles | one-to-many |
Element | Tag | Super | Flags |
---|---|---|---|
comment | # |
Description
A comment line for describing job items.
Element | Tag | Super | Flags |
---|---|---|---|
xrequire | require |
Description
Requires a WizziFactoryPackage.
The IttfNodeValue is the package name.
If the package is not globally installed must be a fully qualified path.
Element | Tag | Super | Flags |
---|---|---|---|
model | model |
Description
A wizzi model instance or a POJO acting as a context during an mTree loading
or an artifact generation.
The ittf node value is the name of the model that must be unique
in a "wfjob"; it will become the default export name of the context
value that exposes the model.
A "model" will be loaded once, and will be reused if
referenced in many evaluations.
Attributes
Name | Tag | Type | Default | Inherited | Flags | Description | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
src | src | string | string |
The path to the primary ittf document of the "model" or to the the POJO source.
When relative, the base path is the "modelsBaseFolder"
declared on the "wfjob" element.
|
||||||||
schema | schema | string | string |
In case of a wizzi model is the name of the schema that will validate the "model".
Is alternative to the attribute 'format'.
|
||||||||
format | format | string | string |
In case of a POJO model is the native format of the source file.
Is alternative to the attribute 'schema'.
restrict
|
||||||||
dumpFile | dump-file | string | string |
A filepath where the loaded must be dumped for test.
The model must implement the toJson method. See the "exportTo" attribute in wizzischema root nodes.
When declared the loaded model is JSON.stringyfied and written
to the "dumpFile" filepath.
|
Relations
Name | Role | Cardinality | Inherited | Flags | Description |
---|---|---|---|---|---|
modelRef | modelRefs | one-to-many | References to "model" instances acting as data context during this "model" evaluation. A "model" is referenced by its name. | ||
comment | comments | one-to-many |
Element | Tag | Super | Flags |
---|---|---|---|
modelRef | model-ref |
Attributes
Name | Tag | Type | Default | Inherited | Flags | Description |
---|---|---|---|---|---|---|
exportName | export-name | string | string |
The name of the context property that will expose the loaded model during
an evaluation. Overrides the name of the "model" that is the default export name.
|
Relations
Name | Role | Cardinality | Inherited | Flags | Description |
---|---|---|---|---|---|
transformer | transformers | one-to-many | A model may have one or more transformers. Transformers are chained and the output of a transformation is the input for the next one. | ||
modelCollection | modelCollections | one-to-many | TODO This is a one-to-one relation, not yet implemented. Single items of a collection contained in the "model" may act as data contexts of artifacts where each collection item generates a separate artifact. | ||
comment | comments | one-to-many |
Methods
Signature | Statements |
---|---|
wzinitialize
|
if this.modelCollections.length > 0;
|
Element | Tag | Super | Flags |
---|---|---|---|
modelCollection | model-coll |
Description
Single items of a collection contained in a "model" may act as data contexts
of artifacts where each collection item generates a separate artifact.
This element, contained in a "modelRef" element, specifies:
. the collection name: the IttfNodeValue of this element
. the export name of the collection item when acting as a data context: the "item-name" attribute
. the property names of the collection item that will be used to build the destination path
of the artifact: the "pathTemplateValues" child elements
Attributes
Name | Tag | Type | Default | Inherited | Flags | Description |
---|---|---|---|---|---|---|
itemName | item-name | string | string |
The export name of a collection item when acting as a data context.
|
Relations
Name | Role | Cardinality | Inherited | Flags | Description |
---|---|---|---|---|---|
pathTemplateValue | pathTemplateValues | one-to-many | |||
comment | comments | one-to-many |
Element | Tag | Super | Flags |
---|---|---|---|
pathTemplateValue | path-template-value |
Attributes
Name | Tag | Type | Default | Inherited | Flags | Description |
---|---|---|---|---|---|---|
attribute | attribute | string | string |
The property of the context object (a collection item) containing the value which will replace
the "token" value in the generated artifact path template.
Is alternative to "function"
|
||
function | function | string | string |
The function of the context object (a collection item) that returns the value which will replace
the "token" value in the generated artifact path template.
Is alternative to "attribute"
|
||
token | token | string | string |
The token that will be replaced by the value returned accessing "attribute" or calling "function"
on a context object.
|
Relations
Name | Role | Cardinality | Inherited | Flags | Description |
---|---|---|---|---|---|
comment | comments | one-to-many |
Element | Tag | Super | Flags |
---|---|---|---|
transformer | transformer |
Description
A model transformer .
The ittf node value is the transformer name {wizzischema}/{transformer}
to be found in {wizziPackage}/artifacts/{wizzischema}/{transformer}/trans/main.js
Attributes
Name | Tag | Type | Default | Inherited | Flags | Description |
---|---|---|---|---|---|---|
dumpFile | dump-file | string | string |
A filepath where the transformed model must be dumped for test.
When declared the transformed model is JSON.stringyfied and written
to the "dumpFile" filepath.
|
Relations
Name | Role | Cardinality | Inherited | Flags | Description |
---|---|---|---|---|---|
comment | comments | one-to-many |
Element | Tag | Super | Flags |
---|---|---|---|
artifact | artifact |
Description
Describe an artifact to be generated.
It is a child element of a "line" element.
Can be one of:
. A Wizzi model instance, acting as a template, which WizziSchema targets a code language technology.
. A swig template.
. A code write generation that takes in input a context of one or more WizziModels.
. A final artifact to be copied to a destination folder without transformations.
. A reference to another WfJob, to be executed before the current WfJob where the artifact is declared.
Context value objects for template transformations are declared in the "model" element, child of the "wfjob" root element
and may be referenced in the elements "modelRef", children of the "artifact" element.
The "src" or "destPath" attributes of an "artifact" element may contain tokens enclosed in graph parens.
When one of the "modelRef@" is a collection model, the artifact generation is repeated
for each item of the collection and the "src" or "destPath" attributes become the template of the destination path.
See the "pathTemplateValues" child elements of the "modelRef" for the values that will replace the tokens.
Example
artifact
dest-path app/db/{table}Datalayer.js.ittf
...
model-ref rdbms
model-coll tables
item-name table
path-template-value
attribute tableName
token table
model rdbms
...
the Wizzi model instance after loading rdbms: {
....
tables: [{
tableName: 'user',
...
},{
...
}]
}
will produce an artifact of path .../app/db/userDatalayer.js, and as many as the items in the tables collection.
Attributes
Name | Tag | Type | Default | Inherited | Flags | Description | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
src | src | string | string |
The path to the primary ittf source document of the artifact, in case of a wizzi model, or
to a native source in case of a POJO.
TODO explain why this:
Or it may contain the literal 'context' if the artifact generator require a context object only
and not a primary model.
If relative, the base path is the cwdFolder of the parent line.
Can be a glob pattern.
If the artifact is a code write artifact the 'src' attribute must be omitted.
|
||||||||
ignore | ignore | string | string |
File returned by the src pattern that must be ignored.
Can be a glob pattern.
|
||||||||
schema | schema | string | string |
When the artifact source is a schemed ittf document, is the schema that will load and
validate the wizzi model instance.
May be null (absent) if the artifact is a final artifact or the artifact source is a POJO;
in this case the 'format' attribute must be declared.
|
||||||||
format | format | string | string |
When the artifact source is a POJO model is the native format of the source file.
Is alternative to the attribute 'schema'.
restrict
|
||||||||
isCompile | is-compile | boolean | false |
Indicator that the mTree buildup script must be 'compiled' for javascript
and loaded with a 'require-from-string' function instead of
being submitted to js-wizzi.
|
||||||||
isWfJob | is-wf-job | boolean | false |
Indicator that the artifact source is a wizzi factory job, alias a wizzi model of schema 'wfjob'.
The job will be executed before any other artifact production of the current wfjob.
This could be autodected from the schema, but autodetection would forbid other uses or transformations
of a "wfjob" model, so the indicator is required.
|
||||||||
isWfModelType | is-wf-model-type | boolean | false |
Indicator that the artifact source is a wizzi schema, alias a wizzi model of schema 'wfschema'
and that the generation of the artifacts for the wizzi model described by the wfschema is requested.
This could be autodected from the schema, but autodetection would forbid other uses or transformations
of a "wfschema" model, so the indicator is required.
|
||||||||
generator | generator | string | string |
When the artifact source is a wizzi model instance or a POJO, acting as a context, is the name of
the artifact generator that will transform the context into a software artifact.
When the artifact is a code write generation or a final artifact must be omitted.
|
||||||||
destPath | dest-path | string | string |
The artifact source file path, 'src', is the default relative destination path
of the generated artifact. When set, this attribute overrides the default.
It can be an absolute or relative path.
If the artifact is a code write generation the 'destPath' attribute is required.
|
||||||||
extension | extension | string | string |
The document path extension of the generated artifact. Optional. The default is the 'src' extension
without the ending '.ittf' string, if present.
|
Relations
Name | Role | Cardinality | Inherited | Flags | Description |
---|---|---|---|---|---|
transformer | transformers | one-to-many | When the artifact source is an Ittf document, the loaded WizziModel may need one or more transformations before being passed to the artifact generator. Transformers are chained and the output of a transformation is the input for the next one. | ||
modelRef | modelRefs | one-to-many | References to 'model/s' acting as context objects. In case of a final artifact must not be declared. | ||
comment | comments | one-to-many |
Element | Tag | Super | Flags |
---|---|---|---|
line | line |
Description
A line is a group of artifacts having the same source "cwdFolder".
Attributes
Name | Tag | Type | Default | Inherited | Flags | Description |
---|---|---|---|---|---|---|
cwdFolder | cwd-folder | string | string |
The source folder of the artifact templates of this line.
|
||
destFolder | dest-folder | string | string |
The destination folder of the generated artifacts of this line.
Overrides the attribute "destFolder" of the "production" element.
|
Relations
Name | Role | Cardinality | Inherited | Flags | Description |
---|---|---|---|---|---|
artifact | artifacts | one-to-many | The artifacts of the "line" | ||
comment | comments | one-to-many |
Element | Tag | Super | Flags |
---|---|---|---|
lineRef | line-ref |
Description
A reference to a line.
Relations
Name | Role | Cardinality | Inherited | Flags | Description |
---|---|---|---|---|---|
comment | comments | one-to-many |
Element | Tag | Super | Flags |
---|---|---|---|
production | production |
Description
A job execution unit that generates a set of Software artifacts
into one destination folder.
Attributes
Name | Tag | Type | Default | Inherited | Flags | Description |
---|---|---|---|---|---|---|
destFolder | dest-folder | string | string |
The destination folder of the generated artifacts.
|
Relations
Name | Role | Cardinality | Inherited | Flags | Description |
---|---|---|---|---|---|
modelRef | modelRefs | one-to-many | References to the context WizziWodels used by this "production". | ||
lineRef | lineRefs | one-to-many | References to the "line(s)" to be generated. | ||
comment | comments | one-to-many |
Methods
Signature | Statements |
---|---|
wzinitialize
|
set this.wfjob = this.wzParent;;
foreach modelRef in this.modelRefs;
set this.lines = [];;
foreach lineRef in this.lineRefs;
|
Element | Tag | Super | Flags |
---|---|---|---|
env | env |
Attributes
Name | Tag | Type | Default | Inherited | Flags | Description | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
type | type | string | string |
restrict
|
||||||||
__name | __name | string | string | |||||||||
__value | __value | string | string |
Methods
Signature | Statements |
---|---|
wzinitialize
|
var nv = verify.parseNameValue(this.wzName);
set this.__name = nv.name;
set this.__value = verify.convert(nv.value, this.type);
|
Element | Tag | Super | Flags |
---|---|---|---|
arg | arg |
Attributes
Name | Tag | Type | Default | Inherited | Flags | Description | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
type | type | string | string |
restrict
|
||||||||
__name | __name | string | string | |||||||||
__value | __value | string | string |
Methods
Signature | Statements |
---|---|
wzinitialize
|
var nv = verify.parseNameValue(this.wzName);
if nv.value && nv.value.length > 0;
else ;
|
Element | Tag | Super | Flags |
---|---|---|---|
execFile | exec-file |
Description
An execution of a child process using
-> child_process.execFile(file[, args][, options][, callback])
Attributes
Name | Tag | Type | Default | Inherited | Flags | Description |
---|---|---|---|---|---|---|
exePath | exe-path | string | string |
The path to the executable.
|
||
title | title | string | string |
A short description of the execution.
|
||
cwd | cwd | string | string |
Current working directory of the child process.
|
||
encoding | encoding | string | string |
Default: 'utf8'
|
||
timeout | timeout | integer | 0 |
Default: 0
|
||
__options | __options | string | string | |||
__args | __args | string | string |
Relations
Name | Role | Cardinality | Inherited | Flags | Description |
---|---|---|---|---|---|
arg | args | one-to-many | |||
env | envs | one-to-many | |||
comment | comments | one-to-many |
Methods
Signature | Statements |
---|---|
wzinitialize
|
var options = {};
if this.cwd && this.cwd.length > 0;
if this.encoding && this.encoding.length > 0;
if this.timeout > 0;
if this.envs.length > 0;
set this.__options = options;
set this.__args = [];
foreach arg in this.args;
|