Android Open Source - field-data-app Checklist Item






From Project

Back to project page field-data-app.

License

The source code is released under:

MIT License

If you think the Android project field-data-app 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 nz.cri.gns.springs.db;
//from   w ww  . ja v  a 2  s  .com
import java.sql.SQLException;
import java.util.List;

import com.j256.ormlite.dao.RuntimeExceptionDao;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.stmt.PreparedQuery;
import com.j256.ormlite.stmt.QueryBuilder;
import com.j256.ormlite.table.DatabaseTable;

/**
 * CheckListItems are named true/false flags that can be grouped and each may be
 * associated with other objects stored in the database.
 * @author duncanw
 *
 */
@DatabaseTable
public class ChecklistItem {
  
  @DatabaseField(generatedId = true) 
  private Long id;
  
  // Used to group ChecklistItems and/or identify which type of database object
  // the ChecklistItem is associated with
  @DatabaseField private String checklistName;
  @DatabaseField private String itemName;
  @DatabaseField private Boolean itemValue;
  @DatabaseField private Long objectId;
  
  public Long getId() {
    return id;
  }
  public void setId(Long id) {
    this.id = id;
  }
  public String getChecklistName() {
    return checklistName;
  }
  public void setChecklistName(String checklistName) {
    this.checklistName = checklistName;
  }
  public String getItemName() {
    return itemName;
  }
  public void setItemName(String itemName) {
    this.itemName = itemName;
  }
  public Boolean getItemValue() {
    return itemValue;
  }
  public void setItemValue(Boolean itemValue) {
    this.itemValue = itemValue;
  }
  public Long getObjectId() {
    return objectId;
  }
  public void setObjectId(Long objectId) {
    this.objectId = objectId;
  }
  
  
  public static List<ChecklistItem> getBy(String checklistName, Long objectId, SpringsDbHelper dbHelper) {
    
    RuntimeExceptionDao<ChecklistItem, Long> dao = dbHelper.getChecklistItemDao();
    QueryBuilder<ChecklistItem, Long> queryBuilder = dao.queryBuilder();
    List<ChecklistItem> checklistItemList;
    try {
      queryBuilder
        .where().eq("checklistName", checklistName)
        .and().eq("objectId", objectId);
      PreparedQuery<ChecklistItem> preparedQuery = queryBuilder.prepare();
      checklistItemList = dao.query(preparedQuery);

    } catch (SQLException e) {
      throw new RuntimeException(e);
    }
    return checklistItemList;
  }

}




Java Source Code List

nz.cri.gns.springs.GpsLocation.java
nz.cri.gns.springs.SpringsApplication.java
nz.cri.gns.springs.activity.BioSampleActivity.java
nz.cri.gns.springs.activity.EditBiologicalSamplesActivity.java
nz.cri.gns.springs.activity.MainMenuActivity.java
nz.cri.gns.springs.activity.ManageBioSamplesActivity.java
nz.cri.gns.springs.activity.SettingsActivity.java
nz.cri.gns.springs.db.BiologicalSampleTest.java
nz.cri.gns.springs.db.BiologicalSample.java
nz.cri.gns.springs.db.ChecklistItem.java
nz.cri.gns.springs.db.Configuration.java
nz.cri.gns.springs.db.FeatureTest.java
nz.cri.gns.springs.db.Feature.java
nz.cri.gns.springs.db.PersistentObject.java
nz.cri.gns.springs.db.SpringsDbHelper.java
nz.cri.gns.springs.db.SurveyImage.java
nz.cri.gns.springs.db.SurveyTest.java
nz.cri.gns.springs.db.Survey.java
nz.cri.gns.springs.fragments.AppearanceFragment.java
nz.cri.gns.springs.fragments.BioSampleActivityFragment.java
nz.cri.gns.springs.fragments.BioSampleFragment.java
nz.cri.gns.springs.fragments.ChooseImageFragment.java
nz.cri.gns.springs.fragments.ExportSamplesFragment.java
nz.cri.gns.springs.fragments.FeatureIdFragment.java
nz.cri.gns.springs.fragments.ImageColourPickerFragment.java
nz.cri.gns.springs.fragments.ImageFragment.java
nz.cri.gns.springs.fragments.SpringsDialogFragment.java
nz.cri.gns.springs.fragments.SpringsFragment.java
nz.cri.gns.springs.util.CustomExceptionHandler.java
nz.cri.gns.springs.util.DataStatistics.java
nz.cri.gns.springs.util.DateTimePickerDialog.java
nz.cri.gns.springs.util.UiUtil.java
nz.cri.gns.springs.util.Util.java