Skip to content

Commit

Permalink
move every project into com.dbflow5 subpackages. move content provide…
Browse files Browse the repository at this point in the history
…r classes into own artifact to be included separately soon.
  • Loading branch information
agrosner committed May 24, 2018
1 parent 9a86f34 commit 712e86b
Show file tree
Hide file tree
Showing 374 changed files with 1,857 additions and 5,929 deletions.
8 changes: 4 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ This document provides general guidelines about how to contribute to the project

## Reporting issues

* Use [github issues](https://github.com/Raizlabs/DBFlow/issues) to report a bug.
* Use [github issues](https://github.com/agrosner/DBFlow/issues) to report a bug.
* Before creating a new issue:
* Make sure you are using the [latest release](https://github.com/Raizlabs/DBFlow/releases).
* Check if the issue was [already reported or fixed](https://github.com/Raizlabs/DBFlow/issues?utf8=%E2%9C%93&q=is%3Aissue). Notice that it may not be released yet.
* Make sure you are using the [latest release](https://github.com/agrosner/DBFlow/releases).
* Check if the issue was [already reported or fixed](https://github.com/agrosner/DBFlow/issues?utf8=%E2%9C%93&q=is%3Aissue). Notice that it may not be released yet.
* If you found a match add the github "+1" reaction brief comment. This helps prioritize the issues addressing the most common and critical ones first. If possible, add additional information to help us reproduce, and find the issue. Please use your best judgement.
* Reporting issues:
* Please include the following information to help maintainers to fix the problem faster:
Expand Down Expand Up @@ -45,6 +45,6 @@ I welcome and encourage all pull requests. It usually will take me within 24-48
We would love to hear your ideas and make discussions about it.

* Use github issues to make feature proposals.
* We use `type: feature request` label to mark all [feature request issues](https://github.com/Raizlabs/DBFlow/labels/type%3A%20feature%20request).
* We use `type: feature request` label to mark all [feature request issues](https://github.com/agrosner/DBFlow/labels/type%3A%20feature%20request).
* Before submitting your proposal make sure there is no similar feature request. If you find a match, feel free to join the discussion or just or just act with a reaction if you think the feature is worth implementing.
* Be as specific as possible providing a precise explanation of the feature so anyone can understand the problem and the benefits of solving it.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Supports:

**Kotlin:** Built using the language, the library is super-concise, null-safe and efficient.

**Coroutines:** Adds coroutine support for queries.

**RX Java:** Enable applications to be reactive by listening to DB changes and ensuring your subscribers are up-to-date.

**Paging:** Android architecture component paging library support for queries via `QueryDataSource`.
Expand Down Expand Up @@ -61,7 +63,7 @@ Add artifacts to your project:
// core set of libraries
compile "com.github.agrosner.dbflow:core:${dbflow_version}"
compile "com.github.agrosner.dbflow:dbflow:${dbflow_version}"
compile "com.github.agrosner.dbflow:lib:${dbflow_version}"
// sql-cipher database encryption (optional)
compile "com.github.agrosner.dbflow:sqlcipher:${dbflow_version}"
Expand Down
1 change: 1 addition & 0 deletions contentprovider/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
36 changes: 36 additions & 0 deletions contentprovider/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

project.ext.artifactId = bt_name

android {
compileSdkVersion target_sdk

defaultConfig {
minSdkVersion min_sdk
targetSdkVersion target_sdk
}

lintOptions {
abortOnError false
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}

dependencies {
api project(':core')
api project(':lib')
api "com.android.support:support-annotations:27.1.1"
api "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
}

apply from: '../kotlin-artifacts.gradle'

3 changes: 3 additions & 0 deletions contentprovider/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bt_name=contentprovider
bt_packaging=aar
bt_artifact_id=contentprovider
21 changes: 21 additions & 0 deletions contentprovider/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
1 change: 1 addition & 0 deletions contentprovider/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<manifest package="com.dbflow5.provider"/>
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.raizlabs.dbflow5.provider
package com.dbflow5.provider

import android.content.ContentProvider
import android.content.ContentValues
import android.net.Uri
import com.raizlabs.dbflow5.config.DBFlowDatabase
import com.raizlabs.dbflow5.config.DatabaseHolder
import com.raizlabs.dbflow5.config.FlowManager
import com.raizlabs.dbflow5.database.DatabaseWrapper
import com.raizlabs.dbflow5.transaction.ITransaction
import com.dbflow5.config.DBFlowDatabase
import com.dbflow5.config.DatabaseHolder
import com.dbflow5.config.FlowManager
import com.dbflow5.database.DatabaseWrapper
import com.dbflow5.transaction.ITransaction

/**
* Description: The base provider class that [com.raizlabs.android.dbflow5.annotation.provider.ContentProvider]
* Description: The base provider class that [com.dbflow5.annotation.provider.ContentProvider]
* extend when generated.
*/
abstract class BaseContentProvider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.raizlabs.dbflow5.provider
package com.dbflow5.provider

import android.content.ContentProvider
import com.raizlabs.dbflow5.config.FlowManager
import com.raizlabs.dbflow5.database.DatabaseWrapper
import com.raizlabs.dbflow5.database.FlowCursor
import com.raizlabs.dbflow5.query.OperatorGroup
import com.raizlabs.dbflow5.structure.BaseModel
import com.raizlabs.dbflow5.structure.Model
import com.dbflow5.config.FlowManager
import com.dbflow5.database.DatabaseWrapper
import com.dbflow5.database.FlowCursor
import com.dbflow5.query.OperatorGroup
import com.dbflow5.structure.BaseModel
import com.dbflow5.structure.Model

/**
* Description: Provides a base implementation of a [Model] backed
Expand Down Expand Up @@ -40,7 +40,7 @@ abstract class BaseProviderModel : BaseModel(), ModelProvider {
*/
override fun exists(wrapper: DatabaseWrapper): Boolean {
val cursor = ContentUtils.query(FlowManager.context.contentResolver,
queryUri, modelAdapter.getPrimaryConditionClause(this), "")
queryUri, modelAdapter.getPrimaryConditionClause(this), "")
val exists = cursor != null && cursor.count > 0
cursor?.close()
return exists
Expand All @@ -52,7 +52,7 @@ abstract class BaseProviderModel : BaseModel(), ModelProvider {
wrapper: DatabaseWrapper,
vararg columns: String?): T? {
val cursor = ContentUtils.query(FlowManager.context.contentResolver,
queryUri, whereOperatorGroup, orderBy, *columns)
queryUri, whereOperatorGroup, orderBy, *columns)
if (cursor != null) {
val flowCursor = FlowCursor.from(cursor)
if (flowCursor.moveToFirst()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.raizlabs.dbflow5.provider
package com.dbflow5.provider

import android.content.ContentProvider
import com.raizlabs.dbflow5.config.FlowManager
import com.raizlabs.dbflow5.database.DatabaseWrapper
import com.raizlabs.dbflow5.database.FlowCursor
import com.raizlabs.dbflow5.query.OperatorGroup
import com.raizlabs.dbflow5.structure.BaseModel
import com.raizlabs.dbflow5.structure.Model
import com.dbflow5.config.FlowManager
import com.dbflow5.database.DatabaseWrapper
import com.dbflow5.database.FlowCursor
import com.dbflow5.query.OperatorGroup
import com.dbflow5.structure.BaseModel
import com.dbflow5.structure.Model

/**
* Description: Provides a base implementation of a [Model] backed
Expand Down Expand Up @@ -40,7 +40,7 @@ abstract class BaseSyncableProviderModel : BaseModel(), ModelProvider {
wrapper: DatabaseWrapper,
vararg columns: String?): T? {
val cursor = ContentUtils.query(FlowManager.context.contentResolver,
queryUri, whereOperatorGroup, orderBy, *columns)
queryUri, whereOperatorGroup, orderBy, *columns)
cursor?.let {
val flowCursor = FlowCursor.from(cursor)
if (flowCursor.moveToFirst()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.raizlabs.dbflow5.provider
package com.dbflow5.provider

import android.content.ContentResolver
import android.content.ContentValues
import android.content.Context
import android.net.Uri
import com.raizlabs.dbflow5.adapter.ModelAdapter
import com.raizlabs.dbflow5.annotation.provider.ContentProvider
import com.raizlabs.dbflow5.config.FlowLog
import com.raizlabs.dbflow5.config.modelAdapter
import com.raizlabs.dbflow5.database.DatabaseWrapper
import com.raizlabs.dbflow5.database.FlowCursor
import com.raizlabs.dbflow5.query.Operator
import com.raizlabs.dbflow5.query.OperatorGroup
import com.dbflow5.adapter.ModelAdapter
import com.dbflow5.annotation.provider.ContentProvider
import com.dbflow5.config.FlowLog
import com.dbflow5.config.modelAdapter
import com.dbflow5.database.DatabaseWrapper
import com.dbflow5.database.FlowCursor
import com.dbflow5.query.Operator
import com.dbflow5.query.OperatorGroup

/**
* Description: Provides handy wrapper mechanisms for [android.content.ContentProvider]
Expand All @@ -32,7 +32,7 @@ object ContentUtils {
*/
@JvmStatic
fun buildUriWithAuthority(authority: String, vararg paths: String): Uri =
buildUri(BASE_CONTENT_URI, authority, *paths)
buildUri(BASE_CONTENT_URI, authority, *paths)

/**
* Constructs an Uri with the specified baseContent uri and authority. Add paths to append to the Uri.
Expand Down Expand Up @@ -61,7 +61,7 @@ object ContentUtils {
*/
@JvmStatic
fun <TableClass : Any> insert(context: Context, insertUri: Uri, model: TableClass): Uri? =
insert(context.contentResolver, insertUri, model)
insert(context.contentResolver, insertUri, model)

/**
* Inserts the model into the [android.content.ContentResolver]. Uses the insertUri to resolve
Expand Down Expand Up @@ -129,7 +129,7 @@ object ContentUtils {
bulkInsertUri: Uri,
table: Class<TableClass>,
models: List<TableClass>): Int =
bulkInsert(context.contentResolver, bulkInsertUri, table, models)
bulkInsert(context.contentResolver, bulkInsertUri, table, models)

/**
* Updates the model through the [android.content.ContentResolver]. Uses the updateUri to
Expand All @@ -143,7 +143,7 @@ object ContentUtils {
fun <TableClass : Any> update(context: Context,
updateUri: Uri,
model: TableClass): Int =
update(context.contentResolver, updateUri, model)
update(context.contentResolver, updateUri, model)

/**
* Updates the model through the [android.content.ContentResolver]. Uses the updateUri to
Expand Down Expand Up @@ -179,7 +179,7 @@ object ContentUtils {
*/
@JvmStatic
fun <TableClass : Any> delete(context: Context, deleteUri: Uri, model: TableClass): Int =
delete(context.contentResolver, deleteUri, model)
delete(context.contentResolver, deleteUri, model)

/**
* Deletes the specified model through the [android.content.ContentResolver]. Uses the deleteUri
Expand Down Expand Up @@ -239,8 +239,8 @@ object ContentUtils {
databaseWrapper: DatabaseWrapper,
whereConditions: OperatorGroup,
orderBy: String, vararg columns: String): List<TableClass>? =
queryList(context.contentResolver, queryUri, table,
databaseWrapper, whereConditions, orderBy, *columns)
queryList(context.contentResolver, queryUri, table,
databaseWrapper, whereConditions, orderBy, *columns)


/**
Expand Down Expand Up @@ -284,8 +284,8 @@ object ContentUtils {
databaseWrapper: DatabaseWrapper,
whereConditions: OperatorGroup,
orderBy: String, vararg columns: String): TableClass? =
querySingle(context.contentResolver, queryUri, table,
databaseWrapper, whereConditions, orderBy, *columns)
querySingle(context.contentResolver, queryUri, table,
databaseWrapper, whereConditions, orderBy, *columns)

/**
* Queries the [android.content.ContentResolver] with the specified queryUri. It will generate
Expand All @@ -306,7 +306,7 @@ object ContentUtils {
whereConditions: OperatorGroup,
orderBy: String, vararg columns: String): TableClass? {
val list = queryList(contentResolver, queryUri, table,
databaseWrapper, whereConditions, orderBy, *columns)
databaseWrapper, whereConditions, orderBy, *columns)
return list?.let { if (list.isNotEmpty()) list[0] else null }
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.raizlabs.dbflow5.provider
package com.dbflow5.provider

import android.content.ContentResolver
import android.net.Uri
import com.raizlabs.dbflow5.database.DatabaseWrapper
import com.raizlabs.dbflow5.query.Operator
import com.raizlabs.dbflow5.query.OperatorGroup
import com.dbflow5.database.DatabaseWrapper
import com.dbflow5.query.Operator
import com.dbflow5.query.OperatorGroup

/**
* Description: A base interface for Models that are connected to providers.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.raizlabs.dbflow5.provider
package com.dbflow5.provider

/**
* Description:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@file:JvmName("StringUtils")

package com.raizlabs.dbflow5
package com.dbflow5

import com.raizlabs.dbflow5.sql.SQLiteType
import com.dbflow5.sql.SQLiteType
import java.util.regex.Pattern


Expand Down Expand Up @@ -41,7 +41,7 @@ fun String?.isQuoted(): Boolean = QUOTE_PATTERN.matcher(this).find()
* @return A name in quotes. E.G. index =&gt; `index` so we can use keywords as column names without fear
* of clashing.
*/
fun String?.quote(): String = "$QUOTE${this?.replace(".", "`.`")}$QUOTE"
fun String?.quote(): String = "${QUOTE}${this?.replace(".", "`.`")}${QUOTE}"

fun String?.quoteIfNeeded() = if (this != null && !isQuoted()) {
quote()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.raizlabs.dbflow5.annotation
package com.dbflow5.annotation

/**
* Represents a SQL Collate method for comparing string columns.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.raizlabs.dbflow5.annotation
package com.dbflow5.annotation

import com.raizlabs.dbflow5.converter.TypeConverter
import com.dbflow5.converter.TypeConverter
import kotlin.reflect.KClass

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.raizlabs.dbflow5.annotation
package com.dbflow5.annotation

/**
* Description: An annotation used to ignore a column in the [Table.allFields] instance.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.raizlabs.dbflow5.annotation
package com.dbflow5.annotation

/**
* Description: Maps an arbitrary object and its corresponding fields into a set of columns. It is similar
Expand Down
Loading

0 comments on commit 712e86b

Please sign in to comment.