/* * Generated by Robotoworks Mechanoid */ package com.robotoworks.example.movies.db; import android.net.Uri; import android.provider.BaseColumns; import com.robotoworks.mechanoid.Mechanoid; import com.robotoworks.mechanoid.db.AbstractValuesBuilder; import java.lang.reflect.Field; import java.util.Collections; import java.util.HashSet; import java.util.HashMap; import java.util.Set; import java.util.Map; public class MovieDBContract { public static final String CONTENT_AUTHORITY = initAuthority(); private static String initAuthority() { String authority = "com.robotoworks.example.movies.db.moviedb"; try { ClassLoader loader = MovieDBContract.class.getClassLoader(); Class<?> clz = loader.loadClass("com.robotoworks.example.movies.db.MovieDBContentProviderAuthority"); Field declaredField = clz.getDeclaredField("CONTENT_AUTHORITY"); authority = declaredField.get(null).toString(); } catch (ClassNotFoundException e) {} catch (NoSuchFieldException e) {} catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } return authority; } private static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY); interface MoviesColumns { String TITLE = "title"; String DESCRIPTION = "description"; String YEAR = "year"; } /** * <p>Column definitions and helper methods to work with the Movies.</p> */ public static class Movies implements MoviesColumns, BaseColumns { public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath("movies").build(); /** * <p>The content type for a cursor that contains many Movies rows.</p> */ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.moviedb.movies"; /** * <p>The content type for a cursor that contains a single Movies row.</p> */ public static final String ITEM_CONTENT_TYPE = "vnd.android.cursor.item/vnd.moviedb.movies"; /** * <p>Builds a Uri with appended id for a row in Movies, * eg:- content://com.robotoworks.example.movies.db.moviedb/movies/123.</p> */ public static Uri buildUriWithId(long id) { return CONTENT_URI.buildUpon().appendPath(String.valueOf(id)).build(); } public static int delete() { return Mechanoid.getContentResolver().delete(Movies.CONTENT_URI, null, null); } public static int delete(String where, String[] selectionArgs) { return Mechanoid.getContentResolver().delete(Movies.CONTENT_URI, where, selectionArgs); } /** * <p>Create a new Builder for Movies</p> */ public static Builder newBuilder() { return new Builder(); } /** * <p>Build and execute insert or update statements for Movies.</p> * * <p>Use {@link Movies#newBuilder()} to create new builder</p> */ public static class Builder extends AbstractValuesBuilder { private Builder() { super(Mechanoid.getApplicationContext(), Movies.CONTENT_URI); } public Builder setTitle(String value) { mValues.put(Movies.TITLE, value); return this; } public Builder setDescription(String value) { mValues.put(Movies.DESCRIPTION, value); return this; } public Builder setYear(long value) { mValues.put(Movies.YEAR, value); return this; } } static final Set<Uri> VIEW_URIS; static { HashSet<Uri> viewUris = new HashSet<Uri>(); VIEW_URIS = Collections.unmodifiableSet(viewUris); } } static Map<Uri, Set<Uri>> REFERENCING_VIEWS; static { Map<Uri, Set<Uri>> map = new HashMap<Uri, Set<Uri>>(); map.put(Movies.CONTENT_URI, Movies.VIEW_URIS); REFERENCING_VIEWS = Collections.unmodifiableMap(map); } private MovieDBContract(){} /** * <p>Delete all rows from all tables</p> */ public static void deleteAll() { Movies.delete(); } }