Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public interface BlazeAbstractQuery<T> extends AbstractQuery<T>, BlazeCommonAbst
// TODO: integrate support for default join nodes?
// TODO: maybe add explicit support for limit?

public <X> BlazeFullSelectCTECriteria<X> with(Class<X> clasz);

public <X> BlazeSelectRecursiveCTECriteria<X> withRecursive(Class<X> clasz);

/**
* Like {@link AbstractQuery#from(Class)} but allows to set the alias of the {@link BlazeRoot}.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Copyright 2014 - 2019 Blazebit.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.blazebit.persistence.criteria;

import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Order;
import javax.persistence.criteria.ParameterExpression;
import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.persistence.metamodel.Bindable;
import javax.persistence.metamodel.SingularAttribute;
import java.util.List;
import java.util.Set;

/**
*
* @param <T>
* @author Jan-Willem Gmelig Meyling
* @since 1.4.0
*/
public interface BlazeBaseCTECriteria<T> extends BlazeAbstractQuery<T> {


/**
* Like {@link BlazeBaseCTECriteria#getRoots()} but returns the subtype {@link BlazeRoot} instead.
*
* @return the set of query roots
*/
Set<BlazeRoot<?>> getBlazeRoots();

/**
* Like {@link CriteriaQuery#getOrderList()} but returns the subtype {@link BlazeOrder} instead.
*
* @return The list of ordering expressions
*/
List<BlazeOrder> getBlazeOrderList();


Set<Root<?>> getRoots();

@Override
BlazeBaseCTECriteria<T> where(Expression<Boolean> restriction);

@Override
BlazeBaseCTECriteria<T> where(Predicate... restrictions);

@Override
BlazeBaseCTECriteria<T> groupBy(Expression<?>... grouping);

@Override
BlazeBaseCTECriteria<T> groupBy(List<Expression<?>> grouping);

@Override
BlazeBaseCTECriteria<T> having(Expression<Boolean> restriction);

@Override
BlazeBaseCTECriteria<T> having(Predicate... restrictions);

BlazeBaseCTECriteria<T> orderBy(Order... o);

BlazeBaseCTECriteria<T> orderBy(List<Order> o);

@Override
BlazeBaseCTECriteria<T> distinct(boolean distinct);

Set<ParameterExpression<?>> getParameters();

// Path-like, except for expression stuff and plural attributes are irrelevant

Bindable<T> getModel();

<Y> Path<Y> get(SingularAttribute<? super T, Y> attribute);

<Y> Path<Y> get(String attributeName);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2014 - 2019 Blazebit.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.blazebit.persistence.criteria;

/**
*
* @param <T>
* @author Jan-Willem Gmelig Meyling
* @since 1.4.0
*/
public interface BlazeFullSelectCTECriteria<T> extends BlazeSelectBaseCTECriteria<T> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Copyright 2014 - 2019 Blazebit.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.blazebit.persistence.criteria;

import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Path;
import javax.persistence.metamodel.SingularAttribute;

/**
*
* @param <T>
* @author Jan-Willem Gmelig Meyling
* @since 1.4.0
*/
public interface BlazeSelectBaseCTECriteria<T> extends BlazeBaseCTECriteria<T> {

/**
* Bind the value of the specified attribute.
*
* @param attribute attribute to be updated
* @param value new value
*
* @return the modified query
*/
<Y, X extends Y> BlazeSelectBaseCTECriteria<T> bind(SingularAttribute<? super T, Y> attribute, X value);

/**
* Bind the value of the specified attribute.
*
* @param attribute attribute to be updated
* @param value new value
*
* @return the modified query
*/
<Y> BlazeSelectBaseCTECriteria<T> bind(SingularAttribute<? super T, Y> attribute, Expression<? extends Y> value);

/**
* Bind the value of the specified attribute.
*
* @param attribute attribute to be updated
* @param value new value
*
* @return the modified query
*/
<Y, X extends Y> BlazeSelectBaseCTECriteria<T> bind(Path<Y> attribute, X value);

/**
* Bind the value of the specified attribute.
*
* @param attribute attribute to be updated
* @param value new value
*
* @return the modified query
*/
<Y> BlazeSelectBaseCTECriteria<T> bind(Path<Y> attribute, Expression<? extends Y> value);

/**
* Bind the value of the specified attribute.
*
* @param attributeName name of the attribute to be updated
* @param value new value
*
* @return the modified query
*/
BlazeSelectBaseCTECriteria<T> bind(String attributeName, Object value);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2014 - 2019 Blazebit.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.blazebit.persistence.criteria;

/**
*
* @param <T>
* @author Jan-Willem Gmelig Meyling
* @since 1.4.0
*/
public interface BlazeSelectCTECriteria<T> extends BlazeSelectBaseCTECriteria<T> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2014 - 2019 Blazebit.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.blazebit.persistence.criteria;

/**
*
* @param <T>
* @author Jan-Willem Gmelig Meyling
* @since 1.4.0
*/
public interface BlazeSelectRecursiveCTECriteria<T> extends BlazeSelectBaseCTECriteria<T> {

BlazeSelectCTECriteria<T> union();

BlazeSelectCTECriteria<T> unionAll();

}
Loading