Portal getPortal(String name) { Portal portal = _portalMgr.providePortal(name); if (portal == null) { portal = _portalMgr.createNewPortal(null, name); if (log.isDebugEnabled()) { log.debug("create Portal: (" + portal.getSystemName() + ", " + name + ")"); } } return portal; }
private static Element storePortal(Portal portal) { Element elem = new Element("portal"); elem.setAttribute("systemName", portal.getSystemName()); elem.setAttribute("portalName", portal.getName()); OBlock block = portal.getFromBlock(); if (block != null) { Element fromElem = new Element("fromBlock"); fromElem.setAttribute("blockName", block.getSystemName()); List<OPath> paths = portal.getFromPaths(); if (paths != null) { for (int i = 0; i < paths.size(); i++) { OPath path = paths.get(i); fromElem.addContent(storePathKey(path)); } } elem.addContent(fromElem); } else { log.error("Portal \"" + portal.getName() + "\" has no fromBlock!"); } NamedBean signal = portal.getFromSignal(); if (signal != null) { Element fromElem = new Element("fromSignal"); fromElem.setAttribute("signalName", signal.getSystemName()); fromElem.setAttribute("signalDelay", "" + portal.getFromSignalOffset()); elem.addContent(fromElem); } block = portal.getToBlock(); if (block != null) { Element toElem = new Element("toBlock"); toElem.setAttribute("blockName", block.getSystemName()); List<OPath> paths = portal.getToPaths(); if (paths != null) { for (int i = 0; i < paths.size(); i++) { OPath path = paths.get(i); toElem.addContent(storePathKey(path)); } } elem.addContent(toElem); } else { log.error("Portal \"" + portal.getName() + "\" has no toBlock!"); } signal = portal.getToSignal(); if (signal != null) { Element toElem = new Element("toSignal"); toElem.setAttribute("signalName", signal.getSystemName()); toElem.setAttribute("signalDelay", "" + portal.getToSignalOffset()); elem.addContent(toElem); } return elem; }