public void addChild(QName name, Object value) { if (MappingConfigContainer.isTraceEnabled()) MappingConfigContainer.trace("addChild:Qname=" + name + ":value=" + value); if (value instanceof MappingModuleEntry) { MappingModuleEntry mme = (MappingModuleEntry) value; String type = mme.getMappingModuleType(); // organize the mapping modules in groups according to their type. if (this.moduleEntries.containsKey(type)) { this.moduleEntries.get(type).add(mme); } else { List<MappingModuleEntry> entries = new ArrayList<MappingModuleEntry>(); entries.add(mme); this.moduleEntries.put(type, entries); } } }
/** * Write element content. The start element is already written. * * @param writer * @throws XMLStreamException */ public void writeContent(XMLStreamWriter writer) throws XMLStreamException { for (int i = 0; i < moduleEntries.size(); i++) { MappingModuleEntry entry = moduleEntries.get(i); writer.writeStartElement(Element.MAPPING_MODULE.getLocalName()); writer.writeAttribute(Attribute.CODE.getLocalName(), entry.getMappingModuleName()); writer.writeAttribute(Attribute.TYPE.getLocalName(), entry.getMappingModuleType()); Map<String, ?> options = entry.getOptions(); if (options != null && options.size() > 0) { for (Entry<String, ?> option : options.entrySet()) { writer.writeStartElement(Element.MODULE_OPTION.getLocalName()); writer.writeAttribute(Attribute.NAME.getLocalName(), option.getKey()); writer.writeAttribute(Attribute.VALUE.getLocalName(), option.getValue().toString()); writer.writeEndElement(); } } writer.writeEndElement(); } writer.writeEndElement(); } }
public void addChild(ApplicationPolicy aPolicy, MappingInfo authInfo, UnmarshallingContext navigator, String namespaceURI, String localName) { // first organize the mapping modules by type. Map<String,List<MappingModuleEntry>> mappings = new HashMap<String,List<MappingModuleEntry>>(); for(MappingModuleEntry entry : authInfo.getModuleEntries()) { String type = entry.getMappingModuleType(); if(mappings.containsKey(type)) mappings.get(type).add(entry); else { List<MappingModuleEntry> entries = new ArrayList<MappingModuleEntry>(); entries.add(entry); mappings.put(type, entries); } } // now set all mapping infos by type. for(Map.Entry<String,List<MappingModuleEntry>> entry : mappings.entrySet()) { MappingInfo info = new MappingInfo(authInfo.getName()); info.add(entry.getValue()); aPolicy.setMappingInfo(entry.getKey(), info); } if (trace) log.trace("addChild.ApplicationPolicy, name: " + aPolicy.getName()); }
String moduleType = entry.getMappingModuleType(); appPolicy.setMappingInfo(moduleType, mappingInfo);
for(MappingModuleEntry entry: entries) aPolicy.setMappingInfo(entry.getMappingModuleType(), mappingInfo);
for(MappingModuleEntry entry: entries) aPolicy.setMappingInfo(entry.getMappingModuleType(), mappingInfo);
String moduleType = entry.getMappingModuleType(); appPolicy.setMappingInfo(moduleType, mappingInfo);