Fixing SchemNode Translation Layer
Dieser Commit ist enthalten in:
Ursprung
bdfc5e8b0e
Commit
6310c9f921
@ -29,16 +29,20 @@ public class SchematicMember {
|
|||||||
|
|
||||||
private NodeMember member;
|
private NodeMember member;
|
||||||
|
|
||||||
private SchematicMember(NodeMember member){
|
private SchematicMember(SchematicNode node, int user, boolean updateDB){
|
||||||
this.member = member;
|
if(updateDB) {
|
||||||
|
member = NodeMember.createNodeMember(node.getId(), user);
|
||||||
|
}else {
|
||||||
|
member = NodeMember.getNodeMember(node.getId(), user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SchematicMember(String schemName, int schemOwner, int schemMember){
|
public SchematicMember(String schemName, int schemOwner, int schemMember, boolean updateDb){
|
||||||
this(NodeMember.getNodeMember(SchematicNode.getSchematicNode(schemOwner, schemName, 0).getId(), schemMember));
|
this(SchematicNode.getSchematicNode(schemOwner, schemName, 0), schemMember, updateDb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SchematicMember(String schemName, UUID schemOwner, UUID schemMember){
|
public SchematicMember(String schemName, UUID schemOwner, UUID schemMember){
|
||||||
this(schemName, SteamwarUser.get(schemOwner).getId(), SteamwarUser.get(schemMember).getId());
|
this(schemName, SteamwarUser.get(schemOwner).getId(), SteamwarUser.get(schemMember).getId(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SchematicMember getSchemMemberFromDB(String schemName, UUID schemOwner, UUID schemMember){
|
public static SchematicMember getSchemMemberFromDB(String schemName, UUID schemOwner, UUID schemMember){
|
||||||
@ -46,11 +50,17 @@ public class SchematicMember {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SchematicMember getSchemMemberFromDB(String schemName, int schemOwner, int schemMember) {
|
public static SchematicMember getSchemMemberFromDB(String schemName, int schemOwner, int schemMember) {
|
||||||
return new SchematicMember(NodeMember.getNodeMember(SchematicNode.getSchematicNode(schemOwner, schemName, 0).getOwner(), schemMember));
|
return getSchemMemberFromDB(schemName, schemOwner, schemMember, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SchematicMember getSchemMemberFromDB(String schemName, int schemOwner, int schemMember, int parent) {
|
||||||
|
SchematicNode node = SchematicNode.getSchematicNode(schemOwner, schemName, parent);
|
||||||
|
NodeMember member = NodeMember.getNodeMember(node.getId(), schemMember);
|
||||||
|
return member == null?null:new SchematicMember(node, schemMember, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SchematicMember getMemberBySchematic(String schemName, int schemMember){
|
public static SchematicMember getMemberBySchematic(String schemName, int schemMember){
|
||||||
return new SchematicMember(NodeMember.getSchematics(schemMember).stream().filter(member1 -> SchematicNode.getSchematicNode(member1.getNode()).getName().equals(schemName)).limit(1).collect(Collectors.toList()).get(0));
|
return new SchematicMember(SchematicNode.getSchematicNode(NodeMember.getSchematics(schemMember).stream().filter(member1 -> SchematicNode.getSchematicNode(member1.getNode()).getName().equals(schemName)).limit(1).collect(Collectors.toList()).get(0).node), schemMember, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<SchematicMember> getSchemMembers(String schemName, UUID schemOwner){
|
public static List<SchematicMember> getSchemMembers(String schemName, UUID schemOwner){
|
||||||
@ -58,9 +68,10 @@ public class SchematicMember {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<SchematicMember> getSchemMembers(String schemName, int schemOwner){
|
public static List<SchematicMember> getSchemMembers(String schemName, int schemOwner){
|
||||||
Set<NodeMember> members = NodeMember.getNodeMembers(SchematicNode.getSchematicNode(schemOwner, schemName, 0).getId());
|
SchematicNode node = SchematicNode.getSchematicNode(schemOwner, schemName, 0);
|
||||||
|
Set<NodeMember> members = NodeMember.getNodeMembers(node.getId());
|
||||||
List<SchematicMember> retMembers = new ArrayList<>();
|
List<SchematicMember> retMembers = new ArrayList<>();
|
||||||
members.forEach(member1 -> retMembers.add(new SchematicMember(member1)));
|
members.forEach(member1 -> retMembers.add(new SchematicMember(node, member1.member, false)));
|
||||||
return retMembers;
|
return retMembers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +81,7 @@ public class SchematicMember {
|
|||||||
|
|
||||||
public static List<SchematicMember> getAccessibleSchems(int schemMember){
|
public static List<SchematicMember> getAccessibleSchems(int schemMember){
|
||||||
List<SchematicMember> members = new ArrayList<>();
|
List<SchematicMember> members = new ArrayList<>();
|
||||||
NodeMember.getSchematics(schemMember).forEach(member1 -> members.add(new SchematicMember(member1)));
|
NodeMember.getSchematics(schemMember).forEach(member1 -> members.add(new SchematicMember(SchematicNode.getSchematicNode(member1.node), member1.member, false)));
|
||||||
return members;
|
return members;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,9 +371,9 @@ public class SchematicNode {
|
|||||||
ResultSet rs = SQL.select("SELECT NodeData FROM SchematicNode WHERE NodeId = ?", id);
|
ResultSet rs = SQL.select("SELECT NodeData FROM SchematicNode WHERE NodeId = ?", id);
|
||||||
try {
|
try {
|
||||||
rs.next();
|
rs.next();
|
||||||
Blob schemData = rs.getBlob("SchemData");
|
Blob schemData = rs.getBlob("NodeData");
|
||||||
if(schemData == null)
|
if(schemData == null)
|
||||||
throw new IOException("SchemData is null");
|
throw new IOException("NodeData is null");
|
||||||
InputStream is = schemData.getBinaryStream();
|
InputStream is = schemData.getBinaryStream();
|
||||||
return VersionedCallable.call(new VersionedCallable<>(() -> Schematic_8.getClipboard(is, schemFormat), 8),
|
return VersionedCallable.call(new VersionedCallable<>(() -> Schematic_8.getClipboard(is, schemFormat), 8),
|
||||||
new VersionedCallable<>(() -> Schematic_14.getClipboard(is, schemFormat), 14));
|
new VersionedCallable<>(() -> Schematic_14.getClipboard(is, schemFormat), 14));
|
||||||
@ -388,7 +388,7 @@ public class SchematicNode {
|
|||||||
ResultSet rs = SQL.select("SELECT NodeData FROM SchematicNode WHERE NodeId = ?", id);
|
ResultSet rs = SQL.select("SELECT NodeData FROM SchematicNode WHERE NodeId = ?", id);
|
||||||
try {
|
try {
|
||||||
rs.next();
|
rs.next();
|
||||||
Blob blob = rs.getBlob("SchemData");
|
Blob blob = rs.getBlob("NodeData");
|
||||||
if(blob == null)
|
if(blob == null)
|
||||||
throw new NoClipboardException();
|
throw new NoClipboardException();
|
||||||
InputStream is = blob.getBinaryStream();
|
InputStream is = blob.getBinaryStream();
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren