本文整理了Java中org.jbundle.base.db.Record.edit
方法的一些代码示例,展示了Record.edit
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.edit
方法的具体详情如下:
包路径:org.jbundle.base.db.Record
类名称:Record
方法名:edit
[英]Lock the current record. This method responds differently depending on what open mode the record is in: OPEN_DONT_LOCK - A physical lock is not done. This is usually where deadlocks are possible (such as screens) and where transactions are in use (and locks are not needed). OPEN_LOCK_ON_EDIT - Holds a lock until an update or close. (Update crucial data, or hold records for processing) Returns false is someone alreay has a lock on this record. OPEN_WAIT_FOR_LOCK - Don't return from edit until you get a lock. (ie., Add to the total). Returns false if someone has a hard lock or time runs out.
[中]锁定当前记录。根据记录处于何种打开模式,此方法的响应会有所不同:open_DONT_LOCK-物理锁定未完成。这通常是可能出现死锁(如屏幕)和正在使用事务(不需要锁)的地方。打开\u锁定\u打开\u编辑-保持锁定,直到更新或关闭。(更新关键数据,或保留记录以进行处理)返回false是指某人确实锁定了该记录。OPEN_WAIT_FOR_LOCK-在获得锁之前不要从编辑返回。(即,加到总数中)。如果某人有硬锁或时间用完,则返回false。
代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.assetdr.report
/**
* Process the command.
* <br />Step 1 - Process the command if possible and return true if processed.
* <br />Step 2 - If I can't process, pass to all children (with me as the source).
* <br />Step 3 - If children didn't process, pass to parent (with me as the source).
* <br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop).
* @param strCommand The command to process.
* @param sourceSField The source screen field (to avoid echos).
* @param iCommandOptions If this command creates a new screen, create in a new window?
* @return true if success.
*/
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
if (strCommand.equalsIgnoreCase(MenuConstants.POST))
{
try {
Record recAssetDrControl = this.getRecord(AssetDrControl.ASSET_DR_CONTROL_FILE);
recAssetDrControl.edit();
((DateTimeField)recAssetDrControl.getField(AssetDrControl.DATE_RECONCILED)).setDateTime(new Date(), DBConstants.DISPLAY, DBConstants.SCREEN_MOVE);
recAssetDrControl.set();
} catch (DBException ex) {
ex.printStackTrace();
}
strCommand = DBConstants.BACK; // Go to previous screen
}
return super.doCommand(strCommand, sourceSField, iCommandOptions);
}
代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.acctrec.screen
/**
* (Optionally) update this detail transaction.
* @return true if success.
*/
public boolean updateDetailTrx()
{
Record recDetail = this.getDetailRecord();
try {
recDetail.edit();
recDetail.getField(Mco.TRX_STATUS_ID).setValue(m_iTrxStatusEntered);
} catch (DBException ex) {
ex.printStackTrace();
return false;
}
return super.updateDetailTrx();
}
/**
代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.acctrec.screen
/**
* (Optionally) update this detail transaction.
* @return true if success.
*/
public boolean updateDetailTrx()
{
Record recDetail = this.getDetailRecord();
try {
recDetail.edit();
recDetail.getField(Mco.TRX_STATUS_ID).setValue(m_iTrxStatusEntered);
} catch (DBException ex) {
ex.printStackTrace();
return false;
}
return super.updateDetailTrx();
}
/**
代码示例来源:origin: org.jbundle.base/org.jbundle.base.mixed
/**
* Delete this item.
*/
public boolean remove()
{
boolean bSuccess = false;
try {
Record recGrid = this.getMainRecord();
if (recGrid.getEditMode() == Constants.EDIT_CURRENT)
recGrid.edit();
if (recGrid.getEditMode() == Constants.EDIT_IN_PROGRESS)
recGrid.remove();
bSuccess = true;
} catch (DBException ex) {
ex.printStackTrace();
bSuccess = false;
}
return bSuccess;
}
/**
代码示例来源:origin: org.jbundle.base.screen/org.jbundle.base.screen.model
/**
* Delete this item.
*/
public boolean remove()
{
boolean bSuccess = false;
try {
Record recGrid = this.getMainRecord();
if (recGrid.getEditMode() == Constants.EDIT_CURRENT)
recGrid.edit();
if (recGrid.getEditMode() == Constants.EDIT_IN_PROGRESS)
recGrid.remove();
bSuccess = true;
} catch (DBException ex) {
ex.printStackTrace();
bSuccess = false;
}
return bSuccess;
}
/**
代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.acctrec.screen
/**
* Remove this batch detail transaction and the distribution.
* @return true if successful.
*/
public boolean removeDetailTrx()
{
// Step 3 - Delete the batch (if not recurring)
Record recBankTrxBatchDetail = this.getDetailRecord();
Record recBankTrxBatchDist = this.getDistRecord();
recBankTrxBatchDist.close();
try {
while (recBankTrxBatchDist.hasNext())
{
recBankTrxBatchDist.next();
recBankTrxBatchDist.edit();
recBankTrxBatchDist.remove();
}
// Don't remove the detail trx as it is not in a batch.
} catch (DBException ex) {
ex.printStackTrace();
return false;
}
return true;
}
/**
代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.request.report
/**
* Run Method.
*/
public void run()
{
Record recRequest = this.getMainRecord();
try {
recRequest.close();
while (recRequest.hasNext())
{
recRequest.next();
recRequest.edit();
recRequest.getField(Request.PRINT_NOW).setState(true);
recRequest.set();
}
} catch (DBException ex) {
ex.printStackTrace();
}
}
代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.request.report
/**
* Run Method.
*/
public void run()
{
Record recRequest = this.getMainRecord();
try {
recRequest.close();
while (recRequest.hasNext())
{
recRequest.next();
recRequest.edit();
recRequest.getField(Request.PRINT_NOW).setState(true);
recRequest.set();
}
} catch (DBException ex) {
ex.printStackTrace();
}
}
代码示例来源:origin: org.jbundle.base/org.jbundle.base.mixed
/**
* Run Method.
*/
public void run()
{
String strID = this.getProperty(DBParams.ID);
if ((strID != null) && (strID.length() > 0))
{
Record recCalendarEntry = this.getMainRecord();
recCalendarEntry.getCounterField().setString(strID);
try {
if (recCalendarEntry.seek(null))
{
recCalendarEntry.edit();
boolean[] rgbEnabled = recCalendarEntry.setEnableListeners(false); // I need to do this since a change in properties will reschedule the jobs.
((PropertiesField)recCalendarEntry.getField(CalendarEntry.kProperties)).setProperty(TASK_COMPLETED, DBConstants.TRUE);
recCalendarEntry.setEnableListeners(rgbEnabled);
recCalendarEntry.set();
}
} catch (DBException ex) {
ex.printStackTrace();
}
}
}
代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.request.report
/**
* UpdateHistoryDetail Method.
*/
public void updateHistoryDetail(Record recRequestDetail, Record recRequestHistoryDetail, Record recRequest)
{
try {
recRequestDetail.close();
while (recRequestDetail.hasNext())
{
recRequestDetail.next();
recRequestDetail.edit();
recRequestHistoryDetail.addNew();
recRequestHistoryDetail.moveFields(recRequestDetail, Record.MOVE_BY_NAME, true, DBConstants.SCREEN_MOVE, true, false, false, false); // Move all fields to the history record
recRequestHistoryDetail.getField(RequestHistoryDetail.PROFILE_ID).moveFieldToThis(recRequest.getField(Request.PROFILE_ID));
recRequestHistoryDetail.add();
recRequestDetail.remove();
}
} catch (DBException ex) {
ex.printStackTrace();
}
}
代码示例来源:origin: org.jbundle.base/org.jbundle.base
/**
* Called when a change is the record status is about to happen/has happened.
* @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)
{
int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption);
if (iChangeType == DBConstants.AFTER_REFRESH_TYPE)
iErrorCode = this.moveIDToCodeField();
else if ((iChangeType == DBConstants.AFTER_ADD_TYPE)
&& (this.getCodeField().isNull()))
{
try {
Record record = this.getOwner();
Object bookmark = record.getLastModified(DBConstants.BOOKMARK_HANDLE);
record.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE);
record.edit();
iErrorCode = this.moveIDToCodeField();
record.set();
} catch (DBException ex) {
ex.printStackTrace();
}
}
return iErrorCode;
}
/**
代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.request.report
/**
* UpdateHistoryDetail Method.
*/
public void updateHistoryDetail(Record recRequestDetail, Record recRequestHistoryDetail, Record recRequest)
{
try {
recRequestDetail.close();
while (recRequestDetail.hasNext())
{
recRequestDetail.next();
recRequestDetail.edit();
recRequestHistoryDetail.addNew();
recRequestHistoryDetail.moveFields(recRequestDetail, Record.MOVE_BY_NAME, true, DBConstants.SCREEN_MOVE, true, false, false, false); // Move all fields to the history record
recRequestHistoryDetail.getField(RequestHistoryDetail.PROFILE_ID).moveFieldToThis(recRequest.getField(Request.PROFILE_ID));
recRequestHistoryDetail.add();
recRequestDetail.remove();
}
} catch (DBException ex) {
ex.printStackTrace();
}
}
代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.product.screen
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{
int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption);
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode;
if (iChangeType == DBConstants.FIELD_CHANGED_TYPE)
{
Record recTourHeader = getHeaderRecord();
if (recTourHeader.getField(TourHeader.TOUR_SERIES).getState() != true)
{
try {
recTourHeader.edit();
recTourHeader.getField(TourHeader.TOUR_SERIES).setState(true);
int iSeriesCode = ((int)recTourHeader.getField(TourHeader.TOUR_TYPE).getValue() | TourType.SERIES);
recTourHeader.getField(TourHeader.TOUR_TYPE).setValue(iSeriesCode);
recTourHeader.writeAndRefresh();
} catch (DBException ex) {
ex.printStackTrace();
}
}
}
return iErrorCode;
}
});
代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.product.screen
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{
int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption);
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode;
if (iChangeType == DBConstants.FIELD_CHANGED_TYPE)
{
Record recTourHeader = getHeaderRecord();
if (recTourHeader.getField(TourHeader.TOUR_SERIES).getState() != true)
{
try {
recTourHeader.edit();
recTourHeader.getField(TourHeader.TOUR_SERIES).setState(true);
int iSeriesCode = ((int)recTourHeader.getField(TourHeader.TOUR_TYPE).getValue() | TourType.SERIES);
recTourHeader.getField(TourHeader.TOUR_TYPE).setValue(iSeriesCode);
recTourHeader.writeAndRefresh();
} catch (DBException ex) {
ex.printStackTrace();
}
}
}
return iErrorCode;
}
});
代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.acctrec.screen
/**
* Post all the transactions in this batch.
* @return true if successful.
*/
public boolean onPost()
{
try {
TrxStatus recTrxStatus = (TrxStatus)this.getRecord(TrxStatus.TRX_STATUS_FILE);
Object bookmark = recTrxStatus.getHandle(DBConstants.DATA_SOURCE_HANDLE);
int iTrxPaidClassID = recTrxStatus.getTrxStatusID(TransactionType.ACCTREC, ArTrx.AR_TRX_FILE, ArTrx.REFUND_PAID);
recTrxStatus.setHandle(bookmark, DBConstants.DATA_SOURCE_HANDLE);
Record recArTrx = this.getMainRecord();
recArTrx.close();
while (recArTrx.hasNext())
{
recArTrx.next();
recArTrx.edit();
recArTrx.getField(ArTrx.TRX_STATUS_ID).setValue(iTrxPaidClassID);
recArTrx.set();
}
} catch (DBException ex) {
ex.printStackTrace();
}
return true;
}
代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.assetdr.process
/**
* UpdateAllCurrencies Method.
*/
public void updateAllCurrencies()
{
Record record = this.getMainRecord();
record.close();
try {
while (record.hasNext())
{
record.next();
if (record.getField(Currencys.DELETED).getState() == true)
continue;
record.edit();
double dRate = this.getConversionRate(record.getField(Currencys.CURRENCY_CODE).toString());
if (dRate != 0.0)
record.getField(Currencys.LAST_RATE).setValue(1 / dRate);
record.set();
}
} catch (DBException e) {
e.printStackTrace();
}
}
/**
代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.acctpay.air
/**
* OnPost Method.
*/
public boolean onPost()
{
try {
TrxStatus recTrxStatus = (TrxStatus)this.getRecord(TrxStatus.TRX_STATUS_FILE);
Object bookmark = recTrxStatus.getHandle(DBConstants.DATA_SOURCE_HANDLE);
int iNewTrxType = recTrxStatus.getTrxStatusID(TransactionType.AIR, TicketTrx.TICKET_TRX_FILE, TicketTrx.ARC_SUBMITTED);
recTrxStatus.setHandle(bookmark, DBConstants.DATA_SOURCE_HANDLE);
Record recTicketTrx = this.getMainRecord();
recTicketTrx.close();
while (recTicketTrx.hasNext())
{
recTicketTrx.next();
recTicketTrx.edit();
recTicketTrx.getField(TicketTrx.TRX_STATUS_ID).setValue(iNewTrxType);
recTicketTrx.getField(TicketTrx.ARC_DATE).setValue(DateField.todaysDate());
recTicketTrx.set();
}
} catch (DBException ex) {
ex.printStackTrace();
return false;
}
return true;
}
代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.booking.db
/**
* Order all the components for this tour.
*/
public void orderAllComponents()
{
if (this.getField(Tour.ORDER_COMPONENTS).getState() == false)
return;
BookingDetail recBookingDetail = new BookingDetail(this.findRecordOwner());
try {
recBookingDetail.addListener(new SubFileFilter(this));
while (recBookingDetail.hasNext())
{
recBookingDetail.next();
Record recBookingDetailCurrent = recBookingDetail.getTable().getCurrentTable().getRecord();
recBookingDetailCurrent.edit();
recBookingDetailCurrent.getField(BookingDetail.PRODUCT_STATUS_REQUEST).setData(Boolean.TRUE);
if (recBookingDetailCurrent.getEditMode() == DBConstants.EDIT_IN_PROGRESS)
recBookingDetailCurrent.set(); // Possible that the listeners re-wrote this record already.
}
} catch (DBException ex) {
recBookingDetail.free();
}
}
/**
代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.booking.db
/**
* Order all the components for this tour.
*/
public void orderAllComponents()
{
if (this.getField(Tour.ORDER_COMPONENTS).getState() == false)
return;
BookingDetail recBookingDetail = new BookingDetail(this.findRecordOwner());
try {
recBookingDetail.addListener(new SubFileFilter(this));
while (recBookingDetail.hasNext())
{
recBookingDetail.next();
Record recBookingDetailCurrent = recBookingDetail.getTable().getCurrentTable().getRecord();
recBookingDetailCurrent.edit();
recBookingDetailCurrent.getField(BookingDetail.PRODUCT_STATUS_REQUEST).setData(Boolean.TRUE);
if (recBookingDetailCurrent.getEditMode() == DBConstants.EDIT_IN_PROGRESS)
recBookingDetailCurrent.set(); // Possible that the listeners re-wrote this record already.
}
} catch (DBException ex) {
recBookingDetail.free();
}
}
/**
代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.request.report
recRequestHistory.edit();
内容来源于网络,如有侵权,请联系作者删除!