@RequestMapping(value = "/addSdb") public String addSdb(Model model) { SDB sdb = js.addSdb(); return "redirect:/editSdb/" + sdb.getId(); }
public void toSDB(String conformFile) { String[] list = { HomePath.homePath + "libpl/discontiguous.pl", fullName, conformFile, HomePath.homePath + "libpl/state.conform.pl" }; SDB tmpconform = new SDB("tmpconform", list); tmpconform.executeProlog(); tmpconform.delete(); }
public void theWork(String filename) { UMLF exml = new UMLF(filename); UMLFpl eumlf = exml.toUMLFpl(); RegTest.Utility.validate(filename + ".umlf.pl", "Correct/" + filename + ".umlf.pl", true); SDB esdb = eumlf.toSDB(); RegTest.Utility.validate(filename + ".sdb.pl", "Correct/" + filename + ".sdb.pl", true); UMLFpl eumlf1 = esdb.toUMLFpl("1"); RegTest.Utility.validate(filename + "1.umlf.pl", "Correct/" + filename + "1.umlf.pl", true); UMLF exmla = eumlf1.toUMLF(); RegTest.Utility.validate(filename + "1g.umlf.xml", "Correct/" + filename + "1g.umlf.xml", true); }
public void all(final LogAction action) { try { sdb.readTransaction( new DBAction() { @Override public void run(SqlJetDb db) throws SqlJetException { SqlJetTableHelper t = sdb.logTable(); ISqlJetCursor c = t.order(null); while (!c.eof()) { long id = c.getInteger("id"); LogRecord l = cache.get(id); // TODO: cache if (l == null) { l = LogRecord.create((int) id, sdb); fromCursor(c, l); } if (action.run(l)) break; c.next(); } c.close(); } }, -1); } catch (SqlJetException e) { e.printStackTrace(); } }
public void printAll() { try { sdb.readTransaction( new DBAction() { @Override public void run(SqlJetDb db) throws SqlJetException { SqlJetTableHelper t = sdb.logTable(); ISqlJetCursor c = t.order(null); while (!c.eof()) { Log.d( "LOG", c.getValue("id") + "," + c.getValue("date") + "," + c.getValue("action") + "," + c.getValue("target")); c.next(); } c.close(); } }, -1); } catch (SqlJetException e) { e.printStackTrace(); } }
public LogManager(final SDB sdb) throws SqlJetException { super(); this.sdb = sdb; sdb.readTransaction( new DBAction() { @Override public void run(SqlJetDb db) throws SqlJetException { SqlJetTableHelper t = sdb.logTable(); ISqlJetCursor c = t.order(null); lastNumber = 0; if (c.last()) { lastNumber = (int) c.getInteger("id"); } } }, -1); }
public void save(final LogRecord log) { sdb.reserveWriteTransaction( new DBAction() { @Override public void run(SqlJetDb db) throws SqlJetException { SqlJetTableHelper t = sdb.logTable(); ISqlJetCursor cur = t.lookup(null, log.id); if (!cur.eof()) { log.update(cur); // cur.update(log.id,log.date,log.action,log.target,log.option); } else { log.insertTo(t); // t.insert(log.id,log.date,log.action,log.target,log.option); } } }); }
public LogRecord byId(final int id) throws SqlJetException { if (!cache.containsKey(id)) { sdb.readTransaction( new DBAction() { @Override public void run(SqlJetDb db) throws SqlJetException { SqlJetTableHelper t = sdb.logTable(); ISqlJetCursor cur = t.lookup(null, id); LogRecord res = LogRecord.create(id, sdb); if (!cur.eof()) { cache.put(id, res); fromCursor(cur, res); } } }, -1); } return cache.get(id); }