NodeMember: CommenCore #27
@ -56,20 +56,15 @@ public class SchematicNode {
|
||||
private static final SelectStatement<SchematicNode> byId = table.select(Table.PRIMARY);
|
||||
private static final SelectStatement<SchematicNode> byOwnerNameParent = table.select("OwnerNameParent");
|
||||
private static final SelectStatement<SchematicNode> byOwnerNameParent_null = new SelectStatement<>(table, nodeSelectCreator("") + "WHERE NodeOwner = ? AND NodeName = ? AND ParentNode is NULL");
|
||||
private static final SelectStatement<SchematicNode> byParent = new SelectStatement<>(table, nodeSelectCreator("") + "WHERE ParentNode = ? ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> byParent_null = new SelectStatement<>(table, nodeSelectCreator("") + "WHERE ParentNode is NULL ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> dirsByParent = new SelectStatement<>(table, nodeSelectCreator("") + "WHERE ParentNode = ? AND NodeType is NULL ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> dirsByParent_null = new SelectStatement<>(table, nodeSelectCreator("") + "WHERE ParentNode is NULL AND NodeType is NULL ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> byParent = new SelectStatement<>(table, nodeSelectCreator("") + "WHERE ParentNode <=> ? ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> dirsByParent = new SelectStatement<>(table, nodeSelectCreator("") + "WHERE ParentNode" + Statement.NULL_SAFE_EQUALS + "? AND NodeType is NULL ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> byOwnerType = new SelectStatement<>(table, nodeSelectCreator("") + "WHERE NodeOwner = ? AND NodeType = ? ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> byType = new SelectStatement<>(table, nodeSelectCreator("") + "WHERE NodeType = ? ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> all = new SelectStatement<>(table, "SELECT * FROM EffectiveSchematicNode WHERE EffectiveOwner = ? ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> list_null = new SelectStatement<>(table, "SELECT * FROM EffectiveSchematicNode WHERE EffectiveOwner = ? AND ParentNode is null ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> list = new SelectStatement<>(table, "SELECT * FROM EffectiveSchematicNode WHERE EffectiveOwner = ? AND ParentNode = ? ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> byParentName = new SelectStatement<>(table, "SELECT * FROM EffectiveSchematicNode WHERE EffectiveOwner = ? AND ParentNode = ? AND NodeName = ? ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> byParentName_null = new SelectStatement<>(table, "SELECT * FROM EffectiveSchematicNode WHERE EffectiveOwner = ? AND ParentNode is null AND NodeName = ? ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> list = new SelectStatement<>(table, "SELECT * FROM EffectiveSchematicNode WHERE EffectiveOwner = ? AND ParentNode" + Statement.NULL_SAFE_EQUALS + "? ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> byParentName = new SelectStatement<>(table, "SELECT * FROM EffectiveSchematicNode WHERE EffectiveOwner = ? AND ParentNode" + Statement.NULL_SAFE_EQUALS + "? AND NodeName = ? ORDER BY NodeName");
|
||||
private static final SelectStatement<SchematicNode> schematicAccessibleForUser = new SelectStatement<>(table, "SELECT COUNT(DISTINCT NodeId) FROM EffectiveSchematicNode WHERE EffectiveOwner = ? AND NodeId = ?");
|
||||
private static final SelectStatement<SchematicNode> accessibleByUserTypeInParent = new SelectStatement<>(table, "WITH RECURSIVE RSN AS (SELECT NodeId, ParentNode FROM EffectiveSchematicNode WHERE NodeType = ? AND EffectiveOwner = ? UNION SELECT SN.NodeId, SN.ParentNode FROM RSN, EffectiveSchematicNode SN WHERE SN.NodeId = RSN.ParentNode AND EffectiveOwner = ?) SELECT SN.NodeId, SN.NodeOwner, ? AS EffectiveOwner, SN.NodeName, RSN.ParentNode, SN.LastUpdate, SN.NodeItem, SN.NodeType, SN.NodeRank FROM RSN INNER JOIN SchematicNode SN ON RSN.NodeId = SN.NodeId WHERE RSN.ParentNode = ?");
|
||||
private static final SelectStatement<SchematicNode> accessibleByUserTypeInParent_null = new SelectStatement<>(table, "WITH RECURSIVE RSN AS (SELECT NodeId, ParentNode FROM EffectiveSchematicNode WHERE NodeType = ? AND EffectiveOwner = ? UNION SELECT SN.NodeId, SN.ParentNode FROM RSN, EffectiveSchematicNode SN WHERE SN.NodeId = RSN.ParentNode AND EffectiveOwner = ?) SELECT SN.NodeId, SN.NodeOwner, ? AS EffectiveOwner, SN.NodeName, RSN.ParentNode, SN.LastUpdate, SN.NodeItem, SN.NodeType, SN.NodeRank FROM RSN INNER JOIN SchematicNode SN ON RSN.NodeId = SN.NodeId WHERE RSN.ParentNode is null");
|
||||
private static final SelectStatement<SchematicNode> accessibleByUserTypeInParent = new SelectStatement<>(table, "WITH RECURSIVE RSN AS (SELECT NodeId, ParentNode FROM EffectiveSchematicNode WHERE NodeType = ? AND EffectiveOwner = ? UNION SELECT SN.NodeId, SN.ParentNode FROM RSN, EffectiveSchematicNode SN WHERE SN.NodeId = RSN.ParentNode AND EffectiveOwner = ?) SELECT SN.NodeId, SN.NodeOwner, ? AS EffectiveOwner, SN.NodeName, RSN.ParentNode, SN.LastUpdate, SN.NodeItem, SN.NodeType, SN.NodeRank FROM RSN INNER JOIN SchematicNode SN ON RSN.NodeId = SN.NodeId WHERE RSN.ParentNode" + Statement.NULL_SAFE_EQUALS + "?");
|
||||
private static final SelectStatement<SchematicNode> accessibleByUserType = new SelectStatement<>(table, "SELECT * FROM EffectiveSchematicNode WHERE EffectiveOwner = ? AND NodeType = ?");
|
||||
private static final SelectStatement<SchematicNode> byIdAndUser = new SelectStatement<>(table, "SELECT * FROM EffectiveSchematicNode WHERE EffectiveOwner = ? AND NodeId = ?");
|
||||
private static final SelectStatement<SchematicNode> allParentsOfNode = new SelectStatement<>(table, "WITH RECURSIVE R AS (SELECT NodeId, ParentNode FROM EffectiveSchematicNode WHERE NodeId = ? AND EffectiveOwner = ? UNION SELECT E.NodeId, E.ParentNode FROM R, EffectiveSchematicNode E WHERE R.ParentNode = E.NodeId AND E.EffectiveOwner = ?) SELECT SN.NodeId, SN.NodeOwner, ? AS EffectiveOwner, SN.NodeName, R.ParentNode, SN.LastUpdate, SN.NodeItem, SN.NodeType, SN.NodeRank FROM R INNER JOIN SchematicNode SN ON SN.NodeId = R.NodeId");
|
||||
@ -135,6 +130,13 @@ public class SchematicNode {
|
||||
this.nodeFormat = nodeFormat;
|
||||
}
|
||||
|
||||
private static Integer nullOrNotNul(Integer i) {
|
||||
if(i == null || i == 0) {
|
||||
return null;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public static List<SchematicNode> getAll(SteamwarUser user) {
|
||||
return all.listSelect(user);
|
||||
}
|
||||
@ -144,19 +146,11 @@ public class SchematicNode {
|
||||
}
|
||||
|
||||
public static List<SchematicNode> list(SteamwarUser user, Integer schematicId) {
|
||||
if(schematicId == null || schematicId == 0) {
|
||||
return list_null.listSelect(user);
|
||||
} else {
|
||||
return list.listSelect(user, schematicId);
|
||||
}
|
||||
return list.listSelect(user, nullOrNotNul(schematicId));
|
||||
}
|
||||
|
||||
public static SchematicNode byParentName(SteamwarUser user, Integer schematicId, String name) {
|
||||
if(schematicId == null || schematicId == 0) {
|
||||
return byParentName_null.select(user, name);
|
||||
} else {
|
||||
return byParentName.select(user, schematicId, name);
|
||||
}
|
||||
return byParentName.select(user, nullOrNotNul(schematicId), name);
|
||||
}
|
||||
|
||||
public static List<SchematicNode> accessibleByUserType(SteamwarUser user, SchematicType type) {
|
||||
@ -172,11 +166,7 @@ public class SchematicNode {
|
||||
}
|
||||
|
||||
public static List<SchematicNode> accessibleByUserTypeParent(SteamwarUser user, SchematicType type, Integer parentId) {
|
||||
if(parentId == null || parentId == 0) {
|
||||
return accessibleByUserTypeInParent_null.listSelect(type, user, user, user);
|
||||
} else {
|
||||
return accessibleByUserTypeInParent.listSelect(type, user, user, user, parentId);
|
||||
}
|
||||
return accessibleByUserTypeInParent.listSelect(type, user, user, user, nullOrNotNul(parentId));
|
||||
}
|
||||
|
||||
public static SchematicNode byIdAndUser(SteamwarUser user, Integer id) {
|
||||
@ -227,18 +217,16 @@ public class SchematicNode {
|
||||
public static List<SchematicNode> getSchematicNodeInNode(Integer parent) {
|
||||
if(parent == null || parent == 0) {
|
||||
rootWarning();
|
||||
return byParent_null.listSelect();
|
||||
}
|
||||
|
||||
return byParent.listSelect(parent);
|
||||
return byParent.listSelect(nullOrNotNul(parent));
|
||||
}
|
||||
|
||||
public static List<SchematicNode> getSchematicDirectoryInNode(Integer parent) {
|
||||
if(parent == null || parent == 0) {
|
||||
rootWarning();
|
||||
return dirsByParent_null.listSelect();
|
||||
}
|
||||
return dirsByParent.listSelect(parent);
|
||||
return dirsByParent.listSelect(nullOrNotNul(parent));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ -254,9 +242,8 @@ public class SchematicNode {
|
||||
public static SchematicNode getSchematicNode(String name, Integer parent) {
|
||||
if(parent == null || parent == 0) {
|
||||
rootWarning();
|
||||
return byParentName_null.select(name);
|
||||
}
|
||||
return byParentName.select(name, parent);
|
||||
return byParentName.select(name, nullOrNotNul(parent));
|
||||
}
|
||||
|
||||
public static SchematicNode getSchematicNode(int id) {
|
||||
@ -576,7 +563,6 @@ public class SchematicNode {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static List<String> getNodeTabcomplete(SteamwarUser user, String s) {
|
||||
boolean sws = s.startsWith("/");
|
||||
if (sws) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren