// Path: sthlmtraveling/src/main/java/com/markupartist/sthlmtraveling/provider/JourneysProvider.java
// public static final class Journeys implements BaseColumns {
//     public static final Uri CONTENT_URI =
//         Uri.parse("content://" + JourneysProvider.AUTHORITY + "/journeys");
//     public static final String CONTENT_TYPE =
//         "vnd.android.cursor.dir/vnd.sthlmtraveling.journeys";
//             
//     public static final int JOURNEY_ID_PATH_POSITION = 1;
// 
//     /**
//      * The default number of journeys to be saved in history.
//      * </p>
//      * Total number of journeys is history size + starred journeys.
//      */
//     public static final int DEFAULT_HISTORY_SIZE = 5;
// 
//     public static final String ID = "_id";
// 
//     /**
//      * The name, example "Take me home" or "To work".
//      */
//     public static final String NAME = "name";
// 
//     /**
//      * The position in a list.
//      */
//     public static final String POSITION = "position";
// 
//     /**
//      * If the journey is starred.
//      */
//     public static final String STARRED = "starred";
// 
//     /**
//      * When the entry was created.
//      */
//     public static final String CREATED_AT = "created_at";
// 
//     /**
//      * When the entry was updated.
//      */
//     public static final String UPDATED_AT = "updated_at";
// 
//     /**
//      * The journey data as json.
//      */
//     public static final String JOURNEY_DATA = "journey_data";
// 
//     /**
//      * The default sort order.
//      */
//     public static final String DEFAULT_SORT_ORDER =
//         "position DESC, updated_at DESC, created_at DESC";
// 
//     /**
//      * The history sort order, this also includes a limit.
//      */
//     public static final String HISTORY_SORT_ORDER =
//         "updated_at DESC, created_at DESC LIMIT " + DEFAULT_HISTORY_SIZE;
// 
// 
//     private Journeys() {
//     }
// }


import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.provider.BaseColumns;
import android.util.Log;
import com.markupartist.sthlmtraveling.BuildConfig;
import com.markupartist.sthlmtraveling.provider.JourneysProvider.Journey.Journeys;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;

    @Override
    public int update(Uri uri, ContentValues values, String selection,
            String[] selectionArgs) {
        SQLiteDatabase db = dbHelper.getWritableDatabase();
        String finalSelection;

        if (!values.containsKey(Journeys.UPDATED_AT)
                && !values.containsKey(Journeys.STARRED)) {
            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
            Date date = new Date();
            values.put(Journeys.UPDATED_AT,
                    dateFormat.format(date));
        }

        int count;

        switch (sUriMatcher.match(uri)) {
            case JOURNEYS:
                count = db.update(JOURNEYS_TABLE_NAME,
                        values, selection, selectionArgs);
                break;
            case JOURNEY_ID:
                // Get the journey ID from the incoming URI.
                //String noteId =
                //    uri.getPathSegments().get(Journeys.JOURNEY_ID_PATH_POSITION);

                // Starts creating the final WHERE clause by restricting it to
                // the incoming ID.
                finalSelection =
// Path: sthlmtraveling/src/main/java/com/markupartist/sthlmtraveling/provider/JourneysProvider.java
// public static final class Journeys implements BaseColumns {
//     public static final Uri CONTENT_URI =
//         Uri.parse("content://" + JourneysProvider.AUTHORITY + "/journeys");
//     public static final String CONTENT_TYPE =
//         "vnd.android.cursor.dir/vnd.sthlmtraveling.journeys";
//             
//     public static final int JOURNEY_ID_PATH_POSITION = 1;
// 
//     /**
//      * The default number of journeys to be saved in history.
//      * </p>
//      * Total number of journeys is history size + starred journeys.
//      */
//     public static final int DEFAULT_HISTORY_SIZE = 5;
// 
//     public static final String ID = "_id";
// 
//     /**
//      * The name, example "Take me home" or "To work".
//      */
//     public static final String NAME = "name";
// 
//     /**
//      * The position in a list.
//      */
//     public static final String POSITION = "position";
// 
//     /**
//      * If the journey is starred.
//      */
//     public static final String STARRED = "starred";
// 
//     /**
//      * When the entry was created.
//      */
//     public static final String CREATED_AT = "created_at";
// 
//     /**
//      * When the entry was updated.
//      */
//     public static final String UPDATED_AT = "updated_at";
// 
//     /**
//      * The journey data as json.
//      */
//     public static final String JOURNEY_DATA = "journey_data";
// 
//     /**
//      * The default sort order.
//      */
//     public static final String DEFAULT_SORT_ORDER =
//         "position DESC, updated_at DESC, created_at DESC";
// 
//     /**
//      * The history sort order, this also includes a limit.
//      */
//     public static final String HISTORY_SORT_ORDER =
//         "updated_at DESC, created_at DESC LIMIT " + DEFAULT_HISTORY_SIZE;
// 
// 
//     private Journeys() {
//     }
// }


// Path: sthlmtraveling/src/main/java/com/markupartist/sthlmtraveling/provider/JourneysProvider.java
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.provider.BaseColumns;
import android.util.Log;
import com.markupartist.sthlmtraveling.BuildConfig;
import com.markupartist.sthlmtraveling.provider.JourneysProvider.Journey.Journeys;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;


    @Override
    public int update(Uri uri, ContentValues values, String selection,
            String[] selectionArgs) {
        SQLiteDatabase db = dbHelper.getWritableDatabase();
        String finalSelection;

        if (!values.containsKey(Journeys.UPDATED_AT)
                && !values.containsKey(Journeys.STARRED)) {
            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
            Date date = new Date();
            values.put(Journeys.UPDATED_AT,
                    dateFormat.format(date));
        }

        int count;

        switch (sUriMatcher.match(uri)) {
            case JOURNEYS:
                count = db.update(JOURNEYS_TABLE_NAME,
                        values, selection, selectionArgs);
                break;
            case JOURNEY_ID:
                // Get the journey ID from the incoming URI.
                //String noteId =
                //    uri.getPathSegments().get(Journeys.JOURNEY_ID_PATH_POSITION);

                // Starts creating the final WHERE clause by restricting it to
                // the incoming ID.
                finalSelection =
                        Journeys._ID +