|
|
@ -33,21 +33,38 @@ import net.micode.notes.ui.NotesListAdapter.AppWidgetAttribute;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @aPackage : net.micode.notes.tool
|
|
|
|
|
|
|
|
* @aClassName: DataUtils
|
|
|
|
|
|
|
|
* @Description:
|
|
|
|
|
|
|
|
* 主要功能:实现便签数据处理工具类,封装如查找、移动、删除数据等操作
|
|
|
|
|
|
|
|
* @aAuthor: Li Qiushi
|
|
|
|
|
|
|
|
* @createdate: 12/30/2023 08:31 AM
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
public class DataUtils {
|
|
|
|
public class DataUtils {
|
|
|
|
public static final String TAG = "DataUtils";
|
|
|
|
public static final String TAG = "DataUtils";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 作用:用于批量删除笔记
|
|
|
|
|
|
|
|
* @param resolver
|
|
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
|
|
* @return boolean
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static boolean batchDeleteNotes(ContentResolver resolver, HashSet<Long> ids) {
|
|
|
|
public static boolean batchDeleteNotes(ContentResolver resolver, HashSet<Long> ids) {
|
|
|
|
|
|
|
|
//判断ids是否为空
|
|
|
|
if (ids == null) {
|
|
|
|
if (ids == null) {
|
|
|
|
Log.d(TAG, "the ids is null");
|
|
|
|
Log.d(TAG, "the ids is null");
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//判断ids大小是否为0
|
|
|
|
if (ids.size() == 0) {
|
|
|
|
if (ids.size() == 0) {
|
|
|
|
Log.d(TAG, "no id is in the hashset");
|
|
|
|
Log.d(TAG, "no id is in the hashset");
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//创建类存储删除的动作
|
|
|
|
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();
|
|
|
|
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();
|
|
|
|
|
|
|
|
//遍历ID,如果发现是根文件夹,则不删除
|
|
|
|
for (long id : ids) {
|
|
|
|
for (long id : ids) {
|
|
|
|
if(id == Notes.ID_ROOT_FOLDER) {
|
|
|
|
if(id == Notes.ID_ROOT_FOLDER) {
|
|
|
|
Log.e(TAG, "Don't delete system folder root");
|
|
|
|
Log.e(TAG, "Don't delete system folder root");
|
|
|
@ -57,9 +74,10 @@ public class DataUtils {
|
|
|
|
.newDelete(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id));
|
|
|
|
.newDelete(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id));
|
|
|
|
operationList.add(builder.build());
|
|
|
|
operationList.add(builder.build());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//批量删除操作
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList);
|
|
|
|
ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList);
|
|
|
|
if (results == null || results.length == 0 || results[0] == null) {
|
|
|
|
if (results.length == 0 || results[0] == null) {
|
|
|
|
Log.d(TAG, "delete notes failed, ids:" + ids.toString());
|
|
|
|
Log.d(TAG, "delete notes failed, ids:" + ids.toString());
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -72,14 +90,29 @@ public class DataUtils {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 作用:将一个笔记从一个文件夹移动到另一个文件夹
|
|
|
|
|
|
|
|
* @param resolver
|
|
|
|
|
|
|
|
* @param id
|
|
|
|
|
|
|
|
* @param srcFolderId
|
|
|
|
|
|
|
|
* @param desFolderId
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static void moveNoteToFoler(ContentResolver resolver, long id, long srcFolderId, long desFolderId) {
|
|
|
|
public static void moveNoteToFoler(ContentResolver resolver, long id, long srcFolderId, long desFolderId) {
|
|
|
|
ContentValues values = new ContentValues();
|
|
|
|
ContentValues values = new ContentValues();
|
|
|
|
values.put(NoteColumns.PARENT_ID, desFolderId);
|
|
|
|
values.put(NoteColumns.PARENT_ID, desFolderId);
|
|
|
|
values.put(NoteColumns.ORIGIN_PARENT_ID, srcFolderId);
|
|
|
|
values.put(NoteColumns.ORIGIN_PARENT_ID, srcFolderId);
|
|
|
|
values.put(NoteColumns.LOCAL_MODIFIED, 1);
|
|
|
|
values.put(NoteColumns.LOCAL_MODIFIED, 1);
|
|
|
|
|
|
|
|
//对需要移动的便签进行数据更新,然后用update实现
|
|
|
|
resolver.update(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id), values, null, null);
|
|
|
|
resolver.update(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id), values, null, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 作用:用于将一组笔记(由id集合表示)批量移动到指定的文件夹
|
|
|
|
|
|
|
|
* @param resolver
|
|
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
|
|
* @param folderId
|
|
|
|
|
|
|
|
* @return boolean
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static boolean batchMoveToFolder(ContentResolver resolver, HashSet<Long> ids,
|
|
|
|
public static boolean batchMoveToFolder(ContentResolver resolver, HashSet<Long> ids,
|
|
|
|
long folderId) {
|
|
|
|
long folderId) {
|
|
|
|
if (ids == null) {
|
|
|
|
if (ids == null) {
|
|
|
@ -89,13 +122,15 @@ public class DataUtils {
|
|
|
|
|
|
|
|
|
|
|
|
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();
|
|
|
|
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();
|
|
|
|
for (long id : ids) {
|
|
|
|
for (long id : ids) {
|
|
|
|
|
|
|
|
//通过withAppendedId方法,为该Uri加上ID
|
|
|
|
ContentProviderOperation.Builder builder = ContentProviderOperation
|
|
|
|
ContentProviderOperation.Builder builder = ContentProviderOperation
|
|
|
|
.newUpdate(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id));
|
|
|
|
.newUpdate(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id));
|
|
|
|
builder.withValue(NoteColumns.PARENT_ID, folderId);
|
|
|
|
builder.withValue(NoteColumns.PARENT_ID, folderId);
|
|
|
|
builder.withValue(NoteColumns.LOCAL_MODIFIED, 1);
|
|
|
|
builder.withValue(NoteColumns.LOCAL_MODIFIED, 1);
|
|
|
|
operationList.add(builder.build());
|
|
|
|
operationList.add(builder.build());
|
|
|
|
}
|
|
|
|
}//将ids里包含的每一列的数据逐次加入到operationList中,等待最后的批量处理
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//使用ContentResolver的applyBatch方法执行批量更新操作
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList);
|
|
|
|
ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList);
|
|
|
|
if (results == null || results.length == 0 || results[0] == null) {
|
|
|
|
if (results == null || results.length == 0 || results[0] == null) {
|
|
|
@ -112,19 +147,22 @@ public class DataUtils {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get the all folder count except system folders {@link Notes#TYPE_SYSTEM}}
|
|
|
|
* 作用 :获取除系统文件夹之外的所有文件夹数量
|
|
|
|
|
|
|
|
* @param resolver
|
|
|
|
|
|
|
|
* @return count
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static int getUserFolderCount(ContentResolver resolver) {
|
|
|
|
public static int getUserFolderCount(ContentResolver resolver) {
|
|
|
|
Cursor cursor =resolver.query(Notes.CONTENT_NOTE_URI,
|
|
|
|
Cursor cursor =resolver.query(Notes.CONTENT_NOTE_URI,
|
|
|
|
new String[] { "COUNT(*)" },
|
|
|
|
new String[] { "COUNT(*)" },
|
|
|
|
NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>?",
|
|
|
|
NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>?",
|
|
|
|
|
|
|
|
//筛选条件:源文件不为trash folder,即垃圾文件
|
|
|
|
new String[] { String.valueOf(Notes.TYPE_FOLDER), String.valueOf(Notes.ID_TRASH_FOLER)},
|
|
|
|
new String[] { String.valueOf(Notes.TYPE_FOLDER), String.valueOf(Notes.ID_TRASH_FOLER)},
|
|
|
|
null);
|
|
|
|
null);
|
|
|
|
|
|
|
|
|
|
|
|
int count = 0;
|
|
|
|
int count = 0;
|
|
|
|
if(cursor != null) {
|
|
|
|
if(cursor != null && cursor.moveToFirst()) {
|
|
|
|
if(cursor.moveToFirst()) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
//获取文件夹的数量,并将其赋值给count变量
|
|
|
|
count = cursor.getInt(0);
|
|
|
|
count = cursor.getInt(0);
|
|
|
|
} catch (IndexOutOfBoundsException e) {
|
|
|
|
} catch (IndexOutOfBoundsException e) {
|
|
|
|
Log.e(TAG, "get folder count failed:" + e.toString());
|
|
|
|
Log.e(TAG, "get folder count failed:" + e.toString());
|
|
|
@ -132,19 +170,27 @@ public class DataUtils {
|
|
|
|
cursor.close();
|
|
|
|
cursor.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return count;
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 作用:用于检查一个笔记是否在Note数据库中可见
|
|
|
|
|
|
|
|
* @param resolver
|
|
|
|
|
|
|
|
* @param noteId
|
|
|
|
|
|
|
|
* @param type
|
|
|
|
|
|
|
|
* @return boolean
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static boolean visibleInNoteDatabase(ContentResolver resolver, long noteId, int type) {
|
|
|
|
public static boolean visibleInNoteDatabase(ContentResolver resolver, long noteId, int type) {
|
|
|
|
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId),
|
|
|
|
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId),
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
|
|
|
|
//查询条件:type符合,且不属于垃圾文件夹
|
|
|
|
NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER,
|
|
|
|
NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER,
|
|
|
|
new String [] {String.valueOf(type)},
|
|
|
|
new String [] {String.valueOf(type)},
|
|
|
|
null);
|
|
|
|
null);
|
|
|
|
|
|
|
|
|
|
|
|
boolean exist = false;
|
|
|
|
boolean exist = false;
|
|
|
|
if (cursor != null) {
|
|
|
|
if (cursor != null) {
|
|
|
|
|
|
|
|
//用getCount函数判断cursor是否为空
|
|
|
|
if (cursor.getCount() > 0) {
|
|
|
|
if (cursor.getCount() > 0) {
|
|
|
|
exist = true;
|
|
|
|
exist = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -153,6 +199,12 @@ public class DataUtils {
|
|
|
|
return exist;
|
|
|
|
return exist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 作用:用于检查一个笔记是否存在于Note数据库中
|
|
|
|
|
|
|
|
* @param resolver
|
|
|
|
|
|
|
|
* @param noteId
|
|
|
|
|
|
|
|
* @return boolean
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static boolean existInNoteDatabase(ContentResolver resolver, long noteId) {
|
|
|
|
public static boolean existInNoteDatabase(ContentResolver resolver, long noteId) {
|
|
|
|
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId),
|
|
|
|
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId),
|
|
|
|
null, null, null, null);
|
|
|
|
null, null, null, null);
|
|
|
@ -167,6 +219,12 @@ public class DataUtils {
|
|
|
|
return exist;
|
|
|
|
return exist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 作用:用于检查给定的数据ID是否存在于数据数据库中(检查方法同上)
|
|
|
|
|
|
|
|
* @param resolver
|
|
|
|
|
|
|
|
* @param dataId
|
|
|
|
|
|
|
|
* @return boolean
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static boolean existInDataDatabase(ContentResolver resolver, long dataId) {
|
|
|
|
public static boolean existInDataDatabase(ContentResolver resolver, long dataId) {
|
|
|
|
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_DATA_URI, dataId),
|
|
|
|
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_DATA_URI, dataId),
|
|
|
|
null, null, null, null);
|
|
|
|
null, null, null, null);
|
|
|
@ -181,6 +239,12 @@ public class DataUtils {
|
|
|
|
return exist;
|
|
|
|
return exist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 作用:用于检查给定的文件夹名称是否在Notes数据库中可见
|
|
|
|
|
|
|
|
* @param resolver
|
|
|
|
|
|
|
|
* @param name
|
|
|
|
|
|
|
|
* @return boolean
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static boolean checkVisibleFolderName(ContentResolver resolver, String name) {
|
|
|
|
public static boolean checkVisibleFolderName(ContentResolver resolver, String name) {
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, null,
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, null,
|
|
|
|
NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER +
|
|
|
|
NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER +
|
|
|
@ -188,6 +252,7 @@ public class DataUtils {
|
|
|
|
" AND " + NoteColumns.SNIPPET + "=?",
|
|
|
|
" AND " + NoteColumns.SNIPPET + "=?",
|
|
|
|
new String[] { name }, null);
|
|
|
|
new String[] { name }, null);
|
|
|
|
boolean exist = false;
|
|
|
|
boolean exist = false;
|
|
|
|
|
|
|
|
//通过名字查询文件是否存在
|
|
|
|
if(cursor != null) {
|
|
|
|
if(cursor != null) {
|
|
|
|
if(cursor.getCount() > 0) {
|
|
|
|
if(cursor.getCount() > 0) {
|
|
|
|
exist = true;
|
|
|
|
exist = true;
|
|
|
@ -197,7 +262,14 @@ public class DataUtils {
|
|
|
|
return exist;
|
|
|
|
return exist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 作用:用于从Notes数据库中获取指定文件夹ID下的所有小部件属性
|
|
|
|
|
|
|
|
* @param resolver
|
|
|
|
|
|
|
|
* @param folderId
|
|
|
|
|
|
|
|
* @return HashSet
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static HashSet<AppWidgetAttribute> getFolderNoteWidget(ContentResolver resolver, long folderId) {
|
|
|
|
public static HashSet<AppWidgetAttribute> getFolderNoteWidget(ContentResolver resolver, long folderId) {
|
|
|
|
|
|
|
|
//查询条件:父ID是传入的folderId
|
|
|
|
Cursor c = resolver.query(Notes.CONTENT_NOTE_URI,
|
|
|
|
Cursor c = resolver.query(Notes.CONTENT_NOTE_URI,
|
|
|
|
new String[] { NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE },
|
|
|
|
new String[] { NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE },
|
|
|
|
NoteColumns.PARENT_ID + "=?",
|
|
|
|
NoteColumns.PARENT_ID + "=?",
|
|
|
@ -211,6 +283,10 @@ public class DataUtils {
|
|
|
|
do {
|
|
|
|
do {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
AppWidgetAttribute widget = new AppWidgetAttribute();
|
|
|
|
AppWidgetAttribute widget = new AppWidgetAttribute();
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
0对应NoteColumns.WIDGET_ID
|
|
|
|
|
|
|
|
1行应的NoteColumns.WIDGET_TYPE
|
|
|
|
|
|
|
|
*/
|
|
|
|
widget.widgetId = c.getInt(0);
|
|
|
|
widget.widgetId = c.getInt(0);
|
|
|
|
widget.widgetType = c.getInt(1);
|
|
|
|
widget.widgetType = c.getInt(1);
|
|
|
|
set.add(widget);
|
|
|
|
set.add(widget);
|
|
|
@ -224,6 +300,12 @@ public class DataUtils {
|
|
|
|
return set;
|
|
|
|
return set;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 作用:用于根据笔记ID获取通话记录中的电话号码
|
|
|
|
|
|
|
|
* @param resolver
|
|
|
|
|
|
|
|
* @param noteId
|
|
|
|
|
|
|
|
* @return String
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static String getCallNumberByNoteId(ContentResolver resolver, long noteId) {
|
|
|
|
public static String getCallNumberByNoteId(ContentResolver resolver, long noteId) {
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI,
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI,
|
|
|
|
new String [] { CallNote.PHONE_NUMBER },
|
|
|
|
new String [] { CallNote.PHONE_NUMBER },
|
|
|
@ -243,6 +325,13 @@ public class DataUtils {
|
|
|
|
return "";
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 作用:用于根据电话号码和通话日期从Android的ContentResolver中查询Notes数据库中的记录
|
|
|
|
|
|
|
|
* @param resolver
|
|
|
|
|
|
|
|
* @param phoneNumber
|
|
|
|
|
|
|
|
* @param callDate
|
|
|
|
|
|
|
|
* @return long
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static long getNoteIdByPhoneNumberAndCallDate(ContentResolver resolver, String phoneNumber, long callDate) {
|
|
|
|
public static long getNoteIdByPhoneNumberAndCallDate(ContentResolver resolver, String phoneNumber, long callDate) {
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI,
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI,
|
|
|
|
new String [] { CallNote.NOTE_ID },
|
|
|
|
new String [] { CallNote.NOTE_ID },
|
|
|
@ -264,7 +353,14 @@ public class DataUtils {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 作用:根据给定的noteId从ContentResolver中获取对应的笔记片段(snippet)
|
|
|
|
|
|
|
|
* @param resolver
|
|
|
|
|
|
|
|
* @param noteId
|
|
|
|
|
|
|
|
* @return String
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static String getSnippetById(ContentResolver resolver, long noteId) {
|
|
|
|
public static String getSnippetById(ContentResolver resolver, long noteId) {
|
|
|
|
|
|
|
|
//查询条件:noteId
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI,
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI,
|
|
|
|
new String [] { NoteColumns.SNIPPET },
|
|
|
|
new String [] { NoteColumns.SNIPPET },
|
|
|
|
NoteColumns.ID + "=?",
|
|
|
|
NoteColumns.ID + "=?",
|
|
|
@ -282,6 +378,11 @@ public class DataUtils {
|
|
|
|
throw new IllegalArgumentException("Note is not found with id: " + noteId);
|
|
|
|
throw new IllegalArgumentException("Note is not found with id: " + noteId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 作用:对输入的字符串进行处理,返回处理后的字符串
|
|
|
|
|
|
|
|
* @param snippet
|
|
|
|
|
|
|
|
* @return String
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static String getFormattedSnippet(String snippet) {
|
|
|
|
public static String getFormattedSnippet(String snippet) {
|
|
|
|
if (snippet != null) {
|
|
|
|
if (snippet != null) {
|
|
|
|
snippet = snippet.trim();
|
|
|
|
snippet = snippet.trim();
|
|
|
|