49 lines
1.3 KiB
Java
49 lines
1.3 KiB
Java
package de.hsadmin.mods.db;
|
|
|
|
import java.io.Serializable;
|
|
|
|
import javax.persistence.DiscriminatorValue;
|
|
import javax.persistence.Entity;
|
|
|
|
import de.hsadmin.core.model.AnnModuleImpl;
|
|
import de.hsadmin.core.model.SearchFilter;
|
|
import de.hsadmin.mods.pac.Pac;
|
|
|
|
@Entity(name = "MySqlDatabases")
|
|
@DiscriminatorValue("mysql")
|
|
@SearchFilter("obj.instance = 'mysql' AND (" + " obj.pac = :loginUserPac OR "
|
|
+ " obj.pac.customer.memberCode = :loginUserName )")
|
|
@AnnModuleImpl(de.hsadmin.mods.db.MySqlDatabaseModuleImpl.class)
|
|
public class MySqlDatabase extends Database implements Serializable {
|
|
|
|
private static final long serialVersionUID = 2862112440807946042L;
|
|
|
|
public MySqlDatabase() {
|
|
setInstance("mysql");
|
|
setEncoding("UTF-8");
|
|
}
|
|
|
|
public MySqlDatabase(Pac pac, String name, String owner, String encoding) {
|
|
super("mysql", pac, name, owner, encoding);
|
|
}
|
|
|
|
public String getSystemEncoding() {
|
|
String sysEnc = getEncoding().toLowerCase().replaceAll("-", "");
|
|
return sysEnc;
|
|
}
|
|
|
|
@Override
|
|
public Class<? extends DatabaseUser> getSqlUserClass() {
|
|
return MySqlUser.class;
|
|
}
|
|
|
|
public static String createQueryFromStringKey(String humanKey) {
|
|
return "obj.name='" + humanKey + "'";
|
|
}
|
|
|
|
public static String restriction() {
|
|
return "obj.instance='mysql' AND ( " + Database.restriction() + " )";
|
|
}
|
|
|
|
}
|