Merge pull request #345 from owncloud/fix_pincode_in_instant_uploads
authorDavid A. Velasco <dvelasco@owncloud.com>
Wed, 8 Jan 2014 17:12:06 +0000 (09:12 -0800)
committerDavid A. Velasco <dvelasco@owncloud.com>
Wed, 8 Jan 2014 17:12:06 +0000 (09:12 -0800)
Fixed pincode request in instant uploads

oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/ReadFileTest.java [new file with mode: 0644]
oc_framework/src/com/owncloud/android/oc_framework/operations/RemoteFile.java
oc_framework/src/com/owncloud/android/oc_framework/operations/RemoteOperationResult.java
oc_framework/src/com/owncloud/android/oc_framework/operations/remote/ReadRemoteFileOperation.java [new file with mode: 0644]
oc_framework/src/com/owncloud/android/oc_framework/utils/FileUtils.java
res/values-id/strings.xml
src/com/owncloud/android/files/services/FileUploader.java
src/com/owncloud/android/operations/SynchronizeFileOperation.java
src/com/owncloud/android/operations/SynchronizeFolderOperation.java
src/com/owncloud/android/utils/FileStorageUtils.java

diff --git a/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/ReadFileTest.java b/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/ReadFileTest.java
new file mode 100644 (file)
index 0000000..b75732b
--- /dev/null
@@ -0,0 +1,61 @@
+/* ownCloud Android client application
+ *   Copyright (C) 2012-2013 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.oc_framework_test_project.test;
+
+import com.owncloud.android.oc_framework.operations.RemoteOperationResult;
+import com.owncloud.android.oc_framework_test_project.TestActivity;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+/**
+ * Class to test Read File Operation
+ * @author masensio
+ *
+ */
+
+public class ReadFileTest extends      ActivityInstrumentationTestCase2<TestActivity> {
+       
+       /* File data to read. This file must exist on the account */
+    private final String mRemoteFolderPath = "/fileToRead.txt";
+    
+    
+    private TestActivity mActivity;
+    
+    public ReadFileTest() {
+        super(TestActivity.class);
+    }
+    
+    @Override
+      protected void setUp() throws Exception {
+        super.setUp();
+        setActivityInitialTouchMode(false);
+        mActivity = getActivity();
+    }
+
+    /**
+     * Test Read File
+     */
+    public void testReadFile() {
+
+            RemoteOperationResult result = mActivity.readFile(mRemoteFolderPath);
+            assertTrue(result.getData().size() ==  1);
+            assertTrue(result.isSuccess());
+    }
+    
+
+}
index 07f45b7..922b270 100644 (file)
@@ -22,6 +22,7 @@ import java.io.Serializable;
 import android.os.Parcel;
 import android.os.Parcelable;
 
+import com.owncloud.android.oc_framework.network.webdav.WebdavEntry;
 import com.owncloud.android.oc_framework.utils.FileUtils;
 
 /**
@@ -33,7 +34,7 @@ import com.owncloud.android.oc_framework.utils.FileUtils;
 public class RemoteFile implements Parcelable, Serializable {
 
        /** Generated - should be refreshed every time the class changes!! */
-       private static final long serialVersionUID = 7256606476031992757L;
+       private static final long serialVersionUID = 532139091191390616L;
        
        private String mRemotePath;
        private String mMimeType;
@@ -108,6 +109,15 @@ public class RemoteFile implements Parcelable, Serializable {
         }
         mRemotePath = path;
        }
+       
+       public RemoteFile(WebdavEntry we) {
+        this(we.decodedPath());
+        this.setCreationTimestamp(we.createTimestamp());
+        this.setLength(we.contentLength());
+        this.setMimeType(we.contentType());
+        this.setModifiedTimestamp(we.modifiedTimestamp());
+        this.setEtag(we.etag());
+       }
 
        /**
      * Used internally. Reset all file properties
index 666e312..58accf9 100644 (file)
@@ -99,7 +99,7 @@ public class RemoteOperationResult implements Serializable {
     private String mRedirectedLocation;
 
     private ArrayList<RemoteFile> mFiles;
-       
+    
     public RemoteOperationResult(ResultCode code) {
         mCode = code;
         mSuccess = (code == ResultCode.OK || code == ResultCode.OK_SSL || code == ResultCode.OK_NO_SSL);
@@ -320,7 +320,7 @@ public class RemoteOperationResult implements Serializable {
         } else if (mCode == ResultCode.ACCOUNT_NOT_THE_SAME) {
             return "Authenticated with a different account than the one updating";
         } else if (mCode == ResultCode.INVALID_CHARACTER_IN_NAME) {
-               return "The file name contains an forbidden character";
+                return "The file name contains an forbidden character";
         }
 
         return "Operation finished with HTTP status code " + mHttpCode + " (" + (isSuccess() ? "success" : "fail") + ")";
diff --git a/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/ReadRemoteFileOperation.java b/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/ReadRemoteFileOperation.java
new file mode 100644 (file)
index 0000000..6cdacad
--- /dev/null
@@ -0,0 +1,108 @@
+/* ownCloud Android client application
+ *   Copyright (C) 2012-2013 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package com.owncloud.android.oc_framework.operations.remote;
+
+import java.util.ArrayList;
+
+import org.apache.http.HttpStatus;
+import org.apache.jackrabbit.webdav.DavConstants;
+import org.apache.jackrabbit.webdav.MultiStatus;
+import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
+
+import android.util.Log;
+
+import com.owncloud.android.oc_framework.network.webdav.WebdavClient;
+import com.owncloud.android.oc_framework.network.webdav.WebdavEntry;
+import com.owncloud.android.oc_framework.network.webdav.WebdavUtils;
+import com.owncloud.android.oc_framework.operations.RemoteFile;
+import com.owncloud.android.oc_framework.operations.RemoteOperation;
+import com.owncloud.android.oc_framework.operations.RemoteOperationResult;
+
+
+/**
+ * Remote operation performing the read a file from the ownCloud server.
+ * 
+ * @author David A. Velasco
+ * @author masensio
+ */
+
+public class ReadRemoteFileOperation extends RemoteOperation {
+
+    private static final String TAG = ReadRemoteFileOperation.class.getSimpleName();
+    private static final int SYNC_READ_TIMEOUT = 10000;
+    private static final int SYNC_CONNECTION_TIMEOUT = 5000;
+    
+    private String mRemotePath;
+    
+       
+    /**
+     * Constructor
+     * 
+     * @param remotePath               Remote path of the file. 
+     */
+    public ReadRemoteFileOperation(String remotePath) {
+       mRemotePath = remotePath;
+    }
+
+    /**
+     * Performs the read operation.
+     * 
+     * @param client           Client object to communicate with the remote ownCloud server.
+     */
+    @Override
+    protected RemoteOperationResult run(WebdavClient client) {
+       PropFindMethod propfind = null;
+       RemoteOperationResult result = null;
+
+       /// take the duty of check the server for the current state of the file there
+       try {
+               propfind = new PropFindMethod(client.getBaseUri() + WebdavUtils.encodePath(mRemotePath),
+                               DavConstants.PROPFIND_ALL_PROP,
+                               DavConstants.DEPTH_0);
+               int status;
+               status = client.executeMethod(propfind, SYNC_READ_TIMEOUT, SYNC_CONNECTION_TIMEOUT);
+
+               boolean isMultiStatus = status == HttpStatus.SC_MULTI_STATUS;
+               if (isMultiStatus) {
+                       // Parse response
+                       MultiStatus resp = propfind.getResponseBodyAsMultiStatus();
+                               WebdavEntry we = new WebdavEntry(resp.getResponses()[0], client.getBaseUri().getPath());
+                               RemoteFile remoteFile = new RemoteFile(we);
+                               ArrayList<RemoteFile> files = new ArrayList<RemoteFile>();
+                               files.add(remoteFile);
+
+                       // Result of the operation
+                       result = new RemoteOperationResult(true, status, propfind.getResponseHeaders());
+                       result.setData(files);
+                       
+               } else {
+                       client.exhaustResponse(propfind.getResponseBodyAsStream());
+                       result = new RemoteOperationResult(false, status, propfind.getResponseHeaders());
+               }
+
+       } catch (Exception e) {
+               result = new RemoteOperationResult(e);
+               e.printStackTrace();
+               Log.e(TAG, "Synchronizing  file " + mRemotePath + ": " + result.getLogMessage(), result.getException());
+       } finally {
+               if (propfind != null)
+                       propfind.releaseConnection();
+       }
+       return result;
+    }
+
+}
index a7674e4..192c267 100644 (file)
@@ -66,4 +66,6 @@ public class FileUtils {
                }
                return result;
        }
