diff --git a/src/cucky/jGuard/lib/object/Map.java b/src/cucky/jGuard/lib/object/Map.java new file mode 100644 index 0000000..d713935 --- /dev/null +++ b/src/cucky/jGuard/lib/object/Map.java @@ -0,0 +1,122 @@ +package cucky.jGuard.lib.object; + +import cucky.jGuard.lib.Status; +import java.io.Serializable; +import java.util.ArrayList; + + +public class Map implements Serializable{ + + private int id; + private String name; + private boolean lock; + private ArrayList objects; + private ArrayList connection; + + public Map(int id, String name) { + this.id = id; + this.name = name; + this.objects = new ArrayList(); + } + + public Map(int id, String name, boolean lock, ArrayList objects, ArrayList connection) { + this.id = id; + this.name = name; + this.lock = lock; + this.objects = objects; + this.connection = connection; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isLock() { + return lock; + } + + public void setLock(boolean lock) { + this.lock = lock; + } + + + public ArrayList getObjects() { + return objects; + } + + public void setObjects(ArrayList objects) { + this.objects = objects; + } + + public void addObject(MapObject obj) { + this.objects.add(obj); + } + + public ArrayList getConnection() { + return connection; + } + + public void setConnection(ArrayList connection) { + this.connection = connection; + } + + public void addObjectConnection(ObjectConnection oc) { + this.connection.add(oc); + } + + + + public int getMapStatus() { + if (objects.size() > 0) { + for (MapObject i : objects) { + if (i.getStatus() == Status.OFFLINE) { + return Status.OFFLINE; + } + } + return Status.OK; + } + return Status.NA; + + } + + public void setObjectStatus(int objId, int status) { + for (MapObject object : objects) { + if (object.getId() == objId) { + object.setStatus(status); + break; + } + } + } + + public int getOfflineCount(){ + int c = 0; + for (MapObject object : objects) { + if (object.getStatus() == Status.OFFLINE) { + c++; + break; + } + } + return c; + } + + public void updateObject(MapObject mo) { + for (MapObject obj : this.objects) { + if (obj.getId() == mo.getId()) { + obj = mo; + } + } + } + +} diff --git a/src/cucky/jGuard/lib/object/MapObject.java b/src/cucky/jGuard/lib/object/MapObject.java new file mode 100644 index 0000000..b6eea33 --- /dev/null +++ b/src/cucky/jGuard/lib/object/MapObject.java @@ -0,0 +1,230 @@ +package cucky.jGuard.lib.object; + +import cucky.jGuard.lib.Status; +import java.io.Serializable; +import java.util.ArrayList; + + +public class MapObject implements Serializable{ + + + public static final int TYPE_DEVICE = 1; + public static final int TYPE_GENERAL = 2; + public static final int TYPE_MAP = 3; + public static final int TYPE_NOTE = 4; + + private int id; + private int map; + private String name; + private int type; + private int x; + private int y; + private String ip; + private String user; + private String password; + private boolean active; + private boolean notification_sms; + private boolean notification_sound; + private ObjectServices service; + private String location; + private String description; + private int snmpProfile; + private ArrayList snmpProbe; + + private int status; + + /* + type zarizeni + 1 Žádná + 2 Mikrotik + 3 Ubiquiti + 4 SW TP-Link + 5 SW HP + 6 SW EdgeCore + 7 Summit BTH + 8 Summit SDV + 9 TinnyControl + */ + + public MapObject(int id, int map, String name, int type, int x, int y, String ip, String user, String password, boolean active, boolean notification_sms, boolean notification_sound, ObjectServices service, String location, String description, int snmpProfile, ArrayList snmpProbe) { + this.id = id; + this.map = map; + this.name = name; + this.type = type; + this.x = x; + this.y = y; + this.ip = ip; + this.user = user; + this.password = password; + this.active = active; + this.notification_sms = notification_sms; + this.notification_sound = notification_sound; + this.service = service; + this.location = location; + this.description = description; + this.snmpProfile = snmpProfile; + this.snmpProbe = snmpProbe; + this.status = Status.NA; + } + + + + + public MapObject() { + this.ip = ""; + this.type = 0; + this.status = Status.NA; + } + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public boolean isNotification_sms() { + return notification_sms; + } + + public void setNotification_sms(boolean notification_sms) { + this.notification_sms = notification_sms; + } + + public boolean isNotification_sound() { + return notification_sound; + } + + public void setNotification_sound(boolean notification_sound) { + this.notification_sound = notification_sound; + } + + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; + } + + public int getMap() { + return map; + } + + public void setMap(int map) { + this.map = map; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public ObjectServices getService() { + return service; + } + + public void setService(ObjectServices service) { + this.service = service; + } + + public int getX() { + return x; + } + + public void setX(int x) { + this.x = x; + } + + public int getY() { + return y; + } + + public void setY(int y) { + this.y = y; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public ArrayList getSnmpProbe() { + return snmpProbe; + } + + public void setSnmpProbe(ArrayList snmpProbe) { + this.snmpProbe = snmpProbe; + } + + public int getSnmpProfile() { + return snmpProfile; + } + + public void setSnmpProfile(int snmpProfile) { + this.snmpProfile = snmpProfile; + } + + + + + + + +} diff --git a/src/cucky/jGuard/lib/object/ObjectConnection.java b/src/cucky/jGuard/lib/object/ObjectConnection.java new file mode 100644 index 0000000..83804f4 --- /dev/null +++ b/src/cucky/jGuard/lib/object/ObjectConnection.java @@ -0,0 +1,126 @@ +package cucky.jGuard.lib.object; + +import java.io.Serializable; + +public class ObjectConnection implements Serializable{ + + public static final int TYPE_NA = 0; + public static final int TYPE_GE = 1; + public static final int TYPE_FE = 2; + public static final int TYPE_E = 3; + public static final int TYPE_VLAN = 4; + public static final int TYPE_WIRELLES = 5; + public static final int TYPE_10G_FIBER = 6; + public static final int TYPE_1G_FIBER = 7; + public static final int TYPE_100M_FIBER = 8; + + private int id; + private int from; + private int to; + private int type; + private boolean read; + private int sourceObjectId; + private int map; + private int iface; + private long tx; + private long rx; + + public ObjectConnection() { + } + + public ObjectConnection(int id, int from, int to, int type, boolean read, int sourceObjectId, int iface) { + this.id = id; + this.from = from; + this.to = to; + this.type = type; + this.read = read; + this.sourceObjectId = sourceObjectId; + this.iface = iface; + } + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getFrom() { + return from; + } + + public void setFrom(int from) { + this.from = from; + } + + public int getTo() { + return to; + } + + public void setTo(int to) { + this.to = to; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public boolean isRead() { + return read; + } + + public void setRead(boolean read) { + this.read = read; + } + + public int getSourceObjectId() { + return sourceObjectId; + } + + public void setSourceObjectId(int sourceObjectId) { + this.sourceObjectId = sourceObjectId; + } + + public int getMap() { + return map; + } + + public void setMap(int map) { + this.map = map; + } + + public int getIface() { + return iface; + } + + public void setIface(int iface) { + this.iface = iface; + } + + public long getTx() { + return tx; + } + + public void setTx(long tx) { + this.tx = tx; + } + + public long getRx() { + return rx; + } + + public void setRx(long rx) { + this.rx = rx; + } + + + + + +} diff --git a/src/cucky/jGuard/lib/object/ObjectServices.java b/src/cucky/jGuard/lib/object/ObjectServices.java new file mode 100644 index 0000000..985276e --- /dev/null +++ b/src/cucky/jGuard/lib/object/ObjectServices.java @@ -0,0 +1,136 @@ + +package cucky.jGuard.lib.object; + +import java.io.Serializable; + +public class ObjectServices implements Serializable{ + + private boolean winbox; + private String portWinbox; + private boolean ssh; + private String portSsh; + private boolean web; + private String portWeb; + private int verzeWeb; + private boolean telnet; + private String portTelnet; + private boolean sms; + private String portSms; + private int verzeSms; + + public ObjectServices(boolean winbox, String portWinbox, boolean ssh, String portSsh, boolean web, String portWeb, int verzeWeb, boolean telnet, String portTelnet, boolean sms, String portSms, int verzeSms) { + this.winbox = winbox; + this.portWinbox = portWinbox; + this.ssh = ssh; + this.portSsh = portSsh; + this.web = web; + this.portWeb = portWeb; + this.verzeWeb = verzeWeb; + this.telnet = telnet; + this.portTelnet = portTelnet; + this.sms = sms; + this.portSms = portSms; + this.verzeSms = verzeSms; + } + + public ObjectServices() { + } + + public boolean isWinbox() { + return winbox; + } + + public void setWinbox(boolean winbox) { + this.winbox = winbox; + } + + public String getPortWinbox() { + return portWinbox; + } + + public void setPortWinbox(String portWinbox) { + this.portWinbox = portWinbox; + } + + public boolean isSsh() { + return ssh; + } + + public void setSsh(boolean ssh) { + this.ssh = ssh; + } + + public String getPortSsh() { + return portSsh; + } + + public void setPortSsh(String portSsh) { + this.portSsh = portSsh; + } + + public boolean isWeb() { + return web; + } + + public void setWeb(boolean web) { + this.web = web; + } + + public String getPortWeb() { + return portWeb; + } + + public void setPortWeb(String portWeb) { + this.portWeb = portWeb; + } + + public int getVerzeWeb() { + return verzeWeb; + } + + public void setVerzeWeb(int verzeWeb) { + this.verzeWeb = verzeWeb; + } + + public boolean isTelnet() { + return telnet; + } + + public void setTelnet(boolean telnet) { + this.telnet = telnet; + } + + public String getPortTelnet() { + return portTelnet; + } + + public void setPortTelnet(String portTelnet) { + this.portTelnet = portTelnet; + } + + public boolean isSms() { + return sms; + } + + public void setSms(boolean sms) { + this.sms = sms; + } + + public String getPortSms() { + return portSms; + } + + public void setPortSms(String portSms) { + this.portSms = portSms; + } + + public int getVerzeSms() { + return verzeSms; + } + + public void setVerzeSms(int verzeSms) { + this.verzeSms = verzeSms; + } + + +} diff --git a/src/cucky/jGuard/lib/object/ObjectType.java b/src/cucky/jGuard/lib/object/ObjectType.java new file mode 100644 index 0000000..fb6df91 --- /dev/null +++ b/src/cucky/jGuard/lib/object/ObjectType.java @@ -0,0 +1,50 @@ +package cucky.jGuard.lib.object; + +import java.io.Serializable; + + +public class ObjectType implements Serializable{ + + int id; + String name; + String imgStr; + + public ObjectType(int id, String name, String imgStr) { + this.id = id; + this.name = name; + this.imgStr = imgStr; + } + + public ObjectType(String name, String imgStr) { + this.name = name; + this.imgStr = imgStr; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getImgStr() { + return imgStr; + } + + public void setImgStr(String imgStr) { + this.imgStr = imgStr; + } + + + + +}