added UUID support
This commit is contained in:
@ -23,6 +23,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import javax.ejb.Lock;
|
||||
import javax.ejb.LockType;
|
||||
import javax.ejb.TransactionAttribute;
|
||||
@ -505,9 +506,24 @@ public abstract class CommonAbstractController {
|
||||
break;
|
||||
case NOT_EQUAL:
|
||||
predicate = cb.notEqual(booleanPath, searchValue);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
throw new ControllerException(ControllerException.INTERNAL_ERROR, currentFilter.getComparator() + "not support for searchValue " + searchValue);
|
||||
throw new ControllerException(ControllerException.INTERNAL_ERROR, currentFilter.getComparator() + "not support for searchValue " + searchValue);
|
||||
}
|
||||
returnCondition = addFilterCondition(cb, returnCondition, predicate);
|
||||
} else if (currentFilter.getSearchValue() instanceof UUID) {
|
||||
UUID searchValue = (UUID) currentFilter.getSearchValue();
|
||||
Path<UUID> booleanPath = root.<UUID>get(currentFilter.getFieldName());
|
||||
Predicate predicate;
|
||||
switch (currentFilter.getComparator()) {
|
||||
case EQUAL:
|
||||
predicate = cb.equal(booleanPath, searchValue);
|
||||
break;
|
||||
case NOT_EQUAL:
|
||||
predicate = cb.notEqual(booleanPath, searchValue);
|
||||
break;
|
||||
default:
|
||||
throw new ControllerException(ControllerException.INTERNAL_ERROR, currentFilter.getComparator() + "not support for searchValue " + searchValue);
|
||||
}
|
||||
returnCondition = addFilterCondition(cb, returnCondition, predicate);
|
||||
} else {
|
||||
|
||||
@ -32,16 +32,15 @@ public class ControllerException extends Exception {
|
||||
public static final int CAUSE_CANNOT_PERSIST = 3;
|
||||
public static final int CAUSE_TOO_MANY_ROWS = 4;
|
||||
public static final int CAUSE_CANNOT_DELETE = 5;
|
||||
public static final int INVALID_FILTER = 6;
|
||||
|
||||
private final int causeCode;
|
||||
|
||||
/**
|
||||
* Creates a new instance of <code>ControllerException</code> without detail
|
||||
* message.
|
||||
* Creates a new instance of <code>ControllerException</code> without detail message.
|
||||
*
|
||||
* @param cause the reason code
|
||||
* @param message the detail message. The detail message is saved for later
|
||||
* retrieval by the {@link #getMessage()} method.
|
||||
* @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
|
||||
*/
|
||||
public ControllerException(int cause, String message) {
|
||||
super(message);
|
||||
@ -51,11 +50,9 @@ public class ControllerException extends Exception {
|
||||
/**
|
||||
*
|
||||
* @param causeCode the reason code
|
||||
* @param message the detail message. The detail message is saved for later
|
||||
* retrieval by the {@link #getMessage()} method.
|
||||
* @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
|
||||
*
|
||||
* @param cause the cause (which is saved for later retrieval by the
|
||||
* {@link #getCause()} method). (A {@code null} value is permitted, and
|
||||
* @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and
|
||||
* indicates that the cause is nonexistent or unknown.)
|
||||
*/
|
||||
public ControllerException(int causeCode, String message, Throwable cause) {
|
||||
@ -65,6 +62,7 @@ public class ControllerException extends Exception {
|
||||
|
||||
/**
|
||||
* returns the cause code
|
||||
*
|
||||
* @return the cause code
|
||||
*/
|
||||
public int getCauseCode() {
|
||||
|
||||
Reference in New Issue
Block a user