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


Java Note.setContent方法代码示例

本文整理汇总了Java中com.evernote.edam.type.Note.setContent方法的典型用法代码示例。如果您正苦于以下问题:Java Note.setContent方法的具体用法?Java Note.setContent怎么用?Java Note.setContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.evernote.edam.type.Note的用法示例。


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

示例1: createNote

import com.evernote.edam.type.Note; //导入方法依赖的package包/类
/**
 * Creates a new note
 * 
 * @param title The note's title
 * @param content The note's content as EHTML
 * @param date If not null used for created and updated date 
 * @param source Source attribute to be added to the note 
 * @throws Exception
 */
public Note createNote(String title, String content, Long date, String source) throws Exception {
	LOG.debug("Creating new note: {}", title);
	
	Note note = new Note();
	note.setTitle(title);
	note.setContent(content);
	if ( date != null) {
		note.setCreated(date);	
		note.setUpdated(date);
	}
	if (source != null && source.length()>0) {
		NoteAttributes attributes = new NoteAttributes();
		attributes.setSource(source);
		note.setAttributes(attributes);
	}

	LOG.debug(content);
	return noteStore.createNote(note);
}
 
开发者ID:windsource,项目名称:evernote-markdown-sync,代码行数:29,代码来源:MyEvernoteService.java

示例2: create

import com.evernote.edam.type.Note; //导入方法依赖的package包/类
private void create(final ENNote args) throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException, ParserConfigurationException, SAXException, IOException {
    Note note = new Note();
    note.setTitle(StringUtils.abbreviate(args.getName(), EDAMLimits.EDAM_NOTE_TITLE_LEN_MAX));
    if (StringUtils.isNotBlank(args.getNotebook().getGuid())) {
        note.setNotebookGuid(args.getNotebook().getGuid());
    }

    ENML enml = new ENML();
    enml.setTabWidth(args.getTabWidth());
    enml.addComment(args.getComments());
    enml.addContent(args.getContent());

    note.setContent(enml.get());

    for (String tagName : args.getTags()) {
        tagName = tagName.trim();
        if (StringUtils.isNotBlank(tagName)) {
            note.addToTagNames(tagName);
        }
    }

    getNoteStoreClient(args).createNote(note);
}
 
开发者ID:LTTPP,项目名称:Eemory,代码行数:24,代码来源:NoteOpsTextImpl.java

示例3: toNote

import com.evernote.edam.type.Note; //导入方法依赖的package包/类
public Note toNote() {
    Note note = new Note();
    note.setTitle("PureNote " + Util.timeStamp(this));
    note.setContent(convertContentToEvernote());
    if (!"".equals(bookGuid)) {
        note.setNotebookGuid(bookGuid);
    }
    if (!"".equals(guid)) {
        note.setGuid(guid);
    }
    return note;
}
 
开发者ID:duanze,项目名称:PureNote,代码行数:13,代码来源:GNote.java

示例4: 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);
}
 
开发者ID:LTTPP,项目名称:Eemory,代码行数:33,代码来源:NoteOpsTextImpl.java

示例5: create

import com.evernote.edam.type.Note; //导入方法依赖的package包/类
private void create(final ENNote args) throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException, NoSuchAlgorithmException, IOException, ParserConfigurationException, SAXException {
    Note note = new Note();
    note.setTitle(StringUtils.abbreviate(args.getName(), EDAMLimits.EDAM_NOTE_TITLE_LEN_MAX));
    if (StringUtils.isNotBlank(args.getNotebook().getGuid())) {
        note.setNotebookGuid(args.getNotebook().getGuid());
    }

    ENML enml = new ENML();
    enml.setTabWidth(args.getTabWidth());
    enml.addComment(args.getComments());

    for (File f : args.getAttachments()) {
        // create resource
        String mimeType = FileUtil.mimeType(f); // E.g "image/png"
        Resource resource = EvernoteUtil.createResource(f, mimeType);
        note.addToResources(resource);

        // create content
        String hashHex = FileUtil.bytesToHex(resource.getData().getBodyHash());
        enml.addResource(hashHex, mimeType);
    }

    note.setContent(enml.get());

    // create tags
    for (String tagName : args.getTags()) {
        tagName = tagName.trim();
        if (StringUtils.isNotBlank(tagName)) {
            note.addToTagNames(tagName);
        }
    }

    getNoteStoreClient(args).createNote(note);
}
 
