Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
RagConnect
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JastAdd
RagConnect
Commits
2285a023
Commit
2285a023
authored
4 years ago
by
René Schöne
Browse files
Options
Downloads
Patches
Plain Diff
Update YAML generation.
parent
9287757d
No related branches found
No related tags found
No related merge requests found
Pipeline
#8585
passed with warnings
4 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ragconnect.base/src/main/jastadd/intermediate2mustache/MustacheNodesToYAML.jrag
+78
-60
78 additions, 60 deletions
...in/jastadd/intermediate2mustache/MustacheNodesToYAML.jrag
with
78 additions
and
60 deletions
ragconnect.base/src/main/jastadd/intermediate2mustache/MustacheNodesToYAML.jrag
+
78
−
60
View file @
2285a023
...
@@ -2,63 +2,71 @@ aspect MustacheNodesToYAML {
...
@@ -2,63 +2,71 @@ aspect MustacheNodesToYAML {
syn Document MRagConnect.toYAML() {
syn Document MRagConnect.toYAML() {
Document doc = new Document();
Document doc = new Document();
MappingElement root = new MappingElement();
MappingElement root = new MappingElement();
root.
addKeyValuePair
("rootNodeName",
StringElement.of(
rootNodeName())
)
;
root.
put
("rootNodeName", rootNodeName());
root.
addKeyValuePair
("closeMethod",
StringElement.of(
closeMethod())
)
;
root.
put
("closeMethod", closeMethod());
root.
addKeyValuePair("usesMqtt", ValueElement.of(
usesMqtt)
)
;
root.
put("usesMqtt",
usesMqtt);
root.
addKeyValuePair("usesRest", ValueElement.of(
usesRest)
)
;
root.
put("usesRest",
usesRest);
// mqtt
// mqtt
root.
addKeyValuePair
("mqttHandlerField",
StringElement.of(
mqttHandlerField())
)
;
root.
put
("mqttHandlerField", mqttHandlerField());
root.
addKeyValuePair
("mqttHandlerAttribute",
StringElement.of(
mqttHandlerAttribute())
)
;
root.
put
("mqttHandlerAttribute", mqttHandlerAttribute());
root.
addKeyValuePair
("mqttSetupWaitUntilReadyMethod",
StringElement.of(
mqttSetupWaitUntilReadyMethod())
)
;
root.
put
("mqttSetupWaitUntilReadyMethod", mqttSetupWaitUntilReadyMethod());
// rootTypeComponents
// rootTypeComponents
ListElement rootTypeComponents = new ListElement();
ListElement rootTypeComponents = new ListElement();
for (MTypeComponent comp : getRootTypeComponentList()) {
for (MTypeComponent comp : getRootTypeComponentList()) {
MappingElement inner = new MappingElement();
MappingElement inner = new MappingElement();
inner.
addKeyValuePair("first", ValueElement.of(
comp.isFirst())
)
;
inner.
put("first",
comp.isFirst());
inner.
addKeyValuePair("name", StringElement.of(
comp.name())
)
;
inner.
put("name",
comp.name());
rootTypeComponents.addElement(inner);
rootTypeComponents.addElement(inner);
}
}
root.
addKeyValuePair
("RootTypeComponents", rootTypeComponents);
root.
put
("RootTypeComponents", rootTypeComponents);
// rest
// rest
root.
addKeyValuePair
("restHandlerField",
StringElement.of(
restHandlerField())
)
;
root.
put
("restHandlerField", restHandlerField());
root.
addKeyValuePair
("restHandlerAttribute",
StringElement.of(
restHandlerAttribute())
)
;
root.
put
("restHandlerAttribute", restHandlerAttribute());
// ReceiveDefinitions
// ReceiveDefinitions
ListElement receiveDefinitions = new ListElement();
ListElement receiveDefinitions = new ListElement();
for (MReceiveDefinition def : getReceiveDefinitionList()) {
for (MReceiveDefinition def : getReceiveDefinitionList()) {
receiveDefinitions.addElement(def.toYAML());
receiveDefinitions.addElement(def.toYAML());
}
}
root.
addKeyValuePair
("ReceiveDefinitions", receiveDefinitions);
root.
put
("ReceiveDefinitions", receiveDefinitions);
// SendDefinitions
// SendDefinitions
ListElement sendDefinitions = new ListElement();
ListElement sendDefinitions = new ListElement();
for (MSendDefinition def : getSendDefinitionList()) {
for (MSendDefinition def : getSendDefinitionList()) {
sendDefinitions.addElement(def.toYAML());
sendDefinitions.addElement(def.toYAML());
}
}
root.
addKeyValuePair
("SendDefinitions", sendDefinitions);
root.
put
("SendDefinitions", sendDefinitions);
// MappingDefinitions
// MappingDefinitions
ListElement mappingDefinitions = new ListElement();
ListElement mappingDefinitions = new ListElement();
for (MMappingDefinition def : getMappingDefinitionList()) {
for (MMappingDefinition def : getMappingDefinitionList()) {
mappingDefinitions.addElement(def.toYAML());
mappingDefinitions.addElement(def.toYAML());
}
}
root.
addKeyValuePair
("MappingDefinitions", mappingDefinitions);
root.
put
("MappingDefinitions", mappingDefinitions);
// DependencyDefinitions
// DependencyDefinitions
ListElement dependencyDefinitions = new ListElement();
ListElement dependencyDefinitions = new ListElement();
for (MDependencyDefinition def : getDependencyDefinitionList()) {
for (MDependencyDefinition def : getDependencyDefinitionList()) {
dependencyDefinitions.addElement(def.toYAML());
dependencyDefinitions.addElement(def.toYAML());
}
}
root.
addKeyValuePair
("DependencyDefinitions", dependencyDefinitions);
root.
put
("DependencyDefinitions", dependencyDefinitions);
// TokenComponents
// TokenComponents
ListElement tokenComponents = new ListElement();
ListElement tokenComponents = new ListElement();
for (MTokenComponent comp : getTokenComponentList()) {
for (MTokenComponent comp : getTokenComponentList()) {
tokenComponents.addElement(comp.toYAML());
tokenComponents.addElement(comp.toYAML());
}
}
root.addKeyValuePair("TokenComponents", tokenComponents);
root.put("TokenComponents", tokenComponents);
// Handlers
ListElement handlers = new ListElement();
for (MHandler handler : getHandlerList()) {
handlers.add(handler.toYAML()
.put("rootTokenComponents", rootTypeComponents.treeCopy()) );
}
root.put("Handlers", handlers);
doc.setRootElement(root);
doc.setRootElement(root);
return doc;
return doc;
...
@@ -66,75 +74,75 @@ aspect MustacheNodesToYAML {
...
@@ -66,75 +74,75 @@ aspect MustacheNodesToYAML {
syn MappingElement MEndpointDefinition.toYAML() {
syn MappingElement MEndpointDefinition.toYAML() {
MappingElement result = new MappingElement();
MappingElement result = new MappingElement();
result.
addKeyValuePair
("parentTypeName",
StringElement.of(
parentTypeName())
)
;
result.
put
("parentTypeName", parentTypeName());
result.
addKeyValuePair
("connectMethod",
StringElement.of(
connectMethod())
)
;
result.
put
("connectMethod", connectMethod());
result.
addKeyValuePair
("connectParameterName",
StringElement.of(
connectParameterName())
)
;
result.
put
("connectParameterName", connectParameterName());
result.
addKeyValuePair
("lastDefinitionToType",
StringElement.of(
lastDefinitionToType())
)
;
result.
put
("lastDefinitionToType", lastDefinitionToType());
result.
addKeyValuePair
("preemptiveReturn",
StringElement.of(
preemptiveReturn())
)
;
result.
put
("preemptiveReturn", preemptiveReturn());
result.
addKeyValuePair
("alwaysApply",
ValueElement.of(
alwaysApply())
)
;
result.
put
("alwaysApply", alwaysApply());
result.
addKeyValuePair("condition", StringElement.of(
result.
put("condition",
condition().replace("\"", "\\\"").replace("\n", "\\n"))
)
;
condition().replace("\"", "\\\"").replace("\n", "\\n"));
result.
addKeyValuePair("lastResult", StringElement.of(
lastResult())
)
;
result.
put("lastResult",
lastResult());
result.
addKeyValuePair("tokenName", StringElement.of(
tokenName())
)
;
result.
put("tokenName",
tokenName());
result.
addKeyValuePair
("InnerMappingDefinitions", innerMappingDefinitionsAsListElement());
result.
put
("InnerMappingDefinitions", innerMappingDefinitionsAsListElement());
return result;
return result;
}
}
syn MappingElement MReceiveDefinition.toYAML() {
syn MappingElement MReceiveDefinition.toYAML() {
MappingElement result = super.toYAML();
MappingElement result = super.toYAML();
result.
addKeyValuePair
("loggingEnabledForReads",
ValueElement.of(
loggingEnabledForReads)
)
;
result.
put
("loggingEnabledForReads", loggingEnabledForReads);
return result;
return result;
}
}
syn MappingElement MSendDefinition.toYAML() {
syn MappingElement MSendDefinition.toYAML() {
MappingElement result = super.toYAML();
MappingElement result = super.toYAML();
result.
addKeyValuePair("sender", StringElement.of(
sender())
)
;
result.
put("sender",
sender());
result.
addKeyValuePair("lastValue", StringElement.of(
lastValue())
)
;
result.
put("lastValue",
lastValue());
result.
addKeyValuePair
("loggingEnabledForWrites",
ValueElement.of(
loggingEnabledForWrites)
)
;
result.
put
("loggingEnabledForWrites", loggingEnabledForWrites);
result.
addKeyValuePair
("updateMethod",
StringElement.of(
updateMethod())
)
;
result.
put
("updateMethod", updateMethod());
result.
addKeyValuePair
("writeMethod",
StringElement.of(
writeMethod())
)
;
result.
put
("writeMethod", writeMethod());
result.
addKeyValuePair
("tokenResetMethod",
StringElement.of(
tokenResetMethod())
)
;
result.
put
("tokenResetMethod", tokenResetMethod());
return result;
return result;
}
}
syn Element MMappingDefinition.toYAML() {
syn Element MMappingDefinition.toYAML() {
MappingElement result = new MappingElement();
MappingElement result = new MappingElement();
result.
addKeyValuePair("toType", StringElement.of(
toType())
)
;
result.
put("toType",
toType());
result.
addKeyValuePair("methodName", StringElement.of(
methodName())
)
;
result.
put("methodName",
methodName());
result.
addKeyValuePair("fromType", StringElement.of(
fromType())
)
;
result.
put("fromType",
fromType());
result.
addKeyValuePair
("fromVariableName",
StringElement.of(
fromVariableName())
)
;
result.
put
("fromVariableName", fromVariableName());
result.
addKeyValuePair("content", StringElement.of(
result.
put("content",
content().replace("\"", "\\\"").replace("\n", "\\n"))
)
;
content().replace("\"", "\\\"").replace("\n", "\\n"));
return result;
return result;
}
}
syn Element MDependencyDefinition.toYAML() {
syn Element MDependencyDefinition.toYAML() {
MappingElement result = new MappingElement();
MappingElement result = new MappingElement();
result.
addKeyValuePair
("targetParentTypeName",
StringElement.of(
targetParentTypeName())
)
;
result.
put
("targetParentTypeName", targetParentTypeName());
result.
addKeyValuePair
("dependencyMethod",
StringElement.of(
dependencyMethod())
)
;
result.
put
("dependencyMethod", dependencyMethod());
result.
addKeyValuePair
("sourceParentTypeName",
StringElement.of(
sourceParentTypeName())
)
;
result.
put
("sourceParentTypeName", sourceParentTypeName());
result.
addKeyValuePair
("internalRelationPrefix",
StringElement.of(
internalRelationPrefix())
)
;
result.
put
("internalRelationPrefix", internalRelationPrefix());
return result;
return result;
}
}
syn Element MTokenComponent.toYAML() {
syn Element MTokenComponent.toYAML() {
MappingElement result = new MappingElement();
MappingElement result = new MappingElement();
result.
addKeyValuePair
("parentTypeName",
StringElement.of(
parentTypeName())
)
;
result.
put
("parentTypeName", parentTypeName());
result.
addKeyValuePair("name", StringElement.of(
name())
)
;
result.
put("name",
name());
result.
addKeyValuePair("javaType", StringElement.of(
javaType())
)
;
result.
put("javaType",
javaType());
result.
addKeyValuePair
("internalName",
StringElement.of(
internalName())
)
;
result.
put
("internalName", internalName());
ListElement dependencyDefinitions = new ListElement();
ListElement dependencyDefinitions = new ListElement();
for (MDependencyDefinition def : getDependencyDefinitionList()) {
for (MDependencyDefinition def : getDependencyDefinitionList()) {
MappingElement inner = new MappingElement();
MappingElement inner = new MappingElement();
inner.
addKeyValuePair
("targetParentTypeName",
StringElement.of(
def.targetParentTypeName())
)
;
inner.
put
("targetParentTypeName", def.targetParentTypeName());
inner.
addKeyValuePair
("internalRelationPrefix",
StringElement.of(
def.internalRelationPrefix())
)
;
inner.
put
("internalRelationPrefix", def.internalRelationPrefix());
MappingElement targetEndpointDefinition = new MappingElement();
MappingElement targetEndpointDefinition = new MappingElement();
targetEndpointDefinition.
addKeyValuePair
("updateMethod",
StringElement.of(
def.targetEndpointDefinition().updateMethod())
)
;
targetEndpointDefinition.
put
("updateMethod", def.targetEndpointDefinition().updateMethod());
targetEndpointDefinition.
addKeyValuePair
("writeMethod",
StringElement.of(
def.targetEndpointDefinition().writeMethod())
)
;
targetEndpointDefinition.
put
("writeMethod", def.targetEndpointDefinition().writeMethod());
inner.
addKeyValuePair
("targetEndpointDefinition", targetEndpointDefinition);
inner.
put
("targetEndpointDefinition", targetEndpointDefinition);
dependencyDefinitions.addElement(inner);
dependencyDefinitions.addElement(inner);
}
}
result.
addKeyValuePair
("DependencyDefinitions", dependencyDefinitions);
result.
put
("DependencyDefinitions", dependencyDefinitions);
return result;
return result;
}
}
...
@@ -142,15 +150,25 @@ aspect MustacheNodesToYAML {
...
@@ -142,15 +150,25 @@ aspect MustacheNodesToYAML {
ListElement innerMappingDefinitions = new ListElement();
ListElement innerMappingDefinitions = new ListElement();
for (MInnerMappingDefinition def : getInnerMappingDefinitionList()) {
for (MInnerMappingDefinition def : getInnerMappingDefinitionList()) {
MappingElement inner = new MappingElement();
MappingElement inner = new MappingElement();
inner.
addKeyValuePair("toType", StringElement.of(
def.toType())
)
;
inner.
put("toType",
def.toType());
inner.
addKeyValuePair("methodName", StringElement.of(
def.methodName())
)
;
inner.
put("methodName",
def.methodName());
inner.
addKeyValuePair
("inputVarName",
StringElement.of(
def.inputVarName())
)
;
inner.
put
("inputVarName", def.inputVarName());
inner.
addKeyValuePair
("outputVarName",
StringElement.of(
def.outputVarName())
)
;
inner.
put
("outputVarName", def.outputVarName());
inner.
addKeyValuePair("last", ValueElement.of(
def.isLast())
)
;
inner.
put("last",
def.isLast());
innerMappingDefinitions.addElement(inner);
innerMappingDefinitions.addElement(inner);
}
}
return innerMappingDefinitions;
return innerMappingDefinitions;
}
}
syn MappingElement MHandler.toYAML() {
MappingElement result = new MappingElement();
result.put("ClassName", getClassName());
result.put("Construction", getConstruction());
result.put("AttributeName", getAttributeName());
result.put("FieldName", getFieldName());
result.put("InUse", getInUse());
return result;
}
}
}
aspect Navigation {
aspect Navigation {
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment