/** * Creates a new <code>persistence-unit</code> element * @return the new created instance of <code>PersistenceUnit<PersistenceDescriptor></code> */ public PersistenceUnit<PersistenceDescriptor> createPersistenceUnit() { return new PersistenceUnitImpl<PersistenceDescriptor>(this, "persistence-unit", model); }
public PersistenceDescriptorImpl(String descriptorName, Node node) { super(descriptorName); this.model = node; addDefaultNamespaces(); }
/** * Adds the default namespaces as defined in the specification * @return the current instance of <code>PersistenceDescriptor</code> */ public PersistenceDescriptor addDefaultNamespaces() { addNamespace("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); addNamespace("xsi:schemaLocation", "http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"); addNamespace("xmlns", "http://java.sun.com/xml/ns/persistence"); return this; }
/** * If not already created, a new <code>persistence-unit</code> element will be created and returned. * Otherwise, the first existing <code>persistence-unit</code> element will be returned. * @return the instance defined for the element <code>persistence-unit</code> */ public PersistenceUnit<PersistenceDescriptor> getOrCreatePersistenceUnit() { List<Node> nodeList = model.get("persistence-unit"); if (nodeList != null && nodeList.size() > 0) { return new PersistenceUnitImpl<PersistenceDescriptor>(this, "persistence-unit", model, nodeList.get(0)); } return createPersistenceUnit(); }
/** * If not already created, a new <code>property</code> element will be created and returned. * Otherwise, the first existing <code>property</code> element will be returned. * @return the instance defined for the element <code>property</code> */ public Property<Properties<T>> getOrCreateProperty() { List<Node> nodeList = childNode.get("property"); if (nodeList != null && nodeList.size() > 0) { return new PropertyImpl<Properties<T>>(this, "property", childNode, nodeList.get(0)); } return createProperty(); }
/** * Creates a new <code>property</code> element * @return the new created instance of <code>Property<Properties<T>></code> */ public Property<Properties<T>> createProperty() { return new PropertyImpl<Properties<T>>(this, "property", childNode); }
/** * If not already created, a new <code>properties</code> element with the given value will be created. * Otherwise, the existing <code>properties</code> element will be returned. * @return a new or existing instance of <code>Properties<PersistenceUnit<T>></code> */ public Properties<PersistenceUnit<T>> getOrCreateProperties() { Node node = childNode.getOrCreate("properties"); Properties<PersistenceUnit<T>> properties = new PropertiesImpl<PersistenceUnit<T>>(this, "properties", childNode, node); return properties; }
/** * If not already created, a new <code>persistence-unit</code> element will be created and returned. * Otherwise, the first existing <code>persistence-unit</code> element will be returned. * @return the instance defined for the element <code>persistence-unit</code> */ public PersistenceUnit<PersistenceDescriptor> getOrCreatePersistenceUnit() { List<Node> nodeList = model.get("persistence-unit"); if (nodeList != null && nodeList.size() > 0) { return new PersistenceUnitImpl<PersistenceDescriptor>(this, "persistence-unit", model, nodeList.get(0)); } return createPersistenceUnit(); }
/** * If not already created, a new <code>property</code> element will be created and returned. * Otherwise, the first existing <code>property</code> element will be returned. * @return the instance defined for the element <code>property</code> */ public Property<Properties<T>> getOrCreateProperty() { List<Node> nodeList = childNode.get("property"); if (nodeList != null && nodeList.size() > 0) { return new PropertyImpl<Properties<T>>(this, "property", childNode, nodeList.get(0)); } return createProperty(); }
/** * Creates a new <code>persistence-unit</code> element * @return the new created instance of <code>PersistenceUnit<PersistenceDescriptor></code> */ public PersistenceUnit<PersistenceDescriptor> createPersistenceUnit() { return new PersistenceUnitImpl<PersistenceDescriptor>(this, "persistence-unit", model); }
/** * Creates a new <code>property</code> element * @return the new created instance of <code>Property<Properties<T>></code> */ public Property<Properties<T>> createProperty() { return new PropertyImpl<Properties<T>>(this, "property", childNode); }
public PersistenceDescriptorImpl(String descriptorName, Node node) { super(descriptorName); this.model = node; addDefaultNamespaces(); }
/** * Adds the default namespaces as defined in the specification * @return the current instance of <code>PersistenceDescriptor</code> */ public PersistenceDescriptor addDefaultNamespaces() { addNamespace("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); addNamespace("xsi:schemaLocation", "http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"); addNamespace("xmlns", "http://java.sun.com/xml/ns/persistence"); return this; }
/** * If not already created, a new <code>properties</code> element with the given value will be created. * Otherwise, the existing <code>properties</code> element will be returned. * @return a new or existing instance of <code>Properties<PersistenceUnit<T>></code> */ public Properties<PersistenceUnit<T>> getOrCreateProperties() { Node node = childNode.getOrCreate("properties"); Properties<PersistenceUnit<T>> properties = new PropertiesImpl<PersistenceUnit<T>>(this, "properties", childNode, node); return properties; }
/** * Returns all <code>persistence-unit</code> elements * @return list of <code>persistence-unit</code> */ public List<PersistenceUnit<PersistenceDescriptor>> getAllPersistenceUnit() { List<PersistenceUnit<PersistenceDescriptor>> list = new ArrayList<PersistenceUnit<PersistenceDescriptor>>(); List<Node> nodeList = model.get("persistence-unit"); for(Node node: nodeList) { PersistenceUnit<PersistenceDescriptor> type = new PersistenceUnitImpl<PersistenceDescriptor>(this, "persistence-unit", model, node); list.add(type); } return list; }
/** * Returns all <code>property</code> elements * @return list of <code>property</code> */ public List<Property<Properties<T>>> getAllProperty() { List<Property<Properties<T>>> list = new ArrayList<Property<Properties<T>>>(); List<Node> nodeList = childNode.get("property"); for(Node node: nodeList) { Property<Properties<T>> type = new PropertyImpl<Properties<T>>(this, "property", childNode, node); list.add(type); } return list; }
/** * Returns all <code>persistence-unit</code> elements * @return list of <code>persistence-unit</code> */ public List<PersistenceUnit<PersistenceDescriptor>> getAllPersistenceUnit() { List<PersistenceUnit<PersistenceDescriptor>> list = new ArrayList<PersistenceUnit<PersistenceDescriptor>>(); List<Node> nodeList = model.get("persistence-unit"); for(Node node: nodeList) { PersistenceUnit<PersistenceDescriptor> type = new PersistenceUnitImpl<PersistenceDescriptor>(this, "persistence-unit", model, node); list.add(type); } return list; }
/** * Returns all <code>property</code> elements * @return list of <code>property</code> */ public List<Property<Properties<T>>> getAllProperty() { List<Property<Properties<T>>> list = new ArrayList<Property<Properties<T>>>(); List<Node> nodeList = childNode.get("property"); for(Node node: nodeList) { Property<Properties<T>> type = new PropertyImpl<Properties<T>>(this, "property", childNode, node); list.add(type); } return list; }