+
+       
 }
index 697ce72..bd151ad 100644 (file)
@@ -1,18 +1,39 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <resources>
+  <string name="about_android">%1$s Apl Android</string>
+  <string name="about_version">versi %1$s</string>
+  <string name="actionbar_sync">Segarkan akun</string>
   <string name="actionbar_upload">Unggah</string>
+  <string name="actionbar_upload_from_apps">Konten dari apl lain</string>
   <string name="actionbar_upload_files">Berkas</string>
+  <string name="actionbar_open_with">Bukan dengan</string>
   <string name="actionbar_mkdir">Buat folder</string>
   <string name="actionbar_settings">pengaturan</string>
-  <string name="actionbar_see_details">Detail</string>
+  <string name="actionbar_see_details">Rincian</string>
   <string name="prefs_category_general">umum</string>
   <string name="prefs_category_more">Lainnya</string>
   <string name="prefs_accounts">Akun</string>
-  <string name="prefs_manage_accounts">Kolola Akun</string>
+  <string name="prefs_manage_accounts">Kelola Akun</string>
+  <string name="prefs_pincode">PIN Apl</string>
+  <string name="prefs_pincode_summary">Lindungi klien Anda</string>
+  <string name="prefs_instant_upload">Aktifkan unggah instan</string>
+  <string name="prefs_instant_upload_summary">Unggah langsung foto yang diambil oleh kamera</string>
+  <string name="prefs_log_title">Aktifkan Pencatatan</string>
+  <string name="prefs_log_summary">Ini digunakan untuk mencatat masalah</string>
+  <string name="prefs_log_title_history">Riwayat Catatan</string>
+  <string name="prefs_log_summary_history">Ini menampilkan catatan yang disimpan</string>
+  <string name="prefs_log_delete_history_button">Riwayat Hapus</string>
   <string name="prefs_help">Bantuan</string>
+  <string name="prefs_recommend">Rekomendasikan ke teman</string>
+  <string name="prefs_feedback">Umpan balik</string>
   <string name="prefs_imprint">Imprint</string>
-  <string name="auth_username">nama pengguna</string>
-  <string name="auth_password">kata kunci</string>
+  <string name="recommend_subject">Coba %1$s pada smartphone Anda!</string>
+  <string name="recommend_text">Saya mengundang Anda untuk menggunakan %1$s pada smartphone Anda!\nUnduh di sini: %2$s</string>
+  <string name="auth_check_server">Periksa Server</string>
+  <string name="auth_host_url">Alamat server https://…</string>
+  <string name="auth_username">Nama Pengguna</string>
+  <string name="auth_password">Sandi</string>
+  <string name="auth_register">Baru di %1$s?</string>
   <string name="sync_string_files">Berkas</string>
   <string name="setup_btn_connect">Sambungkan</string>
   <string name="uploader_btn_upload_text">Unggah</string>
   <string name="uploader_wrn_no_account_text">Belum ada akun %1$s pada perangkat Anda. Silahkan buat akun terlebih dahulu.</string>
   <string name="uploader_wrn_no_account_setup_btn_text">Pengaturan</string>
   <string name="uploader_wrn_no_account_quit_btn_text">Keluar</string>
+  <string name="uploader_wrn_no_content_title">Tidak ada konten untuk diunggah</string>
+  <string name="uploader_wrn_no_content_text">Tidak ada konten yang diterima. Tidak ada yang diunggah</string>
+  <string name="uploader_error_forbidden_content">%1$s tidak diizinkan mengakses konten berbagi</string>
   <string name="uploader_info_uploading">Mengunggah</string>
