Package org.syncany.database

Examples of org.syncany.database.FileVersion


    try (ResultSet resultSet = preparedStatement.executeQuery()) {
      Map<FileHistoryId, FileVersion> mostRecentPurgeFileVersions = new HashMap<FileHistoryId, FileVersion>();
     
      while (resultSet.next()) {
        FileHistoryId fileHistoryId = FileHistoryId.parseFileId(resultSet.getString("filehistory_id"));
        FileVersion fileVersion = createFileVersionFromRow(resultSet);
       
        mostRecentPurgeFileVersions.put(fileHistoryId, fileVersion);
      }  
     
      return mostRecentPurgeFileVersions;
View Full Code Here


  private Map<String, FileVersion> getFileTree(PreparedStatement preparedStatement) {
    Map<String, FileVersion> fileTree = new TreeMap<String, FileVersion>();

    try (ResultSet resultSet = preparedStatement.executeQuery()) {
      while (resultSet.next()) {
        FileVersion fileVersion = createFileVersionFromRow(resultSet);
        fileTree.put(fileVersion.getPath(), fileVersion);
      }

      return fileTree;
    }
    catch (SQLException e) {
View Full Code Here

    }
  }
 
  // TODO [low] This should be private; but it has to be public for a test
  public FileVersion createFileVersionFromRow(ResultSet resultSet) throws SQLException {
    FileVersion fileVersion = new FileVersion();

    fileVersion.setFileHistoryId(FileHistoryId.parseFileId(resultSet.getString("filehistory_id")));
    fileVersion.setVersion(resultSet.getLong("version"));
    fileVersion.setPath(resultSet.getString("path"));
    fileVersion.setType(FileType.valueOf(resultSet.getString("type")));
    fileVersion.setStatus(FileStatus.valueOf(resultSet.getString("status")));
    fileVersion.setSize(resultSet.getLong("size"));
    fileVersion.setLastModified(new Date(resultSet.getTimestamp("lastmodified").getTime()));

    if (resultSet.getString("linktarget") != null) {
      fileVersion.setLinkTarget(resultSet.getString("linktarget"));
    }

    if (resultSet.getString("filecontent_checksum") != null) {
      FileChecksum fileChecksum = FileChecksum.parseFileChecksum(resultSet.getString("filecontent_checksum"));
      fileVersion.setChecksum(fileChecksum);
    }

    if (resultSet.getString("updated") != null) {
      fileVersion.setUpdated(new Date(resultSet.getTimestamp("updated").getTime()));
    }

    if (resultSet.getString("posixperms") != null) {
      fileVersion.setPosixPermissions(resultSet.getString("posixperms"));
    }

    if (resultSet.getString("dosattrs") != null) {
      fileVersion.setDosAttributes(resultSet.getString("dosattrs"));
    }

    return fileVersion;
  }
View Full Code Here

  private void printGroupedHistories(LsOperationResult operationResult, int longestSize, int longestVersion) {
    Iterator<FileVersion> fileVersionIterator = operationResult.getFileTree().values().iterator();
   
    while (fileVersionIterator.hasNext()) {
      FileVersion fileVersion = fileVersionIterator.next();
      PartialFileHistory fileHistory = operationResult.getFileVersions().get(fileVersion.getFileHistoryId());
     
      out.printf("File %s, %s\n", formatObjectId(fileHistory.getFileHistoryId()), fileVersion.getPath());
     
      for (FileVersion fileVersionInHistory : fileHistory.getFileVersions().values()) {
        if (fileVersionInHistory.equals(fileVersion)) {
          out.print(" * ");
        }
 
View Full Code Here

TOP

Related Classes of org.syncany.database.FileVersion

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.