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
request = couch.put().entity(id, entityType, entity, revision);
} else {
throw CouchException.internalServerError("Cannot build PutEntityRequest for entity " + request.getEntityClass() + ", @CouchId is not specified.");