本文整理汇总了Java中org.compiere.model.PO.saveEx方法的典型用法代码示例。如果您正苦于以下问题:Java PO.saveEx方法的具体用法?Java PO.saveEx怎么用?Java PO.saveEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.compiere.model.PO
的用法示例。
在下文中一共展示了PO.saveEx方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import org.compiere.model.PO; //导入方法依赖的package包/类
public static void save(final Object o)
{
if (o == null)
{
throw new IllegalArgumentException("model is null");
}
final PO po = getStrictPO(o);
if (po != null)
{
po.saveEx();
}
else
{
throw new ModelClassNotSupportedException(o);
}
}
示例2: invokeOLCandCreator
import org.compiere.model.PO; //导入方法依赖的package包/类
@Override
public I_C_OLCand invokeOLCandCreator(final PO po, final IOLCandCreator olCandCreator)
{
Check.assumeNotNull(olCandCreator, "olCandCreator is not null");
final I_C_OLCand olCand = olCandCreator.createFrom(po);
if (po.set_ValueOfColumn("Processed", true))
{
po.saveEx();
}
if (olCand == null)
{
OLCandBL.logger.info(olCandCreator + " returned null for " + po + "; Nothing to do.");
return null;
}
olCand.setAD_Table_ID(po.get_Table_ID());
olCand.setRecord_ID(po.get_ID());
InterfaceWrapperHelper.save(olCand);
Services.get(IWFExecutionFactory.class).notifyActivityPerformed(po, olCand); // 03745
return olCand;
}
示例3: modelChange
import org.compiere.model.PO; //导入方法依赖的package包/类
@Override
public String modelChange(final PO po, final int type)
{
if (type != TYPE_SUBSEQUENT)
{
return null;
}
final IPOProcessor processor = Services.get(IPOProcessorBL.class).retrieveProcessorForPO(po);
if (processor == null)
{
final String msg = "Unable to process '" + po + "'; Missing IOLCandCreator implmentation for table '" + MTable.getTableName(po.getCtx(), po.get_Table_ID()) + "'";
logger.warn(msg);
return msg;
}
boolean processed = processor.process(po);
if (processed && po.set_ValueOfColumn("Processed", true))
{
po.saveEx();
}
return null;
}
示例4: saveLog
import org.compiere.model.PO; //导入方法依赖的package包/类
private void saveLog(PO po)
{
boolean isNew = po.is_new();
boolean isChanged = po.is_Changed();
String changelog = "";
if (!isNew && isChanged)
{
changelog = getChangeLog(po);
}
po.saveEx();
if (isNew)
{
addLog("Created[" + po.get_TableName() + "=" + po.get_ID() + "]: " + getPOSummary(po));
}
else if (isChanged)
{
addLog("Updated[" + po.get_TableName() + "=" + po.get_ID() + "]: " + getPOSummary(po) + " - " + changelog);
}
}
示例5: updateAndSaveListItem
import org.compiere.model.PO; //导入方法依赖的package包/类
private boolean updateAndSaveListItem(ListItem item, boolean isYes, int sortNo)
{
if (!item.isUpdateable())
{
return false;
}
final Properties ctx = Env.getCtx();
final String trxName = ITrx.TRXNAME_ThreadInherited;
final PO po = new Query(ctx, m_TableName, m_KeyColumnName + "=?", trxName)
.setParameters(item.getKey())
.firstOnly();
if (po == null)
{
return false;
}
po.set_ValueOfColumn(m_ColumnSortName, sortNo);
if(m_ColumnYesNoName != null)
{
po.set_ValueOfColumn(m_ColumnYesNoName, isYes);
}
po.saveEx();
//
// Update Item
item.setIsYes(isYes);
item.setSortNo(sortNo);
return true;
}
示例6: modelChange
import org.compiere.model.PO; //导入方法依赖的package包/类
@Override
public String modelChange(final PO po, final int type)
{
if (type != TYPE_SUBSEQUENT)
{
return null;
}
final IPOProcessor processor = Services.get(IPOProcessorBL.class).retrieveProcessorForPO(po);
if (processor == null)
{
final String msg =
"Unable to process '" + po + "'; Missing IOLCandCreator implmentation for table '" + MTable.getTableName(po.getCtx(), po.get_Table_ID()) + "'";
logger.warn(msg);
return msg;
}
boolean processed = processor.process(po);
// if (result == null || result.isEmpty())
// {
// logger.info(processor + " returned null for " + po + "; Nothing to do.");
// return null;
// }
if (processed)
{
if (po.set_ValueOfColumn("Processed", true))
{
po.saveEx();
}
}
// if (!Util.isEmpty(olCandCreator.getRelationTypeInternalName()))
// {
// MRelation.add(po.getCtx(), olCandCreator.getRelationTypeInternalName(), po.get_ID(), olCand.get_ID(),
// po.get_TrxName());
// }
return null;
}
示例7: save
import org.compiere.model.PO; //导入方法依赖的package包/类
public void save(PO po) {
if (isSaved()) {
return;
}
po.saveEx();
setSaved(true);
}
示例8: copyRecord
import org.compiere.model.PO; //导入方法依赖的package包/类
@Override
public void copyRecord(final PO po, final String trxName)
{
final PO fromPO;
if (getFromPO_ID() > 0)
{
fromPO = TableModelLoader.instance.getPO(getCtx(), po.get_TableName(), getFromPO_ID(), trxName);
}
else
{
fromPO = po;
}
//
// Copy this level
setBase(true);
final PO toPO;
if (getParentKeyColumn() != null && getParentID() > 0)
{
toPO = TableModelLoader.instance.newPO(getCtx(), fromPO.get_TableName(), trxName);
toPO.setDynAttribute(PO.DYNATTR_CopyRecordSupport, this); // need this for getting defaultValues at copy in PO
PO.copyValues(fromPO, toPO, true);
// reset for avoiding copy same object twice
toPO.setDynAttribute(PO.DYNATTR_CopyRecordSupport, null);
setBase(false);
// Parent link:
toPO.set_CustomColumn(getParentKeyColumn(), getParentID());
// needs refresh
// not sure if this is still needed
for (final String columnName : toPO.get_KeyColumns())
{
toPO.set_CustomColumn(columnName, toPO.get_Value(columnName));
}
// needs to set IsActive because is not copied
if (toPO.get_ColumnIndex(COLUMNNAME_IsActive) >= 0)
{
toPO.set_CustomColumn(COLUMNNAME_IsActive, fromPO.get_Value(COLUMNNAME_IsActive));
}
// Make sure the columns which are required to be unique they have unique values.
updateSpecialColumnsName(toPO);
// Notify listeners
fireOnRecordCopied(toPO, fromPO);
//
toPO.setDynAttribute(PO.DYNATTR_CopyRecordSupport_OldValue, fromPO.get_ID()); // need this for changelog
toPO.saveEx(trxName);
// setParentPO(toPO); // TODO: remove it, not needed
}
else
{
toPO = getParentPO();
}
//
// Copy children
for (final TableInfoVO childTableInfo : getSuggestedChildren(fromPO, getSuggestedChildrenToCopy()))
{
for (final Iterator<? extends PO> it = retrieveChildPOsForParent(childTableInfo.getTableName(), fromPO); it.hasNext();)
{
final PO childPO = it.next();
final CopyRecordSupport childCRS = CopyRecordFactory.getCopyRecordSupport(childTableInfo.getTableName());
childCRS.setParentKeyColumn(childTableInfo.getLinkColumnName());
childCRS.setAD_Window_ID(getAD_Window_ID());
childCRS.setParentPO(toPO);
childCRS.copyRecord(childPO, trxName);
log.info("Copied {}", childPO);
}
}
}
示例9: rollback
import org.compiere.model.PO; //导入方法依赖的package包/类
@Override
public ExecutionResult rollback(final String trxName)
{
final I_AD_MigrationStep step = getAD_MigrationStep();
if (getAD_Table(trxName) == null)
{
final boolean fatal = !getMigrationExecutorContext().isSkipMissingTables();
throw new MigrationExecutorException("@[email protected] @[email protected]=" + step.getAD_Table_ID() + " (@[email protected]: " + step.getTableName() + ") on step " + step, fatal);
}
final boolean createPOIfNotExists = X_AD_MigrationStep.ACTION_Delete.equals(step.getAction()); // create if not exist and action is Delete
final PO po = fetchPO(createPOIfNotExists, trxName);
if (po == null)
{
log("PO not found", "SKIP", true);
return ExecutionResult.Skipped;
}
//
// Action=Insert => Rollback action=Delete
if (X_AD_MigrationStep.ACTION_Insert.equals(step.getAction()))
{
if (I_AD_Column.Table_Name.equals(po.get_TableName()))
{
syncDBColumn(InterfaceWrapperHelper.create(po, I_AD_Column.class), true);
}
po.deleteEx(false);
}
//
// Action=Update/Delete => Rollback action=Insert/Update
else if (X_AD_MigrationStep.ACTION_Update.equals(step.getAction())
|| X_AD_MigrationStep.ACTION_Delete.equals(step.getAction()))
{
for (final I_AD_MigrationData data : getMigrationData())
{
final MigrationDataExecutor dataExecutor = new MigrationDataExecutor(getMigrationExecutorContext(), step, data, po, converter);
dataExecutor.rollback();
}
po.saveEx();
if (I_AD_Column.Table_Name.equals(po.get_TableName()))
{
syncDBColumn(InterfaceWrapperHelper.create(po, I_AD_Column.class), false);
}
}
else
{
throw new AdempiereException("Unknown step action " + step.getAction());
}
log(null, "Rollback", false);
return ExecutionResult.Executed;
}