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

com.breuninger.boot.jobs.service.JobMutexGroups Maven / Gradle / Ivy

There is a newer version: 2.0.5.RELEASE
Show newest version
package com.breuninger.boot.jobs.service;

import static java.util.Collections.emptySet;

import java.util.HashSet;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class JobMutexGroups {

  private Set mutexGroups = emptySet();

  public Set getMutexGroups() {
    return mutexGroups;
  }

  @Autowired(required = false)
  public void setMutexGroups(final Set mutexGroups) {
    this.mutexGroups = mutexGroups;
  }

  public Set mutexJobTypesFor(final String jobType) {
    final Set result = new HashSet<>();
    mutexGroups.stream().map(JobMutexGroup::getJobTypes).filter(g -> g.contains(jobType)).forEach(result::addAll);
    result.remove(jobType);
    return result;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy