package com.example.android.pets.data;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;

/**
 * Pets Created by Muir on 27/06/2017.
 * {@link ContentProvider} for Pets app.
 */

public class PetProvider extends ContentProvider {

    /**
     * Database helper object
     */
    private PetDbHelper dbHelper;

    /**
     * Tag for the log messages
     */
    public static final String LOG_TAG = PetProvider.class.getSimpleName();

    /**
     * Initialise the provider and the database helper object.
     *
     * @return true
     */
    @Override
    public boolean onCreate() {
        dbHelper = new PetDbHelper(getContext());
        return true;
    }

    /**
     * Perform the query for the given URI. Use the given projection, selection arguments, and sort
     * order.
     *
     * @param uri           is the given URI
     * @param projection    is the given projection
     * @param selection     is the selection
     * @param selectionArgs are the selection arguments
     * @param sortOrder     is the given sort order
     * @return null
     */
    @Override
    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
                        String sortOrder) {
        return null;
    }

    /**
     * Returns the MIME type of data for the content URI
     *
     * @param uri is the content URI
     * @return null
     */
    @Override
    public String getType(Uri uri) {
        return null;
    }

    /**
     * Insert new data into the provider with the given ContentValues
     *
     * @param uri           is the given URI
     * @param contentValues are the given content values
     * @return null
     */
    @Override
    public Uri insert(Uri uri, ContentValues contentValues) {
        return null;
    }

    /**
     * Delete the data at the given selection and selection arguments.
     *
     * @param uri           is the given URI
     * @param selection     is the given selection
     * @param selectionArgs is an array of the given selection arguments.
     * @return 0
     */
    @Override
    public int delete(Uri uri, String selection, String[] selectionArgs) {
        return 0;
    }

    /**
     * Updates the data at the given selection and selection arguments, with the new ContentValues.
     *
     * @param uri           is the given URI
     * @param contentValues are the new content values
     * @param selection     is the given selection
     * @param selectionArgs is an array of the given selection arguments
     * @return 0
     */
    @Override
    public int update(Uri uri, ContentValues contentValues, String selection,
                      String[] selectionArgs) {
        return 0;
    }
}

@@ -111,16 +111,51 @@
 Values;%0A
+import android.content.UriMatcher;%0A
 import a
@@ -178,16 +178,16 @@
 Cursor;%0A
-
 import a
@@ -344,16 +344,1949 @@
 ider %7B%0A%0A
+    /**%0A     * URI matcher code for the content URI for the pets table.%0A     */%0A    private static final int PETS = 100;%0A%0A    /**%0A     * URI matcher code for the content URI for a single pet in the pets table.%0A     */%0A    private static final int PET_ID = 101;%0A%0A    /**%0A     * UriMatcher object to match a content URI to a corresponding code. The input passed into the%0A     * constructor represents the code to return for the root URI. It's common to use NO_MATCH as%0A     * the input for this case.%0A     */%0A    private static final UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);%0A%0A    /**%0A     * Static initializer. This is run the first time anything is called from this class.%0A     */%0A    static %7B%0A        /**%0A         * The calls to addURI() go here, for all of the content URI patterns that the provider%0A         * should recognise. All paths added to the UriMatcher have a corresponding code to return%0A         * when a match is found.%0A         */%0A%0A        /**%0A         * The content URI fo the form %22content://com.example.android.pets/pets%22 will map to the%0A         * integer code %7B@link #PETS%7D. This URI is used to provide access to MULTIPLE rows of the%0A         * pets table.%0A         */%0A        uriMatcher.addURI(PetContract.CONTENT_AUTHORITY, PetContract.PATH_PETS, PETS);%0A%0A        /**%0A         * The content URI of the form %22content://com.example.android.pets/pets/#%22 will map to the%0A         * integer code %7B@link #PET_ID%7D. This URI is used to proivde access to ONE single row of the%0A         * pets table.%0A         *%0A         * In this case, the %22#%22 wildcard is used where %22#%22 can be substituted for an integer. For%0A         * example, %22content://com.exammple.android.pets/pets/3%22 matches, but%0A         * %22content://com.example.android.pets/pets%22 (without a number at the end) doesn't match.%0A         */%0A        uriMatcher.addURI(PetContract.CONTENT_AUTHORITY, PetContract.PATH_PETS + %22/#%22, PET_ID);%0A    %7D%0A%0A
     /**%0A
@@ -2402,24 +2402,24 @@
 ges%0A     */%0A
-
     public s
@@ -2479,24 +2479,25 @@
 pleName();%0A%0A
+%0A
     /**%0A    

Add URIMatcher to ContentProvider