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


Java ClientFactory.createNoteStoreClient方法代码示例

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


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

示例1: MyEvernoteService

import com.evernote.clients.ClientFactory; //导入方法依赖的package包/类
/**
 * Creates a service used to access Evernote
 * 
 * @param token authentication token
 * @param sandbox true for snadox, false for prouction enviroment
 * @throws Exception
 */
public MyEvernoteService(String token, boolean sandbox) throws Exception {
	this.token = token;
	// Set up the UserStore client and check that we can speak to the server
	EvernoteService service = EvernoteService.PRODUCTION;
	if ( sandbox ) {
		service = EvernoteService.SANDBOX;
	}
	EvernoteAuth evernoteAuth = new EvernoteAuth(service, token);
	ClientFactory factory = new ClientFactory(evernoteAuth);
	userStore = factory.createUserStoreClient();

	boolean versionOk = userStore.checkVersion("EvernoteMarkdownSync",
			com.evernote.edam.userstore.Constants.EDAM_VERSION_MAJOR,
			com.evernote.edam.userstore.Constants.EDAM_VERSION_MINOR);
	if (!versionOk) {
		LOG.error("Incompatible Evernote client protocol version");
		System.exit(1);
	}

	// Set up the NoteStore client
	noteStore = factory.createNoteStoreClient();
}
 
开发者ID:windsource,项目名称:evernote-markdown-sync,代码行数:30,代码来源:MyEvernoteService.java

示例2: HelpEverNote

import com.evernote.clients.ClientFactory; //导入方法依赖的package包/类
/**
 * Intialize UserStore and NoteStore clients. During this step, we
 * authenticate with the Evernote web service. All of this code is
 * boilerplate - you can copy it straight into your application.
 */
