public void replaceChildCondition(BaseCondition oldChild, BaseCondition newChild) { if (leftCondition == oldChild) { leftCondition = newChild; } else if (rightCondition == oldChild) { rightCondition = newChild; } else { throw log.conditionNotFoundInParent(); } newChild.setParent(this); }
public void replaceChildCondition(BaseCondition oldChild, BaseCondition newChild) { if (leftCondition == oldChild) { leftCondition = newChild; } else if (rightCondition == oldChild) { rightCondition = newChild; } else { throw log.conditionNotFoundInParent(); } newChild.setParent(this); }
private void combine(boolean isConjunction, FilterConditionContext fcc) { if (fcc == null) { throw log.argumentCannotBeNull(); } BaseCondition rightCondition = ((BaseCondition) fcc).getRoot(); if (rightCondition.queryFactory != queryFactory) { throw log.conditionWasCreatedByAnotherFactory(); } if (rightCondition.queryBuilder != null) { throw log.conditionIsAlreadyInUseByAnotherBuilder(); } if (isConjunction && parent instanceof OrCondition) { BooleanCondition p = new AndCondition(queryFactory, this, rightCondition); ((BooleanCondition) parent).replaceChildCondition(this, p); parent = p; rightCondition.setParent(p); } else { BaseCondition root = getRoot(); BooleanCondition p = isConjunction ? new AndCondition(queryFactory, root, rightCondition) : new OrCondition(queryFactory, root, rightCondition); root.setParent(p); rightCondition.setParent(p); } rightCondition.setQueryBuilder(queryBuilder); }
private void combine(boolean isConjunction, FilterConditionContext fcc) { if (fcc == null) { throw log.argumentCannotBeNull(); } BaseCondition rightCondition = ((BaseCondition) fcc).getRoot(); if (rightCondition.queryFactory != queryFactory) { throw log.conditionWasCreatedByAnotherFactory(); } if (rightCondition.queryBuilder != null) { throw log.conditionIsAlreadyInUseByAnotherBuilder(); } if (isConjunction && parent instanceof OrCondition) { BooleanCondition p = new AndCondition(queryFactory, this, rightCondition); ((BooleanCondition) parent).replaceChildCondition(this, p); parent = p; rightCondition.setParent(p); } else { BaseCondition root = getRoot(); BooleanCondition p = isConjunction ? new AndCondition(queryFactory, root, rightCondition) : new OrCondition(queryFactory, root, rightCondition); root.setParent(p); rightCondition.setParent(p); } rightCondition.setQueryBuilder(queryBuilder); }
@Override public FilterConditionContext not(FilterConditionContext fcc) { if (fcc == null) { throw log.argumentCannotBeNull(); } BaseCondition baseCondition = ((BaseCondition) fcc).getRoot(); if (baseCondition.queryFactory != this) { throw log.conditionWasCreatedByAnotherFactory(); } if (baseCondition.queryBuilder != null) { throw log.conditionIsAlreadyInUseByAnotherBuilder(); } NotCondition notCondition = new NotCondition(this, baseCondition); baseCondition.setParent(notCondition); return notCondition; } }
@Override public FilterConditionContext not(FilterConditionContext fcc) { if (fcc == null) { throw log.argumentCannotBeNull(); } BaseCondition baseCondition = ((BaseCondition) fcc).getRoot(); if (baseCondition.queryFactory != this) { throw log.conditionWasCreatedByAnotherFactory(); } if (baseCondition.queryBuilder != null) { throw log.conditionIsAlreadyInUseByAnotherBuilder(); } NotCondition notCondition = new NotCondition(this, baseCondition); baseCondition.setParent(notCondition); return notCondition; } }
@Override public BaseCondition not(FilterConditionContext fcc) { if (fcc == null) { throw log.argumentCannotBeNull(); } if (filterCondition != null) { throw log.cannotUseOperatorAgain("not(..)"); } BaseCondition baseCondition = ((BaseCondition) fcc).getRoot(); if (baseCondition.queryFactory != queryFactory) { throw log.conditionWasCreatedByAnotherFactory(); } if (baseCondition.queryBuilder != null) { throw log.conditionIsAlreadyInUseByAnotherBuilder(); } NotCondition notCondition = new NotCondition(queryFactory, baseCondition); notCondition.setQueryBuilder(this); baseCondition.setParent(notCondition); setFilterCondition(notCondition); return filterCondition; }