+  <string name="file_list_empty">Tidak ada berkas dalam folder ini.\nBerkas baru dapat ditambahkan dengan opsi menu \"Unggah\".</string>
   <string name="filedetails_select_file">Sentuh pada berkas untuk menampilkan informasi tambahan</string>
   <string name="filedetails_size">Ukuran:</string>
   <string name="filedetails_type">Tipe:</string>
   <string name="filedetails_created">Dibuat:</string>
   <string name="filedetails_modified">Diubah:</string>
-  <string name="filedetails_download">unduh</string>
+  <string name="filedetails_download">Unduh</string>
+  <string name="filedetails_sync_file">Segarkan berkas</string>
   <string name="filedetails_renamed_in_upload_msg">Berkas diubah namanya menjadi %1$s saat pengunggahan</string>
   <string name="common_yes">Ya</string>
   <string name="common_no">Tidak</string>
   <string name="common_ok">Oke</string>
   <string name="common_cancel_download">Batal mengunduh</string>
   <string name="common_cancel_upload">Batal mengunggah</string>
-  <string name="common_cancel">batal</string>
+  <string name="common_cancel">Batal</string>
   <string name="common_save_exit">Simpan &amp; Keluar</string>
-  <string name="common_error">kesalahan</string>
+  <string name="common_error">Kesalahan</string>
   <string name="common_loading">Memuat ...</string>
   <string name="common_error_unknown">Galat tidak diketahui</string>
   <string name="about_title">Tentang</string>
   <string name="downloader_download_in_progress_content">%1$d%% Mengunduh %2$s</string>
   <string name="downloader_download_succeeded_ticker">Berhasil mengunduh</string>
   <string name="downloader_download_succeeded_content">%1$s berhasil diunduh</string>
+  <string name="downloader_download_failed_ticker">Gagal Mengunduh</string>
+  <string name="downloader_download_failed_content">Mengunduh %1$s tidak selesai</string>
   <string name="downloader_not_downloaded_yet">Belum diunduh</string>
   <string name="common_choose_account">Pilih akun</string>
+  <string name="sync_fail_ticker">Sinkronisasi gagal</string>
+  <string name="sync_fail_content">Sinkronisasi %1$s tidak selesai</string>
+  <string name="sync_fail_content_unauthorized">Sandi salah untuk %1$s</string>
   <string name="sync_conflicts_in_favourites_ticker">Konflik ditemukan</string>
+  <string name="sync_fail_in_favourites_content">Konten berkas %1$d tidak dapat disinkronasikan (%2$d konflik)</string>
+  <string name="sync_foreign_files_forgotten_ticker">Beberapa berkas lokal terlupakan</string>
+  <string name="sync_foreign_files_forgotten_content">%1$d berkas dari direktori %2$s tidak dapat disalin ke</string>
+  <string name="sync_current_folder_was_removed">Folder %1$s tidak ada lagi</string>
   <string name="foreign_files_move">Pindahkan semua</string>
   <string name="foreign_files_success">Semua berkas sudah dipindahkan</string>
   <string name="foreign_files_fail">Beberapa berkas tidak dapat dipindahkan</string>
   <string name="foreign_files_local_text">Lokal: %1$s</string>
-  <string name="pincode_enter_pin_code">Silakan masukkan App PIN</string>
-  <string name="pincode_configure_your_pin">Masukkan App PIN</string>
-  <string name="pincode_reenter_your_pincode">Silakan masukkan ulang App PIN</string>
-  <string name="pincode_remove_your_pincode">Hapus App PIN</string>
-  <string name="pincode_mismatch">App PIN tidak sama</string>
-  <string name="pincode_wrong">App PIN salah</string>
-  <string name="pincode_removed">App PIN dihapus</string>
-  <string name="pincode_stored">App PIN disimpan</string>
+  <string name="foreign_files_remote_text">Jauh: %1$s</string>
+  <string name="pincode_enter_pin_code">Silakan masukkan PIN Apl</string>
+  <string name="pincode_configure_your_pin">Masukkan PIN Apl</string>
+  <string name="pincode_configure_your_pin_explanation">PIN akan selalu diminta setiap kali apl dijalankan</string>
+  <string name="pincode_reenter_your_pincode">Silakan masukkan ulang PIN Apl</string>
+  <string name="pincode_remove_your_pincode">Hapus PIN Apl</string>
+  <string name="pincode_mismatch">PIN Apl tidak sama</string>
+  <string name="pincode_wrong">PIN Apl salah</string>
+  <string name="pincode_removed">PIN Apl dihapus</string>
+  <string name="pincode_stored">PIN Apl disimpan</string>
   <string name="media_notif_ticker">Pemutar musik %1$s</string>
   <string name="media_state_playing">%1$s (dimainkan)</string>
   <string name="media_state_loading">%1$s (sedang dimuat)</string>
   <string name="media_err_not_in_owncloud">Brkas tidak didalam akun yang sah</string>
   <string name="media_err_unsupported">Kodek media tidak didukung</string>
   <string name="media_err_io">Berkas media tidak dapat dibaca</string>
+  <string name="media_err_malformed">Berkas media tidak di enkode dengan benar</string>
+  <string name="media_err_timeout">Waktu habis saat mencoba untuk main</string>
+  <string name="media_err_invalid_progressive_playback">Berkas media tidak bisa dialirkan</string>
+  <string name="media_err_unknown">Berkas media tidak dapat dimainkan dengan pemutar media</string>
+  <string name="media_err_security_ex">Kesalahan keamanan saat mencoba memutar %1$s</string>
+  <string name="media_err_io_ex">Kesalahan masukkan saat mencoba memutar %1$s</string>
+  <string name="media_err_unexpected">Kesalahan tak terduga saat mencoba memutar %1$s</string>
+  <string name="media_rewind_description">Tombol mundur</string>
+  <string name="media_play_pause_description">Tombol main dan jeda</string>
+  <string name="media_forward_description">Tombol maju</string>
+  <string name="auth_trying_to_login">Mencoba untuk masuk...</string>
   <string name="auth_no_net_conn_title">Tidak ada koneksi internet</string>
   <string name="auth_nossl_plain_ok_title">Sambungan aman tidak tersedia</string>
   <string name="auth_connection_established">Sambungan dibuat</string>
