Coverage Report - org.apache.camel.bam.JpaBamProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
JpaBamProcessor
0% 
0% 
0
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.camel.bam;
 18  
 
 19  
 import org.apache.camel.bam.model.*;
 20  
 import org.apache.camel.bam.model.ProcessInstance;
 21  
 import org.apache.camel.Exchange;
 22  
 import org.apache.camel.Expression;
 23  
 import org.apache.commons.logging.Log;
 24  
 import org.apache.commons.logging.LogFactory;
 25  
 import org.springframework.orm.jpa.JpaTemplate;
 26  
 import org.springframework.transaction.support.TransactionTemplate;
 27  
 
 28  
 /**
 29  
  * @version $Revision: $
 30  0
  */
 31  0
 public class JpaBamProcessor extends JpaBamProcessorSupport<ProcessInstance> {
 32  0
     private static final transient Log log = LogFactory.getLog(JpaBamProcessor.class);
 33  
 
 34  0
     public JpaBamProcessor(TransactionTemplate transactionTemplate, JpaTemplate template, Expression<Exchange> correlationKeyExpression, ActivityRules activityRules) {
 35  0
         super(transactionTemplate, template, correlationKeyExpression, activityRules);
 36  0
     }
 37  
 
 38  0
     public JpaBamProcessor(TransactionTemplate transactionTemplate, JpaTemplate template, Expression<Exchange> correlationKeyExpression, ActivityRules activityRules, Class<ProcessInstance> entitytype) {
 39  0
         super(transactionTemplate, template, correlationKeyExpression, activityRules, entitytype);
 40  0
     }
 41  
 
 42  0
     protected void processEntity(Exchange exchange, ProcessInstance process) throws Exception {
 43  0
         log.info("Processing entity! - attempting to get the current state for process: " + process);
 44  0
 
 45  0
         ActivityState state = process.getActivityState(getActivity());
 46  0
         log.info("Found activity: "+ state);
 47  0
 
 48  0
         if (state == null) {
 49  0
             state = createActivityState(exchange, process);
 50  0
             state.setProcess(process);
 51  
 
 52  0
             log.info("Storing activity: "+ state + " with process: " + state.getProcess());
 53  0
             //getTemplate().persist(state);
 54  
         }
 55  0
         ProcessContext context = new ProcessContext(exchange, getActivity(), state);
 56  
 
 57  0
         state.processExchange(getActivity(), context);
 58  0
     }
 59  
 
 60  
     protected ActivityState createActivityState(Exchange exchange, ProcessInstance process) {
 61  0
         return new ActivityState();
 62  
     }
 63  
 }