Commit 83777446 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Added content for the entities (WIP on UpstreamResponse)

parent a3e3a9ea
package com.frostnerd.dnsserver.database.entities.server;
import com.frostnerd.utils.database.orm.Entity;
import com.frostnerd.utils.database.orm.annotations.DatabaseDefault;
import com.frostnerd.utils.database.orm.annotations.Named;
import com.frostnerd.utils.database.orm.annotations.NotNull;
import com.frostnerd.utils.database.orm.annotations.PrimaryKey;
import com.frostnerd.utils.database.orm.annotations.RowID;
import com.frostnerd.utils.database.orm.annotations.Table;
/**
......@@ -12,6 +17,67 @@ import com.frostnerd.utils.database.orm.annotations.Table;
* <p>
* development@frostnerd.com
*/
@Table
@Table(name = "DNSEntry")
public class DNSEntry extends Entity{
@PrimaryKey
@Named(name = "Host")
private String host;
@NotNull
@Named(name = "Target")
private String target;
@PrimaryKey
@Named(name = "Ipv6")
@DatabaseDefault(defaultValue = "0")
private boolean ipv6 = false;
@Named(name = "Wildcard")
@DatabaseDefault(defaultValue = "0")
private boolean wildcard = false;
@RowID
private long rowid;
public DNSEntry(){
}
public DNSEntry(String host, String target, boolean ipv6, boolean wildcard) {
this.host = host;
this.target = target;
this.ipv6 = ipv6;
this.wildcard = wildcard;
}
public String getHost() {
return host;
}
public String getTarget() {
return target;
}
public boolean isIpv6() {
return ipv6;
}
public boolean isWildcard() {
return wildcard;
}
public void setTarget(String target) {
this.target = target;
}
public long getRowid() {
return rowid;
}
@Override
public String toString() {
return "DNSRule{" +
"host='" + host + '\'' +
", target='" + target + '\'' +
", ipv6=" + ipv6 +
", wildcard=" + wildcard +
", rowid=" + rowid +
'}';
}
}
package com.frostnerd.dnsserver.database.entities.server;
import com.frostnerd.utils.database.orm.Entity;
import com.frostnerd.utils.database.orm.annotations.Named;
import com.frostnerd.utils.database.orm.annotations.PrimaryKey;
import com.frostnerd.utils.database.orm.annotations.Table;
/**
......@@ -14,5 +16,34 @@ import com.frostnerd.utils.database.orm.annotations.Table;
*/
@Table(name = "DNSQuery")
public class DNSQuery extends Entity {
@PrimaryKey
@Named(name = "Host")
private String host;
@Named(name = "Ipv6")
private boolean ipv6;
@PrimaryKey
@Named(name = "Time")
private long time;
public DNSQuery(String host, boolean ipv6, long time) {
this.host = host;
this.ipv6 = ipv6;
this.time = time;
}
public DNSQuery(){
}
public String getHost() {
return host;
}
public boolean isIpv6() {
return ipv6;
}
public long getTime() {
return time;
}
}
package com.frostnerd.dnsserver.database.entities.server;
import com.frostnerd.utils.database.orm.Entity;
import com.frostnerd.utils.database.orm.annotations.Named;
import com.frostnerd.utils.database.orm.annotations.Table;
/**
* Copyright Daniel Wolf 2017
......@@ -11,5 +13,8 @@ import com.frostnerd.utils.database.orm.Entity;
* <p>
* development@frostnerd.com
*/
@Table(name = "UpstreamResponse")
public class UpstreamResponse extends Entity{
@Named(name = "ForQuery")
private DNSQuery forQuery;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment