Skip to content

Commit

Permalink
fix(job): update of job schedule with already existing name now is no…
Browse files Browse the repository at this point in the history
…t permitted
  • Loading branch information
MDeLuise committed Mar 25, 2024
1 parent 3d09cb1 commit f9c6cd0
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@
*******************************************************************************/
package org.eclipse.kapua.service.scheduler.trigger.quartz;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.inject.Singleton;
import javax.validation.constraints.NotNull;

import org.eclipse.kapua.KapuaDuplicateNameException;
import org.eclipse.kapua.KapuaEntityNotFoundException;
import org.eclipse.kapua.KapuaException;
Expand Down Expand Up @@ -41,16 +51,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Singleton;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
* {@link TriggerService} implementation.
*
Expand Down Expand Up @@ -219,7 +219,7 @@ public Trigger update(Trigger trigger) throws KapuaException {
}

// Check duplicate name
if (triggerRepository.countEntitiesWithNameInScope(tx, adapted.getId(), adapted.getName()) > 0) {
if (triggerRepository.countOtherEntitiesWithNameInScope(tx, adapted.getScopeId(), adapted.getId(), adapted.getName()) > 0) {
throw new KapuaDuplicateNameException(adapted.getName());
}
// Check dates
Expand Down

0 comments on commit f9c6cd0

Please sign in to comment.