119 lines
3.2 KiB
Java
119 lines
3.2 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package com.tridium.sys.registry;
|
|
|
|
import com.tridium.sys.registry.NTypeInfo;
|
|
import com.tridium.sys.registry.RegistryDatabase;
|
|
import java.io.DataInputStream;
|
|
import java.io.DataOutputStream;
|
|
import javax.baja.agent.AgentInfo;
|
|
import javax.baja.registry.TypeInfo;
|
|
import javax.baja.security.BPermissions;
|
|
import javax.baja.sys.BIcon;
|
|
import javax.baja.sys.BObject;
|
|
import javax.baja.sys.Context;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public class NAgentInfo
|
|
implements AgentInfo {
|
|
public static final int NO_PREFERRENCE = 0;
|
|
public static final int DEFAULT_PREFERRED = 1;
|
|
public static final int DEFAULT_NOT_PREFERRED = 2;
|
|
final NTypeInfo typeInfo;
|
|
BPermissions permissions;
|
|
String appName;
|
|
int defaultPreferrence;
|
|
|
|
public final TypeInfo getTypeInfo() {
|
|
return this.typeInfo;
|
|
}
|
|
|
|
public final String getAgentId() {
|
|
return this.typeInfo.toString();
|
|
}
|
|
|
|
public final BObject getInstance() {
|
|
return this.typeInfo.getInstance();
|
|
}
|
|
|
|
public final TypeInfo getAgentType() {
|
|
return this.typeInfo;
|
|
}
|
|
|
|
public final String getAppName() {
|
|
return this.appName;
|
|
}
|
|
|
|
public TypeInfo[] getAgentOn() {
|
|
return this.typeInfo.agentOn;
|
|
}
|
|
|
|
public final String getDisplayName(Context context) {
|
|
return this.typeInfo.getDisplayName(context);
|
|
}
|
|
|
|
public final BIcon getIcon(Context context) {
|
|
return this.typeInfo.getIcon(context);
|
|
}
|
|
|
|
public final BPermissions getRequiredPermissions() {
|
|
return this.permissions;
|
|
}
|
|
|
|
public final String toString() {
|
|
return "AgentInfo for " + this.typeInfo;
|
|
}
|
|
|
|
void read(RegistryDatabase registryDatabase, DataInputStream dataInputStream) throws Exception {
|
|
this.permissions = BPermissions.make(dataInputStream.readInt());
|
|
this.defaultPreferrence = dataInputStream.readShort();
|
|
if (dataInputStream.readBoolean()) {
|
|
this.appName = dataInputStream.readUTF();
|
|
}
|
|
}
|
|
|
|
void write(RegistryDatabase registryDatabase, DataOutputStream dataOutputStream) throws Exception {
|
|
dataOutputStream.writeInt(this.permissions.getMask());
|
|
dataOutputStream.writeShort(this.defaultPreferrence);
|
|
boolean bl = false;
|
|
if (this.appName != null) {
|
|
bl = true;
|
|
}
|
|
dataOutputStream.writeBoolean(bl);
|
|
if (this.appName != null) {
|
|
dataOutputStream.writeUTF(this.appName);
|
|
}
|
|
}
|
|
|
|
public static boolean isAdmin(AgentInfo agentInfo) {
|
|
int n = agentInfo.getRequiredPermissions().getMask();
|
|
int n2 = 112;
|
|
boolean bl = false;
|
|
if ((n & n2) != 0) {
|
|
bl = true;
|
|
}
|
|
return bl;
|
|
}
|
|
|
|
private final /* synthetic */ void this() {
|
|
this.permissions = BPermissions.none;
|
|
this.appName = null;
|
|
this.defaultPreferrence = 0;
|
|
}
|
|
|
|
public NAgentInfo(NTypeInfo nTypeInfo) {
|
|
this.this();
|
|
this.typeInfo = nTypeInfo;
|
|
}
|
|
|
|
public NAgentInfo(NTypeInfo nTypeInfo, int n) {
|
|
this.this();
|
|
this.typeInfo = nTypeInfo;
|
|
this.defaultPreferrence = n;
|
|
}
|
|
}
|
|
|