Gets a design document using the id and revision from the database.

@param id  the document id (optionally prefixed with "_design/")
@param rev the document revision
@return {@link DesignDocument}
323730
public DesignDocument get(String id, String rev) {
        assertNotEmpty(id, "id");
        assertNotEmpty(id, "rev");
        return db.find(DesignDocument.class, ensureDesignPrefix(id), rev);
    }
432455
public static List<String> couchStyleRevisionHistoryToFullRevisionIDs(final int start, List<String> ids) {
        List<String> revisionHistory = new ArrayList<String>();
        int generation = start;
        for (String revIdHash : ids) {
            revisionHistory.add(generation + "-" + revIdHash);
            generation--;
        }
        Collections.reverse(revisionHistory);
        return revisionHistory;
    }
1113749
def get(self, id):
        
        collection_name = self.request.headers.get("collection")

        if not collection_name:
            self.raise_error(400, "Missing a collection name for stack")

        self.stack = AsyncSchedulableDocumentRevisionStack(collection_name, self.settings)

        revision = yield self.stack.preview(id)
        self.write(revision)
176912
public static int generationFromRevID(String revID) {
        if (revID == null) return 0;
        int generation = 0;
        int dashPos = revID.indexOf('-');
        if (dashPos > 0) {
            generation = Integer.parseInt(revID.substring(0, dashPos));
        }
        return generation;
    }
638945
public function putDocument($data, $id, $rev = null)
    {
        $data['_id'] = $id;
        if ($rev) {
            $data['_rev'] = $rev;
        }

        $path = '/'.$this->databaseName.'/'.urlencode($id);
        $response = $this->httpClient->request('PUT', $path, json_encode($data));

        if ($response->status != 201) {
            throw HTTPException::fromResponse($path, $response);
        }

        return [$response->body['id'], $response->body['rev']];
    }
1252546
private Document cmisContent( String id ) {
        DocumentWriter writer = newDocument(ObjectId.toString(ObjectId.Type.CONTENT, id));

        org.apache.chemistry.opencmis.client.api.Document doc = (org.apache.chemistry.opencmis.client.api.Document)session.getObject(id);
        writer.setPrimaryType(NodeType.NT_RESOURCE);
        writer.setParent(id);

        ContentStream contentStream = doc.getContentStream();
        if (contentStream != null) {
            BinaryValue content = new CmisConnectorBinary(contentStream, getSourceName(), id, getMimeTypeDetector());
            writer.addProperty(JcrConstants.JCR_DATA, content);
            writer.addProperty(JcrConstants.JCR_MIME_TYPE, contentStream.getMimeType());
        }

        Property<Object> lastModified = doc.getProperty(PropertyIds.LAST_MODIFICATION_DATE);
        Property<Object> lastModifiedBy = doc.getProperty(PropertyIds.LAST_MODIFIED_BY);

        writer.addProperty(JcrLexicon.LAST_MODIFIED, properties.jcrValues(lastModified));
        writer.addProperty(JcrLexicon.LAST_MODIFIED_BY, properties.jcrValues(lastModifiedBy));

        return writer.document();
    }
387626
public E getById(String id) {
        if (id == null) {
            for (E element : this) {
                if (element != null && element.getId() == null) {
                    return element;
                }
            }
        } else {
            for (E element : this) {
                if (element != null && id.equals(element.getId())) {
                    return element;
                }
            }
        }
        return null;
    }
178196
public String getDocumentId(Object instance) {
        if (instance == null) {
            return null;
        }
        DocumentInfo value = documentsByEntity.get(instance);
        return value != null ? value.getId() : null;
    }
648428
def resource_url(self, entity_id, name, revision):
        '''
        
        '''
        return '{}/{}/resource/{}/{}'.format(self.url,
                                             _get_path(entity_id),
                                             name,
                                             revision)