+  <string name="auth_testing_connection">Pengetesan koneksi ...</string>
   <string name="auth_not_configured_title">Konfigurasi server cacat</string>
+  <string name="auth_account_not_new">Akun untuk pengguna dan server yang sama sudah ada dalam perangkat</string>
+  <string name="auth_account_not_the_same">Pengguna yang dimasukkan tidak cocok dengan pengguna akun ini</string>
   <string name="auth_unknown_error_title">Terjadi kesalahan yang tidak diketahui!</string>
+  <string name="auth_unknown_host_title">Tidak menemukan host</string>
+  <string name="auth_incorrect_path_title">Instansi server tidak ditemukan</string>
+  <string name="auth_timeout_title">Server terlalu lama merespon</string>
+  <string name="auth_incorrect_address_title">Format URL salah</string>
+  <string name="auth_ssl_general_error_title">Menginisiasi SSL gagal</string>
+  <string name="auth_ssl_unverified_server_title">Tidak dapat memverifikasi identitas server SSL</string>
+  <string name="auth_bad_oc_version_title">Versi server tidak dikenal</string>
+  <string name="auth_wrong_connection_title">Tidak dapat membuat koneksi</string>
   <string name="auth_secure_connection">Sambungan aman dibuat</string>
+  <string name="auth_unauthorized">Nama pengguna dan sandi salah</string>
+  <string name="auth_oauth_error">Otorisasi tidak berhasil</string>
+  <string name="auth_oauth_error_access_denied">Akses ditolak oleh server otorisasi</string>
+  <string name="auth_wtf_reenter_URL">Keadaan tak terduga, silahkan masukkan URL server yang lagi</string>
+  <string name="auth_expired_oauth_token_toast">Otorisasi Anda telah berakhir. Silakan mengotorisasi lagi</string>
+  <string name="auth_expired_basic_auth_toast">Silakan mesukkan sandi saat ini</string>
+  <string name="auth_expired_saml_sso_token_toast">Sesi Anda telah berakhir. Silakan masuk kembali</string>
+  <string name="auth_connecting_auth_server">Menyambungkan ke server otentikasi...</string>
+  <string name="auth_unsupported_auth_method">Server tidak mendukung medote otentikasi ini</string>
+  <string name="auth_unsupported_multiaccount">%1$s tidak mendukung banyak akun </string>
+  <string name="fd_keep_in_sync">Biarkan berkas tetap terbaru</string>
   <string name="common_rename">Ubah nama</string>
-  <string name="common_remove">hilangkan</string>
+  <string name="common_remove">Hapus</string>
   <string name="confirmation_remove_alert">Apakah Anda yakin ingin menghapus %1$s ?</string>
+  <string name="confirmation_remove_folder_alert">Apakah Anda benar-benar ingin menghapus %1$s beserta isinya?</string>
+  <string name="confirmation_remove_local">Lokal saja</string>
+  <string name="confirmation_remove_folder_local">Konten lokal saja</string>
+  <string name="confirmation_remove_remote">Hapus dari server</string>
+  <string name="confirmation_remove_remote_and_local">Jarak jauh dan lokal</string>
   <string name="remove_success_msg">Penghapusan berhasil</string>
   <string name="remove_fail_msg">Penghapusan gagal</string>
   <string name="rename_dialog_title">Masukkan nama baru</string>
+  <string name="rename_local_fail_msg">Salinan lokal tidak dapat diubah nama, coba dengan nama yang berbeda</string>
+  <string name="rename_server_fail_msg">Mengubah nama tidak selesai</string>
+  <string name="sync_file_fail_msg">Berkas jauh tidak dapat diperiksa</string>
   <string name="sync_file_nothing_to_do_msg">Isi berkas sudah diselaraskan</string>
-  <string name="filedisplay_unexpected_bad_get_content">Masalah tidak terduga, silahkan pilih berkas dari aplikasi yang berbeda</string>
-  <string name="ssl_validator_btn_details_see">Detail</string>
-  <string name="ssl_validator_btn_details_hide">sembunyikan</string>
+  <string name="create_dir_fail_msg">Folder tidak dapat dibuat</string>
+  <string name="filename_forbidden_characters">Karakter yang dilarang: / \\ &lt; &gt; : \" | ? *</string>
+  <string name="wait_a_moment">Tunggu sejenak</string>
+  <string name="filedisplay_unexpected_bad_get_content">Masalah tidak terduga, silahkan pilih berkas dari apl yang berbeda</string>
+  <string name="filedisplay_no_file_selected">Tidak ada berkas yang terpilih</string>
+  <string name="oauth_check_onoff">Masuk dengan oAuth2</string>
+  <string name="oauth_login_connection">Menyambungkan ke server oAuth2...</string>
+  <string name="ssl_validator_header">Identitas situs tidak dapat diverfikasi</string>
+  <string name="ssl_validator_reason_cert_not_trusted">- Sertifikat server tidak terpercaya</string>
+  <string name="ssl_validator_reason_cert_expired">- Sertifikat server kadaluarsa</string>
+  <string name="ssl_validator_reason_cert_not_yet_valid">- Tanggal sertifikat server yang valid adalah di masa depan</string>
+  <string name="ssl_validator_reason_hostname_not_verified">- URL tidak cocok dengan nama host dalam sertifikat</string>
+  <string name="ssl_validator_question">Apakah Anda percaya dengan sertifikat ini?</string>
+  <string name="ssl_validator_not_saved">Sertifikat tidak dapat disimpan</string>
+  <string name="ssl_validator_btn_details_see">Rincian</string>
+  <string name="ssl_validator_btn_details_hide">Sembunyikan</string>
+  <string name="ssl_validator_label_subject">Diterbitkan untuk:</string>
+  <string name="ssl_validator_label_issuer">Diterbitkan oleh:</string>
+  <string name="ssl_validator_label_CN">Nama panggilan:</string>
+  <string name="ssl_validator_label_O">Organisasi:</string>
+  <string name="ssl_validator_label_OU">Unit Organisasi:</string>
+  <string name="ssl_validator_label_C">Negara:</string>
+  <string name="ssl_validator_label_ST">Negara bagian:</string>
+  <string name="ssl_validator_label_L">Lokasi:</string>
+  <string name="ssl_validator_label_validity">Masa berlaku:</string>
+  <string name="ssl_validator_label_validity_from">Dari:</string>
+  <string name="ssl_validator_label_validity_to">Untuk:</string>
   <string name="ssl_validator_label_signature">Tanda tangan:</string>
   <string name="ssl_validator_label_signature_algorithm">Algoritma:</string>
+  <string name="placeholder_sentence">Ini adalah placeholder</string>
+  <string name="placeholder_filename">placeholder.txt</string>
+  <string name="placeholder_filetype">Gambar PNG</string>
+  <string name="placeholder_filesize">389 KB</string>
+  <string name="placeholder_timestamp">18/05/2012 12:23 PM</string>
+  <string name="placeholder_media_time">12:23:45</string>
+  <string name="instant_upload_on_wifi">Hanya unggah gambar via WiFi</string>
+  <string name="instant_upload_path">/UnggahInstan</string>
   <string name="conflict_title">Perbarui benturan</string>
-  <string name="conflict_overwrite">Tindih</string>
+  <string name="conflict_message">Berkas jauh %s tidak sinkron dengan berkas lokal. Melanjutkan akan menggantikan konten berkas di server.</string>
+  <string name="conflict_keep_both">Biarkan keduannya</string>
+  <string name="conflict_overwrite">Timpa</string>
   <string name="conflict_dont_upload">Jangan mengunggah</string>
+  <string name="preview_image_description">Pratilik gambar</string>
+  <string name="preview_image_error_unknown_format">Gambar ini tidak dapat ditampilkan</string>
+  <string name="error__upload__local_file_not_copied">%1$s tidak dapat disalin ke direktori lokal %2$s</string>
+  <string name="actionbar_failed_instant_upload">UnggahInsatan Gagal</string>
+  <string name="failed_upload_headline_text">Unggahan instan gagal</string>
+  <string name="failed_upload_headline_hint">Ringkasan dari semua unggahan instan yang gagal</string>
+  <string name="failed_upload_all_cb">pilih semua</string>
+  <string name="failed_upload_headline_retryall_btn">Ulangi semua yang terpilih</string>
+  <string name="failed_upload_headline_delete_all_btn">hapus semua yang terpilih dari antrian unggahan</string>
+  <string name="failed_upload_retry_text">ulangi unggah gambar:</string>
+  <string name="failed_upload_load_more_images">Muat Gambar selengkapnya</string>
+  <string name="failed_upload_retry_do_nothing_text">Tidak melakukan apapun, Anda tidak sedang online</string>
+  <string name="failed_upload_failure_text">Pesan Kegagalan:</string>
+  <string name="failed_upload_quota_exceeded_text">Silakan periksa konfigurasi server Anda, kemungkinan kuota terlampaui.</string>
 </resources>
index 5fa2751..3595263 100644 (file)
@@ -28,29 +28,24 @@ import java.util.Vector;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-import org.apache.http.HttpStatus;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.apache.jackrabbit.webdav.MultiStatus;
-import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
-
 import com.owncloud.android.R;
 import com.owncloud.android.authentication.AuthenticatorActivity;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.db.DbHandler;
 import com.owncloud.android.operations.CreateFolderOperation;
+import com.owncloud.android.oc_framework.operations.RemoteFile;
 import com.owncloud.android.oc_framework.operations.RemoteOperation;
 import com.owncloud.android.oc_framework.operations.RemoteOperationResult;
 import com.owncloud.android.operations.UploadFileOperation;
 import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode;
 import com.owncloud.android.oc_framework.operations.remote.ExistenceCheckRemoteOperation;
+import com.owncloud.android.oc_framework.operations.remote.ReadRemoteFileOperation;
 import com.owncloud.android.oc_framework.utils.OwnCloudVersion;
 import com.owncloud.android.oc_framework.network.webdav.OnDatatransferProgressListener;
 import com.owncloud.android.oc_framework.accounts.OwnCloudAccount;
 import com.owncloud.android.oc_framework.network.webdav.OwnCloudClientFactory;
 import com.owncloud.android.oc_framework.network.webdav.WebdavClient;
-import com.owncloud.android.oc_framework.network.webdav.WebdavEntry;
-import com.owncloud.android.oc_framework.network.webdav.WebdavUtils;
 import com.owncloud.android.ui.activity.FailedUploadActivity;
 import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.activity.FileDisplayActivity;
@@ -610,40 +605,15 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
         long syncDate = System.currentTimeMillis();
         file.setLastSyncDateForData(syncDate);
 
