Android Open Source - unicef_gis_mobile Uploaded Reports

From Project

Back to project page unicef_gis_mobile.


The source code is released under:

MIT License

If you think the Android project unicef_gis_mobile listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.unicef.gis.model.couchdb.views;
//from w w w .  ja  v a 2  s. c  om
import java.util.List;
import java.util.Map;

import org.unicef.gis.model.Report;

import com.couchbase.cblite.CBLDatabase;
import com.couchbase.cblite.CBLQueryOptions;
import com.couchbase.cblite.CBLStatus;
import com.couchbase.cblite.CBLViewMapBlock;
import com.couchbase.cblite.CBLViewMapEmitBlock;

public class UploadedReports extends UnicefGisView {
  private static final String VIEW_NAME = "uploaded_reports";
  private static final String VIEW_VERSION = "1.0";

  public UploadedReports(CBLDatabase db, String designDoc) {
    super(db, designDoc);

  public List<Map<String, Object>> query() {
    CBLQueryOptions options = new CBLQueryOptions();    
    CBLStatus status = new CBLStatus();
    return view.queryWithOptions(options, status);      

  protected String getViewName() {
    return VIEW_NAME;

  protected String getViewVersion() {
    return VIEW_VERSION;

  protected CBLViewMapBlock getViewMapBlock() {
    return new CBLViewMapBlock() {
      public void map(Map<String, Object> document,
          CBLViewMapEmitBlock emitter) {
        if (isReport(document) && 
            (Boolean)document.get(Report.SYNCED_DATA_KEY) && 
            (Boolean)document.get(Report.SYNCED_IMAGE_KEY)) {          
          emitter.emit(document.get(Report.TIMESTAMP_KEY), document);

Java Source Code List