public void remove() throws DBException {
manager.getModelClass().getProvider().remove(toSQL());
}
public SQLQuery toSQL() {
SQLQuery query = new SQLQuery(multiModel.getMultiTable());
if (targets.size() > 0) {
for (Target target : targets.values()) {
target.setSQL(query);
}
} else {
defaultTarget.setSQL(query);
}
query.setDistinct(distinct);
for (Filter filter : filters) {
filter.setSQL(query);
}
for (StringFilter stringFilter : stringFilters) {
stringFilter.setSQL(query);
}
for (MultiModelField field : group.values()) {
query.group(field.getSQLName());
}
for (OrderItem orderItem : orderList) {
orderItem.setSQL(query);
}
for (String fieldName : values.keySet()) {
Field field = manager.getField(fieldName);
query.addValue(field.getColumnName(), values.get(fieldName));
}
if (page.get("start") != null && page.get("end") != null) {
query.setStart(page.get("start"));
query.setEnd(page.get("end"));
query.addParam(page.get("start"));
query.addParam(page.get("end"));
}
return query;
}