當前位置: 首頁>>代碼示例>>Java>>正文


Java ODataRow.put方法代碼示例

本文整理匯總了Java中com.odoo.core.orm.ODataRow.put方法的典型用法代碼示例。如果您正苦於以下問題:Java ODataRow.put方法的具體用法?Java ODataRow.put怎麽用?Java ODataRow.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.odoo.core.orm.ODataRow的用法示例。


在下文中一共展示了ODataRow.put方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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

示例3: 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

示例4: 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

示例5: doInBackground

import com.odoo.core.orm.ODataRow; //導入方法依賴的package包/類
@Override
protected Boolean doInBackground(String... params) {
    try {
        String subject = params[0];
        String body = params[1];
        OArguments args = new OArguments();
        args.add(server_id);
        HashMap<String, Object> data = new HashMap<>();
        data.put("body", body);
        data.put("subject", (subject.equals("false")) ? false : subject);
        data.put("parent_id", false);
        data.put("attachment_ids", attachmentIds);
        List<Integer> partner_ids = new ArrayList<>();
        if (partner_id != -1 && mType == MessageType.Message) {
            partner_ids.add(partner_id);
        }
        data.put("partner_ids", partner_ids);
        HashMap<String, Object> context = new HashMap<>();
        context.put("mail_read_set_read", true);
        context.put("default_res_id", server_id);
        context.put("default_model", mModel.getModelName());
        context.put("mail_post_autofollow", true);
        context.put("mail_post_autofollow_partner_ids", new ArrayList<>());
        data.put("context", context);
        data.put("type", "comment");
        data.put("content_subtype", "plaintext");
        data.put("subtype", (mType == MessageType.Message) ? "mail.mt_comment" : false);
        int newId = (int)
                mModel.getServerDataHelper().callMethod("message_post", args, null, data);
        Thread.sleep(500);
        ODataRow row = new ODataRow();
        row.put("id", newId);
        mailMessage.quickCreateRecord(row);
        return true;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:40,代碼來源:MailChatterCompose.java

示例6: findAllChild

import com.odoo.core.orm.ODataRow; //導入方法依賴的package包/類
private List<Object> findAllChild(int parent_id) {
    List<Object> items = new ArrayList<>();
    List<ODataRow> rows = db().select(new String[]{"name", "parent_id", "image_medium"}, "parent_id = ?",
            new String[]{parent_id + ""}, "sequence");
    for (ODataRow row : rows) {
        boolean hasChild = db().count("parent_id = ?", new String[]{row.getInt(OColumn.ROW_ID) + ""}) > 0;
        row.put("has_child", hasChild);
        items.add(row);
        if (hasChild) {
            items.addAll(findAllChild(row.getInt(OColumn.ROW_ID)));
        }
    }
    return items;
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:15,代碼來源:ProductSubCategories.java

示例7: toDatarow

import com.odoo.core.orm.ODataRow; //導入方法依賴的package包/類
public static ODataRow toDatarow(Cursor cr) {
    ODataRow row = new ODataRow();
    for (String col : cr.getColumnNames()) {
        row.put(col, OCursorUtils.cursorValue(col, cr));
    }
    return row;
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:8,代碼來源:OCursorUtils.java

示例8: toDataRow

import com.odoo.core.orm.ODataRow; //導入方法依賴的package包/類
public static ODataRow toDataRow(OdooRecord record) {
    ODataRow row = new ODataRow();
    Set<String> keys = record.keySet();
    for (String key : keys) {
        row.put(key, record.get(key));
    }
    return row;
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:9,代碼來源:OdooRecordUtils.java

示例9: onCreate

import com.odoo.core.orm.ODataRow; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.base_profile);
    OAppBarUtils.setAppBar(this, true);
    OUser user = OUser.currentUser(this);
    OForm form = (OForm) findViewById(R.id.profileDetails);
    int color = OStringColorUtil.getStringColor(this, user.getName());
    form.setIconTintColor(color);
    ODataRow userData = new ODataRow();
    userData.put("name", user.getName());
    userData.put("user_login", user.getUsername());
    userData.put("server_url", (user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
    userData.put("database", (user.isOAuthLogin()) ? user.getInstanceDatabase() : user.getDatabase());
    userData.put("version", user.getOdooVersion().getServerSerie());
    userData.put("timezone", user.getTimezone());
    form.initForm(userData);

    CollapsingToolbarLayout collapsing_toolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsing_toolbar.setTitle(userData.getString("name"));
    setTitle(userData.getString("name"));
    Bitmap avatar;
    if (user.getAvatar().equals("false")) {
        avatar = BitmapUtils.getAlphabetImage(this, user.getName());
    } else {
        avatar = BitmapUtils.getBitmapImage(this, user.getAvatar());
    }
    ImageView imageView = (ImageView) findViewById(R.id.image);
    imageView.setImageBitmap(avatar);
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:31,代碼來源:Profile.java

示例10: getRecordItems

import com.odoo.core.orm.ODataRow; //導入方法依賴的package包/類
public static List<ODataRow> getRecordItems(OModel model, OColumn column) {
    List<ODataRow> items = new ArrayList<ODataRow>();

    OModel rel_model = model.createInstance(column.getType());
    StringBuffer whr = new StringBuffer();
    List<Object> args_list = new ArrayList<Object>();
    // Skipping onchange domain filter
    if (!column.hasDomainFilterColumn()) {
        for (String key : column.getDomains().keySet()) {
            OColumn.ColumnDomain domain = column.getDomains().get(key);
            if (domain.getConditionalOperator() != null) {
                whr.append(domain.getConditionalOperator());
            } else {
                whr.append(" ");
                whr.append(domain.getColumn());
                whr.append(" ");
                whr.append(domain.getOperator());
                whr.append(" ? ");
                args_list.add(domain.getValue().toString());
            }
        }
    }
    String where = null;
    String[] args = null;
    if (args_list.size() > 0) {
        where = whr.toString();
        args = args_list.toArray(new String[args_list.size()]);
    }
    List<ODataRow> rows = new ArrayList<>();
    rows = rel_model.select(new String[]{rel_model.getDefaultNameColumn()}, where,
            args, rel_model.getDefaultNameColumn());
    ODataRow row = new ODataRow();
    row.put(OColumn.ROW_ID, -1);
    row.put(rel_model.getDefaultNameColumn(), "No " + column.getLabel() + " selected");
    items.add(row);
    items.addAll(rows);
    return items;
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:39,代碼來源:OSelectionField.java

示例11: doInBackground

import com.odoo.core.orm.ODataRow; //導入方法依賴的package包/類
@Override
protected Boolean doInBackground(String... params) {
    try {
        String subject = params[0];
        String body = params[1];
        OArguments args = new OArguments();
        args.add(server_id);
        HashMap<String, Object> data = new HashMap<>();
        data.put("body", body);
        data.put("subject", (subject.equals("false")) ? false : subject);
        data.put("parent_id", false);
        data.put("attachment_ids", attachmentIds);
        List<Integer> partner_ids = new ArrayList<>();
        if (partner_id != -1 && mType == MessageType.Message) {
            partner_ids.add(partner_id);
        }
        data.put("partner_ids", partner_ids);
        HashMap<String, Object> context = new HashMap<>();
        context.put("mail_read_set_read", true);
        context.put("default_res_id", server_id);
        context.put("default_model", mModel.getModelName());
        context.put("mail_post_autofollow", true);
        context.put("mail_post_autofollow_partner_ids", new ArrayList<>());
        data.put("context", context);
        data.put("type", "comment");
        data.put("content_subtype", "plaintext");
        data.put("subtype", (mType == MessageType.Message) ? "mail.mt_comment" : false);
        Double newId = (double)
                mModel.getServerDataHelper().callMethod("message_post", args, null, data);
        Thread.sleep(500);
        ODataRow row = new ODataRow();
        row.put("id", newId.intValue());
        mailMessage.quickCreateRecord(row);
        return true;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}
 
開發者ID:Odoo-mobile,項目名稱:hr,代碼行數:40,代碼來源:MailChatterCompose.java

示例12: 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, user);
                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();
                Log.e(TAG, OResource.string(context, R.string.toast_something_gone_wrong));
            }
        }
        return odoo;
    }
 
開發者ID:Odoo-mobile,項目名稱:hr,代碼行數:28,代碼來源:OSyncAdapter.java

示例13: onCreate

import com.odoo.core.orm.ODataRow; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.base_profile);
    OAppBarUtils.setAppBar(this, true);
    OUser user = OUser.current(this);
    OForm form = (OForm) findViewById(R.id.profileDetails);
    int color = OStringColorUtil.getStringColor(this, user.getName());
    form.setIconTintColor(color);
    ODataRow userData = new ODataRow();
    userData.put("name", user.getName());
    userData.put("user_login", user.getUsername());
    userData.put("server_url", (user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
    userData.put("database", (user.isOAuthLogin()) ? user.getInstanceDatabase() : user.getDatabase());
    userData.put("version", user.getOdooVersion().getServerSerie());
    userData.put("timezone", user.getTimezone());
    form.initForm(userData);

    CollapsingToolbarLayout collapsing_toolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsing_toolbar.setTitle(userData.getString("name"));
    setTitle(userData.getString("name"));
    Bitmap avatar;
    if (user.getAvatar().equals("false")) {
        avatar = BitmapUtils.getAlphabetImage(this, user.getName());
    } else {
        avatar = BitmapUtils.getBitmapImage(this, user.getAvatar());
    }
    ImageView imageView = (ImageView) findViewById(R.id.image);
    imageView.setImageBitmap(avatar);
}
 
開發者ID:Odoo-mobile,項目名稱:hr,代碼行數:31,代碼來源:Profile.java


注:本文中的com.odoo.core.orm.ODataRow.put方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。