/** * PUBLIC: * Specify the primary key field. * This should be called for each field that make up the primary key. * For EIS XML Descriptors use the addPrimaryKeyField(DatabaseField) API * and supply an org.eclipse.persistence.oxm.XMLField parameter instead of using this method */ @Override public void addPrimaryKeyFieldName(String fieldName) { if (isXMLFormat()) { addPrimaryKeyField(new XMLField(fieldName)); } else { super.addPrimaryKeyFieldName(fieldName); } }
/** * INTERNAL: * Build and return the field value from the specified nested database row. */ @Override public Object buildFieldValueFromNestedRow(AbstractRecord nestedRow, AbstractSession session) throws DatabaseException { Vector nestedRows = new Vector(1); nestedRows.add(nestedRow); return this.buildFieldValueFromNestedRows(nestedRows, "", session); }
/** * INTERNAL: * Configure the object builder for the correct dataFormat. */ @Override public void preInitialize(AbstractSession session) { // Must not initialize if already done. if (isInitialized(PREINITIALIZED)) { return; } if (isXMLFormat()) { setObjectBuilder(new XMLObjectBuilder(this)); if(this.hasInheritance()) { ((QNameInheritancePolicy)getInheritancePolicy()).setNamespaceResolver(this.namespaceResolver); } } // initializeQueryManager(); super.preInitialize(session); }
/** * PUBLIC: * Specify the primary key field. * This should be called for each field that make up the primary key. * For EIS XML Descriptors use the addPrimaryKeyField(DatabaseField) API * and supply an org.eclipse.persistence.oxm.XMLField parameter instead of using this method */ public void addPrimaryKeyFieldName(String fieldName) { if (getDataFormat() == EISDescriptor.XML) { addPrimaryKeyField(new XMLField(fieldName)); } else { super.addPrimaryKeyFieldName(fieldName); } }
/** * INTERNAL: * XML type descriptors should use XMLFields. */ @Override public DatabaseField buildField(String fieldName) { if (isXMLFormat()) { XMLField xmlField = new XMLField(fieldName); xmlField.setNamespaceResolver(this.getNamespaceResolver()); xmlField.initialize(); return xmlField; } else { return super.buildField(fieldName); } }
/** * Set the default record name from the descriptor. */ public void prepare(AbstractSession session) { if (getInputRecordName().length() == 0) { if ((getQuery() != null) && (getQuery().getDescriptor() instanceof EISDescriptor)) { EISDescriptor descriptor = (EISDescriptor)getQuery().getDescriptor(); setInputRecordName(descriptor.getDataTypeName()); } else { setInputRecordName("input"); } } super.prepare(session); }
/** * PUBLIC: Add a direct mapping to the receiver. The new mapping specifies * that an instance variable of the class of objects which the receiver * describes maps in the default manner for its type to the indicated * database field. * * @param attributeName * instanceVariableName is the name of an instance variable of * the class which the receiver describes. * @param fieldName * fieldName is the name of the xml element or attribute which * corresponds with the designated instance variable. * @return The newly created DatabaseMapping is returned. */ @Override public DatabaseMapping addDirectMapping(String attributeName, String fieldName) { EISDirectMapping mapping = new EISDirectMapping(); mapping.setAttributeName(attributeName); if (isXMLFormat()) { mapping.setXPath(fieldName); } else { mapping.setFieldName(fieldName); } return addMapping(mapping); }
public NamespaceResolver getNamespaceResolver() { NamespaceResolver namespaceResolver = null; if (isXmlDescriptor()) { namespaceResolver = ((XMLDescriptor)getDescriptor()).getNamespaceResolver(); } else if (getDescriptor() instanceof org.eclipse.persistence.eis.EISDescriptor) { namespaceResolver = ((org.eclipse.persistence.eis.EISDescriptor)getDescriptor()).getNamespaceResolver(); } return namespaceResolver; } /**
/** * INTERNAL: * XML type descriptors should use XMLFields. */ public DatabaseField buildField(String fieldName) { if (getDataFormat().equals(XML)) { XMLField xmlField = new XMLField(fieldName); xmlField.setNamespaceResolver(this.getNamespaceResolver()); xmlField.initialize(); return xmlField; } else { return super.buildField(fieldName); } }
/** * PUBLIC: * Add a direct mapping to the receiver. The new mapping specifies that * an instance variable of the class of objects which the receiver describes maps in * the default manner for its type to the indicated database field. * * @param String instanceVariableName is the name of an instance variable of the * class which the receiver describes. * @param String fieldName is the name of the xml element or attribute which corresponds * with the designated instance variable. * @return The newly created DatabaseMapping is returned. */ public DatabaseMapping addDirectMapping(String attributeName, String fieldName) { EISDirectMapping mapping = new EISDirectMapping(); mapping.setAttributeName(attributeName); if (getDataFormat() == EISDescriptor.XML) { mapping.setXPath(fieldName); } else { mapping.setFieldName(fieldName); } return addMapping(mapping); }
/** * PUBLIC: * Specify the data type name for the class of objects the descriptor maps. * This may be the XML schema complex type name, or the JCA record name for the type being mapped. */ public String getDataTypeName() throws DescriptorException { return this.getTableName(); }
/** * Aggregates use a dummy table as default. */ @Override protected DatabaseTable extractDefaultTable() { if (this.isAggregateDescriptor()) { return new DatabaseTable(); } return super.extractDefaultTable(); }
if (!getDataFormat().equals(XML)) { if (!(fieldValue instanceof List)) { return new DatabaseRecord(1); return getObjectBuilder().createRecord(null); return getObjectBuilder().createRecord(null); } else { return getObjectBuilder().createRecord(null);
/** * INTERNAL: * Build the nested row. */ @Override public AbstractRecord buildNestedRowFromFieldValue(Object fieldValue) { if (fieldValue instanceof AbstractRecord) { return (AbstractRecord)fieldValue; } // BUG#2667762 if the tag was empty this could be a string of whitespace. if (!(fieldValue instanceof List)) { return getObjectBuilder().createRecord(0, null); } List nestedRows = (List)fieldValue; if (nestedRows.isEmpty()) { return getObjectBuilder().createRecord(0, null); } else { // BUG#2667762 if the tag was empty this could be a string of whitespace. if (!(nestedRows.get(0) instanceof AbstractRecord)) { return getObjectBuilder().createRecord(0, null); } return (AbstractRecord)nestedRows.get(0); } }
/** * INTERNAL: * XML type descriptors should use XMLFields. */ @Override public DatabaseField buildField(String fieldName) { if (isXMLFormat()) { XMLField xmlField = new XMLField(fieldName); xmlField.setNamespaceResolver(this.getNamespaceResolver()); xmlField.initialize(); return xmlField; } else { return super.buildField(fieldName); } }
/** * Set the default record name from the descriptor. */ public void prepare(AbstractSession session) { if (getInputRecordName().length() == 0) { if ((getQuery() != null) && (getQuery().getDescriptor() instanceof EISDescriptor)) { EISDescriptor descriptor = (EISDescriptor)getQuery().getDescriptor(); setInputRecordName(descriptor.getDataTypeName()); } else { setInputRecordName("input"); } } super.prepare(session); }
/** * PUBLIC: Add a direct mapping to the receiver. The new mapping specifies * that an instance variable of the class of objects which the receiver * describes maps in the default manner for its type to the indicated * database field. * * @param attributeName * instanceVariableName is the name of an instance variable of * the class which the receiver describes. * @param fieldName * fieldName is the name of the xml element or attribute which * corresponds with the designated instance variable. * @return The newly created DatabaseMapping is returned. */ @Override public DatabaseMapping addDirectMapping(String attributeName, String fieldName) { EISDirectMapping mapping = new EISDirectMapping(); mapping.setAttributeName(attributeName); if (isXMLFormat()) { mapping.setXPath(fieldName); } else { mapping.setFieldName(fieldName); } return addMapping(mapping); }
public NamespaceResolver getNamespaceResolver() { NamespaceResolver namespaceResolver = null; if (isXmlDescriptor()) { namespaceResolver = ((XMLDescriptor)getDescriptor()).getNamespaceResolver(); } else if (getDescriptor() instanceof org.eclipse.persistence.eis.EISDescriptor) { namespaceResolver = ((org.eclipse.persistence.eis.EISDescriptor)getDescriptor()).getNamespaceResolver(); } return namespaceResolver; } /**
/** * INTERNAL: * If the field is an XMLField then set the namespace resolver from the descriptor. * This allows the resolver to only be set in the descriptor. */ public DatabaseField buildField(DatabaseField field) { if(getDataFormat().equals(XML)) { if(!(field instanceof XMLField)) { field = new XMLField(field.getName()); } ((XMLField)field).setNamespaceResolver(getNamespaceResolver()); ((XMLField)field).initialize(); } return super.buildField(field); }
/** * PUBLIC: * Add a direct to node mapping to the receiver. The new mapping specifies that * a variable accessed by the get and set methods of the class of objects which * the receiver describes maps in the default manner for its type to the indicated * database field. */ public DatabaseMapping addDirectMapping(String attributeName, String getMethodName, String setMethodName, String fieldName) { EISDirectMapping mapping = new EISDirectMapping(); mapping.setAttributeName(attributeName); mapping.setSetMethodName(setMethodName); mapping.setGetMethodName(getMethodName); if (getDataFormat() == EISDescriptor.XML) { mapping.setXPath(fieldName); } else { mapping.setFieldName(fieldName); } return addMapping(mapping); }