本文整理汇总了Java中com.evernote.edam.type.Note.unsetResources方法的典型用法代码示例。如果您正苦于以下问题:Java Note.unsetResources方法的具体用法?Java Note.unsetResources怎么用?Java Note.unsetResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.evernote.edam.type.Note
的用法示例。
在下文中一共展示了Note.unsetResources方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import com.evernote.edam.type.Note; //导入方法依赖的package包/类
private void update(final ENNote args) throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException, DOMException, ParserConfigurationException, SAXException, IOException {
NoteStoreClient client = getNoteStoreClient(args);
Note note = client.getNote(args.getGuid(), true, false, false, false);
if (!note.isActive()) {
EDAMNotFoundException e = new EDAMNotFoundException();
e.setIdentifier(EDAMDataModel.Note_noteGuid.toString());
e.setKey(args.getGuid());
throw e;
}
note.unsetResources();
// update content
ENML enml = new ENML(note.getContent());
enml.setTabWidth(args.getTabWidth());
enml.addComment(args.getComments());
enml.addContent(args.getContent());
note.setContent(enml.get());
// update tags
for (String tagName : args.getTags()) {
tagName = tagName.trim();
if (StringUtils.isNotBlank(tagName)) {
note.addToTagNames(tagName);
}
}
note.setUpdated(System.currentTimeMillis());
client.updateNote(note);
}
示例2: updateNoteTag
import com.evernote.edam.type.Note; //导入方法依赖的package包/类
/**
* Update the tags assigned to a note. This method demonstrates how only
* modified fields need to be sent in calls to updateNote.
*/
private void updateNoteTag() throws Exception {
// When updating a note, it is only necessary to send Evernote the
// fields that have changed. For example, if the Note that you
// send via updateNote does not have the resources field set, the
// Evernote server will not change the note's existing resources.
// If you wanted to remove all resources from a note, you would
// set the resources field to a new List<Resource> that is empty.
// If you are only changing attributes such as the note's title or tags,
// you can save time and bandwidth by omitting the note content and
// resources.
// In this sample code, we fetch the note that we created earlier,
// including
// the full note content and all resources. A real application might
// do something with the note, then update a note attribute such as a
// tag.
Note note = noteStore.getNote(newNoteGuid, true, true, false, false);
// Do something with the note contents or resources...
// Now, update the note. Because we're not changing them, we unset
// the content and resources. All we want to change is the tags.
note.unsetContent();
note.unsetResources();
// We want to apply the tag "TestTag"
note.addToTagNames("TestTag");
// Now update the note. Because we haven't set the content or resources,
// they won't be changed.
noteStore.updateNote(note);
System.out.println("Successfully added tag to existing note");
// To prove that we didn't destroy the note, let's fetch it again and
// verify that it still has 1 resource.
note = noteStore.getNote(newNoteGuid, false, false, false, false);
System.out.println("After update, note has " + note.getResourcesSize()
+ " resource(s)");
System.out.println("After update, note tags are: ");
for (String tagGuid : note.getTagGuids()) {
Tag tag = noteStore.getTag(tagGuid);
System.out.println("* " + tag.getName());
}
System.out.println();
}