/** * <p>deleteObject.</p> * * @param con a {@link de.mhus.lib.sql.DbConnection} object. * @param object a {@link java.lang.Object} object. * @throws java.lang.Exception if any. */ public void deleteObject(DbConnection con, Object object) throws Exception { for (Feature f : features) f.deleteObject(con,object); HashMap<String, Object> attributes = new HashMap<String, Object>(); for (Field f : pk) { attributes.put(f.name, f.getFromTarget(object)); } schema.internalDeleteObject(con, name, object, attributes); sqlDelete.getStatement(con).execute(attributes); }
@Override public void deleteCaseAndFlowNodes(UUID id) throws IOException { try { DbConnection con = pool.getConnection(); MProperties prop = new MProperties(); prop.put("id", id); { DbStatement sta = con.createStatement("DELETE FROM " + prefix + "_case_ WHERE id_=$id$"); sta.execute(prop); } { DbStatement sta = con.createStatement("DELETE FROM " + prefix + "_node_ WHERE case_=$id$"); sta.execute(prop); } con.commit(); con.close(); } catch (Exception e) { throw new IOException(e); } }
/** * <p>createObject.</p> * * @param con a {@link de.mhus.lib.sql.DbConnection} object. * @param object a {@link java.lang.Object} object. * @throws java.lang.Exception if any. */ public void createObject(DbConnection con, Object object) throws Exception { for (Feature f : features) f.preCreateObject(con,object); HashMap<String, Object> attributes = new HashMap<String, Object>(); for (Field f : fList) { attributes.put(f.name, f.getFromTarget(object)); } schema.internalCreateObject(con, name, object, attributes); sqlInsert.getStatement(con).execute(attributes); for (Feature f : features) f.postCreateObject(con,object); for (FieldRelation f : relationList) { f.created(con,object); } }