idk
Dieser Commit ist enthalten in:
Ursprung
4bd282b113
Commit
a8dd024fba
@ -55,9 +55,9 @@ public class SchematicNode {
|
|||||||
parent = null;
|
parent = null;
|
||||||
ResultSet set;
|
ResultSet set;
|
||||||
if(parent == null) {
|
if(parent == null) {
|
||||||
set = SQL.select("SELECT * FROM SchematicNode WHERE NodeOwner = ? AND NodeName = ? AND ParentNode is NULL", owner, name);
|
set = SQL.select("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem FROM SchematicNode WHERE NodeOwner = ? AND NodeName = ? AND ParentNode is NULL", owner, name);
|
||||||
}else {
|
}else {
|
||||||
set = SQL.select("SELECT * FROM SchematicNode WHERE NodeOwner = ? AND NodeName = ? AND ParentNode = ?", owner, name, parent);
|
set = SQL.select("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem FROM SchematicNode WHERE NodeOwner = ? AND NodeName = ? AND ParentNode = ?", owner, name, parent);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
@ -85,9 +85,9 @@ public class SchematicNode {
|
|||||||
parent = null;
|
parent = null;
|
||||||
ResultSet set;
|
ResultSet set;
|
||||||
if(parent == null) {
|
if(parent == null) {
|
||||||
set = SQL.select("SELECT * FROM SchematicNode WHERE ParentNode is NULL");
|
set = SQL.select("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem FROM SchematicNode WHERE ParentNode is NULL");
|
||||||
}else {
|
}else {
|
||||||
set = SQL.select("SELECT * FROM SchematicNode WHERE ParentNode = ?", parent);
|
set = SQL.select("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem FROM SchematicNode WHERE ParentNode = ?", parent);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
List<SchematicNode> nodes = new ArrayList<>();
|
List<SchematicNode> nodes = new ArrayList<>();
|
||||||
@ -112,9 +112,9 @@ public class SchematicNode {
|
|||||||
parent = null;
|
parent = null;
|
||||||
ResultSet set;
|
ResultSet set;
|
||||||
if(parent == null) {
|
if(parent == null) {
|
||||||
set = SQL.select("SELECT * FROM SchematicNode WHERE NodeName = ? AND ParentNode is NULL", name, parent);
|
set = SQL.select("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem FROM SchematicNode WHERE NodeName = ? AND ParentNode is NULL", name, parent);
|
||||||
}else {
|
}else {
|
||||||
set = SQL.select("SELECT * FROM SchematicNode WHERE NodeName = ? AND ParentNode = ?", name, parent);
|
set = SQL.select("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem FROM SchematicNode WHERE NodeName = ? AND ParentNode = ?", name, parent);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
@ -150,7 +150,7 @@ public class SchematicNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SchematicNode getSchematicNode(int id) {
|
public static SchematicNode getSchematicNode(int id) {
|
||||||
ResultSet set = SQL.select("SELECT * FROM SchematicNode WHERE NodeId = ?", id);
|
ResultSet set = SQL.select("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem FROM SchematicNode WHERE NodeId = ?", id);
|
||||||
try {
|
try {
|
||||||
if(!set.next())
|
if(!set.next())
|
||||||
return null;
|
return null;
|
||||||
@ -161,7 +161,7 @@ public class SchematicNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<SchematicNode> getAllSchematicsOfType(int owner, String schemType) {
|
public static List<SchematicNode> getAllSchematicsOfType(int owner, String schemType) {
|
||||||
ResultSet set = SQL.select("SELECT * FROM SchematicNode WHERE NodeOwner = ? AND NodeType = ?", owner, schemType);
|
ResultSet set = SQL.select("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem FROM SchematicNode WHERE NodeOwner = ? AND NodeType = ?", owner, schemType);
|
||||||
try {
|
try {
|
||||||
List<SchematicNode> nodes = new ArrayList<>();
|
List<SchematicNode> nodes = new ArrayList<>();
|
||||||
while (set.next())
|
while (set.next())
|
||||||
@ -173,7 +173,7 @@ public class SchematicNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<SchematicNode> getAllSchematicsOfType(String schemType) {
|
public static List<SchematicNode> getAllSchematicsOfType(String schemType) {
|
||||||
ResultSet set = SQL.select("SELECT * FROM SchematicNode WHERE NodeType = ?", schemType);
|
ResultSet set = SQL.select("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem FROM SchematicNode WHERE NodeType = ?", schemType);
|
||||||
try {
|
try {
|
||||||
List<SchematicNode> nodes = new ArrayList<>();
|
List<SchematicNode> nodes = new ArrayList<>();
|
||||||
while (set.next())
|
while (set.next())
|
||||||
@ -214,7 +214,7 @@ public class SchematicNode {
|
|||||||
if(isAdded)
|
if(isAdded)
|
||||||
return getSchematicNodeInNode(parent);
|
return getSchematicNodeInNode(parent);
|
||||||
} else {
|
} else {
|
||||||
ResultSet set = SQL.select("SELECT * FROM SchematicNode s LEFT JOIN NodeMember n ON s.NodeId = n.NodeId WHERE (s.NodeOwner = ? OR n.UserId = ?) AND s.ParentNode is NULL GROUP BY s.NodeId ORDER BY s.NodeName", user, user);
|
ResultSet set = SQL.select("SELECT s.NodeId, s.NodeName, s.NodeOwner, s.NodeItem, s.NodeType, s.ParentNode FROM SchematicNode s LEFT JOIN NodeMember n ON s.NodeId = n.NodeId WHERE (s.NodeOwner = ? OR n.UserId = ?) AND s.ParentNode is NULL GROUP BY s.NodeId ORDER BY s.NodeName", user, user);
|
||||||
try{
|
try{
|
||||||
List<SchematicNode> nodes = new ArrayList<>();
|
List<SchematicNode> nodes = new ArrayList<>();
|
||||||
while(set.next())
|
while(set.next())
|
||||||
@ -243,16 +243,28 @@ public class SchematicNode {
|
|||||||
List<SchematicNode> finalList = new ArrayList<>();
|
List<SchematicNode> finalList = new ArrayList<>();
|
||||||
List<SchematicNode> nodes = SchematicNode.getSchematicNodeInNode(parent);
|
List<SchematicNode> nodes = SchematicNode.getSchematicNodeInNode(parent);
|
||||||
nodes.forEach(node -> {
|
nodes.forEach(node -> {
|
||||||
if(node.isDir()) {
|
if (node.isDir()) {
|
||||||
finalList.addAll(deepGet(node.getId(), filter));
|
finalList.addAll(deepGet(node.getId(), filter));
|
||||||
}else {
|
} else {
|
||||||
if(filter.test(node))
|
if (filter.test(node))
|
||||||
finalList.add(node);
|
finalList.add(node);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return finalList;
|
return finalList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<SchematicNode> getBaselist(int owner) {
|
||||||
|
ResultSet set = SQL.select("SELECT ");
|
||||||
|
try {
|
||||||
|
List<SchematicNode> nodes = new ArrayList<>();
|
||||||
|
while (set.next())
|
||||||
|
nodes.add(new SchematicNode(set));
|
||||||
|
return nodes;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new SecurityException("Failed listing schematics", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private final int id;
|
private final int id;
|
||||||
private final int owner;
|
private final int owner;
|
||||||
private String name;
|
private String name;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren