pridano vyčítání uživatelskeho popisu portu - pridány proměné
parent
1f1cabf4ec
commit
a2d972fc22
|
|
@ -5,37 +5,67 @@ import java.io.Serializable;
|
|||
public class Interface implements Serializable {
|
||||
|
||||
private int id;
|
||||
private String description;
|
||||
private String description; // původní (plný) popis z ifDescr
|
||||
private String shortDescription; // zkrácená verze popisu
|
||||
private String operStatus;
|
||||
private String speed;
|
||||
private String type;
|
||||
private String macAddress;
|
||||
private String adminStatus;
|
||||
private String lastChangeTime;
|
||||
private String alias; // uživatelský alias (ifAlias)
|
||||
|
||||
public Interface(int id, String description, String operStatus, String speed, String type, String macAddress, String adminStatus, String lastChangeTime) {
|
||||
// Hlavní konstruktor se všemi parametry včetně shortDescription
|
||||
public Interface(int id, String description, String shortDescription, String operStatus,
|
||||
String speed, String type, String macAddress, String adminStatus,
|
||||
String lastChangeTime, String alias) {
|
||||
this.id = id;
|
||||
this.description = description;
|
||||
this.shortDescription = shortDescription;
|
||||
this.operStatus = operStatus;
|
||||
this.speed = speed;
|
||||
this.type = type;
|
||||
this.macAddress = macAddress;
|
||||
this.adminStatus = adminStatus;
|
||||
this.lastChangeTime = lastChangeTime;
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
// Konstruktor pro zpětnou kompatibilitu (shortDescription = description)
|
||||
public Interface(int id, String description, String operStatus, String speed, String type,
|
||||
String macAddress, String adminStatus, String lastChangeTime, String alias) {
|
||||
this(id, description, description, operStatus, speed, type, macAddress,
|
||||
adminStatus, lastChangeTime, alias);
|
||||
}
|
||||
|
||||
// Původní konstruktor bez aliasu (pro zachování kompatibility)
|
||||
public Interface(int id, String description, String operStatus, String speed, String type,
|
||||
String macAddress, String adminStatus, String lastChangeTime) {
|
||||
this(id, description, description, operStatus, speed, type, macAddress,
|
||||
adminStatus, lastChangeTime, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Interface ID: " + id + "\n"
|
||||
+ "Description: " + description + "\n"
|
||||
+ "Operational Status: " + operStatus + "\n"
|
||||
+ "Speed: " + speed + "\n"
|
||||
+ "Type: " + type + "\n"
|
||||
+ "MAC Address: " + macAddress + "\n"
|
||||
+ "Administrative Status: " + adminStatus + "\n"
|
||||
+ "Last Link Change: " + lastChangeTime + "\n";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Interface ID: ").append(id).append("\n");
|
||||
sb.append("Description: ").append(description).append("\n");
|
||||
if (!shortDescription.equals(description)) {
|
||||
sb.append("Short Description: ").append(shortDescription).append("\n");
|
||||
}
|
||||
if (alias != null && !alias.isEmpty() && !alias.equals(shortDescription)) {
|
||||
sb.append("Alias: ").append(alias).append("\n");
|
||||
}
|
||||
sb.append("Operational Status: ").append(operStatus).append("\n");
|
||||
sb.append("Speed: ").append(speed).append("\n");
|
||||
sb.append("Type: ").append(type).append("\n");
|
||||
sb.append("MAC Address: ").append(macAddress).append("\n");
|
||||
sb.append("Administrative Status: ").append(adminStatus).append("\n");
|
||||
sb.append("Last Link Change: ").append(lastChangeTime).append("\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
// Gettery a settery
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
@ -52,6 +82,14 @@ public class Interface implements Serializable {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public String getShortDescription() {
|
||||
return shortDescription;
|
||||
}
|
||||
|
||||
public void setShortDescription(String shortDescription) {
|
||||
this.shortDescription = shortDescription;
|
||||
}
|
||||
|
||||
public String getOperStatus() {
|
||||
return operStatus;
|
||||
}
|
||||
|
|
@ -99,6 +137,12 @@ public class Interface implements Serializable {
|
|||
public void setLastChangeTime(String lastChangeTime) {
|
||||
this.lastChangeTime = lastChangeTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getAlias() {
|
||||
return alias;
|
||||
}
|
||||
|
||||
public void setAlias(String alias) {
|
||||
this.alias = alias;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue