当前位置: 首页>>代码示例>>Java>>正文


Java ODataRow类代码示例

本文整理汇总了Java中com.odoo.core.orm.ODataRow的典型用法代码示例。如果您正苦于以下问题:Java ODataRow类的具体用法?Java ODataRow怎么用?Java ODataRow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ODataRow类属于com.odoo.core.orm包,在下文中一共展示了ODataRow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createOdooInstance

import com.odoo.core.orm.ODataRow; //导入依赖的package包/类
public static Odoo createOdooInstance(final Context context, final OUser user) {
        final App app = (App) context.getApplicationContext();
        Odoo odoo = app.getOdoo(user);
        if (odoo == null) {
            odoo = Odoo.createInstance(context,
                    (user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
            odoo.helper.OUser mUser =
                    odoo.authenticate(user.getUsername(), user.getPassword(), (user.isOAuthLogin()) ?
                            user.getInstanceDatabase() : user.getDatabase());
            app.setOdoo(odoo, user);
            if (mUser != null) {
                ResCompany company = new ResCompany(context);
                if (company.count("id = ? ", new String[]{user.getCompanyId() + ""}) <= 0) {
                    ODataRow company_details = new ODataRow();
                    company_details.put("id", user.getCompanyId());
                    company.quickCreateRecord(company_details);
                }
            } else {
                // FIXME: Need to check again. Not working properly
                //showSignInErrorNotification(context, user);
//                Toast.makeText(context, OResource.string(context, R.string.toast_something_gone_wrong),
//                        Toast.LENGTH_LONG).show();
            }
        }
        return odoo;
    }
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:27,代码来源:OSyncAdapter.java

示例2: onPostExecute

import com.odoo.core.orm.ODataRow; //导入依赖的package包/类
@Override
protected void onPostExecute(ODataRow row) {
    super.onPostExecute(row);
    if (row != null) {
        ONotificationBuilder.cancelNotification(mActivity, row.getInt(OColumn.ROW_ID));
        ONotificationBuilder builder = new ONotificationBuilder(mActivity,
                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(mActivity);
    }
}
 
开发者ID:Odoo-mobile,项目名称:hr,代码行数:25,代码来源:OFileManager.java

示例3: onPostExecute

import com.odoo.core.orm.ODataRow; //导入依赖的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);
    }
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:25,代码来源:OFileManager.java

示例4: generateAttributeView

import com.odoo.core.orm.ODataRow; //导入依赖的package包/类
private void generateAttributeView(LinearLayout parent) {
    List<ODataRow> products = productObj.select(null, "product_tmpl_id = ?", new String[]{product_tmpl_id + ""});
    HashMap<String, List<ODataRow>> attributes = getAttributes(products);
    for (String key : attributesItems.keySet()) {
        ODataRow attr = attributesItems.get(key);
        List<ODataRow> attrValues = attributes.get(key);
        if (attrValues.size() > 1) {
            ProductAttributeValuesView pav = new ProductAttributeValuesView(getContext(), parent,
                    attr, attrValues);
            pav.setOnAttributeSelectListener(this);
            parent.addView(pav.getView());
        } else {
            //TODO: Simple plain product attributes
        }
    }
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:17,代码来源:ProductDetail.java

示例5: getAttributes

import com.odoo.core.orm.ODataRow; //导入依赖的package包/类
private HashMap<String, List<ODataRow>> getAttributes(List<ODataRow> variants) {
    HashMap<String, List<ODataRow>> attributes = new HashMap<>();
    List<String> attValIds = new ArrayList<>();
    for (ODataRow variant : variants) {
        List<ODataRow> attrVals = variant.getM2MRecord("attribute_value_ids").browseEach();
        for (ODataRow attrVal : attrVals) {
            ODataRow attribute = attrVal.getM2ORecord("attribute_id").browse();
            String key = "attr_" + attribute.getInt(OColumn.ROW_ID);
            attributesItems.put(key, attribute);
            List<ODataRow> attValues = new ArrayList<>();
            if (attributes.containsKey(key)) {
                attValues.addAll(attributes.get(key));
            }
            if (!attValIds.contains("attr_val_" + attrVal.getString(OColumn.ROW_ID))) {
                attValues.add(attrVal);
                attValIds.add("attr_val_" + attrVal.getString(OColumn.ROW_ID));
            }
            attributes.put(key, attValues);
        }
    }
    return attributes;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:23,代码来源:ProductDetail.java

示例6: doInBackground

import com.odoo.core.orm.ODataRow; //导入依赖的package包/类
@Override
protected Void doInBackground(Void... params) {
    try {
        if (inNetwork()) {
            init();
            ProductAttributeValue value = new ProductAttributeValue(getContext());
            ODomain domain = new ODomain();
            List<Integer> product_ids = new ArrayList<>();
            for (ODataRow product : products) {
                product_ids.add(product.getInt("id"));
            }
            domain.add("product_ids", "in", product_ids);
            value.quickSyncRecords(domain, false);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:20,代码来源:ProductDetail.java

示例7: doInBackground

import com.odoo.core.orm.ODataRow; //导入依赖的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;
}
 
开发者ID:Odoo-mobile,项目名称:hr,代码行数:24,代码来源:OFileManager.java

示例8: doInBackground

import com.odoo.core.orm.ODataRow; //导入依赖的package包/类
@Override
protected Boolean doInBackground(OUser... params) {
    mUser = params[0];
    if (OdooAccountManager.createAccount(OdooLogin.this, mUser)) {
        mUser = OdooAccountManager.getDetails(OdooLogin.this, mUser.getAndroidName());
        OdooAccountManager.login(OdooLogin.this, mUser.getAndroidName());
        FirstLaunchConfig.onFirstLaunch(OdooLogin.this, mUser);
        try {
            // Syncing company details
            ODataRow company_details = new ODataRow();
            company_details.put("id", mUser.getCompanyId());
            ResCompany company = new ResCompany(OdooLogin.this, mUser);
            company.quickCreateRecord(company_details);
            Thread.sleep(500);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }
    return false;
}
 
开发者ID:Odoo-mobile,项目名称:hr,代码行数:22,代码来源:OdooLogin.java

示例9: bindView

import com.odoo.core.orm.ODataRow; //导入依赖的package包/类
@Override
public void bindView(View view, Context context, Cursor cursor) {
    final ODataRow row = new ODataRow();
    for (String col : cursor.getColumnNames()) {
        row.put(col, getValue(cursor, col));
    }
    if (mBeforeBindUpdateData != null) {
        row.addAll(mBeforeBindUpdateData.updateDataRow(cursor));
    }
    if (view instanceof OForm) {
        OForm form = (OForm) view;
        form.initForm(row);
    }
    if (mOnViewBindListener != null) {
        mOnViewBindListener.onViewBind(view, cursor, row);
    }
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:18,代码来源:OCursorListAdapter.java

示例10: getPos

import com.odoo.core.orm.ODataRow; //导入依赖的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;
}
 
开发者ID:Odoo-mobile,项目名称:hr,代码行数:22,代码来源:OSelectionField.java

示例11: doInBackground

import com.odoo.core.orm.ODataRow; //导入依赖的package包/类
@Override
protected Boolean doInBackground(OUser... params) {
    mUser = params[0];
    if (OdooAccountManager.createAccount(OdooLogin.this, mUser)) {
        mUser = OdooAccountManager.getDetails(OdooLogin.this, mUser.getAndroidName());
        OdooAccountManager.login(OdooLogin.this, mUser.getAndroidName());
        FirstLaunchConfig.onFirstLaunch(OdooLogin.this, mUser);
        try {
            // Syncing company details
            ODataRow company_details = new ODataRow();
            company_details.put("id", mUser.getCompanyId());
            ResCompany company = new ResCompany(OdooLogin.this);
            company.quickCreateRecord(company_details);
            Thread.sleep(500);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }
    return false;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:22,代码来源:OdooLogin.java

示例12: bindCategoryViews

import com.odoo.core.orm.ODataRow; //导入依赖的package包/类
private void bindCategoryViews(ViewGroup container) {
    View separator = LayoutInflater.from(this).inflate(R.layout.base_drawer_group_layout, container, false);
    OControls.setText(separator, R.id.group_title, R.string.label_shop_by_category);
    container.addView(separator);
    ProductPublicCategory categories = new ProductPublicCategory(this);
    for (ODataRow row : categories.select(null, "parent_id is NULL", new String[]{}, "sequence")) {
        View item = LayoutInflater.from(this).inflate(R.layout.base_drawer_category_item, container, false);
        if (row.getString("image_medium").equals("false")) {
            OControls.setImage(item, R.id.icon, R.drawable.ic_action_add);
        } else {
            OControls.setImage(item, R.id.icon, BitmapUtils.getBitmapImage(this,
                    row.getString("image_medium")));
        }
        OControls.setText(item, R.id.title, row.getString("name"));
        item.setTag(row);
        item.setOnClickListener(drawerCategoryItemClick);
        container.addView(item);
    }

}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:21,代码来源:OdooActivity.java

示例13: createRadioGroup

import com.odoo.core.orm.ODataRow; //导入依赖的package包/类
private void createRadioGroup() {
    final LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
    if (mRadioGroup == null) {
        mRadioGroup = new RadioGroup(mContext);
        mRadioGroup.setLayoutParams(params);
    } else {
        removeView(mRadioGroup);
    }
    mRadioGroup.removeAllViews();
    mRadioGroup.setOnCheckedChangeListener(this);
    for (ODataRow label : items) {
        RadioButton rdoBtn = new RadioButton(mContext);
        rdoBtn.setLayoutParams(params);
        rdoBtn.setText(label.getString(mModel.getDefaultNameColumn()));
        if (textSize > -1) {
            rdoBtn.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
        }
        if (appearance > -1) {
            rdoBtn.setTextAppearance(mContext, appearance);
        }
        rdoBtn.setTextColor(textColor);
        mRadioGroup.addView(rdoBtn);
    }
    addView(mRadioGroup);
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:27,代码来源:OSelectionField.java

示例14: doInBackground

import com.odoo.core.orm.ODataRow; //导入依赖的package包/类
@Override
        protected List<ODataRow> doInBackground(String... params) {
            try {
                ServerDataHelper helper = mRelModel.getServerDataHelper();
//                ODomain domain = new ODomain();
//                domain.add(mRelModel.getDefaultNameColumn(), "ilike", params[0]);
//                if (mCol != null) {
//                    for (String key : mCol.getDomains().keySet()) {
//                        OColumn.ColumnDomain dom = mCol.getDomains().get(key);
//                        domain.add(dom.getColumn(), dom.getOperator(),
//                                dom.getValue());
//                    }
//                }
//                OdooFields fields = new OdooFields(mRelModel.getColumns());
//                return helper.searchRecords(fields, domain, 10);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:21,代码来源:SearchableItemActivity.java

示例15: init

import com.odoo.core.orm.ODataRow; //导入依赖的package包/类
private void init() {
    TextView recordName = (TextView) findViewById(R.id.recordName);
    parent = (View) recordName.getParent().getParent();
    ODataRow record = mModel.browse(mModel.selectRowId(server_id));
    String name = record.getString(mModel.getDefaultNameColumn());
    findViewById(R.id.dialogHeader)
            .setBackgroundColor(OStringColorUtil.getStringColor(this, name));
    if (mType == MessageType.Message) {
        edtSubject.setText("Re: " + name);
        recordName.setText(String.format(OResource.string(this, R.string.message_to), name));
    } else {
        recordName.setText(R.string.add_internal_note);
        edtSubject.setVisibility(View.GONE);
        edtBody.setHint(R.string.internal_note_hint);
        OControls.setText(parent, R.id.btnSend, R.string.label_log_note);
    }
    edtBody.requestFocus();
}
 
开发者ID:Odoo-mobile,项目名称:hr,代码行数:19,代码来源:MailChatterCompose.java


注:本文中的com.odoo.core.orm.ODataRow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。