cv.put(ProviderTableMeta.FILE_SHARE_BY_LINK, file.isShareByLink() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, file.getPublicLink());
cv.put(ProviderTableMeta.FILE_PERMISSIONS, file.getPermissions());
+ cv.put(ProviderTableMeta.FILE_REMOTE_ID, file.getRemoteId());
boolean sameRemotePath = fileExists(file.getRemotePath());
if (sameRemotePath ||
cv.put(ProviderTableMeta.FILE_SHARE_BY_LINK, file.isShareByLink() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, file.getPublicLink());
cv.put(ProviderTableMeta.FILE_PERMISSIONS, file.getPermissions());
+ cv.put(ProviderTableMeta.FILE_REMOTE_ID, file.getRemoteId());
boolean existsByPath = fileExists(file.getRemotePath());
if (existsByPath || fileExists(file.getFileId())) {
cv.put(ProviderTableMeta.FILE_SHARE_BY_LINK, folder.isShareByLink() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, folder.getPublicLink());
cv.put(ProviderTableMeta.FILE_PERMISSIONS, folder.getPermissions());
+ cv.put(ProviderTableMeta.FILE_REMOTE_ID, folder.getRemoteId());
operations.add(ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI).
withValues(cv).
c.getColumnIndex(ProviderTableMeta.FILE_SHARE_BY_LINK)) == 1 ? true : false);
file.setPublicLink(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_PUBLIC_LINK)));
file.setPermissions(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_PERMISSIONS)));
+ file.setRemoteId(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_REMOTE_ID)));
}
return file;
cv.put(ProviderTableMeta.FILE_SHARE_BY_LINK, file.isShareByLink() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, file.getPublicLink());
cv.put(ProviderTableMeta.FILE_PERMISSIONS, file.getPermissions());
+ cv.put(ProviderTableMeta.FILE_REMOTE_ID, file.getRemoteId());
boolean existsByPath = fileExists(file.getRemotePath());
if (existsByPath || fileExists(file.getFileId())) {
private String mPublicLink;
private String mPermissions;
+ private String mRemoteId;
/**
mShareByLink = source.readInt() == 1;
mPublicLink = source.readString();
mPermissions = source.readString();
+ mRemoteId = source.readString();
}
@Override
dest.writeInt(mShareByLink ? 1 : 0);
dest.writeString(mPublicLink);
dest.writeString(mPermissions);
+ dest.writeString(mRemoteId);
}
/**
mShareByLink = false;
mPublicLink = null;
mPermissions = null;
+ mRemoteId = null;
}
/**
this.mPermissions = permissions;
}
+ public String getRemoteId() {
+ return mRemoteId;
+ }
+
+ public void setRemoteId(String remoteId) {
+ this.mRemoteId = remoteId;
+ }
+
}
public static final String FILE_SHARE_BY_LINK = "share_by_link";\r
public static final String FILE_PUBLIC_LINK = "public_link";\r
public static final String FILE_PERMISSIONS = "permissions";\r
+ public static final String FILE_REMOTE_ID = "remote_id";\r
\r
public static final String FILE_DEFAULT_SORT_ORDER = FILE_NAME\r
+ " collate nocase asc";\r
file.setModificationTimestamp(remote.getModifiedTimestamp());
file.setEtag(remote.getEtag());
file.setPermissions(remote.getPermissions());
+ file.setRemoteId(remote.getRemoteId());
return file;
}
ProviderTableMeta.FILE_PUBLIC_LINK);
mFileProjectionMap.put(ProviderTableMeta.FILE_PERMISSIONS,
ProviderTableMeta.FILE_PERMISSIONS);
+ mFileProjectionMap.put(ProviderTableMeta.FILE_REMOTE_ID,
+ ProviderTableMeta.FILE_REMOTE_ID);
}
private static final int SINGLE_FILE = 1;
+ ProviderTableMeta.FILE_ETAG + " TEXT, "
+ ProviderTableMeta.FILE_SHARE_BY_LINK + " INTEGER, "
+ ProviderTableMeta.FILE_PUBLIC_LINK + " TEXT, "
- + ProviderTableMeta.FILE_PERMISSIONS + " TEXT null);"
+ + ProviderTableMeta.FILE_PERMISSIONS + " TEXT null,"
+ + ProviderTableMeta.FILE_REMOTE_ID + " TEXT null);"
);
// Create table ocshares
}
if (!upgraded)
Log_OC.i("SQL", "OUT of the ADD in onUpgrade; oldVersion == " + oldVersion + ", newVersion == " + newVersion);
-
+
if (oldVersion < 6 && newVersion >= 6) {
Log_OC.i("SQL", "Entering in the #5 ADD in onUpgrade");
db.beginTransaction();
db .execSQL("ALTER TABLE " + ProviderTableMeta.FILE_TABLE_NAME +
" ADD COLUMN " + ProviderTableMeta.FILE_PUBLIC_LINK + " TEXT " +
" DEFAULT NULL");
-
- db .execSQL("ALTER TABLE " + ProviderTableMeta.FILE_TABLE_NAME +
- " ADD COLUMN " + ProviderTableMeta.FILE_PERMISSIONS + " TEXT " +
- " DEFAULT NULL");
// Create table ocshares
db.execSQL("CREATE TABLE " + ProviderTableMeta.OCSHARES_TABLE_NAME + "("
+ ProviderTableMeta.OCSHARES_USER_ID + " INTEGER, "
+ ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED + " INTEGER,"
+ ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + " TEXT );" );
+
+ upgraded = true;
+ db.setTransactionSuccessful();
+ } finally {
+ db.endTransaction();
+ }
+ }
+ if (!upgraded)
+ Log_OC.i("SQL", "OUT of the ADD in onUpgrade; oldVersion == " + oldVersion + ", newVersion == " + newVersion);
+
+ if (oldVersion < 7 && newVersion >= 7) {
+ Log_OC.i("SQL", "Entering in the #6 ADD in onUpgrade");
+ db.beginTransaction();
+ try {
+ db .execSQL("ALTER TABLE " + ProviderTableMeta.FILE_TABLE_NAME +
+ " ADD COLUMN " + ProviderTableMeta.FILE_PERMISSIONS + " TEXT " +
+ " DEFAULT NULL");
+
+ db .execSQL("ALTER TABLE " + ProviderTableMeta.FILE_REMOTE_ID +
+ " ADD COLUMN " + ProviderTableMeta.FILE_REMOTE_ID + " TEXT " +
+ " DEFAULT NULL");
upgraded = true;
db.setTransactionSuccessful();
file.setModificationTimestamp(remote.getModifiedTimestamp());
file.setEtag(remote.getEtag());
file.setPermissions(remote.getPermissions());
+ file.setRemoteId(remote.getRemoteId());
return file;
}
file.setModifiedTimestamp(ocFile.getModificationTimestamp());
file.setEtag(ocFile.getEtag());
file.setPermissions(ocFile.getPermissions());
+ file.setRemoteId(ocFile.getRemoteId());
return file;
}