/** * write a list of entity manager factory reference descriptors to * a DOM Tree * * @param parentNode parent node for the DOM tree * @param entityMgrFactoryRefs the iterator over the descriptors to write */ protected void writeEntityManagerFactoryReferenceDescriptors(Node parentNode, Iterator entityMgrFactoryRefs) { if (entityMgrFactoryRefs==null || !entityMgrFactoryRefs.hasNext()) return; EntityManagerFactoryReferenceNode subNode = new EntityManagerFactoryReferenceNode(); for (;entityMgrFactoryRefs.hasNext();) { EntityManagerFactoryReferenceDescriptor aEntityMgrFactoryRef = (EntityManagerFactoryReferenceDescriptor)entityMgrFactoryRefs.next(); subNode.writeDescriptor(parentNode, TagNames.PERSISTENCE_UNIT_REF, aEntityMgrFactoryRef); } }
public EntityManagerFactoryReferenceNode() { super(); registerElementHandler(new XMLElement(TagNames.INJECTION_TARGET), InjectionTargetNode.class, "addInjectionTarget"); }
/** * write the descriptor class to a DOM tree and return it * * @param parent node in the DOM tree * @param node name for the root element of this xml fragment * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, EntityManagerFactoryReferenceDescriptor descriptor) { Node entityMgrFactoryRefNode = appendChild(parent, nodeName); writeLocalizedDescriptions(entityMgrFactoryRefNode, descriptor); appendTextChild(entityMgrFactoryRefNode, TagNames.PERSISTENCE_UNIT_REF_NAME, descriptor.getName()); appendTextChild(entityMgrFactoryRefNode, TagNames.PERSISTENCE_UNIT_NAME, descriptor.getUnitName()); if( descriptor.isInjectable() ) { InjectionTargetNode ijNode = new InjectionTargetNode(); for (InjectionTarget target : descriptor.getInjectionTargets()) { ijNode.writeDescriptor(entityMgrFactoryRefNode, TagNames.INJECTION_TARGET, target); } } return entityMgrFactoryRefNode; } }
/** * write the descriptor class to a DOM tree and return it * * @param parent node in the DOM tree * @param node name for the root element of this xml fragment * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, EntityManagerFactoryReferenceDescriptor descriptor) { Node entityMgrFactoryRefNode = appendChild(parent, nodeName); writeLocalizedDescriptions(entityMgrFactoryRefNode, descriptor); appendTextChild(entityMgrFactoryRefNode, TagNames.PERSISTENCE_UNIT_REF_NAME, descriptor.getName()); appendTextChild(entityMgrFactoryRefNode, TagNames.PERSISTENCE_UNIT_NAME, descriptor.getUnitName()); if( descriptor.isInjectable() ) { InjectionTargetNode ijNode = new InjectionTargetNode(); for (InjectionTarget target : descriptor.getInjectionTargets()) { ijNode.writeDescriptor(entityMgrFactoryRefNode, TagNames.INJECTION_TARGET, target); } } return entityMgrFactoryRefNode; } }
/** * write a list of entity manager factory reference descriptors to * a DOM Tree * * @param parentNode parent node for the DOM tree * @param entityMgrFactoryRefs the iterator over the descriptors to write */ protected void writeEntityManagerFactoryReferenceDescriptors(Node parentNode, Iterator entityMgrFactoryRefs) { if (entityMgrFactoryRefs==null || !entityMgrFactoryRefs.hasNext()) return; EntityManagerFactoryReferenceNode subNode = new EntityManagerFactoryReferenceNode(); for (;entityMgrFactoryRefs.hasNext();) { EntityManagerFactoryReferenceDescriptor aEntityMgrFactoryRef = (EntityManagerFactoryReferenceDescriptor)entityMgrFactoryRefs.next(); subNode.writeDescriptor(parentNode, TagNames.PERSISTENCE_UNIT_REF, aEntityMgrFactoryRef); } }
public EntityManagerFactoryReferenceNode() { super(); registerElementHandler(new XMLElement(TagNames.INJECTION_TARGET), InjectionTargetNode.class, "addInjectionTarget"); }