<commit_before>/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.camunda.bpm.engine.impl.jobexecutor;

import java.util.HashMap;
import java.util.Map;

import org.camunda.bpm.engine.ProcessEngineException;
import org.camunda.bpm.engine.impl.interceptor.CommandContext;
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity;
import org.camunda.bpm.engine.impl.pvm.runtime.AtomicOperation;

/**
 * 
 * @author <NAME>
 * @author <NAME>
 */
public class AsyncContinuationJobHandler implements JobHandler {
  
  public final static String TYPE = "async-continuation";
  
  private Map<String, AtomicOperation> supportedOperations;

  public AsyncContinuationJobHandler() {
    supportedOperations = new HashMap<String, AtomicOperation>();
    supportedOperations.put(AtomicOperation.TRANSITION_CREATE_SCOPE.getCanonicalName(), AtomicOperation.TRANSITION_CREATE_SCOPE);
    supportedOperations.put(AtomicOperation.PROCESS_START.getCanonicalName(), AtomicOperation.PROCESS_START);
  }
  
  public String getType() {
    return TYPE;
  }

  public void execute(String configuration, ExecutionEntity execution, CommandContext commandContext) {
    AtomicOperation atomicOperation = findMatchingAtomicOperation(configuration);
    if (atomicOperation == null) {
      throw new ProcessEngineException("Cannot process job with configuration " + configuration);
    }
    
    commandContext
      .performOperation(atomicOperation, execution);
  }
  
  protected AtomicOperation findMatchingAtomicOperation(String configuration) {
    if (configuration == null) {
      // default operation for backwards compatibility
      return AtomicOperation.TRANSITION_CREATE_SCOPE;
    } else {
      return supportedOperations.get(configuration);
    }
  }
}
<commit_msg>[TIFSPP-1323] allow atomic operation TRANSITION_NOTIFY_LISTENER_START in AsyncContinuationJobHandler<commit_after>/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.camunda.bpm.engine.impl.jobexecutor;

import java.util.HashMap;
import java.util.Map;

import org.camunda.bpm.engine.ProcessEngineException;
import org.camunda.bpm.engine.impl.interceptor.CommandContext;
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity;
import org.camunda.bpm.engine.impl.pvm.runtime.AtomicOperation;

/**
 * 
 * @author <NAME>
 * @author <NAME>
 */
public class AsyncContinuationJobHandler implements JobHandler {
  
  public final static String TYPE = "async-continuation";
  
  private Map<String, AtomicOperation> supportedOperations;

  public AsyncContinuationJobHandler() {
    supportedOperations = new HashMap<String, AtomicOperation>();
    supportedOperations.put(AtomicOperation.TRANSITION_CREATE_SCOPE.getCanonicalName(), AtomicOperation.TRANSITION_CREATE_SCOPE);
    supportedOperations.put(AtomicOperation.PROCESS_START.getCanonicalName(), AtomicOperation.PROCESS_START);
    supportedOperations.put(AtomicOperation.TRANSITION_NOTIFY_LISTENER_START.getCanonicalName(), AtomicOperation.TRANSITION_NOTIFY_LISTENER_START);
  }
  
  public String getType() {
    return TYPE;
  }

  public void execute(String configuration, ExecutionEntity execution, CommandContext commandContext) {
    AtomicOperation atomicOperation = findMatchingAtomicOperation(configuration);
    if (atomicOperation == null) {
      throw new ProcessEngineException("Cannot process job with configuration " + configuration);
    }
    
    commandContext
      .performOperation(atomicOperation, execution);
  }
  
  protected AtomicOperation findMatchingAtomicOperation(String configuration) {
    if (configuration == null) {
      // default operation for backwards compatibility
      return AtomicOperation.TRANSITION_CREATE_SCOPE;
    } else {
      return supportedOperations.get(configuration);
    }
  }
}

{'fraction_non_alphanumeric': 0.08120456905503634, 'fraction_numerical': 0.0024922118380062306, 'mean_word_length': 4.760765550239235, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7155509', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1262, 'n_words': 346}