Package com.google.walkaround.proto.FetchAttachmentsAndImportWaveletTask

Examples of com.google.walkaround.proto.FetchAttachmentsAndImportWaveletTask.RemoteAttachmentInfo


      String attachmentId = entry.getKey();
      GoogleDocumentContent metadataDoc = entry.getValue().getContent();
      log.info("metadataDoc=" + metadataDoc);
      Map<String, String> map = makeMapFromDocument(metadataDoc, "node", "key", "value");
      log.info("Attachment metadata for " + attachmentId + ": " + map + ")");
      RemoteAttachmentInfo info = new RemoteAttachmentInfoGsonImpl();
      info.setRemoteId(attachmentId);
      if (map.get("attachment_url") == null) {
        log.warning("Attachment " + attachmentId + " has no URL (incomplete upload?), skipping: "
            + map);
        continue;
      }
      info.setPath(map.get("attachment_url"));
      if (map.get("filename") != null) {
        info.setFilename(map.get("filename"));
      }
      if (map.get("mime_type") != null) {
        info.setMimeType(map.get("mime_type"));
      }
      if (map.get("size") != null) {
        info.setSizeBytes(Long.parseLong(map.get("size")));
      }
      newTask.addToImport(info);
    }
  }
View Full Code Here


        WaveletId.deserialise(waveletTask.getWaveletId()));
    LinkedList<RemoteAttachmentInfo> toImport = Lists.newLinkedList(task.getToImport());
    log.info("Need attachments for " + waveletName + ": " + toImport);
    int infosFetchedThisTask = 0;
    while (!toImport.isEmpty() && infosFetchedThisTask < MAX_FETCHES_PER_TASK) {
      RemoteAttachmentInfo info = toImport.removeFirst();
      AttachmentId localId = fetchAttachment(instance, info);
      log.info("Local id: " + localId);
      ImportedAttachmentInfo imported = new ImportedAttachmentInfoGsonImpl();
      imported.setRemoteInfo(info);
      if (localId != null) {
        imported.setLocalId(localId.getId());
      }
      infosFetchedThisTask++;
      task.addImported(imported);
    }
    if (toImport.isEmpty()) {
      log.info("All attachments imported, will import wavelet");
      for (ImportedAttachmentInfo info : task.getImported()) {
        ImportedAttachment attachment = new ImportedAttachmentGsonImpl();
        attachment.setRemoteId(info.getRemoteInfo().getRemoteId());
        if (info.hasLocalId()) {
          attachment.setLocalId(info.getLocalId());
        }
        waveletTask.addAttachment(attachment);
      }
      ImportTaskPayload payload = new ImportTaskPayloadGsonImpl();
      payload.setImportWaveletTask(waveletTask);
View Full Code Here

TOP

Related Classes of com.google.walkaround.proto.FetchAttachmentsAndImportWaveletTask.RemoteAttachmentInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.