/** * Change the date and time of day. * @param date The date to set. * @param bDisplayOption Display changed fields if true. * @param iMoveMode The move mode. * @return The error code (or NORMAL_RETURN). */ public int setDateTime(java.util.Date date, boolean bDisplayOption, int iMoveMode) { if (date != null) return this.setValue(date.getTime(), bDisplayOption, iMoveMode); else return this.setData(null, bDisplayOption, iMoveMode); } /**
/** * Change the date and time of day. * @param date The date to set. * @param bDisplayOption Display changed fields if true. * @param iMoveMode The move mode. * @return The error code (or NORMAL_RETURN). */ public int setDateTime(java.util.Date date, boolean bDisplayOption, int iMoveMode) { if (date != null) return this.setValue(date.getTime(), bDisplayOption, iMoveMode); else return this.setData(null, bDisplayOption, iMoveMode); } /**
/** * Move the physical binary data to this SQL parameter row. * This method uses the getTimestamp resultset method. * @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 { java.util.Date dateResult = resultset.getTimestamp(iColumn); if (resultset.wasNull()) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else this.setValue((double)dateResult.getTime(), false, DBConstants.READ_MOVE); } /**
/** * Change the date and time of day. * @param date The date to set. * @param bDisplayOption Display changed fields if true. * @param iMoveMode The move mode. * @return The error code (or NORMAL_RETURN). */ public int setDateTime(java.util.Date date, boolean bDisplayOption, int iMoveMode) { if (date != null) return this.setValue(date.getTime(), bDisplayOption, iMoveMode); else return this.setData(null, bDisplayOption, iMoveMode); } /**
/** * Move the physical binary data to this SQL parameter row. * This method uses the getTimestamp resultset method. * @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 { java.util.Date dateResult = resultset.getTimestamp(iColumn); if (resultset.wasNull()) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else this.setValue((double)dateResult.getTime(), false, DBConstants.READ_MOVE); } /**
/** * Move the physical binary data to this SQL parameter row. * This method uses the getTimestamp resultset method. * @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 { java.util.Date dateResult = resultset.getTimestamp(iColumn); if (resultset.wasNull()) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else this.setValue((double)dateResult.getTime(), false, DBConstants.READ_MOVE); } /**
/** * Set the date field to the current time. * Also make sure the time is not the same as it is currently. */ public void setTheDate() { boolean[] rgbEnabled = m_field.setEnableListeners(false); Calendar calAfter = m_field.getCalendar(); Calendar calBefore = m_field.getCalendar(); m_field.setValue(DateTimeField.currentTime(), DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // File written or updated, set the update date calAfter = m_field.getCalendar(); if (calBefore != null) if (calAfter.before(calBefore)) calAfter = calBefore; // If this was set with a different computer (clock), make sure it always increases! if (calAfter != null) if (calAfter.equals(calBefore)) { calAfter.add(Calendar.SECOND, 1); // Can't be the same as last time. m_field.setCalendar(calAfter, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } Utility.getLogger().info("Set date: " + m_field.toString()); m_field.setEnableListeners(rgbEnabled); } /**
/** * Set the date field to the current time. * Also make sure the time is not the same as it is currently. */ public void setTheDate() { boolean[] rgbEnabled = m_field.setEnableListeners(false); Calendar calAfter = m_field.getCalendar(); Calendar calBefore = m_field.getCalendar(); m_field.setValue(DateTimeField.currentTime(), DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // File written or updated, set the update date calAfter = m_field.getCalendar(); if (calBefore != null) if (calAfter.before(calBefore)) calAfter = calBefore; // If this was set with a different computer (clock), make sure it always increases! if (calAfter != null) if (calAfter.equals(calBefore)) { calAfter.add(Calendar.SECOND, 1); // Can't be the same as last time. m_field.setCalendar(calAfter, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } Utility.getLogger().info("Set date: " + m_field.toString()); m_field.setEnableListeners(rgbEnabled); } /**
/** * Set the date field to the current time. * Also make sure the time is not the same as it is currently. */ public void setTheDate() { boolean[] rgbEnabled = m_field.setEnableListeners(false); Calendar calAfter = m_field.getCalendar(); Calendar calBefore = m_field.getCalendar(); m_field.setValue(DateTimeField.currentTime(), DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // File written or updated, set the update date calAfter = m_field.getCalendar(); if (calBefore != null) if (calAfter.before(calBefore)) calAfter = calBefore; // If this was set with a different computer (clock), make sure it always increases! if (calAfter != null) if (calAfter.equals(calBefore)) { calAfter.add(Calendar.SECOND, 1); // Can't be the same as last time. m_field.setCalendar(calAfter, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } Utility.getLogger().info("Set date: " + m_field.toString()); m_field.setEnableListeners(rgbEnabled); } /**
/** * Called when a change is the record status is about to happen/has happened. * This method sets the field to the current time on an add or update. * @param field If this file change is due to a field, this is the field. * @param iChangeType The type of change that occurred. * @param bDisplayOption If true, display any changes. * @return an error code. */ public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Write/Update a record switch (iChangeType) { case DBConstants.REFRESH_TYPE: case DBConstants.ADD_TYPE: case DBConstants.UPDATE_TYPE: DateTimeField thisField = m_field; if (m_field == null) thisField = (DateTimeField)this.getOwner().getField(m_iMainFilesFieldSeq); boolean[] rgbEnabled = thisField.setEnableListeners(false); thisField.setValue(DateTimeField.currentTime(), bDisplayOption, DBConstants.SCREEN_MOVE); // File written or updated, set the update date thisField.setEnableListeners(rgbEnabled); break; } return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record } }
/** * Called when a change is the record status is about to happen/has happened. * This method sets the field to the current time on an add or update. * @param field If this file change is due to a field, this is the field. * @param iChangeType The type of change that occurred. * @param bDisplayOption If true, display any changes. * @return an error code. */ public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Write/Update a record switch (iChangeType) { case DBConstants.REFRESH_TYPE: case DBConstants.ADD_TYPE: case DBConstants.UPDATE_TYPE: DateTimeField thisField = m_field; if (m_field == null) thisField = (DateTimeField)this.getOwner().getField(m_iMainFilesFieldSeq); boolean[] rgbEnabled = thisField.setEnableListeners(false); thisField.setValue(DateTimeField.currentTime(), bDisplayOption, DBConstants.SCREEN_MOVE); // File written or updated, set the update date thisField.setEnableListeners(rgbEnabled); break; } return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record } }
/** * Called when a change is the record status is about to happen/has happened. * This method sets the field to the current time on an add or update. * @param field If this file change is due to a field, this is the field. * @param iChangeType The type of change that occurred. * @param bDisplayOption If true, display any changes. * @return an error code. */ public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Write/Update a record switch (iChangeType) { case DBConstants.FIELD_CHANGED_TYPE: if (!onFieldChange) break; case DBConstants.REFRESH_TYPE: case DBConstants.ADD_TYPE: case DBConstants.UPDATE_TYPE: DateTimeField thisField = m_field; if (thisField == null) if (mainFilesFieldName != null) thisField = (DateTimeField)this.getOwner().getField(mainFilesFieldName); boolean[] rgbEnabled = thisField.setEnableListeners(false); thisField.setValue(DateTimeField.currentTime(), bDisplayOption, DBConstants.SCREEN_MOVE); // File written or updated, set the update date thisField.setEnableListeners(rgbEnabled); break; } return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record } }
/** * SetScreenFields Method. */ public void setScreenFields(Map<String,Object> properties) { super.setScreenFields(properties); Record recTourHeader = this.getMainRecord(); // Add the tour type filter String strTourType = (String)properties.get(SearchConstants.TOUR_TYPE); if (strTourType != null) { int sBitPosition = Integer.parseInt(strTourType); if (sBitPosition > 0) this.getScreenRecord().getField(TourHeaderScreenRecord.TOUR_TYPE).setValue(1 << sBitPosition); else strTourType = null; } if (strTourType == null) this.getScreenRecord().getField(TourHeaderScreenRecord.TOUR_TYPE).moveFieldToThis(this.getRecord(BookingControl.BOOKING_CONTROL_FILE).getField(BookingControl.THIN_TOUR_TYPE)); ((DateTimeField)this.getScreenRecord().getField(TourHeaderScreenRecord.START_DEPARTURE_DATE)).setValue(DateTimeField.todaysDate()); this.addThisRecordFilter(properties, Country.COUNTRY_FILE, JTreePanel.LOCATION, TourHeader.COUNTRY_ID, TourHeaderScreenRecord.COUNTRY_ID); this.addThisRecordFilter(properties, Region.REGION_FILE, JTreePanel.LOCATION, TourHeader.REGION_ID, TourHeaderScreenRecord.REGION_ID); } /**
/** * SetScreenFields Method. */ public void setScreenFields(Map<String,Object> properties) { super.setScreenFields(properties); Record recTourHeader = this.getMainRecord(); // Add the tour type filter String strTourType = (String)properties.get(SearchConstants.TOUR_TYPE); if (strTourType != null) { int sBitPosition = Integer.parseInt(strTourType); if (sBitPosition > 0) this.getScreenRecord().getField(TourHeaderScreenRecord.TOUR_TYPE).setValue(1 << sBitPosition); else strTourType = null; } if (strTourType == null) this.getScreenRecord().getField(TourHeaderScreenRecord.TOUR_TYPE).moveFieldToThis(this.getRecord(BookingControl.BOOKING_CONTROL_FILE).getField(BookingControl.THIN_TOUR_TYPE)); ((DateTimeField)this.getScreenRecord().getField(TourHeaderScreenRecord.START_DEPARTURE_DATE)).setValue(DateTimeField.todaysDate()); this.addThisRecordFilter(properties, Country.COUNTRY_FILE, JTreePanel.LOCATION, TourHeader.COUNTRY_ID, TourHeaderScreenRecord.COUNTRY_ID); this.addThisRecordFilter(properties, Region.REGION_FILE, JTreePanel.LOCATION, TourHeader.REGION_ID, TourHeaderScreenRecord.REGION_ID); } /**
/** * The Field has Changed. * @param bDisplayOption If true, display the change. * @param iMoveMode The type of move being done (init/read/screen). * @return The error code (or NORMAL_RETURN if okay). */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { // Read a valid record if (this.getOwner().getRecord().getField(m_iMainFilesFieldSeq) instanceof DateTimeField) { DateTimeField thisField = ((DateTimeField)this.getOwner().getRecord().getField(m_iMainFilesFieldSeq)); double dDate = 0; if (m_bMoveCurrentTime) dDate = DateField.currentTime(); else dDate = DateField.todaysDate(); int iErrorCode = thisField.setValue(dDate, bDisplayOption, iMoveMode); // File written or updated, set the update date if (iMoveMode == DBConstants.INIT_MOVE) thisField.setModified(false); // Don't make this record modified just because I set this field. return iErrorCode; } return DBConstants.NORMAL_RETURN; } }
/** * The Field has Changed. * @param bDisplayOption If true, display the change. * @param iMoveMode The type of move being done (init/read/screen). * @return The error code (or NORMAL_RETURN if okay). */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { // Read a valid record if (this.getOwner().getRecord().getField(m_iMainFilesFieldSeq) instanceof DateTimeField) { DateTimeField thisField = ((DateTimeField)this.getOwner().getRecord().getField(m_iMainFilesFieldSeq)); double dDate = 0; if (m_bMoveCurrentTime) dDate = DateField.currentTime(); else dDate = DateField.todaysDate(); int iErrorCode = thisField.setValue(dDate, bDisplayOption, iMoveMode); // File written or updated, set the update date if (iMoveMode == DBConstants.INIT_MOVE) thisField.setModified(false); // Don't make this record modified just because I set this field. return iErrorCode; } return DBConstants.NORMAL_RETURN; } }
/** * The Field has Changed. * @param bDisplayOption If true, display the change. * @param iMoveMode The type of move being done (init/read/screen). * @return The error code (or NORMAL_RETURN if okay). */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { // Read a valid record if (this.getOwner().getRecord().getField(m_iMainFilesFieldSeq) instanceof DateTimeField) { DateTimeField thisField = ((DateTimeField)this.getOwner().getRecord().getField(m_iMainFilesFieldSeq)); double dDate = 0; if (m_bMoveCurrentTime) dDate = DateField.currentTime(); else dDate = DateField.todaysDate(); int iErrorCode = thisField.setValue(dDate, bDisplayOption, iMoveMode); // File written or updated, set the update date if (iMoveMode == DBConstants.INIT_MOVE) thisField.setModified(false); // Don't make this record modified just because I set this field. return iErrorCode; } return DBConstants.NORMAL_RETURN; } }
((DateTimeField)recArTrx.getField(ArTrx.TRX_DATE)).setValue(dDate); recArTrx.getField(ArTrx.TRX_STATUS_ID).setValue(iInvoiceModification); recArTrx.getField(ArTrx.COMMENTS).moveFieldToThis(((ReferenceField)recArTrx.getField(ArTrx.TRX_STATUS_ID)).getReference().getField(TrxStatus.STATUS_DESC)); recArTrx.getField(ArTrx.AMOUNT).setValue(dCancellationCharge); dDate = dDate + 1000; // One second later ((DateTimeField)recArTrx.getField(ArTrx.TRX_DATE)).setValue(dDate); recArTrx.getField(ArTrx.TRX_STATUS_ID).setValue(iCancelTrxStatus); recArTrx.getField(ArTrx.COMMENTS).moveFieldToThis(((ReferenceField)recArTrx.getField(ArTrx.TRX_STATUS_ID)).getReference().getField(TrxStatus.STATUS_DESC)); recArTrx.getField(ArTrx.AMOUNT).setValue(dRefund); dDate = dDate + 1000; // One second later ((DateTimeField)recArTrx.getField(ArTrx.TRX_DATE)).setValue(dDate); recArTrx.getField(ArTrx.TRX_STATUS_ID).setValue(iRefundPendingTrxStatus); recArTrx.getField(ArTrx.COMMENTS).moveFieldToThis(((ReferenceField)recArTrx.getField(ArTrx.TRX_STATUS_ID)).getReference().getField(TrxStatus.STATUS_DESC));
((DateTimeField)recArTrx.getField(ArTrx.TRX_DATE)).setValue(dDate); recArTrx.getField(ArTrx.TRX_STATUS_ID).setValue(iInvoiceModification); recArTrx.getField(ArTrx.COMMENTS).moveFieldToThis(((ReferenceField)recArTrx.getField(ArTrx.TRX_STATUS_ID)).getReference().getField(TrxStatus.STATUS_DESC)); recArTrx.getField(ArTrx.AMOUNT).setValue(dCancellationCharge); dDate = dDate + 1000; // One second later ((DateTimeField)recArTrx.getField(ArTrx.TRX_DATE)).setValue(dDate); recArTrx.getField(ArTrx.TRX_STATUS_ID).setValue(iCancelTrxStatus); recArTrx.getField(ArTrx.COMMENTS).moveFieldToThis(((ReferenceField)recArTrx.getField(ArTrx.TRX_STATUS_ID)).getReference().getField(TrxStatus.STATUS_DESC)); recArTrx.getField(ArTrx.AMOUNT).setValue(dRefund); dDate = dDate + 1000; // One second later ((DateTimeField)recArTrx.getField(ArTrx.TRX_DATE)).setValue(dDate); recArTrx.getField(ArTrx.TRX_STATUS_ID).setValue(iRefundPendingTrxStatus); recArTrx.getField(ArTrx.COMMENTS).moveFieldToThis(((ReferenceField)recArTrx.getField(ArTrx.TRX_STATUS_ID)).getReference().getField(TrxStatus.STATUS_DESC));