if (oldCondition == null
|| !getConditionString(oldCondition).contains(toBeReplaced)) {
return oldCondition;
}
if (oldCondition.getConditionType() == Condition.SAC_AND_CONDITION) {
ConditionFactory conditionFactory = new ConditionFactoryImpl();
CombinatorCondition oldCombinatorCondition = (CombinatorCondition) oldCondition;
Condition newFirstCondition = createConditionWithSomePartReplaced(
oldCombinatorCondition.getFirstCondition(), toBeReplaced,
candidate);
Condition newSecondCondition = createConditionWithSomePartReplaced(
oldCombinatorCondition.getSecondCondition(), toBeReplaced,
candidate);
return conditionFactory.createAndCondition(newFirstCondition,
newSecondCondition);
} else {
return candidate;
}
}