Skip to content
Permalink
Browse files

- Migrated Name

  • Loading branch information...
s4kibs4mi committed Oct 4, 2018
1 parent ba63f39 commit 104ecb678c76405936e6279727154cba07be0b63
Showing with 134 additions and 134 deletions.
  1. +18 −18 README.md
  2. +1 −1 build.gradle
  3. +1 −1 src/main/kotlin/ninja/sakib/{pultusorm → belleorm}/annotations/AutoIncrement.kt
  4. +1 −1 src/main/kotlin/ninja/sakib/{pultusorm → belleorm}/annotations/Ignore.kt
  5. +1 −1 src/main/kotlin/ninja/sakib/{pultusorm → belleorm}/annotations/NotNull.kt
  6. +1 −1 src/main/kotlin/ninja/sakib/{pultusorm → belleorm}/annotations/PrimaryKey.kt
  7. +1 −1 src/main/kotlin/ninja/sakib/{pultusorm → belleorm}/annotations/Unique.kt
  8. +5 −5 src/main/kotlin/ninja/sakib/{pultusorm → belleorm}/callbacks/Callback.kt
  9. +24 −24 src/main/kotlin/ninja/sakib/{pultusorm/core/PultusORM.kt → belleorm/core/BelleORM.kt}
  10. +8 −8 ...in/kotlin/ninja/sakib/{pultusorm/core/PultusORMCondition.kt → belleorm/core/BelleORMCondition.kt}
  11. +22 −22 src/main/kotlin/ninja/sakib/{pultusorm/core/PultusORMQuery.kt → belleorm/core/BelleORMQuery.kt}
  12. +11 −11 src/main/kotlin/ninja/sakib/{pultusorm/core/PultusORMUpdater.kt → belleorm/core/BelleORMUpdater.kt}
  13. +4 −4 src/main/kotlin/ninja/sakib/{pultusorm → belleorm}/core/Utils.kt
  14. +3 −3 ...nja/sakib/{pultusorm/exceptions/PultusORMException.kt → belleorm/exceptions/BelleORMException.kt}
  15. +2 −2 src/main/kotlin/ninja/sakib/{pultusorm → belleorm}/system/SqliteSystem.kt
  16. +26 −26 src/test/kotlin/ninja/sakib/{pultusorm/PultusORMTest.kt → belleorm/BelleORMTest.kt}
  17. +1 −1 src/test/kotlin/ninja/sakib/{pultusorm → belleorm}/models/Contact.kt
  18. +4 −4 src/test/kotlin/ninja/sakib/{pultusorm → belleorm}/models/Student.kt
