diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-05-03 17:37:59 +0200 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-05-03 17:37:59 +0200 |
commit | 66da605ef470173526d2dd24c18f2e85ad3b3de0 (patch) | |
tree | 359b6a583e2bfaf075f692079a95f0e73a2e4e48 /src/main/java/org | |
parent | 7c02c5293e9cf99010b6d8237b3fe85e601b7014 (diff) |
Fix policy ID
Fix policy id generated and published to DCAE during deployment
Issue-ID: CLAMP-153
Change-Id: Ie886fbb6fe17668799dd824736fe012862517f08
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/main/java/org')
3 files changed, 16 insertions, 15 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/CldsEventDelegate.java b/src/main/java/org/onap/clamp/clds/client/CldsEventDelegate.java index ce2169fcc..b1243dc22 100644 --- a/src/main/java/org/onap/clamp/clds/client/CldsEventDelegate.java +++ b/src/main/java/org/onap/clamp/clds/client/CldsEventDelegate.java @@ -28,11 +28,8 @@ import com.att.eelf.configuration.EELFManager; import org.apache.camel.Exchange; import org.apache.camel.Handler; -import org.onap.clamp.clds.config.ClampProperties; import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.model.CldsEvent; -import org.onap.clamp.clds.model.CldsModel; -import org.onap.clamp.clds.model.properties.ModelProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -46,8 +43,6 @@ public class CldsEventDelegate { protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); @Autowired private CldsDao cldsDao; - @Autowired - private ClampProperties refProp; /** * Insert event using process variables. @@ -70,15 +65,5 @@ public class CldsEventDelegate { // won't really have userid here... CldsEvent.insEvent(cldsDao, controlName, userid, actionCd, actionStateCd, camelExchange.getExchangeId()); } - generateAutoPolicyId(camelExchange); - } - - private void generateAutoPolicyId(Exchange camelExchange) { - ModelProperties prop = ModelProperties.create(camelExchange); - ; - CldsModel cldsModel = CldsModel.retrieve(cldsDao, (String) camelExchange.getProperty("modelName"), false); - cldsModel.setPropText(cldsModel.getPropText().replaceAll("AUTO_GENERATED_POLICY_ID_AT_SUBMIT", - prop.getPolicyNameForDcaeDeploy(refProp))); - cldsModel.save(cldsDao, (String) camelExchange.getProperty("userid")); } } diff --git a/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDelegate.java b/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDelegate.java index f6e7b640d..e178ec714 100644 --- a/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDelegate.java +++ b/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDelegate.java @@ -32,6 +32,8 @@ import org.apache.camel.Exchange; import org.apache.camel.Handler; import org.onap.clamp.clds.client.req.policy.PolicyClient; import org.onap.clamp.clds.config.ClampProperties; +import org.onap.clamp.clds.dao.CldsDao; +import org.onap.clamp.clds.model.CldsModel; import org.onap.clamp.clds.model.properties.Holmes; import org.onap.clamp.clds.model.properties.ModelProperties; import org.springframework.beans.factory.annotation.Autowired; @@ -49,6 +51,8 @@ public class HolmesPolicyDelegate { private PolicyClient policyClient; @Autowired private ClampProperties refProp; + @Autowired + private CldsDao cldsDao; /** * Perform activity. Send Holmes info to policy api. @@ -68,6 +72,10 @@ public class HolmesPolicyDelegate { if (responseMessage != null) { camelExchange.setProperty("holmesPolicyResponseMessage", responseMessage.getBytes()); } + CldsModel cldsModel = CldsModel.retrieve(cldsDao, (String) camelExchange.getProperty("modelName"), false); + cldsModel.setPropText(cldsModel.getPropText().replaceAll("AUTO_GENERATED_POLICY_ID_AT_SUBMIT", + prop.getPolicyNameForDcaeDeploy(refProp))); + cldsModel.save(cldsDao, (String) camelExchange.getProperty("userid")); } } diff --git a/src/main/java/org/onap/clamp/clds/client/TcaPolicyDelegate.java b/src/main/java/org/onap/clamp/clds/client/TcaPolicyDelegate.java index 5e6bee8bd..cb31b5f66 100644 --- a/src/main/java/org/onap/clamp/clds/client/TcaPolicyDelegate.java +++ b/src/main/java/org/onap/clamp/clds/client/TcaPolicyDelegate.java @@ -33,6 +33,8 @@ import org.apache.camel.Handler; import org.onap.clamp.clds.client.req.policy.PolicyClient; import org.onap.clamp.clds.client.req.tca.TcaRequestFormatter; import org.onap.clamp.clds.config.ClampProperties; +import org.onap.clamp.clds.dao.CldsDao; +import org.onap.clamp.clds.model.CldsModel; import org.onap.clamp.clds.model.properties.ModelProperties; import org.onap.clamp.clds.model.properties.Tca; import org.springframework.beans.factory.annotation.Autowired; @@ -50,6 +52,8 @@ public class TcaPolicyDelegate { private ClampProperties refProp; @Autowired private PolicyClient policyClient; + @Autowired + private CldsDao cldsDao; /** * Perform activity. Send Tca info to policy api. @@ -69,6 +73,10 @@ public class TcaPolicyDelegate { if (responseMessage != null) { camelExchange.setProperty("tcaPolicyResponseMessage", responseMessage.getBytes()); } + CldsModel cldsModel = CldsModel.retrieve(cldsDao, (String) camelExchange.getProperty("modelName"), false); + cldsModel.setPropText(cldsModel.getPropText().replaceAll("AUTO_GENERATED_POLICY_ID_AT_SUBMIT", + prop.getPolicyNameForDcaeDeploy(refProp))); + cldsModel.save(cldsDao, (String) camelExchange.getProperty("userid")); } } } |