org.jbundle.base.db.Record.setOpenMode()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(11.8k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中org.jbundle.base.db.Record.setOpenMode方法的一些代码示例,展示了Record.setOpenMode的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.setOpenMode方法的具体详情如下:
包路径:org.jbundle.base.db.Record
类名称:Record
方法名:setOpenMode

Record.setOpenMode介绍

暂无

代码示例

代码示例来源:origin: org.jbundle.base.screen/org.jbundle.base.screen.model

/**
 *  OpenMainFile Method.
 * @return The new main file.
 */
public Record openMainRecord()
{
  Record record = Record.makeRecordFromClassName(MenusModel.THICK_CLASS, this);
  record.setOpenMode(DBConstants.OPEN_READ_ONLY);   // This will optimize the cache when client is remote.
  return record;
}
/**

代码示例来源:origin: org.jbundle.base/org.jbundle.base

/**
 * 
 * @param bAddNewHeaderOnAdd
 */
public void setAddNewHeaderOnAdd(boolean bAddNewHeaderOnAdd)
{
  m_bAddNewHeaderOnAdd = bAddNewHeaderOnAdd;
  if (m_bAddNewHeaderOnAdd)
    if (this.getMainRecord() != null)
      this.getMainRecord().setOpenMode((this.getMainRecord().getOpenMode() | DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY));
}
/**

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.booking.db

/**
 * Write this record and re-read if (if it has been modified).
 * @return the bookmark.
 */
public Object writeAndRefresh() throws DBException
{
  Object bookmark = super.writeAndRefresh();
  Record recTour = ((ReferenceField)this.getField(Booking.TOUR_ID)).getReference();
  if (recTour != null)
    if ((recTour.getEditMode() == DBConstants.EDIT_CURRENT) || (recTour.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
  {
    int iOldOpenMode = recTour.setOpenMode(recTour.getOpenMode() & ~DBConstants.OPEN_READ_ONLY);
    recTour.writeAndRefresh();
    recTour.setOpenMode(iOldOpenMode);
  }
  return bookmark;
}
/**

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.booking.db

/**
 * Write this record and re-read if (if it has been modified).
 * @return the bookmark.
 */
public Object writeAndRefresh() throws DBException
{
  Object bookmark = super.writeAndRefresh();
  Record recTour = ((ReferenceField)this.getField(Booking.TOUR_ID)).getReference();
  if (recTour != null)
    if ((recTour.getEditMode() == DBConstants.EDIT_CURRENT) || (recTour.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
  {
    int iOldOpenMode = recTour.setOpenMode(recTour.getOpenMode() & ~DBConstants.OPEN_READ_ONLY);
    recTour.writeAndRefresh();
    recTour.setOpenMode(iOldOpenMode);
  }
  return bookmark;
}
/**

代码示例来源:origin: org.jbundle.base/org.jbundle.base.mixed

/**
 * Code to display a Menu.
 * @param strMenu The menu to set up.
 */
public void preSetupGrid(String strMenu)
{
  Record record = this.getMainRecord();
  if (record != null)
    record.setOpenMode(record.getOpenMode() | DBConstants.OPEN_CACHE_RECORDS);    // Cache recently used records.
  if (record != null) if (record.getKeyArea().getKeyName().equals(DBConstants.PRIMARY_KEY))
    record.setKeyArea(record.getDefaultScreenKeyArea());
}
/**

代码示例来源:origin: org.jbundle.base.screen/org.jbundle.base.screen.model

/**
 * Code to display a Menu.
 * @param strMenu The menu to set up.
 */
public void preSetupGrid(String strMenu)
{
  Record record = this.getMainRecord();
  if (record != null)
    record.setOpenMode(record.getOpenMode() | DBConstants.OPEN_CACHE_RECORDS);    // Cache recently used records.
  if (record != null) if (record.getKeyArea().getKeyName().equals(DBConstants.PRIMARY_KEY))
    record.setKeyArea(record.getDefaultScreenKeyArea());
}
/**

代码示例来源:origin: org.jbundle.base/org.jbundle.base.mixed

/**
 * Set the field or file that owns this listener.
 * @param owner My owner.
 */
public void setOwner(ListenerOwner owner)
{
  super.setOwner(owner);
  if (this.getOwner() != null)
    this.getOwner().setOpenMode(this.getOwner().getOpenMode() | DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY);    // Make sure keys are updated before sync
}
/**

代码示例来源:origin: org.jbundle.base.db/org.jbundle.base.db

/**
 * Set the field or file that owns this listener.
 * @param owner My owner.
 */
public void setOwner(ListenerOwner owner)
{
  super.setOwner(owner);
  if (this.getOwner() != null)
    this.getOwner().setOpenMode(this.getOwner().getOpenMode() | DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY);    // Make sure keys are updated before sync
}
/**

代码示例来源:origin: org.jbundle.base/org.jbundle.base

/**
 * Set the field or file that owns this listener.
 * @param owner My owner.
 */
public void setOwner(ListenerOwner owner)
{
  super.setOwner(owner);
  if (this.getOwner() != null)
    this.getOwner().setOpenMode(this.getOwner().getOpenMode() | DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY);    // Make sure keys are updated before sync
}
/**

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.acctrec.screen

/**
 * Add all the screen listeners.
 */
public void addListeners()
{
  // Don't call super
  this.getMainRecord().setOpenMode(this.getMainRecord().getOpenMode() | DBConstants.OPEN_READ_ONLY);
  this.getMainRecord().setKeyArea(CreditCard.TRX_DATE_KEY);
  this.setEnabled(false);
  //x Can't lookup by credit card no since it is encrypted
  //xthis.getMainRecord().getField(CreditCard.CARD_NO).setEnabled(true);
  //xthis.getMainRecord().getField(CreditCard.CARD_NO).addListener(new MainFieldHandler(CreditCard.CARD_NO_KEY));
}
/**

代码示例来源:origin: org.jbundle.base/org.jbundle.base

/**
 * Constructor.
 * @param database Should be null, as the last table on the chain contains the database.
 * @param record The record's current table will be changed to grid table and moved down my list.
 */
public void init(BaseDatabase database, Record record)
{
  super.init(database, record);
  m_gridList = new DataRecordList();      
  m_iEndOfFileIndex = UNKNOWN_POSITION; // Actual end of file (-1 means don't know)
  m_gridBuffer = new DataRecordBuffer();
  m_gridNew = new DataRecordBuffer();
  m_iPhysicalFilePosition = UNKNOWN_POSITION;
  m_iLogicalFilePosition = UNKNOWN_POSITION;
  if (((record.getOpenMode() & DBConstants.OPEN_READ_ONLY) != DBConstants.OPEN_READ_ONLY)
    && (record.getCounterField() != null))
      record.setOpenMode(record.getOpenMode() | DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY);  // Must have for GridTable to re-read.
}
/**

代码示例来源:origin: org.jbundle.base/org.jbundle.base.mixed

/**
 * Constructor.
 * @param database Should be null, as the last table on the chain contains the database.
 * @param record The record's current table will be changed to grid table and moved down my list.
 */
public void init(BaseDatabase database, Record record)
{
  super.init(database, record);
  m_gridList = new DataRecordList();      
  m_iEndOfFileIndex = UNKNOWN_POSITION; // Actual end of file (-1 means don't know)
  m_gridBuffer = new DataRecordBuffer();
  m_gridNew = new DataRecordBuffer();
  m_iPhysicalFilePosition = UNKNOWN_POSITION;
  m_iLogicalFilePosition = UNKNOWN_POSITION;
  if (((record.getOpenMode() & DBConstants.OPEN_READ_ONLY) != DBConstants.OPEN_READ_ONLY)
    && (record.getCounterField() != null))
      record.setOpenMode(record.getOpenMode() | DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY);  // Must have for GridTable to re-read.
}
/**

代码示例来源:origin: org.jbundle.base.db/org.jbundle.base.db

/**
 * Constructor.
 * @param database Should be null, as the last table on the chain contains the database.
 * @param record The record's current table will be changed to grid table and moved down my list.
 */
public void init(BaseDatabase database, Record record)
{
  super.init(database, record);
  m_gridList = new DataRecordList();      
  m_iEndOfFileIndex = UNKNOWN_POSITION; // Actual end of file (-1 means don't know)
  m_gridBuffer = new DataRecordBuffer();
  m_gridNew = new DataRecordBuffer();
  m_iPhysicalFilePosition = UNKNOWN_POSITION;
  m_iLogicalFilePosition = UNKNOWN_POSITION;
  if (((record.getOpenMode() & DBConstants.OPEN_READ_ONLY) != DBConstants.OPEN_READ_ONLY)
    && (record.getCounterField() != null))
      record.setOpenMode(record.getOpenMode() | DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY);  // Must have for GridTable to re-read.
}
/**

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.booking.entry

/**
 * Override this to open the other files in the query.
 */
public void openOtherRecords()
{
  super.openOtherRecords();
  new BookingControl(this);
  new ProfileControl(this);
  
  Record recBooking = this.getMainRecord();
  Record recTour = ((ReferenceField)recBooking.getField(Booking.TOUR_ID)).getReferenceRecord(this);
  recTour.setOpenMode((recTour.getOpenMode() & ~DBConstants.OPEN_READ_ONLY) | DBConstants.OPEN_LOCK_ON_CHANGE_STRATEGY);
  Record recTourHeader = ((ReferenceField)recTour.getField(Tour.TOUR_HEADER_ID)).getReferenceRecord(this);
}
/**

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.booking.db

/**
 * FieldChanged Method.
 */
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
  if (this.getOwner().getRecord().getField(Tour.ORDER_COMPONENTS).getState() == true)
  {
    // Note: Must be finalized to order components (setting this flag will set up the A/P detail)
    Record recTour = this.getOwner().getRecord();
    int iOldOpenMode = recTour.setOpenMode(recTour.getOpenMode() & ~DBConstants.OPEN_READ_ONLY);
    recTour.getField(Tour.FINALIZED).setState(true);
    try {
      recTour.writeAndRefresh();
    } catch (DBException ex) {
      ex.printStackTrace();
    } finally {
      recTour.setOpenMode(iOldOpenMode);
    }
  
    ((Tour)this.getOwner().getRecord()).orderAllComponents();
  }
  return super.fieldChanged(bDisplayOption, iMoveMode);
}

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.acctrec.screen

/**
 * Add all the screen listeners.
 */
public void addListeners()
{
  super.addListeners();
  this.getMainRecord().setOpenMode(this.getMainRecord().getOpenMode() | DBConstants.OPEN_READ_ONLY);
  this.getMainRecord().setKeyArea(Mco.MCO_NO_KEY);
  this.setEnabled(false);
  this.getMainRecord().getField(Mco.MCO_NO).setEnabled(true);
  this.getMainRecord().getField(Mco.MCO_NO).addListener(new MainFieldHandler(Mco.MCO_NO_KEY));
}
/**

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.acctpay.screen

/**
 * Add all the screen listeners.
 */
public void addListeners()
{
  super.addListeners();
  if (this.getHeaderRecord() instanceof BankTrx)
  {
    this.getHeaderRecord().setOpenMode(this.getHeaderRecord().getOpenMode() | DBConstants.OPEN_READ_ONLY);
    if (this.getHeaderRecord().getField(BankTrx.BANK_ACCT_ID).isNull())
    {
      ApControl recApControl = new ApControl(this);
      this.getHeaderRecord().getField(BankTrx.BANK_ACCT_ID).moveFieldToThis(recApControl.getField(ApControl.AP_BANK_ACCT_ID));
      this.getHeaderRecord().getField(BankTrx.BANK_ACCT_ID).setModified(false);
    }
  }
}
/**

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.acctpay.screen

/**
 * Add all the screen listeners.
 */
public void addListeners()
{
  super.addListeners();
  if (this.getHeaderRecord() instanceof BankTrx)
  {
    this.getHeaderRecord().setOpenMode(this.getHeaderRecord().getOpenMode() | DBConstants.OPEN_READ_ONLY);
    if (this.getHeaderRecord().getField(BankTrx.BANK_ACCT_ID).isNull())
    {
      ApControl recApControl = new ApControl(this);
      this.getHeaderRecord().getField(BankTrx.BANK_ACCT_ID).moveFieldToThis(recApControl.getField(ApControl.AP_BANK_ACCT_ID));
      this.getHeaderRecord().getField(BankTrx.BANK_ACCT_ID).setModified(false);
    }
  }
}
/**

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.acctrec.screen

/**
 * Add all the screen listeners.
 */
public void addListeners()
{
  super.addListeners();
  
  this.setEditing(false);     // Can't change current rows
  this.getMainRecord().getField(ArTrx.TRX_DATE).setEnabled(true);
  this.getMainRecord().getField(ArTrx.AMOUNT).setEnabled(true);
  this.getMainRecord().getField(ArTrx.COMMENTS).setEnabled(true);
  this.setAppending(true);    // CAN append
  this.getMainRecord().setOpenMode(DBConstants.OPEN_APPEND_ONLY); // This makes it possible
  
  this.getMainRecord().getListener(UpdateArTrxAcctDetailHandler.class, true).setEnabledListener(false);    // Since I will be doing the updating
  this.getMainRecord().addListener(new UpdateCrDrAcctDetailHandler(this.getRecord(Booking.BOOKING_FILE)));
  
  this.getMainRecord().getField(ArTrx.AMOUNT).addListener(new SetCrDrTypeHandler(null));
}
/**

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.acctrec.screen

/**
 * Add all the screen listeners.
 */
public void addListeners()
{
  super.addListeners();
  
  this.setEditing(false);     // Can't change current rows
  this.getMainRecord().getField(ArTrx.TRX_DATE).setEnabled(true);
  this.getMainRecord().getField(ArTrx.AMOUNT).setEnabled(true);
  this.getMainRecord().getField(ArTrx.COMMENTS).setEnabled(true);
  this.setAppending(true);    // CAN append
  this.getMainRecord().setOpenMode(DBConstants.OPEN_APPEND_ONLY); // This makes it possible
  
  TrxStatus recTrxStatus = (TrxStatus)this.getRecord(TrxStatus.TRX_STATUS_FILE);
  recTrxStatus.getTrxStatusID(TransactionType.ACCTREC, ArTrx.AR_TRX_FILE, ArTrx.REFUND_SUBMITTED);
  this.getMainRecord().getField(ArTrx.TRX_STATUS_ID).addListener(new InitFieldHandler(recTrxStatus.getField(TrxStatus.ID)));
  
  this.getMainRecord().getListener(UpdateArTrxAcctDetailHandler.class, true).setEnabledListener(false);    // Since I will be doing the updating
  this.getMainRecord().addListener(new UpdateRefundAcctDetailHandler(this.getRecord(Booking.BOOKING_FILE)));
}
/**

相关文章

微信公众号

最新文章

更多

Record类方法