-        // / new PROPFIND to keep data consistent with server in theory, should
-        // return the same we already have
-        PropFindMethod propfind = null;
-        RemoteOperationResult result = null;
-        try {
-            propfind = new PropFindMethod(mUploadClient.getBaseUri() + WebdavUtils.encodePath(mCurrentUpload.getRemotePath()),
-                    DavConstants.PROPFIND_ALL_PROP,
-                    DavConstants.DEPTH_0);
-            int status = mUploadClient.executeMethod(propfind);
-            boolean isMultiStatus = (status == HttpStatus.SC_MULTI_STATUS);
-            if (isMultiStatus) {
-                MultiStatus resp = propfind.getResponseBodyAsMultiStatus();
-                WebdavEntry we = new WebdavEntry(resp.getResponses()[0], mUploadClient.getBaseUri().getPath());
-                updateOCFile(file, we);
-                file.setLastSyncDateForProperties(syncDate);
-
-            } else {
-                mUploadClient.exhaustResponse(propfind.getResponseBodyAsStream());
-            }
-
-            result = new RemoteOperationResult(isMultiStatus, status, propfind.getResponseHeaders());
-            Log_OC.i(TAG, "Update: synchronizing properties for uploaded " + mCurrentUpload.getRemotePath() + ": "
-                    + result.getLogMessage());
-
-        } catch (Exception e) {
-            result = new RemoteOperationResult(e);
-            Log_OC.e(TAG, "Update: synchronizing properties for uploaded " + mCurrentUpload.getRemotePath() + ": "
-                    + result.getLogMessage(), e);
-
-        } finally {
-            if (propfind != null)
-                propfind.releaseConnection();
+        // new PROPFIND to keep data consistent with server 
+        // in theory, should return the same we already have
+        ReadRemoteFileOperation operation = new ReadRemoteFileOperation(mCurrentUpload.getRemotePath());
+        RemoteOperationResult result = operation.execute(mUploadClient);
+        if (result.isSuccess()) {
+            updateOCFile(file, result.getData().get(0));
+            file.setLastSyncDateForProperties(syncDate);
         }
-
+        
         // / maybe this would be better as part of UploadFileOperation... or
         // maybe all this method
         if (mCurrentUpload.wasRenamed()) {
@@ -660,13 +630,13 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
         mStorageManager.saveFile(file);
     }
 
-    private void updateOCFile(OCFile file, WebdavEntry we) {
-        file.setCreationTimestamp(we.createTimestamp());
-        file.setFileLength(we.contentLength());
-        file.setMimetype(we.contentType());
-        file.setModificationTimestamp(we.modifiedTimestamp());
-        file.setModificationTimestampAtLastSyncForData(we.modifiedTimestamp());
-        // file.setEtag(mCurrentUpload.getEtag());    // TODO Etag, where available
+    private void updateOCFile(OCFile file, RemoteFile remoteFile) {
+        file.setCreationTimestamp(remoteFile.getCreationTimestamp());
+        file.setFileLength(remoteFile.getLength());
+        file.setMimetype(remoteFile.getMimeType());
+        file.setModificationTimestamp(remoteFile.getModifiedTimestamp());
+        file.setModificationTimestampAtLastSyncForData(remoteFile.getModifiedTimestamp());
+        // file.setEtag(remoteFile.getEtag());    // TODO Etag, where available
     }
 
     private OCFile obtainNewOCFileToUpload(String remotePath, String localPath, String mimeType,
index f087aa5..71d7f72 100644 (file)
 
 package com.owncloud.android.operations;
 
-import org.apache.http.HttpStatus;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.apache.jackrabbit.webdav.MultiStatus;
-import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
-
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.files.services.FileDownloader;
 import com.owncloud.android.files.services.FileUploader;
 import com.owncloud.android.oc_framework.network.webdav.WebdavClient;
-import com.owncloud.android.oc_framework.network.webdav.WebdavEntry;
-import com.owncloud.android.oc_framework.network.webdav.WebdavUtils;
 import com.owncloud.android.oc_framework.operations.RemoteOperation;
 import com.owncloud.android.oc_framework.operations.RemoteOperationResult;
 import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode;
+import com.owncloud.android.oc_framework.operations.remote.ReadRemoteFileOperation;
+import com.owncloud.android.utils.FileStorageUtils;
 import com.owncloud.android.utils.Log_OC;
 
 import android.accounts.Account;
 import android.content.Context;
 import android.content.Intent;
 
+/**
+ * Remote operation performing the read of remote file in the ownCloud server.
+ * 
+ * @author David A. Velasco
+ * @author masensio
+ */
 
 public class SynchronizeFileOperation extends RemoteOperation {
 
     private String TAG = SynchronizeFileOperation.class.getSimpleName();
-    private static final int SYNC_READ_TIMEOUT = 10000;
-    private static final int SYNC_CONNECTION_TIMEOUT = 5000;
     
     private OCFile mLocalFile;
     private OCFile mServerFile;
@@ -74,103 +73,83 @@ public class SynchronizeFileOperation extends RemoteOperation {
 
     @Override
     protected RemoteOperationResult run(WebdavClient client) {
-        
-        PropFindMethod propfind = null;
+
         RemoteOperationResult result = null;
         mTransferWasRequested = false;
-        try {
-            if (!mLocalFile.isDown()) {
-                /// easy decision
-                requestForDownload(mLocalFile);
-                result = new RemoteOperationResult(ResultCode.OK);
-                
-            } else {
-                /// local copy in the device -> need to think a bit more before do anything
-                
-                if (mServerFile == null) {
-                    /// take the duty of check the server for the current state of the file there
-                    propfind = new PropFindMethod(client.getBaseUri() + WebdavUtils.encodePath(mLocalFile.getRemotePath()),
-                            DavConstants.PROPFIND_ALL_PROP,
-                            DavConstants.DEPTH_0);
-                    int status = client.executeMethod(propfind, SYNC_READ_TIMEOUT, SYNC_CONNECTION_TIMEOUT);
-                    boolean isMultiStatus = status == HttpStatus.SC_MULTI_STATUS;
-                    if (isMultiStatus) {
-                        MultiStatus resp = propfind.getResponseBodyAsMultiStatus();
-                        WebdavEntry we = new WebdavEntry(resp.getResponses()[0],
-                                               client.getBaseUri().getPath());
-                        mServerFile = fillOCFile(we);
-                        mServerFile.setLastSyncDateForProperties(System.currentTimeMillis());
-                        
-                    } else {
-                        client.exhaustResponse(propfind.getResponseBodyAsStream());
-                        result = new RemoteOperationResult(false, status, propfind.getResponseHeaders());
-                    }
+        if (!mLocalFile.isDown()) {
+            /// easy decision
+            requestForDownload(mLocalFile);
+            result = new RemoteOperationResult(ResultCode.OK);
+
+        } else {
+            /// local copy in the device -> need to think a bit more before do anything
+
+            if (mServerFile == null) {
+                String remotePath = mLocalFile.getRemotePath();
+                ReadRemoteFileOperation operation = new ReadRemoteFileOperation(remotePath);
+                result = operation.execute(client);
+                if (result.isSuccess()){
+                    mServerFile = FileStorageUtils.fillOCFile(result.getData().get(0));
+                    mServerFile.setLastSyncDateForProperties(System.currentTimeMillis());
                 }
-                
-                if (result == null) {   // true if the server was not checked. nothing was wrong with the remote request
-              
-                    /// check changes in server and local file
-                    boolean serverChanged = false;
-                    /* time for eTag is coming, but not yet
+            }
+
+            if (result.isSuccess()) {   
+
+                /// check changes in server and local file
+                boolean serverChanged = false;
+                /* time for eTag is coming, but not yet
                     if (mServerFile.getEtag() != null) {
                         serverChanged = (!mServerFile.getEtag().equals(mLocalFile.getEtag()));   // TODO could this be dangerous when the user upgrades the server from non-tagged to tagged?
                     } else { */
-                        // server without etags
-                        serverChanged = (mServerFile.getModificationTimestamp() > mLocalFile.getModificationTimestampAtLastSyncForData());
-                    //}
-                    boolean localChanged = (mLocalFile.getLocalModificationTimestamp() > mLocalFile.getLastSyncDateForData());
-                        // TODO this will be always true after the app is upgraded to database version 2; will result in unnecessary uploads
-              
-                    /// decide action to perform depending upon changes
-                    //if (!mLocalFile.getEtag().isEmpty() && localChanged && serverChanged) {
-                    if (localChanged && serverChanged) {
-                        result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT);
-                  
-                    } else if (localChanged) {
-                        if (mSyncFileContents) {
-                            requestForUpload(mLocalFile);
-                            // the local update of file properties will be done by the FileUploader service when the upload finishes
-                        } else {
-                            // NOTHING TO DO HERE: updating the properties of the file in the server without uploading the contents would be stupid; 
-                            // So, an instance of SynchronizeFileOperation created with syncFileContents == false is completely useless when we suspect
-                            // that an upload is necessary (for instance, in FileObserverService).
-                        }
-                        result = new RemoteOperationResult(ResultCode.OK);
-                  
-                    } else if (serverChanged) {
-                        if (mSyncFileContents) {
-                            requestForDownload(mLocalFile); // local, not server; we won't to keep the value of keepInSync!
-                            // the update of local data will be done later by the FileUploader service when the upload finishes
-                        } else {
-                            // TODO CHECK: is this really useful in some point in the code?
-                            mServerFile.setKeepInSync(mLocalFile.keepInSync());
-                            mServerFile.setLastSyncDateForData(mLocalFile.getLastSyncDateForData());
-                            mServerFile.setStoragePath(mLocalFile.getStoragePath());
-                            mServerFile.setParentId(mLocalFile.getParentId());
-                            mStorageManager.saveFile(mServerFile);
-                            
-                        }
-                        result = new RemoteOperationResult(ResultCode.OK);
-              
+                // server without etags
+                serverChanged = (mServerFile.getModificationTimestamp() != mLocalFile.getModificationTimestampAtLastSyncForData());
+                //}
+                boolean localChanged = (mLocalFile.getLocalModificationTimestamp() > mLocalFile.getLastSyncDateForData());
+                // TODO this will be always true after the app is upgraded to database version 2; will result in unnecessary uploads
+
+                /// decide action to perform depending upon changes
+                //if (!mLocalFile.getEtag().isEmpty() && localChanged && serverChanged) {
+                if (localChanged && serverChanged) {
+                    result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT);
+
+                } else if (localChanged) {
+                    if (mSyncFileContents) {
+                        requestForUpload(mLocalFile);
+                        // the local update of file properties will be done by the FileUploader service when the upload finishes
                     } else {
-                        // nothing changed, nothing to do
-                        result = new RemoteOperationResult(ResultCode.OK);
+                        // NOTHING TO DO HERE: updating the properties of the file in the server without uploading the contents would be stupid; 
+                        // So, an instance of SynchronizeFileOperation created with syncFileContents == false is completely useless when we suspect
+                        // that an upload is necessary (for instance, in FileObserverService).
                     }
-              
-                } 
-          
-            }
-            
-            Log_OC.i(TAG, "Synchronizing " + mAccount.name + ", file " + mLocalFile.getRemotePath() + ": " + result.getLogMessage());
-          
-        } catch (Exception e) {
-            result = new RemoteOperationResult(e);
-            Log_OC.e(TAG, "Synchronizing " + mAccount.name + ", file " + (mLocalFile != null ? mLocalFile.getRemotePath() : "NULL") + ": " + result.getLogMessage(), result.getException());
-
-        } finally {
-            if (propfind != null)
-                propfind.releaseConnection();
+                    result = new RemoteOperationResult(ResultCode.OK);
+
+                } else if (serverChanged) {
+                    if (mSyncFileContents) {
+                        requestForDownload(mLocalFile); // local, not server; we won't to keep the value of keepInSync!
+                        // the update of local data will be done later by the FileUploader service when the upload finishes
+                    } else {
+                        // TODO CHECK: is this really useful in some point in the code?
+                        mServerFile.setKeepInSync(mLocalFile.keepInSync());
+                        mServerFile.setLastSyncDateForData(mLocalFile.getLastSyncDateForData());
+                        mServerFile.setStoragePath(mLocalFile.getStoragePath());
+                        mServerFile.setParentId(mLocalFile.getParentId());
+                        mStorageManager.saveFile(mServerFile);
+
+                    }
+                    result = new RemoteOperationResult(ResultCode.OK);
+
+                } else {
+                    // nothing changed, nothing to do
+                    result = new RemoteOperationResult(ResultCode.OK);
+                }
+
+            } 
+
         }
+
+        Log_OC.i(TAG, "Synchronizing " + mAccount.name + ", file " + mLocalFile.getRemotePath() + ": " + result.getLogMessage());
+
         return result;
     }
 
@@ -207,24 +186,6 @@ public class SynchronizeFileOperation extends RemoteOperation {
     }
 
 
-    /**
-     * Creates and populates a new {@link OCFile} object with the data read from the server.
-     * 
-     * @param we        WebDAV entry read from the server for a WebDAV resource (remote file or folder).
-     * @return          New OCFile instance representing the remote resource described by we.
-     */
-    private OCFile fillOCFile(WebdavEntry we) {
-        OCFile file = new OCFile(we.decodedPath());
-        file.setCreationTimestamp(we.createTimestamp());
-        file.setFileLength(we.contentLength());
-        file.setMimetype(we.contentType());
-        file.setModificationTimestamp(we.modifiedTimestamp());
-        file.setEtag(we.etag());
-        
-        return file;
-    }
-
-
     public boolean transferWasRequested() {
         return mTransferWasRequested;
     }
index e93736c..ff387c0 100644 (file)
@@ -30,9 +30,6 @@ import java.util.Map;
 import java.util.Vector;
 
 import org.apache.http.HttpStatus;
-import org.apache.jackrabbit.webdav.DavConstants;
-import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
-
 import android.accounts.Account;
 import android.content.Context;
 import android.content.Intent;
@@ -40,11 +37,10 @@ import android.content.Intent;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.oc_framework.network.webdav.WebdavClient;
-import com.owncloud.android.oc_framework.network.webdav.WebdavEntry;
-import com.owncloud.android.oc_framework.network.webdav.WebdavUtils;
 import com.owncloud.android.oc_framework.operations.RemoteOperation;
 import com.owncloud.android.oc_framework.operations.RemoteOperationResult;
 import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode;
+import com.owncloud.android.oc_framework.operations.remote.ReadRemoteFileOperation;
 import com.owncloud.android.oc_framework.operations.remote.ReadRemoteFolderOperation;
 import com.owncloud.android.oc_framework.operations.RemoteFile;
 import com.owncloud.android.syncadapter.FileSyncService;
@@ -188,48 +184,27 @@ public class SynchronizeFolderOperation extends RemoteOperation {
         mRemoteFolderChanged = false;
         RemoteOperationResult result = null;
         String remotePath = null;
-        PropFindMethod query = null;
-        
-        try {
+
             remotePath = mLocalFolder.getRemotePath();
             Log_OC.d(TAG, "Checking changes in " + mAccount.name + remotePath);
 
             // remote request 
-            query = new PropFindMethod(client.getBaseUri() + WebdavUtils.encodePath(remotePath),
-                    DavConstants.PROPFIND_ALL_PROP,
-                    DavConstants.DEPTH_0);
-            int status = client.executeMethod(query);
-
-            // check and process response
-            if (isMultiStatus(status)) {
-                // parse data from remote folder 
-                WebdavEntry we = new WebdavEntry(query.getResponseBodyAsMultiStatus().getResponses()[0], client.getBaseUri().getPath());
-                OCFile remoteFolder = fillOCFile(we);
-                
-                // check if remote and local folder are different
-                mRemoteFolderChanged = !(remoteFolder.getEtag().equalsIgnoreCase(mLocalFolder.getEtag()));
-                
-                result = new RemoteOperationResult(ResultCode.OK);
+            ReadRemoteFileOperation operation = new ReadRemoteFileOperation(remotePath);
+            result = operation.execute(client);
+            if (result.isSuccess()){
+                OCFile remoteFolder = FileStorageUtils.fillOCFile(result.getData().get(0));
                 
+             // check if remote and local folder are different
+              mRemoteFolderChanged = !(remoteFolder.getEtag().equalsIgnoreCase(mLocalFolder.getEtag()));
+              
+              result = new RemoteOperationResult(ResultCode.OK);
+
+              Log_OC.i(TAG, "Checked " + mAccount.name + remotePath + " : " + (mRemoteFolderChanged ? "changed" : "not changed"));
             } else {
                 // check failed
-                client.exhaustResponse(query.getResponseBodyAsStream());
-                if (status == HttpStatus.SC_NOT_FOUND) {
+                if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
                     removeLocalFolder();
                 }
-                result = new RemoteOperationResult(false, status, query.getResponseHeaders());
-            }
-
-        } catch (Exception e) {
-            result = new RemoteOperationResult(e);
-            
-
-        } finally {
-            if (query != null)
-                query.releaseConnection();  // let the connection available for other methods
-            if (result.isSuccess()) {
-                Log_OC.i(TAG, "Checked " + mAccount.name + remotePath + " : " + (mRemoteFolderChanged ? "changed" : "not changed"));
-            } else {
                 if (result.isException()) {
                     Log_OC.e(TAG, "Checked " + mAccount.name + remotePath  + " : " + result.getLogMessage(), result.getException());
                 } else {
@@ -237,7 +212,6 @@ public class SynchronizeFolderOperation extends RemoteOperation {
                 }
             }
             
-        }
         return result;
     }
 
@@ -398,23 +372,6 @@ public class SynchronizeFolderOperation extends RemoteOperation {
         return (status == HttpStatus.SC_MULTI_STATUS); 
     }
 
-    
-    /**
-     * Creates and populates a new {@link OCFile} object with the data read from the server.
-     * 
-     * @param we        WebDAV entry read from the server for a WebDAV resource (remote file or folder).
-     * @return          New OCFile instance representing the remote resource described by we.
-     */
-    private OCFile fillOCFile(WebdavEntry we) {
-        OCFile file = new OCFile(we.decodedPath());
-        file.setCreationTimestamp(we.createTimestamp());
-        file.setFileLength(we.contentLength());
-        file.setMimetype(we.contentType());
-        file.setModificationTimestamp(we.modifiedTimestamp());
-        file.setEtag(we.etag());
-        return file;
-    }
-
     /**
      * Creates and populates a new {@link OCFile} object with the data read from the server.
      * 
index 16812c6..d4042f5 100644 (file)
@@ -84,6 +84,22 @@ public class FileStorageUtils {
         return parentPath;
     }
     
+    /**
+     * Creates and populates a new {@link OCFile} object with the data read from the server.
+     * 
+     * @param remote    remote file read from the server (remote file or folder).
+     * @return          New OCFile instance representing the remote resource described by we.
+     */
+    public static OCFile fillOCFile(RemoteFile remote) {
+        OCFile file = new OCFile(remote.getRemotePath());
+        file.setCreationTimestamp(remote.getCreationTimestamp());
+        file.setFileLength(remote.getLength());
+        file.setMimetype(remote.getMimeType());
+        file.setModificationTimestamp(remote.getModifiedTimestamp());
+        file.setEtag(remote.getEtag());
+        
+        return file;
+    }
     
     /**
      * Creates and populates a new {@link RemoteFile} object with the data read from an {@link OCFile}.