开发者ID:LTTPP,项目名称:Eemory,代码行数:35,代码来源:NoteOpsFileImpl.java

示例6: update

import com.evernote.edam.type.Note; //导入方法依赖的package包/类
private void update(final ENNote args) throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException, NoSuchAlgorithmException, IOException, ParserConfigurationException, SAXException {
    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;
    }

    ENML enml = new ENML(note.getContent());
    enml.setTabWidth(args.getTabWidth());
    // update content
    enml.addComment(args.getComments());

    // update resource
    Iterator<File> iter = args.getAttachments().iterator();
    while (iter.hasNext()) {
        File file = iter.next();
        String mimeType = FileUtil.mimeType(file); // E.g "image/png"
        Resource resource = EvernoteUtil.createResource(file, mimeType);
        note.addToResources(resource);

        String hashHex = FileUtil.bytesToHex(resource.getData().getBodyHash());
        enml.addResource(hashHex, mimeType);
    }

    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);
}
 
开发者ID:LTTPP,项目名称:Eemory,代码行数:43,代码来源:NoteOpsFileImpl.java

示例7: createNote

import com.evernote.edam.type.Note; //导入方法依赖的package包/类
/**
 * Create a new note containing a little text and the Evernote icon.
 */
private void createNote() throws Exception {
	// To create a new note, simply create a new Note object and fill in
	// attributes such as the note's title.
	Note note = new Note();
	note.setTitle("Test note from EDAMDemo.java");

	String fileName = "enlogo.png";
	String mimeType = "image/png";

	// To include an attachment such as an image in a note, first create a
	// Resource
	// for the attachment. At a minimum, the Resource contains the binary
	// attachment
	// data, an MD5 hash of the binary data, and the attachment MIME type.
	// It can also
	// include attributes such as filename and location.
	Resource resource = new Resource();
	resource.setData(readFileAsData(fileName));
	resource.setMime(mimeType);
	ResourceAttributes attributes = new ResourceAttributes();
	attributes.setFileName(fileName);
	resource.setAttributes(attributes);

	// Now, add the new Resource to the note's list of resources
	note.addToResources(resource);

	// To display the Resource as part of the note's content, include an
	// <en-media>
	// tag in the note's ENML content. The en-media tag identifies the
	// corresponding
	// Resource using the MD5 hash.
	String hashHex = bytesToHex(resource.getData().getBodyHash());

	// The content of an Evernote note is represented using Evernote Markup
	// Language
	// (ENML). The full ENML specification can be found in the Evernote API
	// Overview
	// at http://dev.evernote.com/documentation/cloud/chapters/ENML.php
	String content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
			+ "<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">"
			+ "<en-note>"
			+ "<span style=\"color:green;\">Here's the Evernote logo:</span><br/>"
			+ "<en-media type=\"image/png\" hash=\"" + hashHex + "\"/>"
			+ "</en-note>";
	note.setContent(content);

	// Finally, send the new note to Evernote using the createNote method
	// The new Note object that is returned will contain server-generated
	// attributes such as the new note's unique GUID.
	Note createdNote = noteStore.createNote(note);
	newNoteGuid = createdNote.getGuid();

	System.out.println("Successfully created a new note with GUID: "
			+ newNoteGuid);
	System.out.println();
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:60,代码来源:HelpEverNote.java

示例8: toNote

import com.evernote.edam.type.Note; //导入方法依赖的package包/类
public Note toNote() {
	Note note = new Note();
	note.setTitle(getTitle());
	note.setContent(convertContentToEvernote());
	return note;
}
 
开发者ID:daimajia,项目名称:EverMemo,代码行数:7,代码来源:Memo.java


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