Bug #123: Check the cases where the repeated criterion satisfaction was already deleted.
The save() method was removed and replaced with confirm(), which is exactly the same to the code used in Workers screen, and it's working correctly. FEA: ItEr76S04BugFixing
This commit is contained in:
parent
86ca3c69dd
commit
5bb6aeb9d1
3 changed files with 8 additions and 22 deletions
|
|
@ -311,6 +311,8 @@ public class AssignedMachineCriterionsModel extends IntegrationEntityModel
|
|||
CriterionSatisfactionDTO satisfaction) {
|
||||
for (CriterionSatisfactionDTO otherSatisfaction : criterionSatisfactionDTOs) {
|
||||
if ((!otherSatisfaction.equals(satisfaction))
|
||||
&& (!otherSatisfaction.isIsDeleted())
|
||||
&& (!satisfaction.isIsDeleted())
|
||||
&& (sameCriterion(otherSatisfaction, satisfaction))
|
||||
&& (sameInterval(otherSatisfaction, satisfaction))) {
|
||||
return true;
|
||||
|
|
@ -351,25 +353,6 @@ public class AssignedMachineCriterionsModel extends IntegrationEntityModel
|
|||
return satisfaction.overlapsWith(otherInterval);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void save() throws ValidationException {
|
||||
for (CriterionSatisfactionDTO satisfactionDTO : getWithCriterionAssignedDTOs()) {
|
||||
save(satisfactionDTO);
|
||||
}
|
||||
}
|
||||
|
||||
private void save(CriterionSatisfactionDTO satisfactionDTO) {
|
||||
if (satisfactionDTO.isNewObject()) {
|
||||
addNewSatisfaction(satisfactionDTO);
|
||||
} else {
|
||||
if (satisfactionDTO.isIsDeleted()) {
|
||||
removeSatisfaction(satisfactionDTO);
|
||||
} else {
|
||||
updateSatisfaction(satisfactionDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addNewSatisfaction(CriterionSatisfactionDTO satisfactionDTO) {
|
||||
Interval interval = satisfactionDTO.getInterval();
|
||||
CriterionSatisfaction satisfaction = resource.addSatisfaction(
|
||||
|
|
@ -437,6 +420,9 @@ public class AssignedMachineCriterionsModel extends IntegrationEntityModel
|
|||
satisfaction = CriterionSatisfaction.create(criterion,
|
||||
resource, interval);
|
||||
|
||||
// set the autogenerated code
|
||||
currentCriterionSatisfaction = satisfaction;
|
||||
setDefaultCode();
|
||||
} else {
|
||||
satisfaction = satisfactionDTO.getCriterionSatisfaction();
|
||||
if (satisfactionDTO.isIsDeleted()) {
|
||||
|
|
@ -445,6 +431,8 @@ public class AssignedMachineCriterionsModel extends IntegrationEntityModel
|
|||
satisfaction.setStartDate(satisfactionDTO.getStart());
|
||||
if (satisfactionDTO.getEndDate() != null) {
|
||||
satisfaction.finish(satisfactionDTO.getEnd());
|
||||
} else {
|
||||
satisfaction.noFinish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,8 +60,6 @@ public interface IAssignedMachineCriterionsModel extends
|
|||
|
||||
void remove(CriterionSatisfactionDTO criterionSatisfactionDTO);
|
||||
|
||||
void save() throws ValidationException;
|
||||
|
||||
public void setCriterionWithItsType(
|
||||
CriterionSatisfactionDTO criterionSatisfactionDTO,
|
||||
CriterionWithItsType criterionAndType) throws WrongValueException;
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ public class CriterionsMachineController extends GenericForwardComposer {
|
|||
}
|
||||
|
||||
public void save() throws ValidationException{
|
||||
assignedMachineCriterionsModel.save();
|
||||
assignedMachineCriterionsModel.confirm();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue