109 lines
3.4 KiB
Java
109 lines
3.4 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package javax.baja.sync;
|
|
|
|
import javax.baja.security.BPermissions;
|
|
import javax.baja.space.BComponentSpace;
|
|
import javax.baja.sync.SyncBuffer;
|
|
import javax.baja.sync.SyncDecoder;
|
|
import javax.baja.sync.SyncEncoder;
|
|
import javax.baja.sync.SyncOp;
|
|
import javax.baja.sys.BComplex;
|
|
import javax.baja.sys.BComponent;
|
|
import javax.baja.sys.BString;
|
|
import javax.baja.sys.BValue;
|
|
import javax.baja.sys.Context;
|
|
import javax.baja.sys.Property;
|
|
|
|
public class SetOp
|
|
extends SyncOp {
|
|
String name;
|
|
BValue value;
|
|
|
|
public int getId() {
|
|
return 115;
|
|
}
|
|
|
|
public String getSlotName() {
|
|
return this.name;
|
|
}
|
|
|
|
public BValue getValue() {
|
|
return this.value;
|
|
}
|
|
|
|
void commit(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, Context context) throws Exception {
|
|
String string;
|
|
String string2;
|
|
BComplex bComplex;
|
|
Property property;
|
|
block4: {
|
|
property = null;
|
|
bComplex = this.component;
|
|
string = string2 = this.name;
|
|
int n = 0;
|
|
do {
|
|
int n2;
|
|
if ((n2 = this.name.indexOf(47, n)) < 0) {
|
|
if (n > 0) {
|
|
string = string2.substring(n);
|
|
}
|
|
break block4;
|
|
}
|
|
string = string2.substring(n, n2);
|
|
n = n2 + 1;
|
|
} while ((bComplex = (BComplex)bComplex.get(string)) != null);
|
|
throw new IllegalStateException("Missing property " + string2);
|
|
}
|
|
property = bComplex.getProperty(string);
|
|
if (property == null) {
|
|
throw new IllegalStateException("Missing property " + string2);
|
|
}
|
|
bComplex.set(property, this.value, context);
|
|
}
|
|
|
|
void encode(SyncEncoder syncEncoder) throws Exception {
|
|
BPermissions bPermissions;
|
|
BValue bValue = this.value;
|
|
if (bValue == null) {
|
|
bValue = this.component.get(this.name);
|
|
}
|
|
if (bValue == null) {
|
|
System.out.println("WARNING: SetOp null value: " + this.name);
|
|
bValue = BString.DEFAULT;
|
|
return;
|
|
}
|
|
if (bValue.isComponent() && !(bPermissions = syncEncoder.getPermissionsFor(bValue.asComponent())).hasOperatorRead()) {
|
|
throw new SyncOp.SyncOpSecurityException(this, "Missing op read permission on value");
|
|
}
|
|
super.encode(syncEncoder);
|
|
syncEncoder.attr("n", this.name).endAttr().newLine().key("b");
|
|
syncEncoder.encode(bValue);
|
|
syncEncoder.end(String.valueOf((char)this.getId())).newLine();
|
|
}
|
|
|
|
void decode(SyncBuffer syncBuffer, BComponentSpace bComponentSpace, SyncDecoder syncDecoder) throws Exception {
|
|
super.decode(syncBuffer, bComponentSpace, syncDecoder);
|
|
this.name = syncDecoder.elem().get("n");
|
|
syncDecoder.next();
|
|
this.value = syncDecoder.decode();
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
stringBuffer.append("Set: ").append(this.componentToString()).append('.').append(this.name).append(" -> ").append(this.value);
|
|
return stringBuffer.toString();
|
|
}
|
|
|
|
public SetOp(BComponent bComponent, String string, BValue bValue) {
|
|
super(bComponent);
|
|
this.name = string;
|
|
this.value = bValue;
|
|
}
|
|
|
|
public SetOp() {
|
|
}
|
|
}
|
|
|