aboutsummaryrefslogtreecommitdiffstats
path: root/tools/model-generator/src
diff options
context:
space:
mode:
Diffstat (limited to 'tools/model-generator/src')
-rw-r--r--tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java73
1 files changed, 38 insertions, 35 deletions
diff --git a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java
index b5f6f432a..bd5b83518 100644
--- a/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java
+++ b/tools/model-generator/src/main/java/org/onap/policy/apex/tools/model/generator/model2cli/Model2Cli.java
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,12 +33,12 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import org.apache.commons.lang3.Validate;
-import org.onap.policy.apex.auth.clicodegen.CodeGenCliEditorBuilder;
+import org.onap.policy.apex.auth.clicodegen.CodeGenCliEditor;
import org.onap.policy.apex.auth.clicodegen.CodeGeneratorCliEditor;
-import org.onap.policy.apex.auth.clicodegen.EventDeclarationBuilder;
-import org.onap.policy.apex.auth.clicodegen.PolicyStateDefBuilder;
-import org.onap.policy.apex.auth.clicodegen.PolicyStateTaskBuilder;
-import org.onap.policy.apex.auth.clicodegen.TaskDeclarationBuilder;
+import org.onap.policy.apex.auth.clicodegen.EventDeclaration;
+import org.onap.policy.apex.auth.clicodegen.PolicyStateDef;
+import org.onap.policy.apex.auth.clicodegen.PolicyStateTask;
+import org.onap.policy.apex.auth.clicodegen.TaskDeclaration;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
@@ -170,9 +171,9 @@ public class Model2Cli {
final List<ST> parameters = getParametersForTask(codeGen, t);
final List<ST> contextRefs = getCtxtRefsForTask(codeGen, t);
- codeGen.addTaskDeclaration(new TaskDeclarationBuilder().setName(kig.getName(key))
- .setVersion(kig.getVersion(key)).setUuid(kig.getUuid(key)).setDescription(kig.getDesc(key))
- .setLogic(logic).setParameters(parameters).setContextRefs(contextRefs));
+ codeGen.addTaskDeclaration(TaskDeclaration.builder().name(kig.getName(key))
+ .version(kig.getVersion(key)).uuid(kig.getUuid(key)).description(kig.getDesc(key))
+ .logic(logic).parameters(parameters).contextRefs(contextRefs).build());
}
// 3: events
@@ -181,25 +182,26 @@ public class Model2Cli {
final List<ST> fields = getParametersForEvent(codeGen, e);
codeGen.addEventDeclaration(
- new EventDeclarationBuilder()
- .setName(kig.getName(key))
- .setVersion(kig.getVersion(key))
- .setUuid(kig.getUuid(key))
- .setDescription(kig.getDesc(key))
- .setNameSpace(e.getNameSpace())
- .setSource(e.getSource())
- .setTarget(e.getTarget())
- .setFields(fields));
+ EventDeclaration.builder()
+ .name(kig.getName(key))
+ .version(kig.getVersion(key))
+ .uuid(kig.getUuid(key))
+ .description(kig.getDesc(key))
+ .nameSpace(e.getNameSpace())
+ .source(e.getSource())
+ .target(e.getTarget())
+ .fields(fields)
+ .build());
}
// 4: context albums
for (final AxContextAlbum a : policyModel.getAlbums().getAlbumsMap().values()) {
final AxArtifactKey key = a.getKey();
- codeGen.addContextAlbumDeclaration(new CodeGenCliEditorBuilder().setName(kig.getName(key))
- .setVersion(kig.getVersion(key)).setUuid(kig.getUuid(key)).setDescription(kig.getDesc(key))
- .setScope(a.getScope()).setWritable(a.isWritable()).setSchemaName(kig.getName(a.getItemSchema()))
- .setSchemaVersion(kig.getVersion(a.getItemSchema())));
+ codeGen.addContextAlbumDeclaration(CodeGenCliEditor.builder().name(kig.getName(key))
+ .version(kig.getVersion(key)).uuid(kig.getUuid(key)).description(kig.getDesc(key))
+ .scope(a.getScope()).writable(a.isWritable()).schemaName(kig.getName(a.getItemSchema()))
+ .schemaVersion(kig.getVersion(a.getItemSchema())).build());
}
// 5: policies
@@ -327,14 +329,14 @@ public class Model2Cli {
final List<ST> tsLogic = getTslForState(cg, st);
final List<ST> ctxRefs = getCtxtRefsForState(cg, st);
- final ST val = cg.createPolicyStateDef(new PolicyStateDefBuilder()
- .setPolicyName(kig.getPName(skey)).setVersion(kig.getPVersion(skey))
- .setStateName(kig.getLName(skey)).setTriggerName(kig.getName(st.getTrigger()))
- .setTriggerVersion(kig.getVersion(st.getTrigger()))
- .setDefaultTask(kig.getName(st.getDefaultTask()))
- .setDefaultTaskVersion(kig.getVersion(st.getDefaultTask())).setOutputs(outputs)
- .setTasks(tasks).setTsLogic(tsLogic).setFinalizerLogics(finalizerLogics)
- .setCtxRefs(ctxRefs));
+ final ST val = cg.createPolicyStateDef(PolicyStateDef.builder()
+ .policyName(kig.getPName(skey)).version(kig.getPVersion(skey))
+ .stateName(kig.getLName(skey)).triggerName(kig.getName(st.getTrigger()))
+ .triggerVersion(kig.getVersion(st.getTrigger()))
+ .defaultTask(kig.getName(st.getDefaultTask()))
+ .defaultTaskVersion(kig.getVersion(st.getDefaultTask())).outputs(outputs)
+ .tasks(tasks).tsLogic(tsLogic).finalizerLogics(finalizerLogics)
+ .ctxRefs(ctxRefs).build());
ret.add(val);
}
@@ -419,12 +421,13 @@ public class Model2Cli {
final AxStateTaskReference tr = e.getValue();
final AxReferenceKey trkey = tr.getKey();
- final ST val = cg.createPolicyStateTask(new PolicyStateTaskBuilder()
- .setPolicyName(kig.getPName(skey)).setVersion(kig.getPVersion(skey))
- .setStateName(kig.getLName(skey)).setTaskLocalName(kig.getLName(trkey))
- .setTaskName(kig.getName(tkey)).setTaskVersion(kig.getVersion(tkey))
- .setOutputType(tr.getStateTaskOutputType().name())
- .setOutputName(kig.getLName(tr.getOutput())));
+ final ST val = cg.createPolicyStateTask(PolicyStateTask.builder()
+ .policyName(kig.getPName(skey)).version(kig.getPVersion(skey))
+ .stateName(kig.getLName(skey)).taskLocalName(kig.getLName(trkey))
+ .taskName(kig.getName(tkey)).taskVersion(kig.getVersion(tkey))
+ .outputType(tr.getStateTaskOutputType().name())
+ .outputName(kig.getLName(tr.getOutput()))
+ .build());
ret.add(val);
}