/* * __NAME__.java * * $Id: AppDbObject.java 85 2008-01-24 19:02:22Z harald $ */ // @{ // # name of database table // tablename = // mapping = $scripts/$tablename.map # java <-> db mapping // relations = $scripts/$tablename.rel # object relations // @} // @> $mapping // # mapping for __NAME__ // @< // @> $relations // # relations for __NAME__ // @< package Templates.Tentackle; import org.tentackle.appworx.AppDbObject; import org.tentackle.appworx.AppDbObjectClassVariables; import org.tentackle.appworx.ContextDb; import org.tentackle.db.PreparedStatementWrapper; import org.tentackle.db.ResultSetWrapper; /** * */ public class __NAME__ extends AppDbObject { public static final String TABLENAME = /**//**/; // @wurblet < Inject --string $tablename private static AppDbObjectClassVariables classVariables = new AppDbObjectClassVariables(__NAME__.class, TABLENAME, "__NAME__", "__NAME__s"); /** * Creates an instance of __NAME__ in db-context * * @param db the db-context */ public __NAME__(ContextDb db) { super(db); } /** * Creates an instance of __NAME__ without db-context */ public __NAME__() { this(null); } /** * Gets the string representation of the object. * This is usually a unique attribute of the object. * * @return the string value */ @Override public String toString() { // return ???; } // /** // * Gets the string representation in an object tree (AppDbObjectTree). // * This is usually toString() plus some extra information. // * // * @return the string value // */ // @Override // public String getTreeText() { // return toString() + ...; // } // /** // * Gets the tooltip text in an object tree (AppDbObjectTree). // * This is usually getTreeText() plus some extra information. // * Newlines are allowed. // * // * @return the tooltip text // */ // @Override // public String getToolTipText() { // return getTreeText() + ...; // } // /** // * Gets the icon displayed in an object tree. // * // * @return the icon // */ // @Override // public ImageIcon getIcon() { // return ImageFactory.???Icon; // } // /** // * Gets the Plugin for the QBF-Search-Dialog. // * // * @return the plugin initialized in db-context // */ // @Override // public QbfPlugin makeQbfPlugin() { // return new __NAME__QbfPlugin(getContextDb()); // } // // // /** // * Presets the QBF-Searchparameter using current object as a template. // * // * @param qbfPar the QBF-Parameter // */ // @Override // public void presetQbfParameter(QbfParameter qbfPar) { // __NAME__QbfParameter par = (__NAME__QbfParameter)qbfPar; // par.??? = ???; // ... // } // /** // * Defines whether a panel to edit/show the object exists. // * // * @return true if a panel exists, false if no such panel // */ // @Override // public boolean panelExists() { // return true; // } // // /** // * Gets the panel to edit/show the object. // * // * @return the panel initialized with this object // */ // @Override // public FormContainer newPanel() { // return new __NAME__Panel(this); // } // /** // * Gets a list of child objects, i.e. objects that are to // * be displayed as subnodes in a tree. // * // * @return the list of childs, null = no childs (default) // */ // @Override // public List getTreeChildObjects() { // List list = super.getTreeChildObjects(); // if (getDb().isRemote() == false) { // list.add(...); // } // return list; // } // /** // * Gets the list of child objects for a given class. // * This is an optimization for generating column-trees. // * // * @param clazz the class to extract child nodes for // * @return the list of child-objects for that class // */ // @Override // public List extractTreePathObjects(Class clazz) { // List list = super.extractTreePathObjects(clazz); // if (getDb().isRemote() == false) { // if (clazz == XXX.class) { // list.addAll(...); // } // else if (clazz == YYY.class) { // ... // } // } // return list; // } // /** // * overwritten to enable getTreeParentObjects(). // * @return true if object allows visualization of parent objects in trees // */ // public boolean allowsTreeParentObjects() { // return true; // } // // /** // * Gets all parent objects, i.e. objects referring to this object. // * // * @return the list of parent objects // */ // public List getTreeParentObjects() { // if (getDb().isRemote()) return super.getTreeParentObjects(); // execute this method on server // List list = super.getTreeParentObjects(); // if (...) { // list.add(...); // } // return list; // } // /** // * Gets the name of the FormTable used as a key to the preferences. // * // * @return the name // */ // @Override // public String getFormTableName() { // return getTableName() + "Table"; // } // // /** // * Gets the FormTableEntry initialized with current object. // * // * @return the table entry // */ // @Override // public FormTableEntry getFormTableEntry() { // return new __NAME__TableEntry(this); // } // /** // * Defines management of the tableserial. // * // * @return true if object is managing the tableserial // */ // @Override // public boolean isTableSerialValid() { // return true; // } // /** // * Checks whether object is referenced by other objects. // * // * @return true if object is referenced // */ // @Override // public boolean isReferenced() { // return false; // } // /** // * Gets the "order-by"-suffix for standard queries. // * // * @return the sql-string following "ORDER BY ", // * null if no order-by-clause necessary. // */ // public String orderBy() { // return FIELD_...; // } /** * Selects a __NAME__-object by id. * * @param id the object id * @return the __NAME__ object */ @Override public __NAME__ select (long id) { return (__NAME__)super.select(id); } /** * Wurblet generates code for history. * * \@wurblet history AppDbHistory */ /** * Wurblet generates code for caching. * * \@wurblet cache AppDbCache $mapping * \@wurblet cache AppDbCache $mapping --preload * \@wurblet cache AppDbCache $mapping --preload */ /** * Prepares the insert statement. * * @return the statement id */ @Override public int prepareInsertStatement () { // @wurblet insert DbInsert $mapping return stmtId; } /** * Prepares the update statement. * * @return the statement id */ @Override public int prepareUpdateStatement () { // @wurblet update DbUpdate $mapping return stmtId; } /** * Gets all fields from a result set. * * @param rs the result set * @return true if all fields read, false if not (e.g. invalid row) */ @Override public boolean getFields (ResultSetWrapper rs) { // @wurblet getfields DbGetFields $mapping return true; } /** * Prepares the fields before setFields(). * * @return true if preparation done, false if some error. */ @Override public boolean prepareSetFields() { // setNormText(StringHelper.normalize(...)); return true; } /** * Sets the fields in the prepared statement for insert and update. * * @param st the prepared statement * @return the number of fields */ @Override public int setFields (PreparedStatementWrapper st) { // @wurblet setfields DbSetFields $mapping return ndx; } /** * Gets the class variables. * * @return the static variables for this class */ @Override public AppDbObjectClassVariables getAppDbObjectClassVariables() { return classVariables; } /** * Wurblet generates methods to implement the relations to other objects. * * @wurblet relations AppDbRelations $mapping $relations */ /** * Wurblet generates accessor methods to the objects attributes. * * @wurblet methods DbMethods $mapping */ /** * Wurblet generates the declarations of the attributes. * * @wurblet declare DbDeclare $mapping */ /** * Wurblet generates the fieldnames of the attributes. * * @wurblet fieldnames DbFieldNames $mapping */ /** * Wurblet generates the field-lengths of the attributes. * * @wurblet fieldlengths DbFieldLengths $mapping */ }