/** * Get the main (base) record for this table. * Same as getFieldList, but casts the class to Record. * @return The record. */ public Record getRecord() { return (Record)super.getRecord(); } /**
/** * Get the main (base) record for this table. * Same as getFieldList, but casts the class to Record. * @return The record. */ public Record getRecord() { return (Record)super.getRecord(); } /**
/** * Get the main (base) record for this table. * Same as getFieldList, but casts the class to Record. * @return The record. */ public Record getRecord() { return (Record)super.getRecord(); } /**
/** * Get the next record (return a null at EOF). * Note: Remember to set the data source before returning a NORMAL_RETURN. * @param iRelPosition The relative records to move. * @return A record status (NORMAL_RETURN means the move was successful). */ public int doMove(int iRelPosition) throws DBException { this.getRecord().setEditMode(Constants.EDIT_NONE); return Constants.ERROR_RETURN; // You better override this. } /**
/** * Close the file. * Reset the current position. */ public void close() { m_bIsOpen = false; this.getRecord().setEditMode(Constants.EDIT_NONE); } /**
/** * Look up this string in the resource table. * This is a convience method - calls getString in the task. * @param string The string key. * @return The local string (or the key if the string doesn't exist). */ public String getString(String string) { if (this.getRecord() != null) if (this.getRecord().getTask() != null) string = this.getRecord().getTask().getString(string); return string; } /**
/** * Reposition to this record Using this bookmark. * @param Object bookmark Bookmark. * @param int iHandleType Type of handle (see getHandle). * @exception FILE_NOT_OPEN. * @return record if found/null - record not found. */ public FieldList setHandle(Object bookmark, int iHandleType) throws DBException { if (this.doSetHandle(bookmark, iHandleType)) return this.getRecord(); else return null; } /**
/** * Remove the current record. */ public void remove() throws DBException { if ((this.getRecord().getEditMode() != Constants.EDIT_CURRENT) && ((this.getRecord().getEditMode() != Constants.EDIT_IN_PROGRESS))) throw new DBException(Constants.INVALID_RECORD); this.doRemove(); this.getRecord().setEditMode(Constants.EDIT_NONE); } /**
/** * Get the status of this object. */ public Object getFieldData(String strFieldName) { FieldInfo fieldInfo = m_table.getRecord().getField(strFieldName); if (fieldInfo != null) return fieldInfo.getData(); return null; } /**
/** * Get this field (or return null if this field doesn't belong on the screen). * This is the method to use to filter the items to display on the screen. */ public Convert getFieldInfo(int iIndex) { FieldList fieldList = m_table.getRecord(); if (iIndex == TOUR_DAYS_COLUMN) return fieldList.getField(TourHeader.DAYS); return super.getFieldInfo(iIndex); } /**
/** * Reposition to this record using this bookmark. * @param bookmark The handle to use to position the record. * @param iHandleType The type of handle (DATA_SOURCE/OBJECT_ID,OBJECT_SOURCE,BOOKMARK). * @return - true - record found/false - record not found * @exception FILE_NOT_OPEN. * @exception DBException File exception. */ public boolean doSetHandle(Object bookmark, int iHandleType) throws DBException { String strCurrentOrder = this.getRecord().getKeyName(); this.getRecord().setKeyArea(Constants.PRIMARY_KEY); this.getRecord().getCounterField().setData(bookmark); boolean bSuccess = this.seek(Constants.EQUALS); this.getRecord().setKeyArea(strCurrentOrder); return bSuccess; } /**
/** * Get a unique object that can be used to reposition to this record. * @exception FILE_NOT_OPEN. * @exception INVALID_RECORD - There is no current record. */ public Object getHandle(int iHandleType) throws DBException { return this.getRecord().getCounterField().getData(); } /**
/** * Reset the current position and open the file. * Note: This is called automatically on your first file access. */ public void open() throws DBException { m_bIsOpen = true; this.getRecord().setEditMode(Constants.EDIT_NONE); this.setDataSource(null); } /**
/** * Set up the raw data key areas. * @param table The table. * @exception DBException File exception. */ public void initKeyAreas(FieldTable table) throws DBException { if (m_VKeyList == null) { m_VKeyList = new Vector<PKeyArea>(); // Now, copy the keys for (int iKeyArea = Constants.MAIN_KEY_AREA; iKeyArea <= table.getRecord().getKeyAreaCount() + Constants.MAIN_KEY_AREA - 1; iKeyArea++) { this.makePKeyArea(table); } } } /**
/** * Get this field (or return null if this field doesn't belong on the screen). * This is the method to use to filter the items to display on the screen. */ public Convert getFieldInfo(int iIndex) { FieldList fieldList = m_table.getRecord(); switch (iIndex) { case COLUMN_COUNT: return fieldList.getField(Hotel.DOUBLE_PRICE_LOCAL); } return super.getFieldInfo(iIndex); } }
/** * Set the current record to this (new) record. * NOTE: In the thin model, it is not necessary to call edit() before set. * @exception Throws an exception if there is no current record. */ public void set(Rec record) throws DBException { if ((this.getRecord().getEditMode() != Constants.EDIT_CURRENT) && ((this.getRecord().getEditMode() != Constants.EDIT_IN_PROGRESS))) throw new DBException(Constants.INVALID_RECORD); m_record = (FieldList)record; this.fieldsToData(record); this.doSet(record); this.setDataSource(null); this.getRecord().setEditMode(Constants.EDIT_NONE); } /**
/** * Add this record to this table. * Add this record to the table and set the current edit mode to NONE. * @param record The record to add. * @throws Exception */ public void add(Rec record) throws DBException { if (this.getRecord().getEditMode() != Constants.EDIT_ADD) throw new DBException(Constants.INVALID_RECORD); m_record = (FieldList)record; this.fieldsToData(record); this.doAdd(record); this.setDataSource(null); this.getRecord().setEditMode(Constants.EDIT_NONE); } /**
/** * Get this field (or return null if this field doesn't belong on the screen). * This is the method to use to filter the items to display on the screen. */ public Convert getFieldInfo(int iIndex) { FieldList fieldList = m_table.getRecord(); switch (iIndex) { case COLUMN_COUNT: return fieldList.getField(Land.PMC_PRICE_HOME); case COLUMN_COUNT + 1: return fieldList.getField(Land.SIC_PRICE_HOME); } return super.getFieldInfo(iIndex); } }
/** * Delete this record. * @param table The table. * @exception DBException File exception. */ public synchronized void remove(FieldTable table) throws DBException { BaseBuffer bufferOld = (BaseBuffer)table.getDataSource(); // same as .getHandle(Constants.DATA_SOURCE_HANDLE); for (int iKeyArea = Constants.MAIN_KEY_AREA; iKeyArea < table.getRecord().getKeyAreaCount() + Constants.MAIN_KEY_AREA; iKeyArea++) { // Delete the current key. KeyAreaInfo keyArea = table.getRecord().getKeyArea(iKeyArea); keyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA); this.getPKeyArea(iKeyArea).doRemove(table, table.getRecord().getKeyArea(iKeyArea), bufferOld); } bufferOld.free(); // Get rid of the old one table.setDataSource(null); // same as .doSetHandle(null, Constants.DATA_SOURCE_HANDLE); } /**