test_class.declarator: mockedDriveService
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private DriveHelper.DriveService mockedDriveService;
test_class.type: DriveHelper.DriveService
test_class.var_name: mockedDriveService
test_class.declarator: mockedRequest
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private Drive.Files.List mockedRequest;
test_class.type: Drive.Files.List
test_class.var_name: mockedRequest
test_class.declarator: driveHelper
test_class.modifier: private
test_class.original_string: private DriveHelper driveHelper;
test_class.type: DriveHelper
test_class.var_name: driveHelper
test_class.file: collect_app/src/test/java/org/odk/collect/android/utilities/gdrive/DriveHelperTest.java
test_class.identifier: DriveHelperTest
test_case.body: @Test
      public void generateSearchQueryTest() {
          String result = driveHelper.generateSearchQuery(null, null, null);
          assertNull(result);
  
          result = driveHelper.generateSearchQuery("sample-folder", null, null);
          assertEquals("name = 'sample-folder' and trashed = false", result);
  
          result = driveHelper.generateSearchQuery(null, "some-parent-id", null);
          assertEquals("'some-parent-id' in parents and trashed = false", result);
  
          result = driveHelper.generateSearchQuery(null, null, "xml-mime-type");
          assertEquals("mimeType = 'xml-mime-type' and trashed = false", result);
  
          result = driveHelper.generateSearchQuery("sample-folder", null, "xml-mime-type");
          assertEquals("name = 'sample-folder' and mimeType = 'xml-mime-type' and trashed = false", result);
  
          result = driveHelper.generateSearchQuery("sample-folder", "some-parent-id", "xml-mime-type");
          assertEquals("name = 'sample-folder' and 'some-parent-id' in parents and mimeType = 'xml-mime-type' and trashed = false", result);
      }
test_case.class_method_signature: DriveHelperTest.generateSearchQueryTest()
test_case.full_signature: @Test public void generateSearchQueryTest()
test_case.identifier: generateSearchQueryTest
test_case.invocations: generateSearchQuery assertNull generateSearchQuery assertEquals generateSearchQuery assertEquals generateSearchQuery assertEquals generateSearchQuery assertEquals generateSearchQuery assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void generateSearchQueryTest()
focal_class.declarator: ODK_GOOGLE_DRIVE_ROOT_FOLDER_NAME = "Open Data Kit"
focal_class.modifier: public static final
focal_class.original_string: public static final String ODK_GOOGLE_DRIVE_ROOT_FOLDER_NAME = "Open Data Kit";
focal_class.type: String
focal_class.var_name: ODK_GOOGLE_DRIVE_ROOT_FOLDER_NAME
focal_class.declarator: ODK_GOOGLE_DRIVE_SUBMISSION_FOLDER_NAME = "Submissions"
focal_class.modifier: public static final
focal_class.original_string: public static final String ODK_GOOGLE_DRIVE_SUBMISSION_FOLDER_NAME = "Submissions";
focal_class.type: String
focal_class.var_name: ODK_GOOGLE_DRIVE_SUBMISSION_FOLDER_NAME
focal_class.declarator: FOLDER_MIME_TYPE = "application/vnd.google-apps.folder"
focal_class.modifier: public static final
focal_class.original_string: public static final String FOLDER_MIME_TYPE = "application/vnd.google-apps.folder";
focal_class.type: String
focal_class.var_name: FOLDER_MIME_TYPE
focal_class.declarator: driveService
focal_class.modifier: private final
focal_class.original_string: private final DriveService driveService;
focal_class.type: DriveService
focal_class.var_name: driveService
focal_class.file: collect_app/src/main/java/org/odk/collect/android/utilities/gdrive/DriveHelper.java
focal_class.identifier: DriveHelper
focal_class.class_method_signature: DriveHelper.DriveHelper(@NonNull GoogleAccountCredential credential,
                  @NonNull HttpTransport transport,
                  @NonNull JsonFactory jsonFactory)
focal_class.full_signature:   DriveHelper(@NonNull GoogleAccountCredential credential,
                  @NonNull HttpTransport transport,
                  @NonNull JsonFactory jsonFactory)
focal_class.identifier: DriveHelper
focal_class.parameters: (@NonNull GoogleAccountCredential credential,
                  @NonNull HttpTransport transport,
                  @NonNull JsonFactory jsonFactory)
focal_class.signature:  DriveHelper(@NonNull GoogleAccountCredential credential,
                  @NonNull HttpTransport transport,
                  @NonNull JsonFactory jsonFactory)
focal_class.class_method_signature: DriveHelper.DriveHelper(DriveService driveService)
focal_class.full_signature:   DriveHelper(DriveService driveService)
focal_class.identifier: DriveHelper
focal_class.parameters: (DriveService driveService)
focal_class.signature:  DriveHelper(DriveService driveService)
focal_class.class_method_signature: DriveHelper.getRootFolderId()
focal_class.full_signature: public String getRootFolderId()
focal_class.identifier: getRootFolderId
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getRootFolderId()
focal_class.class_method_signature: DriveHelper.buildRequest(String query, String fields)
focal_class.full_signature: @Nullable public Drive.Files.List buildRequest(String query, String fields)
focal_class.identifier: buildRequest
focal_class.modifiers: @Nullable public
focal_class.parameters: (String query, String fields)
focal_class.return: Drive.Files.List
focal_class.signature: Drive.Files.List buildRequest(String query, String fields)
focal_class.class_method_signature: DriveHelper.downloadFile(@NonNull String fileId, @NonNull File file)
focal_class.full_signature: public void downloadFile(@NonNull String fileId, @NonNull File file)
focal_class.identifier: downloadFile
focal_class.modifiers: public
focal_class.parameters: (@NonNull String fileId, @NonNull File file)
focal_class.return: void
focal_class.signature: void downloadFile(@NonNull String fileId, @NonNull File file)
focal_class.class_method_signature: DriveHelper.createOrGetIDOfSubmissionsFolder()
focal_class.full_signature: public String createOrGetIDOfSubmissionsFolder()
focal_class.identifier: createOrGetIDOfSubmissionsFolder
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String createOrGetIDOfSubmissionsFolder()
focal_class.class_method_signature: DriveHelper.getIDOfFolderWithName(@NonNull String name, @Nullable String inFolder, boolean shouldCreateIfNotFound)
focal_class.full_signature: @Nullable public String getIDOfFolderWithName(@NonNull String name, @Nullable String inFolder, boolean shouldCreateIfNotFound)
focal_class.identifier: getIDOfFolderWithName
focal_class.modifiers: @Nullable public
focal_class.parameters: (@NonNull String name, @Nullable String inFolder, boolean shouldCreateIfNotFound)
focal_class.return: String
focal_class.signature: String getIDOfFolderWithName(@NonNull String name, @Nullable String inFolder, boolean shouldCreateIfNotFound)
focal_class.class_method_signature: DriveHelper.uploadFileToDrive(String mediaName, String destinationFolderID, File toUpload)
focal_class.full_signature: public String uploadFileToDrive(String mediaName, String destinationFolderID, File toUpload)
focal_class.identifier: uploadFileToDrive
focal_class.modifiers: public
focal_class.parameters: (String mediaName, String destinationFolderID, File toUpload)
focal_class.return: String
focal_class.signature: String uploadFileToDrive(String mediaName, String destinationFolderID, File toUpload)
focal_class.class_method_signature: DriveHelper.createFolderInDrive(@NonNull String folderName,
                                        @Nullable String parentId)
focal_class.full_signature: public String createFolderInDrive(@NonNull String folderName,
                                        @Nullable String parentId)
focal_class.identifier: createFolderInDrive
focal_class.modifiers: public
focal_class.parameters: (@NonNull String folderName,
                                        @Nullable String parentId)
focal_class.return: String
focal_class.signature: String createFolderInDrive(@NonNull String folderName,
                                        @Nullable String parentId)
focal_class.class_method_signature: DriveHelper.createNewFile(@NonNull String name,
                                                                    @Nullable String mimeType,
                                                                    @Nullable String parentId)
focal_class.full_signature: public com.google.api.services.drive.model.File createNewFile(@NonNull String name,
                                                                    @Nullable String mimeType,
                                                                    @Nullable String parentId)
focal_class.identifier: createNewFile
focal_class.modifiers: public
focal_class.parameters: (@NonNull String name,
                                                                    @Nullable String mimeType,
                                                                    @Nullable String parentId)
