FileDocCategorySizeDatePackage
XMLTableHelper.javaAPI DocGlassfish v2 API3762Tue May 22 16:54:32 BST 2007oracle.toplink.essentials.internal.ejb.cmp3.xml.tables

XMLTableHelper

public class XMLTableHelper extends Object
Object to hold onto an XML table metadata in a TopLink database table.
author
Guy Pelletier
since
TopLink EJB 3.0 Reference Implementation

Fields Summary
Constructors Summary
Methods Summary
public static voidprocessUniqueConstraints(org.w3c.dom.Node node, oracle.toplink.essentials.internal.ejb.cmp3.xml.XMLHelper helper, oracle.toplink.essentials.internal.helper.DatabaseTable table)
INTERNAL: Process the unique-constraints for a given table node.

        NodeList uniqueConstraintNodes = helper.getNodes(node, XMLConstants.UNIQUE_CONSTRAINTS);
        
        if (uniqueConstraintNodes != null) {
            for (int i = 0; i < uniqueConstraintNodes.getLength(); i++) {
                NodeList columnNameNodes = helper.getTextColumnNodes(uniqueConstraintNodes.item(i));
                
                if (columnNameNodes != null) {
                    List<String> columnNames = new ArrayList<String>(columnNameNodes.getLength());
                    for (int k = 0; k < columnNameNodes.getLength(); k++) {
                        String columnName = columnNameNodes.item(k).getNodeValue();
                        
                        if (columnName != null && !columnName.equals("")) {
                            columnNames.add(columnName);
                        }
                    }
                    if (columnNames.size() > 0) {
                        table.addUniqueConstraints(columnNames.toArray(new String[0]));
                    }
                }
            }
        }