diff --git a/build.gradle b/build.gradle index 1b53e6e..9afb985 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,10 @@ buildscript { dependencies { + // Material Design classpath group: 'de.dynamicfiles.projects.gradle.plugins', name: 'javafx-gradle-plugin', version: '8.8.2' + + // Database + } repositories { mavenLocal() diff --git a/fasel-jfx/build.gradle b/fasel-jfx/build.gradle index 1e15f7f..12bc5ea 100644 --- a/fasel-jfx/build.gradle +++ b/fasel-jfx/build.gradle @@ -10,6 +10,9 @@ repositories { // sourceSet.test of the core subproject dependencies { implementation 'com.jfoenix:jfoenix:8.0.7' + implementation 'de.jensd:fontawesomefx:8.9' + implementation 'javax.persistence:javax.persistence-api:2.2' + implementation 'com.j256.ormlite:ormlite-core:5.1' } repositories { diff --git a/fasel-jfx/src/main/java/de/vanitasvitae/fasel/Configs.java b/fasel-jfx/src/main/java/de/vanitasvitae/fasel/Configs.java new file mode 100644 index 0000000..21606e2 --- /dev/null +++ b/fasel-jfx/src/main/java/de/vanitasvitae/fasel/Configs.java @@ -0,0 +1,22 @@ +package de.vanitasvitae.fasel; + +public class Configs { + + /** + * Application wide configurations. + */ + public interface ApplicationConfig { + + boolean isDebug(); + void setIsDebug(boolean debug); + + boolean isUIDummy(); + } + + /** + * Account specific configurations. + */ + public interface AccountConfig { + + } +} diff --git a/fasel-jfx/src/main/java/de/vanitasvitae/fasel/db/AbstractDatabase.java b/fasel-jfx/src/main/java/de/vanitasvitae/fasel/db/AbstractDatabase.java new file mode 100644 index 0000000..86d2399 --- /dev/null +++ b/fasel-jfx/src/main/java/de/vanitasvitae/fasel/db/AbstractDatabase.java @@ -0,0 +1,19 @@ +package de.vanitasvitae.fasel.db; + +import java.sql.SQLException; + +import com.j256.ormlite.dao.Dao; +import com.j256.ormlite.dao.DaoManager; +import com.j256.ormlite.support.ConnectionSource; +import de.vanitasvitae.fasel.db.entity.Account; + +public abstract class AbstractDatabase { + + public abstract ConnectionSource getConnectionSource(); + + public Dao getAccountsDao() throws SQLException { + return DaoManager.createDao(getConnectionSource(), Account.class); + } + + +} diff --git a/fasel-jfx/src/main/java/de/vanitasvitae/fasel/db/dao/AccountDao.java b/fasel-jfx/src/main/java/de/vanitasvitae/fasel/db/dao/AccountDao.java new file mode 100644 index 0000000..0857805 --- /dev/null +++ b/fasel-jfx/src/main/java/de/vanitasvitae/fasel/db/dao/AccountDao.java @@ -0,0 +1,8 @@ +package de.vanitasvitae.fasel.db.dao; + +import com.j256.ormlite.dao.Dao; +import de.vanitasvitae.fasel.db.entity.Account; + +public interface AccountDao extends Dao { + +} diff --git a/fasel-jfx/src/main/java/de/vanitasvitae/fasel/db/dao/impl/AccountDaoImpl.java b/fasel-jfx/src/main/java/de/vanitasvitae/fasel/db/dao/impl/AccountDaoImpl.java new file mode 100644 index 0000000..beae87b --- /dev/null +++ b/fasel-jfx/src/main/java/de/vanitasvitae/fasel/db/dao/impl/AccountDaoImpl.java @@ -0,0 +1,17 @@ +package de.vanitasvitae.fasel.db.dao.impl; + +import java.sql.SQLException; + +import com.j256.ormlite.dao.BaseDaoImpl; +import com.j256.ormlite.support.ConnectionSource; +import de.vanitasvitae.fasel.db.dao.AccountDao; +import de.vanitasvitae.fasel.db.entity.Account; + +public class AccountDaoImpl extends BaseDaoImpl implements AccountDao { + + protected AccountDaoImpl(ConnectionSource connectionSource) + throws SQLException { + super(connectionSource, Account.class); + } + +} diff --git a/fasel-jfx/src/main/java/de/vanitasvitae/fasel/db/entity/Account.java b/fasel-jfx/src/main/java/de/vanitasvitae/fasel/db/entity/Account.java new file mode 100644 index 0000000..30eb19e --- /dev/null +++ b/fasel-jfx/src/main/java/de/vanitasvitae/fasel/db/entity/Account.java @@ -0,0 +1,23 @@ +package de.vanitasvitae.fasel.db.entity; + +import com.j256.ormlite.field.DataType; +import com.j256.ormlite.field.DatabaseField; +import com.j256.ormlite.table.DatabaseTable; +import de.vanitasvitae.fasel.db.dao.impl.AccountDaoImpl; + +@DatabaseTable(tableName = "accounts", daoClass = AccountDaoImpl.class) +public class Account { + + @DatabaseField(id = true, dataType = DataType.LONG) + private String accountId; + + @DatabaseField(canBeNull = false, dataType = DataType.STRING_BYTES) + private String jid; + + @DatabaseField(canBeNull = false, dataType = DataType.STRING_BYTES) + private char[] password; + + public Account() { + + } +}