/** * Creates a new object of the same class as this object. * @return a clone of this instance. * @exception CloneNotSupportedException if the object's class does not support the <code>Cloneable</code> interface. * @see java.lang.Cloneable */ public Object clone() throws CloneNotSupportedException { BaseField field = new IntegerField(null, m_strFieldName, m_iMaxLength, m_strFieldDesc, null); field.setRecord(m_record); // Set table without adding to table field list return field; } /**
/** * Initialize class fields. */ public void init(Record record, String strName, int iDataLength, String strDesc, Object strDefault) { super.init(record, strName, iDataLength, strDesc, strDefault); } /**
/** * Get the Value of this field as a double. * @return The value of this field. */ public double getValue() { // Get this field's value Integer longField = (Integer)this.getData(); // Get the physical data if (longField == null) return 0; return (double)longField.intValue(); } /*
/** * Move the physical binary data to this SQL parameter row. * @param resultset The resultset to get the SQL data from. * @param iColumn the column in the resultset that has my data. * @exception SQLException From SQL calls. */ public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException { int sResult = resultset.getInt(iColumn); if (resultset.wasNull()) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else { if ((!this.isNullable()) && (sResult == NAN)) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else this.setValue(sResult, false, DBConstants.READ_MOVE); } } /**
/** * Compare field to this and return < > or = (-,+,0). * @return The compare value. */ public int compareTo(Field field) { if (field instanceof BaseField) if (!this.isSameType((BaseField)field)) return super.compareTo(field); int long1 = Integer.MIN_VALUE, long2 = Integer.MIN_VALUE; Integer tempLong = (Integer)this.getData(); // Get the physical data if (tempLong != null) long1 = tempLong.intValue(); tempLong = (Integer)field.getData(); // Get the physical data if (tempLong != null) long2 = tempLong.intValue(); if (long1 == long2) return 0; if (long1 < long2) return -1; else return 1; } /**
/** * Set the user ID. * @param iChangeType * @param bDisplayOption The display option. * @return The error code. */ public int setUserID(int iChangeType, boolean bDisplayOption) { int iErrorCode = DBConstants.NORMAL_RETURN; IntegerField thisField = (IntegerField)this.getOwner().getField(m_iFieldSeq); int iUserID = -1; if (this.getOwner().getRecordOwner() != null) if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()) != null) if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID() != null) if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID().length() > 0) iUserID = Integer.parseInt(((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID()); boolean bOldModified = thisField.isModified(); boolean[] rgbEnabled = null; if (iChangeType == DBConstants.INIT_MOVE) rgbEnabled = thisField.setEnableListeners(false); iErrorCode = thisField.setValue(iUserID, bDisplayOption, iChangeType); if (iChangeType == DBConstants.INIT_MOVE) { // Don't change the record on an init thisField.setEnableListeners(rgbEnabled); thisField.setModified(bOldModified); } return iErrorCode; } }
if (((BaseApplication)this.getOwner().getRecord().getRecordOwner().getTask().getApplication()).getUserID().length() > 0) iUserID = Integer.parseInt(((BaseApplication)this.getOwner().getRecord().getRecordOwner().getTask().getApplication()).getUserID()); // File written or updated, set the user name int iErrorCode = thisField.setValue(iUserID, bDisplayOption, DBConstants.SCREEN_MOVE); if (iMoveMode == DBConstants.INIT_MOVE) thisField.setModified(false); // Don't make this record modified just because I set this field. return iErrorCode;
case DBConstants.UPDATE_TYPE: IntegerField thisField = (IntegerField)this.getOwner().getField(m_UserIDFieldSeq); thisField.setValue(m_CurrentUserID, bDisplayOption, DBConstants.SCREEN_MOVE); // File written or updated, set the update date break;
/** * Set this field to the maximum or minimum value. * @param iAreaDesc END_SELECT_KEY means set to largest value, others mean smallest. */ public void setToLimit(int iAreaDesc) // Set this field to the largest or smallest value { // By default compare as ASCII strings Integer tempLong = MIN; // Lowest value if (iAreaDesc == DBConstants.END_SELECT_KEY) tempLong = MAX; // Highest value this.doSetData(tempLong, DBConstants.DONT_DISPLAY, DBConstants.SCREEN_MOVE); } /**
/** * Do I skip getting/putting this field into the SQL param list? * For counters, you NEVER write the value, except in the following rare case: * <br/>1. Autosequence is not supported in the database. * <br/>2. You are doing the first insert (where you are bumping the counter for a valid value). * @param iType The type of SQL statement (UPDATE/INSERT/etc). * @return true To skip this param (ie., skip insert field if not modified). */ public boolean getSkipSQLParam(int iType) { boolean bSkip = super.getSkipSQLParam(iType); // Don't skip this if (bSkip) return bSkip; // If super says skip, definitely skip if ((iType == DBConstants.SQL_INSERT_TABLE_TYPE) || (iType == DBConstants.SQL_INSERT_VALUE_TYPE)) { if (this.getRecord().getTable() != null) if (this.getRecord().getTable().getDatabase() != null) if (!this.getRecord().getTable().getDatabase().isAutosequenceSupport()) return false; // Special case - autocounters not supported. return true; // Skip auto sequence inserts } return false; // For other query types, don't skip } }
/** * Move the physical binary data to this SQL parameter row. * @param resultset The resultset to get the SQL data from. * @param iColumn the column in the resultset that has my data. * @exception SQLException From SQL calls. */ public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException { int sResult = resultset.getInt(iColumn); if (resultset.wasNull()) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else { if ((!this.isNullable()) && (sResult == NAN)) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else this.setValue(sResult, false, DBConstants.READ_MOVE); } } /**
/** * Set the user ID. * @param iChangeType * @param bDisplayOption The display option. * @return The error code. */ public int setUserID(int iChangeType, boolean bDisplayOption) { int iErrorCode = DBConstants.NORMAL_RETURN; IntegerField thisField = (IntegerField)this.getOwner().getField(m_iFieldSeq); int iUserID = -1; if (this.getOwner().getRecordOwner() != null) if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()) != null) if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID() != null) if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID().length() > 0) iUserID = Integer.parseInt(((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID()); boolean bOldModified = thisField.isModified(); boolean[] rgbEnabled = null; if (iChangeType == DBConstants.INIT_MOVE) rgbEnabled = thisField.setEnableListeners(false); iErrorCode = thisField.setValue(iUserID, bDisplayOption, iChangeType); if (iChangeType == DBConstants.INIT_MOVE) { // Don't change the record on an init thisField.setEnableListeners(rgbEnabled); thisField.setModified(bOldModified); } return iErrorCode; } }
/** * Compare field to this and return < > or = (-,+,0). * @return The compare value. */ public int compareTo(Field field) { if (field instanceof BaseField) if (!this.isSameType((BaseField)field)) return super.compareTo(field); int long1 = Integer.MIN_VALUE, long2 = Integer.MIN_VALUE; Integer tempLong = (Integer)this.getData(); // Get the physical data if (tempLong != null) long1 = tempLong.intValue(); tempLong = (Integer)field.getData(); // Get the physical data if (tempLong != null) long2 = tempLong.intValue(); if (long1 == long2) return 0; if (long1 < long2) return -1; else return 1; } /**
if (((BaseApplication)this.getOwner().getRecord().getRecordOwner().getTask().getApplication()).getUserID().length() > 0) iUserID = Integer.parseInt(((BaseApplication)this.getOwner().getRecord().getRecordOwner().getTask().getApplication()).getUserID()); // File written or updated, set the user name int iErrorCode = thisField.setValue(iUserID, bDisplayOption, DBConstants.SCREEN_MOVE); if (iMoveMode == DBConstants.INIT_MOVE) thisField.setModified(false); // Don't make this record modified just because I set this field. return iErrorCode;
/** * Set this field to the maximum or minimum value. * @param iAreaDesc END_SELECT_KEY means set to largest value, others mean smallest. */ public void setToLimit(int iAreaDesc) // Set this field to the largest or smallest value { // By default compare as ASCII strings Integer tempLong = MIN; // Lowest value if (iAreaDesc == DBConstants.END_SELECT_KEY) tempLong = MAX; // Highest value this.doSetData(tempLong, DBConstants.DONT_DISPLAY, DBConstants.SCREEN_MOVE); } /**
/** * Do I skip getting/putting this field into the SQL param list? * For counters, you NEVER write the value, except in the following rare case: * <br/>1. Autosequence is not supported in the database. * <br/>2. You are doing the first insert (where you are bumping the counter for a valid value). * @param iType The type of SQL statement (UPDATE/INSERT/etc). * @return true To skip this param (ie., skip insert field if not modified). */ public boolean getSkipSQLParam(int iType) { boolean bSkip = super.getSkipSQLParam(iType); // Don't skip this if (bSkip) return bSkip; // If super says skip, definitely skip if ((iType == DBConstants.SQL_INSERT_TABLE_TYPE) || (iType == DBConstants.SQL_INSERT_VALUE_TYPE)) { if (this.getRecord().getTable() != null) if (this.getRecord().getTable().getDatabase() != null) if (!this.getRecord().getTable().getDatabase().isAutosequenceSupport()) return false; // Special case - autocounters not supported. return true; // Skip auto sequence inserts } return false; // For other query types, don't skip } }
/** * Creates a new object of the same class as this object. * @return a clone of this instance. * @exception CloneNotSupportedException if the object's class does not support the <code>Cloneable</code> interface. * @see java.lang.Cloneable */ public Object clone() throws CloneNotSupportedException { BaseField field = new IntegerField(null, m_strFieldName, m_iMaxLength, m_strFieldDesc, null); field.setRecord(m_record); // Set table without adding to table field list return field; } /**
/** * Initialize class fields. */ public void init(Record record, String strName, int iDataLength, String strDesc, Object strDefault) { super.init(record, strName, iDataLength, strDesc, strDefault); } /**
/** * Move the physical binary data to this SQL parameter row. * @param resultset The resultset to get the SQL data from. * @param iColumn the column in the resultset that has my data. * @exception SQLException From SQL calls. */ public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException { int sResult = resultset.getInt(iColumn); if (resultset.wasNull()) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else { if ((!this.isNullable()) && (sResult == NAN)) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else this.setValue(sResult, false, DBConstants.READ_MOVE); } } /**
/** * Get the Value of this field as a double. * @return The value of this field. */ public double getValue() { // Get this field's value Integer longField = (Integer)this.getData(); // Get the physical data if (longField == null) return 0; return (double)longField.intValue(); } /*