-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
153 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 0 additions & 74 deletions
74
AtmLocator/app/src/main/java/piotrek/atmlocator/orm/Atm.java
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
AtmLocator/app/src/main/java/piotrek/atmlocator/orm/Atm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package piotrek.atmlocator.orm | ||
|
||
import com.j256.ormlite.field.DatabaseField | ||
import com.j256.ormlite.table.DatabaseTable | ||
import piotrek.atmlocator.orm.Atm.Columns.ID | ||
|
||
/** | ||
* Created by Admin on 2016-04-26. | ||
*/ | ||
|
||
@DatabaseTable(tableName = "atm", daoClass = AtmDao::class) | ||
class Atm { | ||
@DatabaseField(generatedId = true, columnName = ID) | ||
var id: Int = 0 | ||
|
||
// eager loading | ||
//@DatabaseField(foreign = true, foreignAutoRefresh = true) | ||
@DatabaseField(foreign = true) | ||
var bank: Bank? = null | ||
@DatabaseField(canBeNull = false) | ||
var longitude: Double = 0.toDouble() | ||
@DatabaseField(canBeNull = false) | ||
var latitude: Double = 0.toDouble() | ||
@DatabaseField(canBeNull = false) | ||
var address: String? = null | ||
|
||
object Columns { | ||
const val ID = "id" | ||
} | ||
} |
24 changes: 0 additions & 24 deletions
24
AtmLocator/app/src/main/java/piotrek/atmlocator/orm/AtmDao.java
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
AtmLocator/app/src/main/java/piotrek/atmlocator/orm/AtmDao.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package piotrek.atmlocator.orm | ||
|
||
import com.j256.ormlite.dao.BaseDaoImpl | ||
import com.j256.ormlite.support.ConnectionSource | ||
import com.j256.ormlite.table.DatabaseTableConfig | ||
|
||
import java.sql.SQLException | ||
|
||
/** | ||
* Created by Admin on 2016-04-26. | ||
*/ | ||
class AtmDao : BaseDaoImpl<Atm, Int> { | ||
@Throws(SQLException::class) | ||
protected constructor(dataClass: Class<Atm>) : super(dataClass) { | ||
} | ||
|
||
@Throws(SQLException::class) | ||
protected constructor(connectionSource: ConnectionSource, dataClass: Class<Atm>) : super(connectionSource, dataClass) { | ||
} | ||
|
||
@Throws(SQLException::class) | ||
protected constructor(connectionSource: ConnectionSource, tableConfig: DatabaseTableConfig<Atm>) : super(connectionSource, tableConfig) { | ||
} | ||
} |
59 changes: 0 additions & 59 deletions
59
AtmLocator/app/src/main/java/piotrek/atmlocator/orm/Bank.java
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
AtmLocator/app/src/main/java/piotrek/atmlocator/orm/Bank.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package piotrek.atmlocator.orm | ||
|
||
import com.j256.ormlite.field.DatabaseField | ||
import com.j256.ormlite.table.DatabaseTable | ||
|
||
@DatabaseTable(tableName = "bank", daoClass = BankDao::class) | ||
class Bank() { | ||
|
||
@DatabaseField(generatedId = true, columnName = Columns.ID) | ||
var id: Int = 0 | ||
@DatabaseField(columnName = Columns.BANK_NAME, canBeNull = false, unique = true) | ||
var name: String? = null | ||
@DatabaseField(columnName = Columns.PHONE) | ||
var phone: String? = null | ||
|
||
override fun toString(): String { | ||
return name ?: "" | ||
} | ||
|
||
constructor(name: String, phone: String) : this() { | ||
this.name = name | ||
this.phone = phone | ||
} | ||
|
||
object Columns { | ||
const val ID = "id" | ||
const val BANK_NAME = "bank_name" | ||
const val PHONE = "phone" | ||
} | ||
} |
24 changes: 0 additions & 24 deletions
24
AtmLocator/app/src/main/java/piotrek/atmlocator/orm/BankDao.java
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
AtmLocator/app/src/main/java/piotrek/atmlocator/orm/BankDao.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package piotrek.atmlocator.orm | ||
|
||
import com.j256.ormlite.dao.BaseDaoImpl | ||
import com.j256.ormlite.support.ConnectionSource | ||
import com.j256.ormlite.table.DatabaseTableConfig | ||
|
||
import java.sql.SQLException | ||
|
||
/** | ||
* Created by Admin on 2016-04-26. | ||
*/ | ||
class BankDao : BaseDaoImpl<Bank, Int> { | ||
@Throws(SQLException::class) | ||
protected constructor(dataClass: Class<Bank>) : super(dataClass) { | ||
} | ||
|
||
@Throws(SQLException::class) | ||
protected constructor(connectionSource: ConnectionSource, dataClass: Class<Bank>) : super(connectionSource, dataClass) { | ||
} | ||
|
||
@Throws(SQLException::class) | ||
protected constructor(connectionSource: ConnectionSource, tableConfig: DatabaseTableConfig<Bank>) : super(connectionSource, tableConfig) { | ||
} | ||
} |
49 changes: 0 additions & 49 deletions
49
AtmLocator/app/src/main/java/piotrek/atmlocator/orm/DbHelper.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.