Package org.syncany.database.PartialFileHistory

Examples of org.syncany.database.PartialFileHistory.FileHistoryId


    clientA.upWithForceChecksum();
   
    String originalFileHistoryStr = TestSqlUtil.runSqlSelect("select filehistory_id from fileversion", databaseConnectionA);
    assertNotNull(originalFileHistoryStr);
   
    FileHistoryId originalFileHistoryId = FileHistoryId.parseFileId(originalFileHistoryStr);
       
    // A "delete"
    File deletedFile = new File(tempDir, "A-original-DELETED");
    FileUtils.moveFile(clientA.getLocalFile("A-original"), deletedFile);
           
View Full Code Here


    clientA.upWithForceChecksum();
   
    String originalFileHistoryStr = TestSqlUtil.runSqlSelect("select filehistory_id from fileversion", databaseConnectionA);
    assertNotNull(originalFileHistoryStr);
   
    FileHistoryId originalFileHistoryId = FileHistoryId.parseFileId(originalFileHistoryStr);
       
    // A "delete"
    File deletedFile = new File(tempDir, "A-original-DELETED");
    FileUtils.moveFile(clientA.getLocalFile("A-original"), deletedFile);
           
View Full Code Here

    clientA.upWithForceChecksum();
   
    String originalFileHistoryStr = TestSqlUtil.runSqlSelect("select filehistory_id from fileversion where path='folder/subfolder/A-original'", databaseConnectionA);
    assertNotNull(originalFileHistoryStr);
   
    FileHistoryId originalFileHistoryId = FileHistoryId.parseFileId(originalFileHistoryStr);
       
    // A "delete"
    FileUtils.deleteDirectory(clientA.getLocalFile("folder"));           
    clientA.upWithForceChecksum();
   
View Full Code Here

    logger.log(Level.INFO, "");
    logger.log(Level.INFO, "Running 'Restore' at client " + config.getMachineName() + " ...");
    logger.log(Level.INFO, "--------------------------------------------");
   
    // Find file history
    FileHistoryId restoreFileHistoryId = findFileHistoryId();

    if (restoreFileHistoryId == null) {
      return new RestoreOperationResult(RestoreResultCode.NACK_NO_FILE);
    }
   
View Full Code Here

      }
    }

    private PartialFileHistory createNewFileHistory(PartialFileHistory lastFileHistory) {
      if (lastFileHistory == null) {
        FileHistoryId newFileHistoryId = FileHistoryId.secureRandomFileId();
        return new PartialFileHistory(newFileHistoryId);
      }
      else {
        return new PartialFileHistory(lastFileHistory.getFileHistoryId());
      }
View Full Code Here

  @Override
  public Response handleRequest(FolderRequest request) {
    GetFileFolderRequest concreteRequest = (GetFileFolderRequest) request;
   
    try {
      FileHistoryId fileHistoryId = FileHistoryId.parseFileId(concreteRequest.getFileHistoryId());
      long version = concreteRequest.getVersion();

      FileVersion fileVersion = localDatabase.getFileVersion(fileHistoryId, version);
      FileContent fileContent = localDatabase.getFileContent(fileVersion.getChecksum(), true);
      Map<ChunkChecksum, MultiChunkId> multiChunks = localDatabase.getMultiChunkIdsByChecksums(fileContent.getChunks());
View Full Code Here

  @Override
  public Response handleRequest(FolderRequest request) {
    GetFileHistoryFolderRequest concreteRequest = (GetFileHistoryFolderRequest) request;
   
    FileHistoryId fileHistoryId = FileHistoryId.parseFileId(concreteRequest.getFileHistoryId());
    List<FileVersion> fileHistory = localDatabase.getFileHistory(fileHistoryId);
   
    return new GetFileHistoryFolderResponse(concreteRequest.getId(), concreteRequest.getRoot(), fileHistory);     
  }
View Full Code Here

 
        PartialFileHistory fileHistory = null;
 
        while (resultSet.next()) {
          if (fileHistory == null) {
            FileHistoryId fileHistoryId = FileHistoryId.parseFileId(resultSet.getString("filehistory_id"));
            fileHistory = new PartialFileHistory(fileHistoryId);
          }
 
          FileVersion fileVersion = fileVersionDao.createFileVersionFromRow(resultSet);
          fileHistory.addFileVersion(fileVersion);
View Full Code Here

        multiChunk.addChunk(ChunkChecksum.parseChunkChecksum(chunkChecksumStr));
      }
      else if (elementPath.equalsIgnoreCase("/database/databaseVersions/databaseVersion/fileHistories/fileHistory")) {
        String fileHistoryIdStr = attributes.getValue("id");
        FileHistoryId fileId = FileHistoryId.parseFileId(fileHistoryIdStr);
        fileHistory = new PartialFileHistory(fileId);
      }
      else if (elementPath.equalsIgnoreCase("/database/databaseVersions/databaseVersion/fileHistories/fileHistory/fileVersions/fileVersion")) {
        String fileVersionStr = attributes.getValue("version");
        String path = attributes.getValue("path");
View Full Code Here

      try (PreparedStatement preparedStatement = getStatement("filehistory.select.master.getFileHistoryWithLastVersion.sql")) {
        preparedStatement.setString(1, relativePath);

        try (ResultSet resultSet = preparedStatement.executeQuery()) {
          if (resultSet.next()) {
            FileHistoryId fileHistoryId = FileHistoryId.parseFileId(resultSet.getString("filehistory_id"));
            FileVersion lastFileVersion = fileVersionDao.createFileVersionFromRow(resultSet);
   
            PartialFileHistory fileHistory = new PartialFileHistory(fileHistoryId);
            fileHistory.addFileVersion(lastFileVersion);
   
View Full Code Here

TOP

Related Classes of org.syncany.database.PartialFileHistory.FileHistoryId

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.