/** * Get a list containg all teh case studies in the database * * @return List<CaseStudy> containg all the case studies in the database */ public static List<CaseStudy> getAllCaseStudy() { if (database == null) { return new LinkedList<CaseStudy>(); } else { return database.getAllCaseStudy(); } }
/** * Get all the case study data as one long string (for debugging) * * @return String teh string representing the data in the database ("false" indicates load * failure) */ public static String getAllCaseString() { if (database == null) { return "false"; } else { return database.getRowsString(); } }
/** * Add a case study to the database * * @param id the id of the case study * @param name the human readable case study name * @param type the type of case study (local/disk) //TODO: make this an int and store values in * array * @param location teh loacation of the casestudy.json on the disk * @return long indicates the row id (-1 indicates a failure) */ public static long addCaseStudy( String id, String name, String desc, String location, String type) { if (database == null) { return -1; } else { return database.writeRow(id, name, desc, location, type); } }
/** * Load the case study data from the database * * @return boolean indicates whether the load was succesful */ public static CaseStudy getCaseStudy(long pk, Context context) { database = new CaseStudyDatabase(context); if (database == null) { cs_ = new CaseStudy(); return cs_; } else { cs_ = database.getCaseStudy(pk); return cs_; } }