369260
def put_design(self, design_name, design, verbose=False):
    

    try:

      try:
        # check if there is a previous revision of the
        # specified design, if there is get the _rev
        # id from it and apply it to the new version
        existing = self.get_design(design_name)

        design = json.loads(design)

        if design.get("version") and existing.get("version") == design.get("version"):
          if verbose:
            print "No change in design... skipping update!"
          return

        design["_rev"] = existing["_rev"]
        design = json.dumps(design)
      except RESTException:
        pass

      r = requests.request(
        "PUT",
        "%s/%s/_design/%s" % (
          self.host,
          self.database_name,
          design_name
        ),
        auth=self.auth,
        data=design,
        headers={"content-type" : "application/json"}
      )

      return self.result(r.text)

    except:
      raise
632782
public CollectionWrapper<PropertyTagInTopicWrapper> getPropertyTagInTopicRevisions(int id, final Integer revision,
            final RESTBaseTopicV1<?, ?, ?> topic) {
        return RESTCollectionWrapperBuilder.<PropertyTagInTopicWrapper>newBuilder()
                .providerFactory(getProviderFactory())
                .collection(getRESTPropertyTagInTopicRevisions(id, revision, topic))
                .isRevisionCollection()
                .parent(topic)
                .expandedEntityMethods(Arrays.asList("getRevisions"))
                .entityWrapperInterface(PropertyTagInTopicWrapper.class)
                .build();
    }
395442
public function getDocument(string $id): Document
    {
        if (isset($this->documents[$id])) {
            return $this->documents[$id];
        }

        if ($this->hasDocument($id)) {
            $path = $this->getDocumentPath($id);
            $source = $this->filesystem->read($path);

            if (is_string($source)) {
                return $this->documents[$id] = new Document($this->format->parse($source));
            }

            throw new RuntimeException(sprintf('Format error in the file "%s"', $path));
        }

        throw new RuntimeException(sprintf('File "%s" not found', $id));
    }
236425
public Response remove(DesignDocument designDocument) {
        assertNotEmpty(designDocument, "DesignDocument");
        ensureDesignPrefixObject(designDocument);
        return db.remove(designDocument);
    }
1163930
private static Map<String, Object> buildJSONBody(List<RevisionInternal> revs, final Database db) {
        // Build up a JSON body describing what revisions we want:
        final int maxRevTreeDepth = db.getMaxRevTreeDepth();
        Collection<Map<String, Object>> keys = CollectionUtils.transform(
                revs, new CollectionUtils.Functor<RevisionInternal, Map<String, Object>>() {
                    public Map<String, Object> invoke(RevisionInternal rev) {
                        AtomicBoolean haveBodies = new AtomicBoolean(false);
                        List<String> possibleAncestors = db.getPossibleAncestorRevisionIDs(
                                rev, PullerInternal.MAX_NUMBER_OF_ATTS_SINCE, haveBodies, true);
                        Map<String, Object> key = new HashMap<String, Object>();
                        key.put("id", rev.getDocID());
                        key.put("rev", rev.getRevID());
                        if (possibleAncestors != null) {
                            key.put(haveBodies.get() ? "atts_since" : "revs_from", possibleAncestors);
                        } else {
                            if (rev.getGeneration() > maxRevTreeDepth)
                                key.put("revs_limit", maxRevTreeDepth);
                        }
                        return key;
                    }
                });
        Map<String, Object> retval = new HashMap<String, Object>();
        retval.put("docs", keys);
        return retval;
    }
1111376
private CouchbaseResponse handleGetDesignDocumentResponse(final GetDesignDocumentRequest request) {
        ResponseStatus status = ResponseStatusConverter.fromHttp(responseHeader.getStatus().code());
        return new GetDesignDocumentResponse(request.name(), request.development(), responseContent.copy(), status,
            request);
    }
75577
def get_revision(cls, id, revision, api=None):
        
        api = api if api else cls._API
        extra = {'resource': cls.__name__, 'query': {
            'id': id,
            'revision': revision
        }}
        logger.info('Get revision', extra=extra)
        app = api.get(url=cls._URL['get_revision'].format(
            id=id, revision=revision)).json()
        return App(api=api, **app)
1313035
public Map<String, Object> getDocument(String collectionName, String docId) {
        Map<String, Map<String,Object>> docs = DDPStateSingleton.getInstance()
                .getCollection(collectionName);
        if (docs != null) {
            return docs.get(docId);
        }
        return null;
    }