10/31: merge casablanca to master
[so.git] / bpmn / so-bpmn-infrastructure-common / src / main / java / org / onap / so / bpmn / infrastructure / pnf / delegate / CheckAaiForCorrelationIdDelegate.java
index b49c421..8e57121 100644 (file)
@@ -24,13 +24,11 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
 
 import java.io.IOException;
+
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.delegate.JavaDelegate;
 import org.onap.so.bpmn.common.scripts.ExceptionUtil;
 import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiResponse;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.CheckAaiForCorrelationIdImplementation;
-import org.onap.so.logger.MsoLogger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -41,14 +39,11 @@ import org.springframework.stereotype.Component;
  * - correlationId - String
  *
  * Outputs:
- * - AAI_CONTAINS_INFO_ABOUT_PNF - local Boolean
- * - aaiContainsInfoAboutIp - local Boolean
+ * - aaiContainsInfoAboutPnf - local Boolean
  */
 
 @Component
 public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
-       private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, CheckAaiForCorrelationIdDelegate.class);
-    private CheckAaiForCorrelationIdImplementation implementation = new CheckAaiForCorrelationIdImplementation();
     private AaiConnection aaiConnection;
 
     @Autowired
@@ -57,18 +52,15 @@ public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
     }
 
     @Override
-    public void execute(DelegateExecution execution) throws Exception {
+    public void execute(DelegateExecution execution) {
         String correlationId = (String) execution.getVariable(CORRELATION_ID);
         if (correlationId == null) {
             new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set");
         }
-
         try {
-            AaiResponse aaiResponse = implementation.check(correlationId, aaiConnection);
-
-            execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, aaiResponse.getContainsInfoAboutPnf());
+            boolean isEntry = aaiConnection.getEntryFor(correlationId).isPresent();
+            execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, isEntry);
         } catch (IOException e) {
-               LOGGER.error("IOException",e);
             new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage());
         }
     }