focal_class.return: com.google.api.services.drive.model.File
focal_class.signature: com.google.api.services.drive.model.File createNewFile(@NonNull String name,
                                                                    @Nullable String mimeType,
                                                                    @Nullable String parentId)
focal_class.class_method_signature: DriveHelper.setSharingPermissions(String folderId)
focal_class.full_signature: private void setSharingPermissions(String folderId)
focal_class.identifier: setSharingPermissions
focal_class.modifiers: private
focal_class.parameters: (String folderId)
focal_class.return: void
focal_class.signature: void setSharingPermissions(String folderId)
focal_class.class_method_signature: DriveHelper.getFilesFromDrive(
              @Nullable String folderName,
              @Nullable String parentId)
focal_class.full_signature: public List<com.google.api.services.drive.model.File> getFilesFromDrive(
              @Nullable String folderName,
              @Nullable String parentId)
focal_class.identifier: getFilesFromDrive
focal_class.modifiers: public
focal_class.parameters: (
              @Nullable String folderName,
              @Nullable String parentId)
focal_class.return: List<com.google.api.services.drive.model.File>
focal_class.signature: List<com.google.api.services.drive.model.File> getFilesFromDrive(
              @Nullable String folderName,
              @Nullable String parentId)
focal_class.class_method_signature: DriveHelper.generateSearchQuery(@Nullable String folderName,
                                        @Nullable String parentId,
                                        @Nullable String mimeType)
focal_class.full_signature: @Nullable public String generateSearchQuery(@Nullable String folderName,
                                        @Nullable String parentId,
                                        @Nullable String mimeType)
focal_class.identifier: generateSearchQuery
focal_class.modifiers: @Nullable public
focal_class.parameters: (@Nullable String folderName,
                                        @Nullable String parentId,
                                        @Nullable String mimeType)
focal_class.return: String
focal_class.signature: String generateSearchQuery(@Nullable String folderName,
                                        @Nullable String parentId,
                                        @Nullable String mimeType)
focal_class.class_method_signature: DriveHelper.fetchFilesForCurrentPage(Drive.Files.List request, List<com.google.api.services.drive.model.File> files)
focal_class.full_signature: public void fetchFilesForCurrentPage(Drive.Files.List request, List<com.google.api.services.drive.model.File> files)
focal_class.identifier: fetchFilesForCurrentPage
focal_class.modifiers: public
focal_class.parameters: (Drive.Files.List request, List<com.google.api.services.drive.model.File> files)
focal_class.return: void
focal_class.signature: void fetchFilesForCurrentPage(Drive.Files.List request, List<com.google.api.services.drive.model.File> files)
focal_method.body: @Nullable
      public String generateSearchQuery(@Nullable String folderName,
                                        @Nullable String parentId,
                                        @Nullable String mimeType) {
          List<String> queryList = new ArrayList<>();
          if (folderName != null) {
              queryList.add(String.format("name = '%s'", folderName));
          }
          if (parentId != null) {
              queryList.add(String.format("'%s' in parents", parentId));
          }
          if (mimeType != null) {
              queryList.add(String.format("mimeType = '%s'", mimeType));
          }
  
          if (queryList.isEmpty()) {
              return null;
          }
  
          // this query prevents siteName searching the deleted files
          queryList.add("trashed = false");
  
          StringBuilder query = new StringBuilder(queryList.get(0));
          for (int i = 1; i < queryList.size(); i++) {
              query.append(" and ").append(queryList.get(i));
          }
  
          return query.toString();
      }
focal_method.class_method_signature: DriveHelper.generateSearchQuery(@Nullable String folderName,
                                        @Nullable String parentId,
                                        @Nullable String mimeType)
focal_method.full_signature: @Nullable public String generateSearchQuery(@Nullable String folderName,
                                        @Nullable String parentId,
                                        @Nullable String mimeType)
focal_method.identifier: generateSearchQuery
focal_method.invocations: add format add format add format isEmpty add get size append append get toString
focal_method.modifiers: @Nullable public
focal_method.parameters: (@Nullable String folderName,
                                        @Nullable String parentId,
                                        @Nullable String mimeType)
focal_method.return: String
focal_method.signature: String generateSearchQuery(@Nullable String folderName,
                                        @Nullable String parentId,
                                        @Nullable String mimeType)