Ejemplo n.º 1
0
 private long removeFileNode() {
   assert (resolver != null);
   return resolver.delete(
       Files.buildIdUri(id),
       Files.NAME + "=? AND " + Files.FILENAME + "=?",
       new String[] {name, filename});
 }
Ejemplo n.º 2
0
 public OrgFile(long id, ContentResolver resolver) {
   Cursor cursor = resolver.query(Files.buildIdUri(id), Files.DEFAULT_COLUMNS, null, null, null);
   if (cursor == null || cursor.getCount() < 1)
     throw new IllegalArgumentException("File with id \"" + id + "\" not found");
   set(cursor);
   cursor.close();
   this.resolver = resolver;
 }
Ejemplo n.º 3
0
 private long addFileNode(long nodeId) {
   ContentValues values = new ContentValues();
   values.put(Files.FILENAME, filename);
   values.put(Files.NAME, name);
   values.put(Files.CHECKSUM, checksum);
   values.put(Files.NODE_ID, nodeId);
   assert (resolver != null);
   Uri uri = resolver.insert(Files.CONTENT_URI, values);
   return Long.parseLong(Files.getId(uri));
 }
Ejemplo n.º 4
0
  private boolean doesFileExist() {
    Log.d("MobileOrg", "Filename is :" + filename);
    assert (resolver != null);
    Cursor cursor =
        resolver.query(Files.buildFilenameUri(filename), Files.DEFAULT_COLUMNS, null, null, null);
    int count = cursor.getCount();
    cursor.close();

    if (count > 0) return true;
    else return false;
  }