Package com.couchace.core.api

Examples of com.couchace.core.api.CouchException


            String id = document.getDocumentId();
            String revision = document.getDocumentRevision();
            WriteResponse deleteResponse = new DeleteDocumentRequest(this, DeleteDocumentRequest.Type.DOCUMENT, id, revision)
                    .execute();
            if (deleteResponse.isError()) {
                throw new CouchException(deleteResponse.getStatusCode(), "Error deleting design document " + id);
            }
        }
        couchHttpResponse = CouchHttpResponse.builder(CouchMethodType.DELETE, httpClient.uri(path), CouchHttpStatus.OK).build();
        return new WriteResponse(couchHttpResponse);
    }
View Full Code Here


            if (id.startsWith("_design")) {
                String revision = document.getDocumentRevision();
                WriteResponse deleteResponse = new DeleteDocumentRequest(this, DeleteDocumentRequest.Type.DOCUMENT, id, revision)
                        .execute();
                if (deleteResponse.isError()) {
                    throw new CouchException(deleteResponse.getStatusCode(), "Error deleting design document " + id);
                }
            }
        }
        couchHttpResponse = CouchHttpResponse.builder(CouchMethodType.DELETE, httpClient.uri(path), CouchHttpStatus.OK).build();
        return new WriteResponse(couchHttpResponse);
View Full Code Here

                String revision = document.getDocumentRevision();
                WriteResponse deleteResponse = new DeleteDocumentRequest(this, DeleteDocumentRequest.Type.DOCUMENT, id, revision)
                        .execute();
                if (deleteResponse.isError()) {
                    String msg = String.format("Error deleting document %s rev(%s) - %s", id, revision, deleteResponse.getErrorReason());
                    throw new CouchException(deleteResponse.getStatusCode(), msg);
                }
            }
        }
        couchHttpResponse = CouchHttpResponse.builder(CouchMethodType.DELETE, httpClient.uri(path), CouchHttpStatus.OK).build();
        return new WriteResponse(couchHttpResponse);
View Full Code Here

                if (value != null) {
                    couchHttpResponse = writeAttachment(attachmentMeta, couchHttpResponse.getDocumentId(), couchHttpResponse.getDocumentRevision(), value);
                }
            } catch (CouchException e) {
                log.error(e);
                throw new CouchException(CouchHttpStatus.INTERNAL_SERVER_ERROR, "Exception saving attachment: " + e.getMessage(), e);
            }
        }
        return couchHttpResponse;
    }
View Full Code Here

        if (couchHttpResponse.isError()) {
            CouchErrorContent errorContent = CouchErrorContent.parseJson(couchHttpResponse.getStringContent());
            String msg = String.format("Store of document successful but failed in storage of attachment with status: %s and error content: %s",
                    couchHttpResponse.getHttpStatus().getReason(),
                    errorContent.toString());
            throw new CouchException(couchHttpResponse.getHttpStatus(), msg);
        }

        return couchHttpResponse;

    }
View Full Code Here

            String id = document.getDocumentId();
            String revision = document.getDocumentRevision();
            WriteResponse deleteResponse = new DeleteDocumentRequest(this, DeleteDocumentRequest.Type.DOCUMENT, id, revision)
                    .execute();
            if (deleteResponse.isError()) {
                throw new CouchException(deleteResponse.getHttpStatus(), "Error deleting design document " + id);
            }
        }
        couchHttpResponse = CouchHttpResponse.builder(CouchMethodType.DELETE, httpClient.uri(path), CouchHttpStatus.OK).build();
        return new WriteResponse(couchHttpResponse);
    }
View Full Code Here

            if (id.startsWith("_design")) {
                String revision = document.getDocumentRevision();
                WriteResponse deleteResponse = new DeleteDocumentRequest(this, DeleteDocumentRequest.Type.DOCUMENT, id, revision)
                        .execute();
                if (deleteResponse.isError()) {
                    throw new CouchException(deleteResponse.getHttpStatus(), "Error deleting design document " + id);
                }
            }
        }
        couchHttpResponse = CouchHttpResponse.builder(CouchMethodType.DELETE, httpClient.uri(path), CouchHttpStatus.OK).build();
        return new WriteResponse(couchHttpResponse);
View Full Code Here

                String revision = document.getDocumentRevision();
                WriteResponse deleteResponse = new DeleteDocumentRequest(this, DeleteDocumentRequest.Type.DOCUMENT, id, revision)
                        .execute();
                if (deleteResponse.isError()) {
                    String msg = String.format("Error deleting document %s rev(%s) - %s", id, revision, deleteResponse.getErrorReason());
                    throw new CouchException(deleteResponse.getHttpStatus(), msg);
                }
            }
        }
        couchHttpResponse = CouchHttpResponse.builder(CouchMethodType.DELETE, httpClient.uri(path), CouchHttpStatus.OK).build();
        return new WriteResponse(couchHttpResponse);
View Full Code Here

                if (value != null) {
                    couchHttpResponse = writeAttachment(attachmentMeta, couchHttpResponse.getDocumentId(), couchHttpResponse.getDocumentRevision(), value);
                }
            } catch (CouchException e) {
                log.error(e);
                throw new CouchException(CouchHttpStatus.INTERNAL_SERVER_ERROR, "Exception saving attachment: " + e.getMessage(), e);
            }
        }
        return couchHttpResponse;
    }
View Full Code Here

        if (couchHttpResponse.isError()) {
            CouchErrorContent errorContent = CouchErrorContent.parseJson(couchHttpResponse.getStringContent());
            String msg = String.format("Store of document successful but failed in storage of attachment with status: %s and error content: %s",
                    couchHttpResponse.getHttpStatus().getReason(),
                    errorContent.toString());
            throw new CouchException(couchHttpResponse.getHttpStatus(), msg);
        }

        return couchHttpResponse;

    }
View Full Code Here

TOP

Related Classes of com.couchace.core.api.CouchException

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.