All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.camunda.bpm.engine.impl.cmd.SetJobsRetriesBatchCmd Maven / Gradle / Ivy

There is a newer version: 7.9.0-alpha4
Show newest version
/* 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.cmd;

import org.camunda.bpm.engine.impl.interceptor.CommandContext;
import org.camunda.bpm.engine.runtime.Job;
import org.camunda.bpm.engine.runtime.JobQuery;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @author Askar Akhmerov
 */
public class SetJobsRetriesBatchCmd extends AbstractSetJobsRetriesBatchCmd {
  protected final List jobIds;
  protected final JobQuery jobQuery;

  public SetJobsRetriesBatchCmd(List jobIds, JobQuery jobQuery, int retries) {
    this.jobQuery = jobQuery;
    this.jobIds = jobIds;
    this.retries = retries;
  }

  protected List collectJobIds(CommandContext commandContext) {
    Set collectedJobIds = new HashSet();

    List jobIds = this.getJobIds();
    if (jobIds != null) {
      collectedJobIds.addAll(jobIds);
    }

    final JobQuery jobQuery = this.jobQuery;
    if (jobQuery != null) {
      for (Job job : jobQuery.list()) {
        collectedJobIds.add(job.getId());
      }
    }

    return new ArrayList(collectedJobIds);
  }

  public List getJobIds() {
    return jobIds;
  }

  public int getRetries() {
    return retries;
  }

  public JobQuery getJobQuery() {
    return jobQuery;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy