本文整理汇总了Java中com.odoo.core.utils.OListUtils类的典型用法代码示例。如果您正苦于以下问题:Java OListUtils类的具体用法?Java OListUtils怎么用?Java OListUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OListUtils类属于com.odoo.core.utils包,在下文中一共展示了OListUtils类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateRecordsOnServer
import com.odoo.core.utils.OListUtils; //导入依赖的package包/类
public boolean updateRecordsOnServer(OSyncAdapter adapter) {
try {
// Use key (modal name) from updateToServerRecords
// use updateToServerRecords ids
int counter = 0;
for (String key : updateToServerRecords.keySet()) {
OModel model = OModel.get(mContext, key, mUser.getAndroidName());
List<String> ids = OListUtils.toStringList(updateToServerRecords.get(key));
counter += ids.size();
for (ODataRow record : model.select(null,
"id IN ( " + StringUtils.repeat("?, ", ids.size() - 1) + " ?)",
ids.toArray(new String[ids.size()]))) {
if (adapter.validateRelationRecords(model, record)) {
mOdoo.updateRecord(model.getModelName(), OdooRecordUtils
.createRecordValues(model, record),
record.getInt("id"));
OValues value = new OValues();
value.put("_is_dirty", "false");
value.put("_write_date", ODateUtils.getUTCDate());
model.update(record.getInt(OColumn.ROW_ID), value);
model.close();
}
}
}
Log.i(TAG, counter + " records updated on server");
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
示例2: deleteRecords
import com.odoo.core.utils.OListUtils; //导入依赖的package包/类
public int deleteRecords(List<Integer> serverIds, boolean permanently) {
String selection = "id IN (" + StringUtils.repeat("?, ", serverIds.size() - 1) + " ?)";
String[] args = OListUtils.toStringList(serverIds).toArray(new String[serverIds.size()]);
if (permanently) {
return delete(selection, args, true);
} else {
OValues values = new OValues();
values.put("_is_active", "false");
return update(selection, args, values);
}
}