Examples of EntityMeta


Examples of com.couchace.core.api.meta.EntityMeta

            throw new UnsupportedOperationException(msg);
        }
    }

    protected WriteResponse executePutEntity(PutEntityRequest request) {
        EntityMeta entityMeta = metaRepository.getOrCreateEntityMeta(request.getEntityClass());

        if (request.getDocumentId() == null && request.getDocumentRevision() == null) {
            // Request does not define documentId or revision so look to the EntityMeta
            if (entityMeta.hasId()) {
                // Read the id and revision
                Object entity = request.getEntity();
                String id = entityMeta.readDocumentId(entity);
                String revision = entityMeta.readDocumentRevision(entity);
                String entityType = entityMeta.getEntityType();

                // Create the PutEntityRequest
                if (revision != null) {
                    request = couch.put().entity(id, entityType, entity, revision);
                } else {
View Full Code Here

Examples of com.couchace.core.api.meta.EntityMeta

            throw new UnsupportedOperationException(msg);
        }
    }

    protected WriteResponse executePostEntity(PostEntityRequest request) {
        EntityMeta entityMeta = metaRepository.getOrCreateEntityMeta(request.getEntityClass());
        HttpPostRequest httpPostRequest = httpRequestFactory.newHttpPostRequest(request);

        CouchHttpResponse couchHttpResponse = httpClient.post(httpPostRequest);

        if (couchHttpResponse.isSuccess()) {
View Full Code Here

Examples of com.couchace.core.api.meta.EntityMeta

            throw CouchException.badRequest("Unsupported DeleteRequestType " + deleteRequest.getType());
        }
    }

    protected WriteResponse executeDeleteEntity(DeleteEntityRequest request) {
        EntityMeta entityMeta = metaRepository.getOrCreateEntityMeta(request.getEntityClass());

        // Request does not define documentId or revision so look to the EntityMeta
        if (entityMeta.hasId() == false) {
            throw CouchException.internalServerError("Cannot build DeleteEntityRequest for entity " + request.getEntityClass() + ", @CouchId is not specified.");
        }

        // Read the id and revision
        Object entity = request.getEntity();
        String id = entityMeta.readDocumentId(entity);
        String revision = entityMeta.readDocumentRevision(entity);

        // Create the DeleteEntityRequest
        DeleteDocumentRequest deleteDocumentRequest = couch.delete().document(id, revision);

        CouchHttpResponse couchHttpResponse = httpClient.delete(httpRequestFactory.newHttpDeleteRequest(deleteDocumentRequest));
View Full Code Here

Examples of com.couchace.core.api.meta.EntityMeta

        return response;

    }

    protected WriteResponse executePutEntity(PutEntityRequest request) {
        EntityMeta entityMeta = metaRepository.getOrCreateEntityMeta(request.getEntityClass());

        if (request.getDocumentId() == null && request.getDocumentRevision() == null) {
            // Request does not define documentId or revision so look to the EntityMeta
            if (entityMeta.hasId()) {
                // Read the id and revision
                Object entity = request.getEntity();
                String id = entityMeta.readDocumentId(entity);
                String revision = entityMeta.readDocumentRevision(entity);
                String entityType = entityMeta.getEntityType();

                // Create the PutEntityRequest
                if (revision != null) {
                    request = couch.put().entity(id, entityType, entity, revision);
                } else {
View Full Code Here

Examples of com.couchace.core.api.meta.EntityMeta

            throw new UnsupportedOperationException(msg);
        }
    }

    protected WriteResponse executePostEntity(PostEntityRequest request) {
        EntityMeta entityMeta = metaRepository.getOrCreateEntityMeta(request.getEntityClass());
        HttpPostRequest httpPostRequest = httpRequestFactory.newHttpPostRequest(request);

        CouchHttpResponse couchHttpResponse = httpClient.post(httpPostRequest);

        if (couchHttpResponse.isSuccess()) {
View Full Code Here

Examples of com.couchace.core.api.meta.EntityMeta

            throw CouchException.badRequest(msg);
        }
    }

    protected WriteResponse executeDeleteEntity(DeleteEntityRequest request) {
        EntityMeta entityMeta = metaRepository.getOrCreateEntityMeta(request.getEntityClass());

        // Request does not define documentId or revision so look to the EntityMeta
        if (entityMeta.hasId() == false) {
            throw CouchException.internalServerError("Cannot build DeleteEntityRequest for entity " + request.getEntityClass() + ", @CouchId is not specified.");
        }

        // Read the id and revision
        Object entity = request.getEntity();
        String id = entityMeta.readDocumentId(entity);
        String revision = entityMeta.readDocumentRevision(entity);

        // Create the DeleteEntityRequest
        DeleteDocumentRequest deleteDocumentRequest = couch.delete().document(id, revision);

        CouchHttpResponse couchHttpResponse = httpClient.delete(httpRequestFactory.newHttpDeleteRequest(deleteDocumentRequest));
View Full Code Here

Examples of com.couchace.core.api.meta.EntityMeta

    public WriteResponse execute(PutRequest request) {
        CouchHttpResponse couchHttpResponse;
        if (request instanceof PutEntityRequest) {
            // Special handling for Entity
            PutEntityRequest putEntityRequest = (PutEntityRequest) request;
            EntityMeta entityMeta = metaRepository.getOrCreateEntityMeta(putEntityRequest.getEntityClass());

            if (putEntityRequest.getDocumentId() == null && putEntityRequest.getDocumentRevision() == null) {
                // Request does not define documentId or revision so look to the EntityMeta
                if (entityMeta.hasId()) {
                    // Read the id and revision
                    Object entity = putEntityRequest.getEntity();
                    String id = entityMeta.readDocumentId(entity);
                    String revision = entityMeta.readDocumentRevision(entity);
                    String entityType = entityMeta.getEntityType();

                    // Create the PutEntityRequest
                    putEntityRequest = couch.put().entity(id, entityType, entity, revision);
                } else {
                    throw CouchException.internalServerError("Cannot build PutEntityRequest for entity " + putEntityRequest.getEntityClass() + ", @CouchId is not specified.");
View Full Code Here

Examples of com.couchace.core.api.meta.EntityMeta

    public WriteResponse execute(PostRequest request) {
        CouchHttpResponse couchHttpResponse;
        if (request instanceof PostEntityRequest) {
            PostEntityRequest postEntityRequest = (PostEntityRequest) request;
            EntityMeta entityMeta = metaRepository.getOrCreateEntityMeta(postEntityRequest.getEntityClass());
            HttpPostRequest httpPostRequest = httpRequestFactory.newHttpPostRequest(postEntityRequest);
            couchHttpResponse = httpClient.post(httpPostRequest);
            if (couchHttpResponse.isSuccess()) {
                couchHttpResponse = writeEntityAttachments(entityMeta, couchHttpResponse, postEntityRequest.getEntity());
            }
View Full Code Here

Examples of com.couchace.core.api.meta.EntityMeta

            throw new UnsupportedOperationException(msg);
        }
    }

    protected WriteResponse executePutEntity(PutEntityRequest request) {
        EntityMeta entityMeta = metaRepository.getOrCreateEntityMeta(request.getEntityClass());

        if (request.getDocumentId() == null && request.getDocumentRevision() == null) {
            // Request does not define documentId or revision so look to the EntityMeta
            if (entityMeta.hasId()) {
                // Read the id and revision
                Object entity = request.getEntity();
                String id = entityMeta.readDocumentId(entity);
                String revision = entityMeta.readDocumentRevision(entity);
                String entityType = entityMeta.getEntityType();

                // Create the PutEntityRequest
                if (revision != null) {
                    request = couch.put().entity(id, entityType, entity, revision);
                } else {
View Full Code Here

Examples of com.couchace.core.api.meta.EntityMeta

            throw new UnsupportedOperationException(msg);
        }
    }

    protected WriteResponse executePostEntity(PostEntityRequest request) {
        EntityMeta entityMeta = metaRepository.getOrCreateEntityMeta(request.getEntityClass());
        HttpPostRequest httpPostRequest = httpRequestFactory.newHttpPostRequest(request);

        CouchHttpResponse couchHttpResponse = httpClient.post(httpPostRequest);

        if (couchHttpResponse.isSuccess()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.