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


Java StringUtils类代码示例

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


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

示例1: getView

import com.odoo.core.utils.StringUtils; //导入依赖的package包/类
@Override
public View getView(int position, View view, ViewGroup parent) {
    ODataRow row = (ODataRow) chatterItems.get(position);
    if (row.getString("subtype_id").equals("false")) {
        view.setBackgroundResource(R.color.base_chatter_view_note_background);
    } else {
        view.setBackgroundColor(Color.WHITE);
    }
    view.findViewById(R.id.imgAttachments).setVisibility(
            (row.getBoolean("has_attachments")) ?
                    View.VISIBLE :
                    View.GONE
    );

    if (row.getString("subject").equals("false")) {
        OControls.setGone(view, R.id.chatterSubject);
    } else {
        OControls.setVisible(view, R.id.chatterSubject);
        OControls.setText(view, R.id.chatterSubject, row.getString("subject"));
    }
    String date = ODateUtils.convertToDefault(row.getString("date"),
            ODateUtils.DEFAULT_FORMAT, "MMM dd hh:mm a");
    OControls.setText(view, R.id.chatterDate, date);
    OControls.setText(view, R.id.chatterBody, StringUtils.htmlToString(row.getString("body")));
    OControls.setText(view, R.id.chatterAuthor, row.getString("author_name"));
    String author_image = mailMessage.getAuthorImage(row.getInt(OColumn.ROW_ID));
    if (!author_image.equals("false")) {
        Bitmap author = BitmapUtils.getBitmapImage(mContext, author_image);
        OControls.setImage(view, R.id.authorImage, author);
    } else {
        OControls.setImage(view, R.id.authorImage, R.drawable.avatar);
    }

    view.setTag(row);
    view.setOnClickListener(this);
    return view;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:38,代码来源:MailChatterView.java

示例2: updateRecordsOnServer

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

示例3: deleteRecords

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

示例4: selectManyToManyRecords

import com.odoo.core.utils.StringUtils; //导入依赖的package包/类
public List<ODataRow> selectManyToManyRecords(String[] projection, String column_name, int row_id) {
    OColumn column = getColumn(column_name);
    OModel rel_model = createInstance(column.getType());
    String table = getTableName() + "_" + rel_model.getTableName() + "_rel";
    String base_column = getTableName() + "_id";
    String rel_column = rel_model.getTableName() + "_id";

    // Getting relation table ids
    List<String> ids = new ArrayList<>();
    SQLiteDatabase db = getReadableDatabase();
    Cursor cr = null;
    try {
        cr = db.query(table, new String[]{rel_column}, base_column + "=?",
                new String[]{row_id + ""}, null, null, null);
        if (cr.moveToFirst()) {
            do {
                ids.add(cr.getInt(0) + "");
            } while (cr.moveToNext());
        }
    } finally {
        if (cr != null) {
            cr.close();
        }
    }
    List<ODataRow> data = rel_model.select(projection, OColumn.ROW_ID + " IN (" + StringUtils.repeat(" ?, ", ids.size() - 1) + " ?)",
            ids.toArray(new String[ids.size()]));
    rel_model.close();
    return data;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:30,代码来源:OModel.java

示例5: onViewBind

import com.odoo.core.utils.StringUtils; //导入依赖的package包/类
@Override
public void onViewBind(View view, Cursor cursor, ODataRow row) {
    OControls.setText(view, R.id.subject, row.getString("subject"));
    OControls.setText(view, R.id.message, StringUtils.htmlToString(row.getString("message")));
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:6,代码来源:News.java


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