}
private NetGraph copyBaseInfoFromTemplate(NetGraph netGraph) {
NetGraph to = new NetGraph();
for (NetTopology netTopologyA : netGraph.getNetTopologies()) {
NetTopology netTopologyB = new NetTopology();
for (Anchor anchorA : netTopologyA.getAnchors()) {
Anchor anchorB = new Anchor();
anchorB.setName(anchorA.getName());
anchorB.setX(anchorA.getX());
anchorB.setY(anchorA.getY());
netTopologyB.addAnchor(anchorB);
}
for (Switch switchA : netTopologyA.getSwitchs()) {
Switch switchB = new Switch();
switchB.setName(switchA.getName());
switchB.setX(switchA.getX());
switchB.setY(switchA.getY());
switchB.setState(switchA.getState());
netTopologyB.addSwitch(switchB);
}
for (Connection connectionA : netTopologyA.getConnections()) {
Connection connectionB = new Connection();
for (Interface interA : connectionA.getInterfaces()) {
Interface interB = new Interface();
interB.setDomain(interA.getDomain());
interB.setGroup(interA.getGroup());
interB.setKey(interA.getKey());
interB.setIn(interA.getIn());
interB.setOut(interA.getOut());
interB.setInstate(interA.getInstate());
interB.setOutstate(interA.getOutstate());
interB.setInstate(interA.getInstate());
interB.setOutstate(interA.getOutstate());
interB.setInDiscardsState(interA.getInDiscardsState());
interB.setOutDiscardsState(interA.getOutDiscardsState());
interB.setInErrorsState(interA.getInErrorsState());
interB.setOutErrorsState(interA.getOutErrorsState());
connectionB.addInterface(interB);
}
connectionB.setInsum(connectionA.getInsum());
connectionB.setOutsum(connectionA.getOutsum());
connectionB.setFrom(connectionA.getFrom());
connectionB.setTo(connectionA.getTo());
connectionB.setInstate(connectionA.getInstate());
connectionB.setOutstate(connectionA.getOutstate());
connectionB.setInDiscardsState(connectionA.getInDiscardsState());
connectionB.setOutDiscardsState(connectionA.getOutDiscardsState());
connectionB.setInErrorsState(connectionA.getInErrorsState());
connectionB.setOutErrorsState(connectionA.getOutErrorsState());
netTopologyB.addConnection(connectionB);
}
to.addNetTopology(netTopologyB);
}