SuperX-Kernmodul
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

107 lines
2.8 KiB

package de.superx.common;
import static de.superx.servlet.SxSQL_Server.DEFAULT_MANDANTEN_ID;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.tree.DefaultTreeModel;
import de.superx.servlet.SuperXManager;
import de.superx.servlet.SxPools;
import de.superx.util.SqlStringUtils;
import freemarker.template.TemplateException;
public class StandaloneSicht extends AbstractSicht {
private static final long serialVersionUID = 1L;
private String sqlDialect;
private Connection con;
/**
*
*/
public StandaloneSicht(Sichten sichten, Object id, String name) {
super(sichten, id, name);
}
/**
* Used for cloning
*
* @param id
* @param name
* @param model
*/
private StandaloneSicht(Sichten sichten, Object id, String name,
DefaultTreeModel model) {
super(sichten, id, name, model);
}
public void setSqlDialect(String sqlDialect) {
this.sqlDialect = sqlDialect;
}
protected String getSqlDialect() {
return sqlDialect;
}
public void setConnection(Connection con) {
this.con = con;
}
protected SxResultSet readFromDb(String sql) throws SQLException,
DBServletException, TemplateException, IOException {
SuperX_el el = new SuperX_el();
// execute addRow adaptColumnType aus SxSql-Server übernommen, wegen
// Abhängigkeit von SuperXManager httpservlet classe hierhin kopiert
SxSqlHelper sh=new SxSqlHelper();
sh.execute(sql, con, el);
if (el.getError_String() != null
&& !el.getError_String().trim().equals(""))
throw new SQLException("\nProblem bei Sichtenaufbau DETAILS:" + "\n\n Meldung:"
+ el.getError_String() + "\n sql:" + sql);
return el.getResultSet();
}
public boolean isCachedVersionInPool() {
return false;
}
public void addCachedNodes(SelectableItemNode root) {
}
/**
* bei Standalone Sichten gibt's keine Dynmik
*/
public String dynamicSichtGenerateSql(Hashtable formular,String sql) {
return sql;
}
public String dynmicSichtFMParsing(HashMap map,
FieldContainer individualFields, String sql)
throws TemplateException, IOException, SQLException {
sql = new TemplateProcessor(DEFAULT_MANDANTEN_ID).process("Sicht "+getName_intern()+" "+sql, sql, map, sqlDialect);
return sql;
}
public Object clone() throws CloneNotSupportedException {
SelectableItemTree st = (SelectableItemTree) super.clone();
StandaloneSicht cl = new StandaloneSicht(sichten, getId(), getName(),
(DefaultTreeModel) st.getModel());
finishClone(cl);
return cl;
}
}