Package com.evernote.edam.type

Examples of com.evernote.edam.type.Data


                    extractCommonFacetData(facet, updateInfo);
                    facet.guid = resource.getGuid();
                }
                if (facet.USN==null||facet.USN<resource.getUpdateSequenceNum()) {
                    if (resource.isSetAlternateData()) {
                        Data alternateData = resource.getAlternateData();
                        if (alternateData.isSetBody()&&resource.isSetGuid())
                            saveDataBodyAsFile(updateInfo, resource.getGuid(), ALTERNATE_APPENDIX, alternateData.getBody(), resource.getMime());
                        if (alternateData.isSetBodyHash())
                            facet.alternateDataBodyHash = alternateData.getBodyHash();
                        if (alternateData.isSetSize())
                            facet.alternateDataSize = alternateData.getSize();
                    }
                    if (resource.isSetAttributes()) {
                        final ResourceAttributes resourceAttributes = resource.getAttributes();
                        if (resourceAttributes.isSetAltitude())
                            facet.altitude = resourceAttributes.getAltitude();
                        if (resourceAttributes.isSetAttachment())
                            facet.isAttachment = resourceAttributes.isAttachment();
                        if (resourceAttributes.isSetCameraMake())
                            facet.cameraMake = resourceAttributes.getCameraMake();
                        if (resourceAttributes.isSetCameraModel())
                            facet.cameraModel = resourceAttributes.getCameraModel();
                        if (resourceAttributes.isSetFileName())
                            facet.fileName = resourceAttributes.getFileName();
                        if (resourceAttributes.isSetLatitude())
                            facet.latitude = resourceAttributes.getLatitude();
                        if (resourceAttributes.isSetLongitude())
                            facet.longitude = resourceAttributes.getLongitude();
                        if (resourceAttributes.isSetRecoType())
                            facet.recoType = resourceAttributes.getRecoType();
                        if (resourceAttributes.isSetSourceURL())
                            facet.sourceURL = resourceAttributes.getSourceURL();
                        if (resourceAttributes.isSetTimestamp())
                            facet.timestamp = resourceAttributes.getTimestamp();
                        if (resourceAttributes.isSetTimestamp() &&
                            resourceAttributes.isSetLongitude() &&
                            resourceAttributes.isSetLatitude()&&
                            resource.isSetNoteGuid()){
                            // resource locations are associated with their parent note's guid
                            addGuestLocation(updateInfo, facet.latitude, facet.longitude, facet.altitude,
                                             facet.timestamp, resource.getNoteGuid());
                        }
                    }
                    if (resource.isSetData()) {
                        Data data = resource.getData();
                        if (data.isSetBody()&&resource.isSetGuid())
                            saveDataBodyAsFile(updateInfo, resource.getGuid(), MAIN_APPENDIX, data.getBody(), resource.getMime());
                        if (data.isSetBodyHash())
                            facet.dataBodyHash = data.getBodyHash();
                        if (data.isSetSize())
                            facet.dataSize = data.getSize();
                    }
                    if (resource.isSetHeight())
                        facet.height = resource.getHeight();
                    if (resource.isSetMime())
                        facet.mime = resource.getMime();
                    if (resource.isSetNoteGuid())
                        facet.noteGuid = resource.getNoteGuid();
                    if (resource.isSetRecognition()) {
                        Data recognitionData = resource.getRecognition();
                        if (recognitionData.isSetBody()&&resource.isSetGuid())
                            saveDataBodyAsFile(updateInfo, resource.getGuid(), RECOGNITION_APPENDIX, recognitionData.getBody(), null);
                        if (recognitionData.isSetBodyHash())
                            facet.recognitionDataBodyHash = recognitionData.getBodyHash();
                        if (recognitionData.isSetSize())
                            facet.recognitionDataSize = recognitionData.getSize();
                    }
                    if (resource.isSetUpdateSequenceNum())
                        facet.USN = resource.getUpdateSequenceNum();
                    if (resource.isSetWidth())
                        facet.width = resource.getWidth();
View Full Code Here


        r.setUpdateSequenceNum(0);
        r.setWidth((short) 0);
        r.setHeight((short) 0);
        r.setDuration((short) 0);
             
        Data d = new Data();
        d.setBody(fileData);
        d.setBodyIsSet(true);
        d.setBodyHash(hash);
        d.setBodyHashIsSet(true);
        r.setData(d);
        d.setSize(fileData.length);
       
        int fileNamePos = address.lastIndexOf(File.separator);
        if (fileNamePos == -1)
          fileNamePos = address.lastIndexOf("/");
         String fileName = address.substring(fileNamePos+1);
View Full Code Here

  }


  private void indexResourceRTF(Resource r) {

    Data d = r.getData();
    for (int i=0; i<20 && d.getSize() == 0; i++)
      d = r.getData();
    if (d.getSize()== 0)
      return;

    QTemporaryFile f = writeResource(d);
    if (!keepRunning) {
      return;
View Full Code Here

  }

 
  private void indexResourceODF(Resource r) {

    Data d = r.getData();
    for (int i=0; i<20 && d.getSize() == 0; i++)
      d = r.getData();
    if (d.getSize()== 0)
      return;
    QTemporaryFile f = writeResource(d);
    if (!keepRunning) {
      return;
    }
View Full Code Here

  }

 
  private void indexResourceOffice(Resource r) {

    Data d = r.getData();
    for (int i=0; i<20 && d.getSize() == 0; i++)
      d = r.getData();
    if (d.getSize()== 0)
      return;
    QTemporaryFile f = writeResource(d);
    if (!keepRunning) {
      return;
    }
View Full Code Here

 
 
  private void indexResourcePDF(Resource r) {

    Data d = r.getData();
    for (int i=0; i<20 && d.getSize() == 0; i++)
      d = r.getData();
    if (d.getSize()== 0)
      return;
    QTemporaryFile f = writeResource(d);
    if (!keepRunning) {
      return;
    }
View Full Code Here

  }
 
 
  private void indexResourceOOXML(Resource r) {

    Data d = r.getData();
    for (int i=0; i<20 && d.getSize() == 0; i++)
      d = r.getData();
    if (d.getSize()== 0)
      return;
    QTemporaryFile f = writeResource(d);
    if (!keepRunning) {
      return;
    }
View Full Code Here

   
    return resource;
  }
 
  private Data processData(String nodeName) {
    Data data = new Data();
    boolean atEnd = false;
    while(!atEnd) {
      if (reader.isStartElement()) {
        if (reader.name().equalsIgnoreCase("Size"))
          data.setSize(intValue());
        if (reader.name().equalsIgnoreCase("Body")) {
          byte[] b = textValue().getBytes();   // data binary
          QByteArray hexData = new QByteArray(b);
          QByteArray binData = new QByteArray(QByteArray.fromHex(hexData));
          data.setBody(binData.toByteArray());
        }
        if (reader.name().equalsIgnoreCase("BodyHash")) {
          byte[] b = textValue().getBytes();   // data binary
          QByteArray hexData = new QByteArray(b);
          QByteArray binData = new QByteArray(QByteArray.fromHex(hexData));
          data.setBodyHash(binData.toByteArray());
        }

        reader.readNext();
        if (reader.name().equalsIgnoreCase("data") && reader.isEndElement())
          atEnd = true;
View Full Code Here

    conn.getNoteTable().noteResourceTable.updateNoteResource(resource, true);
    return resource;
  }
 
  private Data processData(String nodeName) {
    Data data = new Data();
    boolean atEnd = false;
    while(!atEnd) {
      if (reader.isStartElement()) {
        try {
        byte[] b = textValue().getBytes();   // data binary
        if (b.length > 0) {
          QByteArray hexData = new QByteArray(b);
          String hexString = hexData.toString();
          data.setBody(DatatypeConverter.parseBase64Binary(hexString));
          MessageDigest md;
          try {
            md = MessageDigest.getInstance("MD5");
            md.update(data.getBody());
            data.setBodyHash(md.digest());
          } catch (NoSuchAlgorithmException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
         
View Full Code Here

  }

   
 
  private Data processRecognition() {
    Data reco = new Data();
    reco.setBody(textValue().getBytes());
    MessageDigest md;
    try {
      md = MessageDigest.getInstance("MD5");
      md.update(reco.getBody());
      reco.setBodyHash(md.digest());
      reco.setSize(reco.getBody().length);
    } catch (NoSuchAlgorithmException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return reco;
View Full Code Here

TOP

Related Classes of com.evernote.edam.type.Data

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.