Search in sources :

Example 1 with AudioClipTable

use of org.storymaker.app.model.AudioClipTable in project storymaker by StoryMaker.

the class ProjectsProvider method update.

@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
    mCacheWordHandler.connectToService();
    setTimer(60000);
    SQLiteDatabase db = getDB();
    if (db != null) {
        int uriType = sURIMatcher.match(uri);
        switch(uriType) {
            case PROJECTS:
            case PROJECT_ID:
                return (new ProjectTable(db)).update(getContext(), uri, values, selection, selectionArgs);
            case SCENES:
            case SCENE_ID:
                return (new SceneTable(db)).update(getContext(), uri, values, selection, selectionArgs);
            case LESSONS:
            case LESSON_ID:
                return (new LessonTable(db)).update(getContext(), uri, values, selection, selectionArgs);
            case MEDIA:
            case MEDIA_ID:
                return (new MediaTable(db)).update(getContext(), uri, values, selection, selectionArgs);
            case AUTH:
            case AUTH_ID:
                return (new AuthTable(db)).update(getContext(), uri, values, selection, selectionArgs);
            case TAGS:
            case TAG_ID:
            case DISTINCT_TAGS:
            case DISTINCT_TAG_ID:
                return (new TagTable(db)).update(getContext(), uri, values, selection, selectionArgs);
            case JOBS:
            case JOB_ID:
                return (new JobTable(db)).update(getContext(), uri, values, selection, selectionArgs);
            case PUBLISH_JOBS:
            case PUBLISH_JOB_ID:
                return (new PublishJobTable(db)).update(getContext(), uri, values, selection, selectionArgs);
            case AUDIO_CLIPS:
            case AUDIO_CLIP_ID:
                return (new AudioClipTable(db)).update(getContext(), uri, values, selection, selectionArgs);
            default:
                throw new IllegalArgumentException("Unknown URI");
        }
    }
    return 0;
}
Also used : SceneTable(org.storymaker.app.model.SceneTable) PublishJobTable(org.storymaker.app.model.PublishJobTable) JobTable(org.storymaker.app.model.JobTable) PublishJobTable(org.storymaker.app.model.PublishJobTable) MediaTable(org.storymaker.app.model.MediaTable) SQLiteDatabase(net.sqlcipher.database.SQLiteDatabase) AudioClipTable(org.storymaker.app.model.AudioClipTable) AuthTable(org.storymaker.app.model.AuthTable) TagTable(org.storymaker.app.model.TagTable) ProjectTable(org.storymaker.app.model.ProjectTable) LessonTable(org.storymaker.app.model.LessonTable)

Example 2 with AudioClipTable

use of org.storymaker.app.model.AudioClipTable in project storymaker by StoryMaker.

the class ProjectsProvider method query.