@@ -59,22 +59,22 @@ More option can be found [here](https://jitpack.io/#ninja.sakib/BelleORM/v1.8).
##### Kotlin
```kotlin
In Kotlin,
val pultusORM: PultusORM = PultusORM("test.db", "/Users/s4kib/")
val pultusORM: PultusORM = PultusORM("test.db") // DB will take place in user.home directory
val belleORM: BelleORM = BelleORM("test.db", "/Users/s4kib/")
val belleORM: BelleORM = BelleORM("test.db") // DB will take place in user.home directory
In Android,
val appPath: String = getApplicationContext().getFilesDir().getAbsolutePath() // Output : /data/data/application_package_name/files/
val pultusORM: PultusORM = PultusORM("test.db", appPath)
val belleORM: BelleORM = BelleORM("test.db", appPath)
```
##### Java
```java
In Java,
PultusORM orm = new PultusORM("test.db", "/Users/s4kib/")
PultusORM orm = new PultusORM("test.db", ) // DB will take place in user.home directory
BelleORM belleORM = new BelleORM("test.db", "/Users/s4kib/")
BelleORM belleORM = new BelleORM("test.db", ) // DB will take place in user.home directory
In Android,
String appPath = getApplicationContext().getFilesDir().getAbsolutePath() // Output : /data/data/application_package_name/files/
val orm = new PultusORM("test.db", appPath)
val belleORM = new BelleORM("test.db", appPath)
```

##### Insert value
@@ -96,13 +96,13 @@ student.name = "Sakib Sayem"
student.department = "CSE"
student.cgpa = 2.3
student.dateOfBirth = Date()
pultusORM.save(student)
pultusORM.close()
belleORM.save(student)
belleORM.close()
```

##### Retrieve Values
```kotlin
val students = pultusORM.find(Student())
val students = belleORM.find(Student())
for (it in students) {
val student = it as Student
println(student.studentId)
@@ -125,17 +125,17 @@ Wed Sep 27 23:21:52 BDT 2017

##### Retrieve values based on condition
```kotlin
val condition: PultusORMCondition = PultusORMCondition.Builder()
val condition: BelleORMCondition = BelleORMCondition.Builder()
.eq("name", "sakib")
.and()
.greaterEq("cgpa", 18)
.or()
.startsWith("name", "sami")
.sort("name", PultusORMQuery.Sort.DESCENDING)
.sort("department", PultusORMQuery.Sort.ASCENDING)
.sort("name", BelleORMQuery.Sort.DESCENDING)
.sort("department", BelleORMQuery.Sort.ASCENDING)
.build()
val students = pultusORM.find(Student(), condition)
val students = belleORM.find(Student(), condition)
for (it in students) {
val student = it as Student
println("${student.studentId}")
@@ -146,26 +146,26 @@ for (it in students) {
##### Update value
```kotlin
// values will be updated based on this condition
val condition: PultusORMCondition = PultusORMCondition.Builder()
val condition: BelleORMCondition = BelleORMCondition.Builder()
.eq("name", "Sakib")
.build()
val updater: PultusORMUpdater = PultusORMUpdater.Builder()
val updater: BelleORMUpdater = BelleORMUpdater.Builder()
.set("name", "Sayan Nur")
.condition(condition) // condition is optional
.build()
pultusORM.update(Student(), updater)
belleORM.update(Student(), updater)
```

##### Delete values
```kotlin
pultusORM.delete(Student())
belleORM.delete(Student())
```

##### Drop Table
```kotlin
pultusORM.drop(Student())
belleORM.drop(Student())
```

**Check out more examples & API docs [here](https://s4kibs4mi.github.io/BelleORM/)**
@@ -1,4 +1,4 @@
group 'ninja.sakib.pultusorm'
group 'ninja.sakib.belleorm'
version '1.7'

buildscript {
@@ -1,4 +1,4 @@
package ninja.sakib.pultusorm.annotations
package ninja.sakib.belleorm.annotations

/**
* := Coded with love by Sakib Sami on 9/28/16.
@@ -1,4 +1,4 @@
package ninja.sakib.pultusorm.annotations
package ninja.sakib.belleorm.annotations

/**
* := Coded with love by Sakib Sami on 11/10/16.
@@ -1,4 +1,4 @@
package ninja.sakib.pultusorm.annotations
package ninja.sakib.belleorm.annotations

/**
* := Coded with love by Sakib Sami on 9/28/16.
@@ -1,4 +1,4 @@
package ninja.sakib.pultusorm.annotations;
package ninja.sakib.belleorm.annotations;


/**
@@ -1,4 +1,4 @@
package ninja.sakib.pultusorm.annotations
package ninja.sakib.belleorm.annotations

/**
* := Coded with love by Sakib Sami on 10/4/16.
@@ -1,7 +1,7 @@
package ninja.sakib.pultusorm.callbacks
package ninja.sakib.belleorm.callbacks

import ninja.sakib.pultusorm.core.PultusORMQuery
import ninja.sakib.pultusorm.exceptions.PultusORMException
import ninja.sakib.belleorm.core.BelleORMQuery
import ninja.sakib.belleorm.exceptions.BelleORMException

/**
* := Coded with love by Sakib Sami on 9/27/16.
@@ -18,12 +18,12 @@ interface Callback {
* Method will be called on successful task
* @param type this is to indicate from which task firing this callback
*/
fun onSuccess(type: PultusORMQuery.Type)
fun onSuccess(type: BelleORMQuery.Type)

/**
* Method will be called on failure of task
* @param type this is to indicate on which task firing this callback
* @param exception failure information
*/
fun onFailure(type: PultusORMQuery.Type, exception: PultusORMException)
fun onFailure(type: BelleORMQuery.Type, exception: BelleORMException)
}
@@ -1,6 +1,6 @@
package ninja.sakib.pultusorm.core
package ninja.sakib.belleorm.core

import ninja.sakib.pultusorm.callbacks.Callback
import ninja.sakib.belleorm.callbacks.Callback
import java.sql.Connection
import java.sql.DriverManager

@@ -13,11 +13,11 @@ import java.sql.DriverManager


/**
* Base class of PultusORM API
* Base class of BelleORM API
* It handles database connection
* and serves queries
*/
class PultusORM {
class BelleORM {
private var databaseName: String? = null // Name of the database
private var databasePath: String? = null // Path to database
private var connection: Connection? = null // Connection to database
@@ -72,7 +72,7 @@ class PultusORM {
* @param clazz Class object which data want to add
*/
fun save(clazz: Any): Boolean {
return PultusORMQuery(connection!!).save(clazz)
return BelleORMQuery(connection!!).save(clazz)
}

/**
@@ -81,16 +81,16 @@ class PultusORM {
* @param callback will be fired on task complete
*/
fun save(clazz: Any, callback: Callback) {
PultusORMQuery(connection!!).save(clazz, callback)
BelleORMQuery(connection!!).save(clazz, callback)
}

/**
* Method to update value
* @param clazz value of which class going to update
* @param updater holds update condition and values
*/
fun update(clazz: Any, updater: PultusORMUpdater): Boolean {
return PultusORMQuery(connection!!).update(clazz, updater)
fun update(clazz: Any, updater: BelleORMUpdater): Boolean {
return BelleORMQuery(connection!!).update(clazz, updater)
}

/**
@@ -99,8 +99,8 @@ class PultusORM {
* @param updater holds update condition and values
* @param callback will be fired on task complete
*/
fun update(clazz: Any, updater: PultusORMUpdater, callback: Callback) {
PultusORMQuery(connection!!).update(clazz, updater, callback)
fun update(clazz: Any, updater: BelleORMUpdater, callback: Callback) {
BelleORMQuery(connection!!).update(clazz, updater, callback)
}

/**
@@ -109,7 +109,7 @@ class PultusORM {
* @return MutableList of type Any
*/
fun find(clazz: Any): MutableList<Any> {
return PultusORMQuery(connection!!).get(clazz)
return BelleORMQuery(connection!!).get(clazz)
}

/**
@@ -118,25 +118,25 @@ class PultusORM {
* @param condition condition will be used to get data
* @return MutableList of type Any
*/
fun find(clazz: Any, condition: PultusORMCondition): MutableList<Any> {
return PultusORMQuery(connection!!).get(clazz, condition)
fun find(clazz: Any, condition: BelleORMCondition): MutableList<Any> {
return BelleORMQuery(connection!!).get(clazz, condition)
}

/**
* Method to delete data of specific clazz
* @param clazz which type of data will be deleted
*/
fun delete(clazz: Any): Boolean {
return PultusORMQuery(connection!!).delete(clazz)
return BelleORMQuery(connection!!).delete(clazz)
}

/**
* Method to delete data of specific clazz based on condition
* @param clazz which type of data will be deleted
* @param condition will be used to delete data
*/
fun delete(clazz: Any, condition: PultusORMCondition): Boolean {
return PultusORMQuery(connection!!).delete(clazz, condition)
fun delete(clazz: Any, condition: BelleORMCondition): Boolean {
return BelleORMQuery(connection!!).delete(clazz, condition)
}

/**
@@ -145,7 +145,7 @@ class PultusORM {
* @param callback will be fired on task complete
*/
fun delete(clazz: Any, callback: Callback) {
PultusORMQuery(connection!!).delete(clazz, callback)
BelleORMQuery(connection!!).delete(clazz, callback)
}

/**
@@ -154,16 +154,16 @@ class PultusORM {
* @param condition will be used to delete data
* @param callback will be fired on task complete
*/
fun delete(clazz: Any, condition: PultusORMCondition, callback: Callback) {
PultusORMQuery(connection!!).delete(clazz, condition, callback)
fun delete(clazz: Any, condition: BelleORMCondition, callback: Callback) {
BelleORMQuery(connection!!).delete(clazz, condition, callback)
}

/**
* Method to drop table
* @param clazz which type of table will be deleted
*/
fun drop(clazz: Any): Boolean {
return PultusORMQuery(connection!!).drop(clazz)
return BelleORMQuery(connection!!).drop(clazz)
}

/**
@@ -172,24 +172,24 @@ class PultusORM {
* @param callback will be fired on task complete
*/
fun drop(clazz: Any, callback: Callback) {
PultusORMQuery(connection!!).drop(clazz, callback)
BelleORMQuery(connection!!).drop(clazz, callback)
}

/**
* Method to get number of objects of a specific type
* @param clazz which type of data will count
*/
fun count(clazz: Any): Long {
return PultusORMQuery(connection!!).count(clazz, null)
return BelleORMQuery(connection!!).count(clazz, null)
}

/**
* Method to get number of objects of a specific type
* @param clazz which type of data will count
* @param condition if you want to apply any condition to count or pass null
*/
fun count(clazz: Any, condition: PultusORMCondition?): Long {
return PultusORMQuery(connection!!).count(clazz, condition)
fun count(clazz: Any, condition: BelleORMCondition?): Long {
return BelleORMQuery(connection!!).count(clazz, condition)
}

/**
@@ -1,4 +1,4 @@
package ninja.sakib.pultusorm.core
package ninja.sakib.belleorm.core

/**
* := Coded with love by Sakib Sami on 10/3/16.
@@ -8,10 +8,10 @@ package ninja.sakib.pultusorm.core
*/

/**
* PultusORMCondition
* BelleORMCondition
* Class used to provide condition on queries
*/
class PultusORMCondition private constructor(builder: Builder) {
class BelleORMCondition private constructor(builder: Builder) {
private var rawQuery: String = ""

init {
@@ -231,17 +231,17 @@ class PultusORMCondition private constructor(builder: Builder) {
* @param order ordering type
* @return Builder with appended current condition
*/
fun sort(fieldName: String, order: PultusORMQuery.Sort): Builder {
fun sort(fieldName: String, order: BelleORMQuery.Sort): Builder {
if (sortQuery.isNotEmpty())
sortQuery.append(",")

when (order) {
PultusORMQuery.Sort.ASCENDING -> {
BelleORMQuery.Sort.ASCENDING -> {
addSeparator()

sortQuery.append("$fieldName ASC")
}
PultusORMQuery.Sort.DESCENDING -> {
BelleORMQuery.Sort.DESCENDING -> {
addSeparator()

sortQuery.append("$fieldName DESC")
@@ -346,8 +346,8 @@ class PultusORMCondition private constructor(builder: Builder) {
* Method build condition and
* return it
*/
fun build(): PultusORMCondition {
return PultusORMCondition(this)
fun build(): BelleORMCondition {
return BelleORMCondition(this)
}

private fun addSeparator() {
Oops, something went wrong.

0 comments on commit 104ecb6

Please sign in to comment.
You can’t perform that action at this time.