Remove dead code
[clamp.git] / src / main / java / org / onap / clamp / clds / client / CldsEventDelegate.java
index ce2169f..8ae10b2 100644 (file)
@@ -18,7 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END============================================
  * ===================================================================
- * 
+ *
  */
 
 package org.onap.clamp.clds.client;
@@ -27,12 +27,8 @@ import com.att.eelf.configuration.EELFLogger;
 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,20 +42,23 @@ public class CldsEventDelegate {
     protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
     @Autowired
     private CldsDao cldsDao;
-    @Autowired
-    private ClampProperties refProp;
 
     /**
      * Insert event using process variables.
      *
      * @param camelExchange
-     *            The Camel Exchange object containing the properties
+     *        The Camel Exchange object containing the properties
+     * @param actionState
+     *        The action state that is used instead of the one in exchange property
      */
-    @Handler
-    public void execute(Exchange camelExchange) {
+
+    public void addEvent(Exchange camelExchange, String actionState) {
         String controlName = (String) camelExchange.getProperty("controlName");
         String actionCd = (String) camelExchange.getProperty("actionCd");
-        String actionStateCd = (String) camelExchange.getProperty("actionStateCd");
+        String actionStateCd = (actionState != null) ? actionState : CldsEvent.ACTION_STATE_COMPLETED;
+        actionStateCd = ((String) camelExchange.getProperty("actionStateCd")) != null
+            ? ((String) camelExchange.getProperty("actionStateCd"))
+            : actionStateCd;
         // Flag indicate whether it is triggered by Validation Test button from
         // UI
         boolean isTest = (boolean) camelExchange.getProperty("isTest");
@@ -70,15 +69,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"));
     }
 }