aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-08-23 17:10:00 -0400
committerJim Hahn <jrh3@att.com>2021-08-24 09:22:38 -0400
commit53fe02c107eae2f45abfee02e5b56a8ab3c09523 (patch)
tree35c9646b7c629485f6241ed1b48b853305e585ac /tools
parentc3d0b33c9facf49e37e9ab58412227ff44c66363 (diff)
More lombok for apex-pdp
Added lombok to auth thru context-management, excluding basic-model and context-model. Issue-ID: POLICY-3391 Change-Id: I1c3a69d52d3bc65a99126ad44126e5a97424c66f Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'tools')
-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);
}