本文整理汇总了Java中com.odoo.core.orm.fields.OColumn类的典型用法代码示例。如果您正苦于以下问题:Java OColumn类的具体用法?Java OColumn怎么用?Java OColumn使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OColumn类属于com.odoo.core.orm.fields包,在下文中一共展示了OColumn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doInBackground
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
@Override
protected ODataRow doInBackground(ODataRow... params) {
if (mApp.inNetwork()) {
try {
Thread.sleep(500);
ODataRow attachment = params[0];
String base64 = irAttachment.getDatasFromServer(attachment.getInt(OColumn.ROW_ID));
if (!base64.equals("false")) {
String file = createFile(attachment.getString("name"),
Base64.decode(base64, 0)
, attachment.getString("file_type"));
Uri uri = Uri.fromFile(new File(file));
OValues values = new OValues();
values.put("file_uri", uri.toString());
irAttachment.update(attachment.getInt(OColumn.ROW_ID), values);
return irAttachment.browse(attachment.getInt(OColumn.ROW_ID));
}
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
示例2: onPostExecute
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
@Override
protected void onPostExecute(ODataRow row) {
super.onPostExecute(row);
if (row != null) {
ONotificationBuilder.cancelNotification(mContext, row.getInt(OColumn.ROW_ID));
ONotificationBuilder builder = new ONotificationBuilder(mContext,
row.getInt(OColumn.ROW_ID));
builder.allowVibrate(true);
builder.withRingTone(true);
builder.setTitle(row.getString("name"));
builder.setText("Download Complete");
builder.setBigText("Download Complete");
if (row.getString("file_type").contains("image")) {
Bitmap bmp = getBitmapFromURI(Uri.parse(row.getString("file_uri")));
builder.setBigPicture(bmp);
}
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(row.getString("file_uri")), row.getString("file_type"));
builder.setResultIntent(intent);
builder.build().show();
} else {
ONotificationBuilder.cancelNotification(mContext);
}
}
示例3: setupActionBar
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
private void setupActionBar() {
if (extras == null) {
setMode(mEditMode);
userImage.setColorFilter(Color.parseColor("#ffffff"));
mForm.setEditable(mEditMode);
mForm.initForm(null);
} else {
int rowId = extras.getInt(OColumn.ROW_ID);
record = resPartner.browse(rowId);
record.put("full_address", resPartner.getAddress(record));
checkControls();
setMode(mEditMode);
mForm.setEditable(mEditMode);
mForm.initForm(record);
mTitleView.setText(record.getString("name"));
setCustomerImage();
if (record.getInt("id") != 0 && record.getString("large_image").equals("false")) {
BigImageLoader bigImageLoader = new BigImageLoader();
bigImageLoader.execute(record.getInt("id"));
}
}
}
示例4: onViewCreated
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setNavigationIcon(R.drawable.ic_action_navigation_arrow_back);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getFragmentManager().popBackStack();
}
});
toolbar.inflateMenu(R.menu.menu_home);
OAppBarUtils.bindShopMenu(parent(), new int[]{}, toolbar.getMenu());
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
OAppBarUtils.onShopMenuItemClick(parent(), ProductSubCategories.this, item);
return true;
}
});
data = getArguments();
category = db().browse(data.getInt(OColumn.ROW_ID));
setTitle(toolbar);
init();
}
示例5: delete
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
public int delete(String selection, String[] args, boolean permanently) {
int count = 0;
if (permanently) {
count = mContext.getContentResolver().delete(uri(), selection, args);
} else {
List<ODataRow> records = select(new String[]{"_is_active"}, selection, args);
for (ODataRow row : records) {
if (row.getBoolean("_is_active")) {
OValues values = new OValues();
values.put("_is_active", "false");
update(row.getInt(OColumn.ROW_ID), values);
}
count++;
}
}
return count;
}
示例6: getManyToManyColumns
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
public List<OColumn> getManyToManyColumns(OModel relation_model) {
List<OColumn> cols = new ArrayList<OColumn>();
_write_date.setName("_write_date");
cols.add(_write_date);
_is_dirty.setName("_is_dirty");
cols.add(_is_dirty);
_is_active.setName("_is_active");
cols.add(_is_active);
OColumn base_id = new OColumn("Base Id", OInteger.class);
base_id.setName(getTableName() + "_id");
cols.add(base_id);
OColumn relation_id = new OColumn("Relation Id", OInteger.class);
relation_id.setName(relation_model.getTableName() + "_id");
cols.add(relation_id);
return cols;
}
示例7: updateProjection
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
private String[] updateProjection(String[] projection) {
HashSet<String> names = new HashSet<>();
String[] allProjection = projection;
if (allProjection == null) {
allProjection = projection();
} else {
for (String col : projection) {
OColumn column = getColumn(col);
if (column.isFunctionalColumn() && column.canFunctionalStore()) {
names.add(column.getName());
}
}
}
names.addAll(Arrays.asList(allProjection));
names.addAll(Arrays.asList(new String[]{OColumn.ROW_ID, "id", "_write_date", "_is_dirty", "_is_active"}));
return names.toArray(new String[names.size()]);
}
示例8: createRelationTable
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
private void createRelationTable(OModel base_model, OColumn column) {
try {
OModel rel_model = base_model.createInstance(column.getType());
switch (column.getRelationType()) {
case ManyToOne:
case OneToMany:
createStatements(rel_model);
break;
case ManyToMany:
manyToManyTable(column, base_model);
// Creating master table for related column
createStatements(base_model.createInstance(column.getType()));
break;
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例9: manyToManyTable
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
private void manyToManyTable(OColumn column, OModel model) {
StringBuffer sql = null;
try {
OModel relation_model = model.createInstance(column.getType());
List<OColumn> m2mCols = model.getManyToManyColumns(relation_model);
String table_name = model.getTableName() + "_"
+ relation_model.getTableName() + "_rel";
if (!mModels.contains(table_name)) {
sql = new StringBuffer();
mModels.add(table_name);
String col_statement = generateColumnStatement(model, m2mCols);
sql.append("CREATE TABLE IF NOT EXISTS ");
sql.append(table_name);
sql.append(" (");
sql.append(col_statement);
sql.deleteCharAt(sql.lastIndexOf(","));
sql.append(")");
mSQLStatements.put(table_name, sql.toString());
Log.v(TAG, "Table Created : " + table_name);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例10: getType
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
private String getType(OColumn column) {
try {
if (column.getRelationType() == null) {
if (column.getType().getSuperclass().isAssignableFrom(OTypeHelper.class)) {
OTypeHelper type = (OTypeHelper) column.getType().newInstance();
type.setSize(column.getSize());
return type.getType();
}
} else if (column.getRelationType() == OColumn.RelationType.ManyToOne) {
return new OInteger().getType();
}
} catch (Exception e) {
Log.e(TAG, e.getMessage());
e.printStackTrace();
}
return null;
}
示例11: removeRelationColumns
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
private String[] removeRelationColumns(String[] projection) {
HashSet<String> columns = new HashSet<>();
if (projection != null && projection.length > 0 && mModel != null) {
for (String key : projection) {
OColumn column = mModel.getColumn(key);
if (column != null && column.getRelationType() == null) {
columns.add(key);
} else if (column != null && column.getRelationType() == OColumn.RelationType.ManyToOne) {
columns.add(key);
}
}
columns.addAll(Arrays.asList(new String[]{OColumn.ROW_ID, "id", "_is_active", "_write_date"}));
return columns.toArray(new String[columns.size()]);
}
return null;
}
示例12: updateProjection
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
private String[] updateProjection(String[] projection) {
HashSet<String> names = new HashSet<>();
String[] allProjection = projection;
if (allProjection == null) {
allProjection = projection();
} else {
for (String col : projection) {
OColumn column = getColumn(col);
if (column.isFunctionalColumn() && column.canFunctionalStore()) {
names.add(column.getName());
}
}
}
names.addAll(Arrays.asList(allProjection));
names.addAll(Arrays.asList(OColumn.ROW_ID, "id", "_write_date", "_is_dirty", "_is_active"));
return names.toArray(new String[names.size()]);
}
示例13: delete
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
int count = 0;
setModel(uri);
setMatcher(uri);
int match = matcher.match(uri);
switch (match) {
case COLLECTION:
SQLiteDatabase db = mModel.getWritableDatabase();
count = db.delete(mModel.getTableName(), selection, selectionArgs);
break;
case SINGLE_ROW:
db = mModel.getWritableDatabase();
String row_id = uri.getLastPathSegment();
count = db.delete(mModel.getTableName(), OColumn.ROW_ID + " = ?", new String[]{row_id});
break;
case UriMatcher.NO_MATCH:
break;
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
notifyDataChange(uri);
return count;
}
示例14: generateValues
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
private ContentValues[] generateValues(ContentValues values) {
OValues data_value = new OValues();
OValues rel_value = new OValues();
for (String key : values.keySet()) {
OColumn column = mModel.getColumn(key);
if (column != null) {
if (column.getRelationType() == null) {
data_value.put(key, values.get(key));
} else {
if (column.getRelationType() == OColumn.RelationType.ManyToOne) {
data_value.put(key, values.get(key));
} else {
rel_value.put(key, values.get(key).toString());
}
}
}
}
return new ContentValues[]{data_value.toContentValues(), rel_value.toContentValues()};
}
示例15: getPos
import com.odoo.core.orm.fields.OColumn; //导入依赖的package包/类
private int getPos() {
if (mResourceArray != -1 && mValue != null) {
return Integer.parseInt(mValue.toString());
} else if (mCol.getType().isAssignableFrom(OSelection.class)) {
if (items.size() <= 0) {
createItems();
}
for (ODataRow item : items) {
int index = items.indexOf(item);
if (item.getString("key").equals(mValue.toString())) {
return index;
}
}
} else {
ODataRow rec = getValueForM2O();
if (rec != null) {
return rec.getInt(OColumn.ROW_ID);
}
}
return -1;
}