Package ca.carleton.gcrc.couch.app

Examples of ca.carleton.gcrc.couch.app.Document


    jsonWriter.key("features");
    jsonWriter.array();
   
    while( retrieval.hasNext() ){
      Document doc = retrieval.getNext();
      if( null != doc
       && docFilter.accepts(doc) ) {
        JSONObject jsonDoc = doc.getJSONObject();
       
        String schemaName = jsonDoc.optString("nunaliit_schema");
        if( null != schemaName ) {
          boolean containsGeometry = JSONSupport.containsKey(jsonDoc, "nunaliit_geom");
          SchemaExportInfo exportInfo = schemaCache.getExportInfo(schemaName);
         
          if( null != exportInfo || containsGeometry ){
            jsonWriter.object();
           
            jsonWriter.key("type");
            jsonWriter.value("Feature");

            jsonWriter.key("id");
            jsonWriter.value(doc.getId());
           
            jsonWriter.key("properties");
            jsonWriter.object();
           
            if( null != exportInfo ){
View Full Code Here


    if( null == jsonDoc ) {
      documentsFromSchemaName.put(schemaName, null);
      return null;
    }

    Document doc = new DocumentJSON(jsonDoc);
    documentsFromSchemaName.put(schemaName, doc);
   
    return doc;
  }
View Full Code Here

      return exportInfoFromSchemaName.get(schemaName);
    }
   
    SchemaExportInfo exportInfo = null;
    try {
      Document doc = getSchema(schemaName);
      if( null != doc ) {
        JSONArray jsonExport = doc.getJSONObject().optJSONArray("export");
        if( null != jsonExport ) {
          exportInfo = SchemaExportInfo.parseJson(jsonExport);
        }
      }
    } catch(Exception e) {
View Full Code Here

    try {
      DocumentUpdateProcess updateProcess = new DocumentUpdateProcess(couchDb);
      updateProcess.setListener(UpdateListener._singleton);
     
      FSEntry fileEntry = new FSEntryFile(ddDir);
      Document doc = DocumentFile.createDocument(fileEntry);

      updateProcess.update(
          doc
          ,DocumentUpdateProcess.Schedule.UPDATE_EVEN_IF_MODIFIED
          );
View Full Code Here

      CouchDb userDb = couchClient.getDatabase("_users");
      DocumentUpdateProcess updateProcess = new DocumentUpdateProcess(userDb);
      updateProcess.setListener(UpdateListener._singleton);
     
      FSEntry fileEntry = new FSEntryFile(ddDir);
      Document doc = DocumentFile.createDocument(fileEntry);

      updateProcess.update(
          doc
          ,DocumentUpdateProcess.Schedule.UPDATE_EVEN_IF_MODIFIED
          );
View Full Code Here

        for(String fileName : fileNames) {
          File file = new File(documentsDir, fileName);
   
          try {
            FSEntry fileEntry = new FSEntryFile(file);
            Document doc = DocumentFile.createDocument(fileEntry);

            updateProcess.update(doc);

          } catch(Exception e) {
            throw new ServletException("Problem pushing document: "+file.getAbsolutePath(), e);
          }
        }
      }
    }
   
    // Find root directory for updating documents
    {
      File documentsDir = null;
      {
        documentsDir = new File(webInfDirectory, "updateDocs");
        if( false == documentsDir.exists() || false == documentsDir.isDirectory() ) {
          documentsDir = null;
        }
      }
     
      if( null == documentsDir ) {
        logger.error("Unable to find document directory for updating");
      } else {
        String[] fileNames = documentsDir.list();
        for(String fileName : fileNames) {
          File file = new File(documentsDir, fileName);
   
          try {
            FSEntry fileEntry = new FSEntryFile(file);
            Document doc = DocumentFile.createDocument(fileEntry);

            updateProcess.update(
              doc
              ,DocumentUpdateProcess.Schedule.UPDATE_EVEN_IF_MODIFIED
              );
View Full Code Here

    try {
      DocumentUpdateProcess updateProcess = new DocumentUpdateProcess(couchDb);
      updateProcess.setListener(UpdateListener._singleton);
     
      FSEntry fileEntry = new FSEntryFile(ddDir);
      Document doc = DocumentFile.createDocument(fileEntry);

      updateProcess.update(
          doc
          ,DocumentUpdateProcess.Schedule.UPDATE_EVEN_IF_MODIFIED
          );
View Full Code Here

      CouchDb userDb = couchClient.getDatabase("_users");
      DocumentUpdateProcess updateProcess = new DocumentUpdateProcess(userDb);
      updateProcess.setListener(UpdateListener._singleton);
     
      FSEntry fileEntry = new FSEntryFile(ddDir);
      Document doc = DocumentFile.createDocument(fileEntry);

      updateProcess.update(
          doc
          ,DocumentUpdateProcess.Schedule.UPDATE_EVEN_IF_MODIFIED
          );
View Full Code Here

        for(String fileName : fileNames) {
          File file = new File(documentsDir, fileName);
   
          try {
            FSEntry fileEntry = new FSEntryFile(file);
            Document doc = DocumentFile.createDocument(fileEntry);

            updateProcess.update(doc);

          } catch(Exception e) {
            throw new ServletException("Problem pushing document: "+file.getAbsolutePath(), e);
          }
        }
      }
    }
   
    // Find root directory for updating documents
    {
      File documentsDir = null;
      {
        documentsDir = new File(webInfDirectory, "updateDocs");
        if( false == documentsDir.exists() || false == documentsDir.isDirectory() ) {
          documentsDir = null;
        }
      }
     
      if( null == documentsDir ) {
        logger.error("Unable to find document directory for updating");
      } else {
        String[] fileNames = documentsDir.list();
        for(String fileName : fileNames) {
          File file = new File(documentsDir, fileName);
   
          try {
            FSEntry fileEntry = new FSEntryFile(file);
            Document doc = DocumentFile.createDocument(fileEntry);

            updateProcess.update(
              doc
              ,DocumentUpdateProcess.Schedule.UPDATE_EVEN_IF_MODIFIED
              );
View Full Code Here

TOP

Related Classes of ca.carleton.gcrc.couch.app.Document

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.