This commit is contained in:
Paul Schaub 2018-09-15 22:59:08 +02:00
parent df7b6a3cf2
commit d086ce3b85
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
7 changed files with 96 additions and 0 deletions

View file

@ -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()

View file

@ -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 {

View file

@ -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 {
}
}

View file

@ -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<Account, String> getAccountsDao() throws SQLException {
return DaoManager.createDao(getConnectionSource(), Account.class);
}
}

View file

@ -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<Account, String> {
}

View file

@ -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<Account, String> implements AccountDao {
protected AccountDaoImpl(ConnectionSource connectionSource)
throws SQLException {
super(connectionSource, Account.class);
}
}

View file

@ -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() {
}
}