@Nullable
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    mCacheWordHandler.connectToService();
    setTimer(60000);
    SQLiteDatabase db = getDB();
    if (db != null) {
        int uriType = sURIMatcher.match(uri);
        switch(uriType) {
            case PROJECT_ID:
                return (new ProjectTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case PROJECTS:
                return (new ProjectTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case SCENE_ID:
                return (new SceneTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case SCENES:
                return (new SceneTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case LESSON_ID:
                return (new LessonTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case LESSONS:
                return (new LessonTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case MEDIA_ID:
                return (new MediaTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case MEDIA:
                return (new MediaTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case AUTH_ID:
                return (new AuthTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case AUTH:
                return (new AuthTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case TAG_ID:
                return (new TagTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case TAGS:
                return (new TagTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case DISTINCT_TAG_ID:
                return (new TagTable(db)).queryOneDistinct(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case DISTINCT_TAGS:
                return (new TagTable(db)).queryAllDistinct(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case JOB_ID:
                return (new JobTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case JOBS:
                return (new JobTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case PUBLISH_JOB_ID:
                return (new PublishJobTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case PUBLISH_JOBS:
                return (new PublishJobTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case AUDIO_CLIP_ID:
                return (new AudioClipTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case AUDIO_CLIPS:
                return (new AudioClipTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            default:
                throw new IllegalArgumentException("Unknown URI");
        }
    }
    return null;
}
Also used : SceneTable(org.storymaker.app.model.SceneTable) PublishJobTable(org.storymaker.app.model.PublishJobTable) JobTable(org.storymaker.app.model.JobTable) PublishJobTable(org.storymaker.app.model.PublishJobTable) MediaTable(org.storymaker.app.model.MediaTable) SQLiteDatabase(net.sqlcipher.database.SQLiteDatabase) AudioClipTable(org.storymaker.app.model.AudioClipTable) AuthTable(org.storymaker.app.model.AuthTable) TagTable(org.storymaker.app.model.TagTable) ProjectTable(org.storymaker.app.model.ProjectTable) LessonTable(org.storymaker.app.model.LessonTable) Nullable(android.support.annotation.Nullable)

Example 3 with AudioClipTable

use of org.storymaker.app.model.AudioClipTable in project storymaker by StoryMaker.

the class ProjectsProvider method delete.

@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
    mCacheWordHandler.connectToService();
    setTimer(60000);
    SQLiteDatabase db = getDB();
    if (db != null) {
        int uriType = sURIMatcher.match(uri);
        switch(uriType) {
            case PROJECTS:
            case PROJECT_ID:
                return (new ProjectTable(db)).delete(getContext(), uri, selection, selectionArgs);
            case SCENES:
            case SCENE_ID:
                return (new SceneTable(db)).delete(getContext(), uri, selection, selectionArgs);
            case LESSONS:
            case LESSON_ID:
                return (new LessonTable(db)).delete(getContext(), uri, selection, selectionArgs);
            case MEDIA:
            case MEDIA_ID:
                return (new MediaTable(db)).delete(getContext(), uri, selection, selectionArgs);
            case AUTH:
            case AUTH_ID:
                return (new AuthTable(db)).delete(getContext(), uri, selection, selectionArgs);
            case TAGS:
            case TAG_ID:
            case DISTINCT_TAGS:
            case DISTINCT_TAG_ID:
                return (new TagTable(db)).delete(getContext(), uri, selection, selectionArgs);
            case JOBS:
            case JOB_ID:
                return (new JobTable(db)).delete(getContext(), uri, selection, selectionArgs);
            case PUBLISH_JOBS:
            case PUBLISH_JOB_ID:
                return (new PublishJobTable(db)).delete(getContext(), uri, selection, selectionArgs);
            case AUDIO_CLIPS:
            case AUDIO_CLIP_ID:
                return (new AudioClipTable(db)).delete(getContext(), uri, selection, selectionArgs);
            default:
                throw new IllegalArgumentException("Unknown URI");
        }
    }
    return 0;
}
Also used : SceneTable(org.storymaker.app.model.SceneTable) PublishJobTable(org.storymaker.app.model.PublishJobTable) JobTable(org.storymaker.app.model.JobTable) PublishJobTable(org.storymaker.app.model.PublishJobTable) MediaTable(org.storymaker.app.model.MediaTable) SQLiteDatabase(net.sqlcipher.database.SQLiteDatabase) AudioClipTable(org.storymaker.app.model.AudioClipTable) AuthTable(org.storymaker.app.model.AuthTable) TagTable(org.storymaker.app.model.TagTable) ProjectTable(org.storymaker.app.model.ProjectTable) LessonTable(org.storymaker.app.model.LessonTable)

Example 4 with AudioClipTable

use of org.storymaker.app.model.AudioClipTable in project storymaker by StoryMaker.

the class ProjectsProvider method insert.

@Nullable
@Override
public Uri insert(Uri uri, ContentValues values) {
    mCacheWordHandler.connectToService();
    setTimer(60000);
    SQLiteDatabase db = getDB();
    if (db != null) {
        long newId;
        int uriType = sURIMatcher.match(uri);
        switch(uriType) {
            case PROJECTS:
                return (new ProjectTable(db)).insert(getContext(), uri, values);
            case SCENES:
                return (new SceneTable(db)).insert(getContext(), uri, values);
            case LESSONS:
                return (new LessonTable(db)).insert(getContext(), uri, values);
            case MEDIA:
                return (new MediaTable(db)).insert(getContext(), uri, values);
            case AUTH:
                return (new AuthTable(db)).insert(getContext(), uri, values);
            case TAGS:
            case DISTINCT_TAGS:
                return (new TagTable(db)).insert(getContext(), uri, values);
            case JOBS:
                return (new JobTable(db)).insert(getContext(), uri, values);
            case PUBLISH_JOBS:
                return (new PublishJobTable(db)).insert(getContext(), uri, values);
            case AUDIO_CLIPS:
                return (new AudioClipTable(db)).insert(getContext(), uri, values);
            default:
                throw new IllegalArgumentException("Unknown URI");
        }
    }
    return null;
}
Also used : PublishJobTable(org.storymaker.app.model.PublishJobTable) JobTable(org.storymaker.app.model.JobTable) MediaTable(org.storymaker.app.model.MediaTable) AuthTable(org.storymaker.app.model.AuthTable) LessonTable(org.storymaker.app.model.LessonTable) SceneTable(org.storymaker.app.model.SceneTable) PublishJobTable(org.storymaker.app.model.PublishJobTable) SQLiteDatabase(net.sqlcipher.database.SQLiteDatabase) AudioClipTable(org.storymaker.app.model.AudioClipTable) TagTable(org.storymaker.app.model.TagTable) ProjectTable(org.storymaker.app.model.ProjectTable) Nullable(android.support.annotation.Nullable)

Aggregations

SQLiteDatabase (net.sqlcipher.database.SQLiteDatabase)4 AudioClipTable (org.storymaker.app.model.AudioClipTable)4 AuthTable (org.storymaker.app.model.AuthTable)4 JobTable (org.storymaker.app.model.JobTable)4 LessonTable (org.storymaker.app.model.LessonTable)4 MediaTable (org.storymaker.app.model.MediaTable)4 ProjectTable (org.storymaker.app.model.ProjectTable)4 PublishJobTable (org.storymaker.app.model.PublishJobTable)4 SceneTable (org.storymaker.app.model.SceneTable)4 TagTable (org.storymaker.app.model.TagTable)4 Nullable (android.support.annotation.Nullable)2