Search in sources :

Example 11 with CloudPluginException

use of com.amaze.filemanager.exceptions.CloudPluginException in project AmazeFileManager by TeamAmaze.

the class CloudHandler method updateEntry.

public void updateEntry(OpenMode serviceType, CloudEntry newCloudEntry) throws CloudPluginException {
    if (!CloudSheetFragment.isCloudProviderAvailable(context))
        throw new CloudPluginException();
    SQLiteDatabase sqLiteDatabase = getWritableDatabase();
    ContentValues contentValues = new ContentValues();
    contentValues.put(COLUMN_CLOUD_ID, newCloudEntry.getId());
    contentValues.put(COLUMN_CLOUD_SERVICE, newCloudEntry.getServiceType().ordinal());
    try {
        contentValues.put(COLUMN_CLOUD_PERSIST, CryptUtil.encryptPassword(context, newCloudEntry.getPersistData()));
    } catch (Exception e) {
        e.printStackTrace();
        // failed to encrypt, revert back to plain
        contentValues.put(COLUMN_CLOUD_PERSIST, newCloudEntry.getPersistData());
    }
    sqLiteDatabase.update(TABLE_CLOUD_PERSIST, contentValues, COLUMN_CLOUD_SERVICE + " = ?", new String[] { serviceType.ordinal() + "" });
}
Also used : ContentValues(android.content.ContentValues) CloudPluginException(com.amaze.filemanager.exceptions.CloudPluginException) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) CloudPluginException(com.amaze.filemanager.exceptions.CloudPluginException)

Aggregations

CloudPluginException (com.amaze.filemanager.exceptions.CloudPluginException)11 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)4 CloudEntry (com.amaze.filemanager.database.models.CloudEntry)4 SmbException (jcifs.smb.SmbException)3 SmbFile (jcifs.smb.SmbFile)3 ContentValues (android.content.ContentValues)2 Cursor (android.database.Cursor)2 CursorLoader (android.support.v4.content.CursorLoader)2 ShellNotRunningException (com.amaze.filemanager.exceptions.ShellNotRunningException)2 HybridFileParcelable (com.amaze.filemanager.filesystem.HybridFileParcelable)2 SFtpClientTemplate (com.amaze.filemanager.filesystem.ssh.SFtpClientTemplate)2 CloudStorage (com.cloudrail.si.interfaces.CloudStorage)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 ArrayList (java.util.ArrayList)2 RemoteResourceInfo (net.schmizz.sshj.sftp.RemoteResourceInfo)2 SFTPClient (net.schmizz.sshj.sftp.SFTPClient)2 SFTPException (net.schmizz.sshj.sftp.SFTPException)2 ActivityNotFoundException (android.content.ActivityNotFoundException)1