Package org.apache.rave.exception

Examples of org.apache.rave.exception.DuplicateItemException


    @Override
    @Transactional
    public Widget registerNewWidget(Widget widget) {
        if (getWidgetByUrl(widget.getUrl()) != null) {
            throw new DuplicateItemException("Trying to add an existing widget for url " + widget.getUrl());
        }
        return widgetRepository.save(widget);
    }
View Full Code Here


                       
            // now translate the H2 specific error codes into Rave's common application Exceptions
            // add more error codes to the switch statement that should be specifically trapped                        
            switch(rootException.getErrorCode()) {
                case ErrorCode.DUPLICATE_KEY_1: {
                    e = new DuplicateItemException("DUPLICATE_ITEM", rootException);
                    break;
                }

                default: {
                    e = new TranslatedH2Exception(rootException.getErrorCode(), "ERROR", "Unknown Database Error");
View Full Code Here

    @Override
    @Transactional
    public Widget registerNewWidget(Widget widget) {
        if (getWidgetByUrl(widget.getUrl()) != null) {
            throw new DuplicateItemException("Trying to add an existing widget for url " + widget.getUrl());
        }
        return widgetRepository.save(widget);
    }
View Full Code Here

    @Override
    @Transactional
    public Widget registerNewWidget(Widget widget) {
        if (getWidgetByUrl(widget.getUrl()) != null) {
            throw new DuplicateItemException("Trying to add an existing widget for url " + widget.getUrl());
        }
        return widgetRepository.save(widget);
    }
View Full Code Here

    @Override
    @Transactional
    public Widget registerNewWidget(Widget widget) {
        if (getWidgetByUrl(widget.getUrl()) != null) {
            throw new DuplicateItemException("Trying to add an existing widget for url " + widget.getUrl());
        }
        return widgetRepository.save(widget);
    }
View Full Code Here

                       
            // now translate the H2 specific error codes into Rave's common application Exceptions
            // add more error codes to the switch statement that should be specifically trapped                        
            switch(rootException.getErrorCode()) {
                case ErrorCode.DUPLICATE_KEY_1: {
                    e = new DuplicateItemException("DUPLICATE_ITEM", rootException);
                    break;
                }

                default: {
                    e = new TranslatedH2Exception(rootException.getErrorCode(), "ERROR", "Unknown Database Error");
View Full Code Here

    @Override
    @Transactional
    public Widget registerNewWidget(Widget widget) {
        if (getWidgetByUrl(widget.getUrl()) != null) {
            throw new DuplicateItemException("Trying to add an existing widget for url " + widget.getUrl());
        }
        return widgetRepository.save(widget);
    }
View Full Code Here

                       
            // now translate the H2 specific error codes into Rave's common application Exceptions
            // add more error codes to the switch statement that should be specifically trapped                        
            switch(rootException.getErrorCode()) {
                case ErrorCode.DUPLICATE_KEY_1: {
                    e = new DuplicateItemException("DUPLICATE_ITEM", rootException);
                    break;
                }

                default: {
                    e = new TranslatedH2Exception(rootException.getErrorCode(), "ERROR", "Unknown Database Error");
View Full Code Here

    @Test
    public void execute_duplicateItemException() {
        RpcOperation<String> valid = new RpcOperation<String>() {
            @Override
            public String execute() {
                throw new DuplicateItemException("Duplicate Item Error");
            }
        };

        RpcResult<String> result = valid.getResult();
        assertThat(result.getResult(), is(nullValue()));
View Full Code Here

TOP

Related Classes of org.apache.rave.exception.DuplicateItemException

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.