public HelpEverNote() throws Exception {
	// Set up the UserStore client and check that we can speak to the server
	EvernoteAuth evernoteAuth = new EvernoteAuth(EvernoteService.SANDBOX,
			AUTH_TOKEN);
	ClientFactory factory = ClientFactory.getInstance(evernoteAuth);
	userStore = factory.createUserStoreClient();

	boolean versionOk = userStore.checkVersion("Evernote EDAMDemo (Java)",
			com.evernote.edam.userstore.Constants.EDAM_VERSION_MAJOR,
			com.evernote.edam.userstore.Constants.EDAM_VERSION_MINOR);
	if (!versionOk) {
		System.err.println("Incompatible Evernote client protocol version");
		System.exit(1);
	}

	// Set up the NoteStore client
	noteStore = factory.createNoteStoreClient();
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:24,代码来源:HelpEverNote.java

示例3: EverNoteHelp

import com.evernote.clients.ClientFactory; //导入方法依赖的package包/类
public EverNoteHelp() throws Exception {
	// Set up the UserStore client and check that we can speak to the server
	EvernoteAuth evernoteAuth = new EvernoteAuth(EvernoteService.SANDBOX,
			AUTH_TOKEN);
	ClientFactory factory = ClientFactory.getInstance(evernoteAuth);
	userStore = factory.createUserStoreClient();

	boolean versionOk = userStore.checkVersion("Evernote EDAMDemo (Java)",
			com.evernote.edam.userstore.Constants.EDAM_VERSION_MAJOR,
			com.evernote.edam.userstore.Constants.EDAM_VERSION_MINOR);
	if (!versionOk) {
	}
	noteStore = factory.createNoteStoreClient();
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:15,代码来源:EverNoteHelp.java

示例4: run

import com.evernote.clients.ClientFactory; //导入方法依赖的package包/类
public void run() throws Exception {
	final EvernoteAuth evernoteAuth = new EvernoteAuth(EvernoteService.PRODUCTION, conf.getDevToken());
	evernoteAuth.setNoteStoreUrl(conf.getNoteStore());
	final ClientFactory clientFactory = new ClientFactory(evernoteAuth);

	final NoteStoreClient noteStoreClient;
	noteStoreClient = clientFactory.createNoteStoreClient();

	final ICalendar ical = new ICalendar();
	ical.setProductId("org.tario.enki");

	final Pattern eventDatePattern = conf.getEventDatePattern();
	final List<Notebook> notebooks = noteStoreClient.listNotebooks();
	for (final Notebook notebook : notebooks) {
		if (conf.getEventNotebook().equals(notebook.getName())) {
			final NoteFilter filter = new NoteFilter();
			filter.setNotebookGuid(notebook.getGuid());
			final NoteList notes = noteStoreClient.findNotes(filter, 0, 9000);
			for (final Note note : notes.getNotes()) {
				final VEvent event = new VEvent();
				final String title = note.getTitle();

				final Matcher matcher = eventDatePattern.matcher(title);
				if (matcher.matches()) {
					final String day = matcher.group("day");
					final String month = matcher.group("month");
					final String year = matcher.group("year");
					final String fromHour = matcher.group("fromHour");
					final String fromMinute = matcher.group("fromMinute");
					final String toHour = matcher.group("toHour");
					final String toMinute = matcher.group("toMinute");

					final LocalDate fromDate = new LocalDate(Integer.parseInt(year), Integer.parseInt(month),
							Integer.parseInt(day));
					if (fromHour != null && fromMinute != null) {
						final LocalTime fromTime = new LocalTime(Integer.parseInt(fromHour),
								Integer.parseInt(fromMinute));

						final DateStart dateStart = new DateStart(fromDate.toLocalDateTime(fromTime).toDate());
						dateStart.setTimezoneId(conf.getEventTimeZone());
						event.setDateStart(dateStart);

						if (toHour != null && toMinute != null) {
							final LocalTime toTime = new LocalTime(Integer.parseInt(toHour),
									Integer.parseInt(toMinute));
							final DateEnd dateEnd = new DateEnd(fromDate.toLocalDateTime(toTime).toDate());
							dateEnd.setTimezoneId(conf.getEventTimeZone());
							event.setDateEnd(dateEnd);
						} else {
							event.setDuration(Duration.builder().hours(1).build());
						}
					} else {
						event.setDateStart(new DateStart(fromDate.toDate(), false));
						event.setDuration(Duration.builder().days(1).build());
					}

					event.setSummary(title);

					ical.addEvent(event);
				}

			}
		}
	}

	Biweekly.write(ical).go(conf.getEventFile());
}
 
开发者ID:tarioch,项目名称:enki,代码行数:68,代码来源:Enki.java

示例5: evernoteNoteStoreGet

import com.evernote.clients.ClientFactory; //导入方法依赖的package包/类
@Override
  public SSEvernoteInfo evernoteNoteStoreGet(final SSEvernoteNoteStoreGetPar par) throws SSErr {
    
    try{
      final EvernoteAuth              evernoteAuth       = new EvernoteAuth   (EvernoteService.PRODUCTION, par.authToken);
      final ClientFactory             clientFactory      = new ClientFactory  (evernoteAuth);
      final UserStoreClient           userStore          = clientFactory.createUserStoreClient();
      final NoteStoreClient           noteStore          = clientFactory.createNoteStoreClient();
      final SSUri                     shardUri           = SSUri.get(userStore.getPublicUserInfo(userStore.getUser().getUsername()).getWebApiUrlPrefix());
      final SyncChunkFilter           filter             = new SyncChunkFilter();
      SyncChunk                       noteStoreSyncChunk;
      Integer                         lastUSN;
      
      filter.setIncludeNotes                               (true);
      filter.setIncludeNoteResources	                     (true);
      filter.setIncludeNoteAttributes	                     (true);
      filter.setIncludeNotebooks                           (true);
      filter.setIncludeTags	                               (true);
      filter.setIncludeSearches                            (false);
      filter.setIncludeResources	                         (true);
      filter.setIncludeLinkedNotebooks                     (true);
      filter.setIncludeExpunged                            (false);
      filter.setIncludeNoteApplicationDataFullMap	         (true);
      filter.setIncludeResourceApplicationDataFullMap	     (true);
      filter.setIncludeNoteResourceApplicationDataFullMap	 (true);
      
      noteStoreSyncChunk =
        noteStore.getFilteredSyncChunk(
          sql.getUSN(par, par.authToken),
          1000000,
          filter);
      
      if(noteStoreSyncChunk.isSetChunkHighUSN()){
        lastUSN = noteStoreSyncChunk.getChunkHighUSN();
      }else{
        lastUSN = noteStoreSyncChunk.getUpdateCount();
      }
      
      if(
        !noteStoreSyncChunk.isSetUpdateCount()  ||
        !noteStoreSyncChunk.isSetChunkHighUSN() ||
        (lastUSN >= noteStoreSyncChunk.getUpdateCount()) && lastUSN >= sql.getUSN(par, par.authToken)){
        
        SSLogU.debug(par.authEmail + " received full evernote content");
      }else{
        SSLogU.info(par.authEmail + " needs further syncing to retrieve full evernote content");
      }
      
//      if(lastUSN != noteStoreSyncChunk.getUpdateCount()){
//        SSLogU.warn(par.authEmail + " didnt receive latest information from evernote | more than 1.000.000 (new) entries available");
//      }
      
      return SSEvernoteInfo.get(
        userStore,
        noteStore,
        shardUri,
        noteStoreSyncChunk,
        par.authToken);
      
//      https://sandbox.evernote.com/shard/s1/sh/72ddd50f-5d13-46e3-b32d-d2b314ced5c1/ea77ae0587d735f39a94868ce3ddab5f
      
    }catch(EDAMSystemException edamError){
      
      if(gotToSleep(edamError, par.authEmail)){
        return evernoteNoteStoreGet(par);
      }else{
        SSServErrReg.regErrThrow(edamError);
        return null;
      }
      
    }catch(Exception error){
      SSServErrReg.regErrThrow(error);
      return null;
    }
  }
 
开发者ID:learning-layers,项目名称:SocialSemanticServer,代码行数:76,代码来源:SSEvernoteImpl.java


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