Package org.conventionsframework.exception

Examples of org.conventionsframework.exception.BusinessException


    public static void isTrue(boolean expression, String message) {
        if (!expression) {
            if (!hasText(message)) {
                message = "assert.isTrue";
            }
            throw new BusinessException(getMessage(message));
        }
    }
View Full Code Here


    public static void notTrue(boolean expression, String message) {
        if (expression) {
            if (!hasText(message)) {
                message = "assert.notTrue";
            }
            throw new BusinessException(getMessage(message));
        }
    }
View Full Code Here

    public static <T extends Object> void equals(T obj1, T obj2, String message) {
        if (!obj1.equals(obj2)) {
            if (!hasText(message)) {
                message = "assert.equals";
            }
            throw new BusinessException(getMessage(message));
        }
    }
View Full Code Here

    public static <T extends Object> void notEquals(T obj1, T obj2, String message) {
        if (obj1.equals(obj2)) {
            if (!hasText(message)) {
                message = "assert.notEquals";
            }
            throw new BusinessException(getMessage(message));
        }
    }
View Full Code Here

    public static void isNull(Object object, String message) {
        if (!isNull(object)) {
            if (message == null) {
                message = "assert.isNull";
            }
            throw new BusinessException(getMessage(message));
        }
    }
View Full Code Here

    public static void notNull(Object object, String message) {
        if (isNull(object)) {
            if (!hasText(message)) {
                message = "assert.notNull";
            }
            throw new BusinessException(getMessage(message));
        }
    }
View Full Code Here

    public static void hasLength(String text, String message) {
        if (!hasLength(text)) {
            if (!hasText(message)) {
                message = "assert.hasLength";
            }
            throw new BusinessException(getMessage(message));
        }
    }
View Full Code Here

    public static void hasText(String text, String message) {
        if (!hasText(text)) {
            if (!hasText(message)) {
                message = "assert.hasText";
            }
            throw new BusinessException(getMessage(message));
        }
    }
View Full Code Here

    public Object checkPermission(InvocationContext ic) throws Exception {
            String[] rolesAllowed = this.extractMethodRoles(ic.getMethod());
            if (rolesAllowed != null && rolesAllowed.length > 0) {
                if (!this.checkUserPermissions(rolesAllowed)) {
                    String cause = getFatalMessage(ic.getMethod().getAnnotation(SecurityMethod.class).message());
                    BusinessException be = new BusinessException(cause);
                    be.setSeverity(FacesMessage.SEVERITY_FATAL);
                    be.setSummary(cause);
                    throw be;
                }
            }
            return ic.proceed();
    }
View Full Code Here

    public static void contains(String textToSearch, String substring, String message) {
        if (!contains(textToSearch, substring)) {
            if (!hasText(message)) {
                message = "assert.contains";
            }
            throw new BusinessException(getMessage(message));
        }
    }
View Full Code Here

TOP

Related Classes of org.conventionsframework.exception.BusinessException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.