Improve the policy name
[clamp.git] / src / main / java / org / onap / clamp / policy / operational / OperationalPolicy.java
index b5a88b3..18ee84f 100644 (file)
@@ -123,7 +123,9 @@ public class OperationalPolicy extends Policy implements Serializable {
     public OperationalPolicy(Loop loop, Service service, LoopElementModel loopElementModel,
                              ToscaConverterWithDictionarySupport toscaConverter) {
         this(Policy.generatePolicyName("OPERATIONAL", service.getName(), service.getVersion(),
-                RandomStringUtils.randomAlphanumeric(3), RandomStringUtils.randomAlphanumeric(3)), new JsonObject(),
+                loopElementModel.getPolicyModels().first().getPolicyAcronym() + '_'
+                        + loopElementModel.getPolicyModels().first().getVersion(),
+                RandomStringUtils.randomAlphanumeric(3)), new JsonObject(),
                 new JsonObject(), loopElementModel.getPolicyModels().first(), loopElementModel, null, null);
         this.setLoop(loop);
         this.updateJsonRepresentation(toscaConverter, service);
@@ -141,7 +143,9 @@ public class OperationalPolicy extends Policy implements Serializable {
     public OperationalPolicy(Loop loop, Service service, PolicyModel policyModel,
                              ToscaConverterWithDictionarySupport toscaConverter) throws IOException {
         this(Policy.generatePolicyName("OPERATIONAL", service.getName(), service.getVersion(),
-                RandomStringUtils.randomAlphanumeric(3), RandomStringUtils.randomAlphanumeric(3)), new JsonObject(),
+                policyModel.getPolicyAcronym() + '_' + policyModel.getVersion(),
+                RandomStringUtils.randomAlphanumeric(3)),
+                new JsonObject(),
                 new JsonObject(), policyModel, null, null, null);
         this.setLoop(loop);
         this.updateJsonRepresentation(toscaConverter, service);