@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ExportInformation that = (ExportInformation) o; return Objects.equals(getPaginationData(), that.getPaginationData()) && Objects.equals(getContainerResource(), that.getContainerResource()); }
@Override public int hashCode() { return Objects.hash(getPaginationData(), getContainerResource()); } }
@Override public ExportResult<TaskContainerResource> export( UUID jobId, AuthData authData, Optional<ExportInformation> exportInformation) { // Create new service for the authorized user RememberTheMilkService service = getOrCreateService(authData); IdOnlyContainerResource resource = exportInformation.isPresent() ? (IdOnlyContainerResource) exportInformation.get().getContainerResource() : null; if (resource != null) { return exportTask(service, resource); } else { return exportTaskList(service); } }
@Override public ExportResult<CalendarContainerResource> export( UUID jobId, TokensAndUrlAuthData authData, Optional<ExportInformation> exportInformation) { if (!exportInformation.isPresent()) { return exportCalendars(authData, Optional.empty()); } else { StringPaginationToken paginationToken = (StringPaginationToken) exportInformation.get().getPaginationData(); if (paginationToken != null && paginationToken.getToken().startsWith(CALENDAR_TOKEN_PREFIX)) { // Next thing to export is more calendars return exportCalendars(authData, Optional.of(paginationToken)); } else { // Next thing to export is events IdOnlyContainerResource idOnlyContainerResource = (IdOnlyContainerResource) exportInformation.get().getContainerResource(); Optional<PaginationData> pageData = Optional.ofNullable(paginationToken); return getCalendarEvents(authData, idOnlyContainerResource.getId(), pageData); } } }
@Override public ExportResult<TaskContainerResource> export( UUID jobId, TokensAndUrlAuthData authData, Optional<ExportInformation> exportInformation) { // Create a new tasks service for the authorized user Tasks tasksService = getOrCreateTasksService(authData); IdOnlyContainerResource resource = exportInformation.isPresent() ? (IdOnlyContainerResource) exportInformation.get().getContainerResource() : null; PaginationData paginationData = exportInformation.isPresent() ? exportInformation.get().getPaginationData() : null; try { if (resource != null) { return getTasks(tasksService, resource, Optional.ofNullable(paginationData)); } else { return getTasksList(tasksService, Optional.ofNullable(paginationData)); } } catch (Exception e) { monitor.severe(() -> "Error occurred trying to retrieve task", e); return new ExportResult<>(e); } }
@Override public ExportResult<PhotosContainerResource> export( UUID jobId, TokenSecretAuthData authData, Optional<ExportInformation> exportInformation) throws IOException { StringPaginationToken paginationToken = exportInformation.isPresent() ? (StringPaginationToken) exportInformation.get().getPaginationData() : null; IdOnlyContainerResource resource = exportInformation.isPresent() ? (IdOnlyContainerResource) exportInformation.get().getContainerResource() : null; SmugMugInterface smugMugInterface; try { smugMugInterface = getOrCreateSmugMugInterface(authData); } catch (IOException e) { monitor.severe(() -> "Unable to create Smugmug service for user", e); throw e; } if (resource != null) { return exportPhotos(resource, paginationToken, smugMugInterface, jobId); } else { return exportAlbums(paginationToken, smugMugInterface); } }
(StringPaginationToken) exportInformation.get().getPaginationData(); IdOnlyContainerResource idOnlyContainerResource = (IdOnlyContainerResource) exportInformation.get().getContainerResource();
@Override public ExportResult<PhotosContainerResource> export( UUID jobId, AuthData authData, Optional<ExportInformation> exportInformation) { Auth auth; try { auth = FlickrUtils.getAuth(authData, flickr); } catch (FlickrException e) { return new ExportResult<>(e); } RequestContext.getRequestContext().setAuth(auth); PaginationData paginationData = exportInformation.isPresent() ? exportInformation.get().getPaginationData() : null; IdOnlyContainerResource resource = exportInformation.isPresent() ? (IdOnlyContainerResource) exportInformation.get().getContainerResource() : null; if (resource != null) { return getPhotos(resource, paginationData); } else { return getAlbums(paginationData, auth); } }
ContainerResource containerResource = exportInformation.get().getContainerResource();
continuationData.getPaginationData(), exportInformation.isPresent() ? exportInformation.get().getContainerResource() : null)));
if (exportInformation.getContainerResource() != null) { BlobbyStorageContainerResource parent = (BlobbyStorageContainerResource) exportInformation.getContainerResource(); parentId = parent.getId();