Package ca.carleton.gcrc.couch.client

Examples of ca.carleton.gcrc.couch.client.CouchQuery


   
    // Add documents marked as skeleton
    {
      logger.debug("Obtain list of documents from skeleton-docs view");
      CouchDesignDocument designDoc = couchDb.getDesignDocument("atlas");
      CouchQuery query = new CouchQuery();
      query.setViewName("skeleton-docs");
      CouchQueryResults results = designDoc.performQuery(query);
      List<JSONObject> rows = results.getRows();
      for(JSONObject row : rows){
        String docId = row.getString("id");
        docIds.add(docId);
View Full Code Here


    CouchDb atlasDb = couchClient.getDatabase(atlasInfo.getDatabaseName());
    CouchDesignDocument atlasDesign = atlasDb.getDesignDocument("atlas");

    // Roles from layer definitions
    {
      CouchQuery query = new CouchQuery();
      query.setViewName("layer-definitions");
      CouchQueryResults queryResults = atlasDesign.performQuery(query);
      for(JSONObject row : queryResults.getRows()){
        String layerId = row.getString("key");
        if( false == "public".equals(layerId) ) {
          String layerRole = atlasInfo.getAtlasName() + "_layer_" + layerId;
          roles.add(layerRole);
        }
      }
    }

    // Roles from layers in use
    {
      CouchQuery query = new CouchQuery();
      query.setViewName("layers");
      query.setReduce(true);
      query.setGrouping(true);
      CouchQueryResults queryResults = atlasDesign.performQuery(query);
      for(JSONObject row : queryResults.getRows()){
        String layerId = row.getString("key");
        if( false == "public".equals(layerId) ) {
          String layerRole = atlasInfo.getAtlasName() + "_layer_" + layerId;
View Full Code Here

    return getUsersWithRoles(roles);
  }
 
  @Override
  public Collection<UserDocument> getUsersWithRoles(List<String> roles) throws Exception {
    CouchQuery query = new CouchQuery();
    query.setViewName("roles");
    query.setIncludeDocs(true);
    query.setReduce(false);
    query.setKeys(roles);
   
    CouchQueryResults results = dd.performQuery(query);
    List<JSONObject> rows = results.getRows();
   
    // Accumulate users
View Full Code Here

  }

  @Override
  public JSONObject getUserFromEmailAddress(String emailAddress) throws Exception {
    try {
      CouchQuery query = new CouchQuery();
      query.setViewName("validated-emails");
      query.setStartKey(emailAddress);
      query.setEndKey(emailAddress);
      query.setIncludeDocs(true);

      CouchQueryResults results = nunaliitUserDesignDocument.performQuery(query);
      List<JSONObject> rows = results.getRows();
      for(JSONObject row : rows){
        JSONObject doc = row.optJSONObject("doc");
View Full Code Here

      return;
    }
   
    // Check users that have agreed to the previous agreement and revoke
    // privilege
    CouchQuery query = new CouchQuery();
    query.setViewName("roles");
    query.setStartKey(agreementRole);
    query.setEndKey(agreementRole);
   
    logger.debug("Looking for users with role: "+agreementRole);
   
    CouchQueryResults results = userDbDesignDocument.performQuery(query);
View Full Code Here

    logger.info("Upload worker thread exiting");
  }
 
  private void activity() {
    CouchQuery query = new CouchQuery();
    query.setViewName("server_work");
   
    CouchQueryResults results;
    try {
      results = dd.performQuery(query);
    } catch (Exception e) {
View Full Code Here

public class DocumentRetrievalSchema implements DocumentRetrieval {

  static public DocumentRetrieval create(CouchDb couchDb, String schemaName) throws Exception {
    CouchDesignDocument dd = couchDb.getDesignDocument("atlas");
   
    CouchQuery query = new CouchQuery();
    query.setViewName("nunaliit-schema");
    query.setStartKey(schemaName);
    query.setEndKey(schemaName);
    query.setIncludeDocs(false);
   
    CouchQueryResults results = dd.performQuery(query);
   
    Set<String> ids = new HashSet<String>();
    for(JSONObject row : results.getRows()){
View Full Code Here

  public Document getSchema(String schemaName) throws Exception {
    if( documentsFromSchemaName.containsKey(schemaName) ) {
      return documentsFromSchemaName.get(schemaName);
    }
   
    CouchQuery query = new CouchQuery();
    query.setViewName("schemas");
    query.setStartKey(schemaName);
    query.setEndKey(schemaName);
    query.setIncludeDocs(true);
   
    CouchQueryResults results = dd.performQuery(query);
   
    List<JSONObject> rows = results.getRows();
    if( rows.size() < 1 ) {
View Full Code Here

public class DocumentRetrievalLayer implements DocumentRetrieval {

  static public DocumentRetrieval create(CouchDb couchDb, String layerName) throws Exception {
    CouchDesignDocument dd = couchDb.getDesignDocument("atlas");
   
    CouchQuery query = new CouchQuery();
    query.setViewName("geom-layer");
    query.setStartKey(layerName);
    query.setEndKey(layerName);
    query.setIncludeDocs(false);
   
    CouchQueryResults results = dd.performQuery(query);
   
    Set<String> ids = new HashSet<String>();
    for(JSONObject row : results.getRows()){
View Full Code Here

   
    configDesign.getDatabase().createDocument(doc);
  }

  public CouchConfig retrieveConfigurationObject() throws Exception {
    CouchQuery query = new CouchQuery();
    query.setViewName(viewName);
    query.setStartKey(serverName);
    query.setEndKey(serverName);
   
    CouchQueryResults results;
    try {
      results = configDesign.performQuery(query);
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of ca.carleton.gcrc.couch.client.CouchQuery

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.