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