Package net.sf.nfp.mini.dao

Source Code of net.sf.nfp.mini.dao.ObservationDAO

package net.sf.nfp.mini.dao;

import java.io.IOException;

import javax.microedition.rms.RecordStore;
import javax.microedition.rms.RecordStoreException;

import net.sf.nfp.mini.data.Observation;

public class ObservationDAO extends AbstractDAO {
  private RecordStore observationsRMS = null;
 
  protected RecordStore getBaseRMS() throws RecordStoreException {
    if(observationsRMS == null)
      observationsRMS = RecordStore.openRecordStore("observations", true);
    return observationsRMS;
  }

  public Observation find(int id) throws RecordStoreException, IOException {
    return (Observation) super.find(id, new Observation());
  }

  public Observation persist(Observation observation) throws RecordStoreException, IOException {
    return (Observation) super.persist(observation);
  }
 
  public void close() throws RecordStoreException {
    observationsRMS.closeRecordStore();
  }

  public void deleteAll() throws RecordStoreException {
    deleteAll(getBaseRMS());
    observationsRMS = null;
  }
}
TOP

Related Classes of net.sf.nfp.mini.dao.ObservationDAO

TOP
Copyright © 2018 www.massapi.com. 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.