/** * Get the state of this boolean field. * @return true if true, false if not boolean or null. */ public boolean getState() // init this field override for other value { if (this.getDataClass() == Boolean.class) { Boolean objData = (Boolean)this.getData(); if (objData != null) return objData.booleanValue(); } return false; } /**
/** * Get the start time of this service. */ public Date getStartDate() { return (Date)this.getField(BookingDetail.DETAIL_DATE).getData(); } /**
/** * Is this field null? * @return true if the data is null or the current length is 0. */ public boolean isNull() { if (this.getData() == null) return true; return (this.getLength() == 0); } /**
/** * Retrieve (in string format) from this field. * @return This field converted to a string. */ public String getString() { try { return Converter.formatObjectToString(this.getData(), this.getDataClass(), this.getDefault()); } catch (Exception ex) { return null; } } /**
/** * Get the status of this object. */ public int getStatus() { Integer intStatus = (Integer)this.getField(BookingDetail.STATUS_SUMMARY).getData(); if (intStatus == null) return 0; return intStatus.intValue(); } /**
/** * Utility method to add the data in this screen field to this key in the property object. */ public void addScreenFieldProperty(Map properties, String strFieldName, String strKey) { properties.put(strKey, this.getFieldList().getField(strFieldName).getData()); } /**
/** * Compare this fields with the next data in the buffer. * This is a utility method that compares the record. * @param field The target field. * @return True if they are equal. */ public boolean compareNextToField(FieldInfo field) // Must be to call right Get calls { Object objNext = this.getNextData(); if (objNext == DATA_ERROR) return false; // EOF if (objNext == DATA_EOF) return false; // EOF if (objNext == DATA_SKIP) return true; // Don't set this field Object objField = field.getData(); if ((objNext == null) || (objField == null)) { if ((objNext == null) && (objField == null)) return true; return false; } return objNext.equals(objField); } /**
/** * 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 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(); } /**
/** * Get the ending time of this service. */ public Date getEndDate() { Date date = (Date)this.getField(BookingDetail.DETAIL_END_DATE).getData(); if (date == null) return this.getStartDate(); return date; } /**
/** * Markup this cost using the current markup percentages. * @param dCost * @return */ public double markupThisCost(double dCost) { if (this.isUsingPricingScreens()) return 0.00; // Can't get price from cost FieldList recBooking = this.getFieldList(); double dMarkup = ((Double)recBooking.getField(Booking.MARKUP).getData()).doubleValue(); double dCommission = 0; //((Double)recBooking.getFieldInfo(Booking.STD_COMMISSION).getData()).doubleValue(); return Math.floor(((dCost * (1 + dMarkup)) / (1 - dCommission)) * 100 + 0.5) / 100; } }
/** * Set up the key area indicated. * <br />Note: The thin implementation is completely different from the thick implementation * here, the areadesc is ignored and the thin data data area is set up instead. * @param destBuffer (Always ignored for the thin implementation). * @param iAreaDesc (Always ignored for the thin implementation). */ public void setupKeyBuffer(BaseBuffer destBuffer, int iAreaDesc) { int iKeyFields = this.getKeyFields(); m_rgobjTempData = new Object[iKeyFields]; for (int iKeyFieldSeq = Constants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFields + Constants.MAIN_KEY_FIELD; iKeyFieldSeq++) { m_rgobjTempData[iKeyFieldSeq] = this.getField(iKeyFieldSeq).getData(); } } /**
/** * Add this field to the buffer. * @param field The field to add to this buffer. */ public void addNextField(FieldInfo field) { if (((m_iFieldsTypes & MODIFIED_ONLY) == MODIFIED_ONLY) && (!field.isModified())) this.addNextData(DATA_SKIP); else this.addNextData(field.getData()); } /**
/** * */ private void copyFieldList(FieldList fieldList, FieldList item) { for (int i = 0; i < item.getFieldCount(); i++) { FieldInfo fldSource = item.getField(i); FieldInfo fldDest = fieldList.getField(i); fldDest.setData(fldSource.getData(), Constants.DISPLAY, Constants.READ_MOVE); } } /**
/** * Move data to this field from another field. * If the data types are the same data is moved, otherwise a string conversion is done. * @param field The source field. * @param bDisplayOption If true, display changes. * @param iMoveMode The move mode. * @return The error code (or NORMAL_RETURN). */ public int moveFieldToThis(FieldInfo field, boolean bDisplayOption, int iMoveMode) { // Copy a field to this if (this.isSameType(field)) { // Same type, just move the info Object data = field.getData(); return this.setData(data, bDisplayOption, iMoveMode); } else { // Different type... convert to text first String tempString = field.getString(); return this.setString(tempString, bDisplayOption, iMoveMode); } } /**
/** * Move data to this field from another field. * If the data types are the same data is moved, otherwise a string conversion is done. * @param field The source field. * @param bDisplayOption If true, display changes. * @param iMoveMode The move mode. * @return The error code (or NORMAL_RETURN). */ public int moveFieldToThis(FieldInfo field, boolean bDisplayOption, int iMoveMode) { // Copy a field to this if (this.isSameType(field)) { // Same type, just move the info Object data = field.getData(); return this.setData(data, bDisplayOption, iMoveMode); } else { // Different type... convert to text first String tempString = field.getString(); return this.setString(tempString, bDisplayOption, iMoveMode); } } /**
/** * Move data to this field from another field. * If the data types are the same data is moved, otherwise a string conversion is done. * @param field The source field. * @param bDisplayOption If true, display changes. * @param iMoveMode The move mode. * @return The error code (or NORMAL_RETURN). */ public int moveFieldToThis(FieldInfo field, boolean bDisplayOption, int iMoveMode) { // Copy a field to this if (this.isSameType(field)) { // Same type, just move the info Object data = field.getData(); return this.setData(data, bDisplayOption, iMoveMode); } else { // Different type... convert to text first String tempString = field.getString(); return this.setString(tempString, bDisplayOption, iMoveMode); } } /**
public void done() { // 'Please wait...' is done displaying String strCommand = "addTourDetail"; Map<String,Object> properties = new HashMap<String,Object>(); properties.put(TourHeader.TOUR_HEADER_FILE, m_recTourHeader.getCounterField().getData()); properties.put(m_recTour.getField(TourModel.DEPARTURE_DATE).getFieldName(), m_recTour.getField(TourModel.DEPARTURE_DATE).getData()); Object objReturn; try { objReturn = ((Record)m_recBooking).handleRemoteCommand(strCommand, properties); } catch (RemoteException e) { e.printStackTrace(); objReturn = Boolean.FALSE; } catch (DBException e) { e.printStackTrace(); objReturn = Boolean.FALSE; } if (Boolean.FALSE.equals(objReturn)) { BookingAnswerModel recBookingAnswer = null; // This causes addTourDetail to resolve the answers automatically BookingPaxModel recBookingPax = null; Date dateStart = ((DateTimeField)m_recTour.getField(TourModel.DEPARTURE_DATE)).getDateTime(); // Use tour departure date. ((BookingModel)m_recBooking).addTourDetail(m_recTour, m_recTourHeader, recBookingPax, recBookingAnswer, dateStart, m_recBooking.getField(BookingModel.ASK_FOR_ANSWER)); } } };
public void done() { // 'Please wait...' is done displaying String strCommand = "addTourDetail"; Map<String,Object> properties = new HashMap<String,Object>(); properties.put(TourHeader.TOUR_HEADER_FILE, m_recTourHeader.getCounterField().getData()); properties.put(m_recTour.getField(TourModel.DEPARTURE_DATE).getFieldName(), m_recTour.getField(TourModel.DEPARTURE_DATE).getData()); Object objReturn; try { objReturn = ((Record)m_recBooking).handleRemoteCommand(strCommand, properties); } catch (RemoteException e) { e.printStackTrace(); objReturn = Boolean.FALSE; } catch (DBException e) { e.printStackTrace(); objReturn = Boolean.FALSE; } if (Boolean.FALSE.equals(objReturn)) { BookingAnswerModel recBookingAnswer = null; // This causes addTourDetail to resolve the answers automatically BookingPaxModel recBookingPax = null; Date dateStart = ((DateTimeField)m_recTour.getField(TourModel.DEPARTURE_DATE)).getDateTime(); // Use tour departure date. ((BookingModel)m_recBooking).addTourDetail(m_recTour, m_recTourHeader, recBookingPax, recBookingAnswer, dateStart, m_recBooking.getField(BookingModel.ASK_FOR_ANSWER)); } } };