List gateways = rule.getGateways(); List permissions = rule.getPermissions();
List<Gateway> gateways = rule.getGateways(); List<Permission> permissions = rule.getPermissions();
    public void generate(IDialingRule rule) {        List gateways = rule.getGateways();        List permissions = rule.getPermissions();        if (gateways.size() == 0) {            // nothing to generate            return;        }        Element mappings = m_doc.getRootElement();        Element hostMatch = mappings.addElement("hostMatch");        addRuleNameComment(hostMatch, rule);        addRuleDescription(hostMatch, rule);        for (Iterator i = gateways.iterator(); i.hasNext();) {            Gateway gateway = (Gateway) i.next();            Element hostPattern = hostMatch.addElement("hostPattern");            hostPattern.setText(gateway.getAddress());            m_gateways.add(gateway);        }        Element userMatch = hostMatch.addElement("userMatch");        String[] patterns = rule.getTransformedPatterns();        for (int i = 0; i < patterns.length; i++) {            String pattern = patterns[i];            Element userPattern = userMatch.addElement("userPattern");            userPattern.setText(pattern);        }        // even if no permission is specified (permission list is empty) we create empty element        Element permissionMatch = userMatch.addElement("permissionMatch");        for (Iterator i = permissions.iterator(); i.hasNext();) {            Permission permission = (Permission) i.next();            Element pelement = permissionMatch.addElement("permission");            pelement.setText(permission.getName());        }    }