public void addChoiceElement(String xpath, String elementTypeName) { addChoiceElement(xpath, elementTypeName, false); }
public void addChoiceElement(XMLField sourceField, Class elementType, XMLField targetField) { getFieldToClassMappings().put(sourceField, elementType); this.fieldToClassNameMappings.put(sourceField, elementType.getName()); if (classToFieldMappings.get(elementType) == null) { classToFieldMappings.put(elementType, sourceField); } addChoiceElementMapping(sourceField, elementType, targetField); }
public Vector<DatabaseField> getFields() { return this.collectFields(); }
public void addChoiceElement(List<XMLField> srcFields, String elementTypeName, List<XMLField> tgtFields) { for(XMLField sourceField:srcFields) { this.fieldToClassNameMappings.put(sourceField, elementTypeName); } if (getClassNameToSourceFieldsMappings().get(elementTypeName) == null) { getClassNameToSourceFieldsMappings().put(elementTypeName, srcFields); } addChoiceElementMapping(srcFields, elementTypeName, tgtFields); }
public void addChoiceElement(List<XMLField> srcFields, Class elementType, List<XMLField> tgtFields) { for(XMLField sourceField:srcFields) { getFieldToClassMappings().put(sourceField, elementType); this.fieldToClassNameMappings.put(sourceField, elementType.getName()); } if (getClassToSourceFieldsMappings().get(elementType) == null) { getClassToSourceFieldsMappings().put(elementType, srcFields); } addChoiceElementMapping(srcFields, elementType, tgtFields); }
public void preInitialize(AbstractSession session) throws DescriptorException { getAttributeAccessor().setIsWriteOnly(this.isWriteOnly()); getAttributeAccessor().setIsReadOnly(this.isReadOnly()); super.preInitialize(session); Iterator<XMLMapping> mappings = getChoiceElementMappings().values().iterator(); while(mappings.hasNext()){ DatabaseMapping nextMapping = (DatabaseMapping)mappings.next(); nextMapping.setDescriptor(getDescriptor()); nextMapping.setAttributeName(this.getAttributeName()); if(nextMapping.getAttributeAccessor() == temporaryAccessor){ nextMapping.setAttributeAccessor(getAttributeAccessor()); } nextMapping.preInitialize(session); } }
private DatabaseMapping buildXMLChoiceObjectMapping(String mappingUri) { XMLChoiceObjectMapping mapping = new XMLChoiceObjectMapping(); mapping.setAttributeName(getName()); //First add XPath for this property String xPath = getQualifiedXPath(mappingUri, getType().isDataType()); mapping.addChoiceElement(xPath, getType().getImplClass()); //For each substitutable property, create the xpath and add it. Iterator<SDOProperty> properties = this.getSubstitutableElements().iterator(); while(properties.hasNext()) { SDOProperty nextProp = properties.next(); xPath = nextProp.getQualifiedXPath(mappingUri, nextProp.getType().isDataType(), getContainingType()); mapping.addChoiceElement(xPath, nextProp.getType().getImplClass()); } return mapping; }
try { if (jaxbMapping.isAbstractCompositeObjectMapping()) { XMLChoiceObjectMapping xmlChoiceMapping = new XMLChoiceObjectMapping(); xmlChoiceMapping.setAttributeName(attributeName); copyAccessorToMapping(jaxbMapping, xmlChoiceMapping); xmlChoiceMapping.setProperties(jaxbMapping.getProperties()); xmlChoiceMapping.addChoiceElement(compositeMapping.getXPath(), Link.class); xmlChoiceMapping.addChoiceElement(compositeMapping.getXPath(), refDesc.getJavaClass()); xmlChoiceMapping.setConverter(new XMLJavaTypeConverter(Class.forName(adapterClassName, true, cl))); jaxbDescriptor.removeMappingForAttributeName(jaxbMapping.getAttributeName()); jaxbDescriptor.addMapping(xmlChoiceMapping);
public void setChoiceFieldToClassAssociations(ArrayList associations) { if(associations.size() > 0) { for(Object next:associations) { XMLChoiceFieldToClassAssociation<Converter, XMLField> association = (XMLChoiceFieldToClassAssociation<Converter, XMLField>)next; this.addChoiceElement(association.getXmlField(), association.getClassName()); if(association.getConverter() != null) { this.addConverter(association.getXmlField(), association.getConverter()); } } } } private void addChoiceElementMapping(XMLField xmlField, String className){
mappingsList.addAll(getChoiceElementMappings().values()); for(XMLMapping next:getChoiceElementMappingsByClass().values()) { if(!(mappingsList.contains(next))) { mappingsList.add(next); ((XMLDirectMapping)nextMapping).setIsWriteOnly(this.isWriteOnly()); if(converter != null){ ((AbstractDirectMapping)nextMapping).setConverter(converter); ((XMLCompositeObjectMapping)nextMapping).setIsWriteOnly(this.isWriteOnly()); if(converter != null){ ((AbstractCompositeObjectMapping)nextMapping).setConverter(converter);
public void addChoiceElement(XMLField sourceField, String elementTypeName, XMLField targetField) { this.fieldToClassNameMappings.put(sourceField, elementTypeName); addChoiceElementMapping(sourceField, elementTypeName, targetField); }
public ChoiceObjectMapping generateChoiceMapping(Property property, Descriptor descriptor, NamespaceInfo namespace) { ChoiceObjectMapping mapping = new XMLChoiceObjectMapping(); initializeXMLMapping((XMLChoiceObjectMapping)mapping, property);
public void initializeNodeValue() { XMLMapping xmlMapping = xmlChoiceMapping.getChoiceElementMappings().get(xmlField); if(xmlMapping instanceof XMLDirectMapping) { choiceElementNodeValue = new XMLDirectMappingNodeValue((XMLDirectMapping)xmlMapping); } else { choiceElementNodeValue = new XMLCompositeObjectMappingNodeValue((XMLCompositeObjectMapping)xmlMapping); } }
@Override public void writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, WriteType writeType) throws DescriptorException { Object value = getAttributeValueFromObject(object); Class valueClass = value.getClass(); if(valueClass == XMLRoot.class) { List<XMLField> xflds = getClassToSourceFieldsMappings().get(valueClass); if (xflds != null) { valueField = xflds.get(0);
public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if (this.fieldToClassMappings.size() == 0) { this.convertClassNamesToClasses(((XMLConversionManager) session.getDatasourcePlatform().getConversionManager()).getLoader()); Iterator<XMLMapping> mappings = getChoiceElementMappings().values().iterator(); while(mappings.hasNext()){ DatabaseMapping nextMapping = (DatabaseMapping)mappings.next();
public void writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session) throws DescriptorException { Object value = getAttributeValueFromObject(object); Class valueClass = value.getClass(); if(valueClass == XMLRoot.class) {
public void preInitialize(AbstractSession session) throws DescriptorException { getAttributeAccessor().setIsWriteOnly(this.isWriteOnly()); getAttributeAccessor().setIsReadOnly(this.isReadOnly()); super.preInitialize(session); ArrayList<XMLMapping> mappingsList = new ArrayList<XMLMapping>(); mappingsList.addAll(getChoiceElementMappings().values()); for(XMLMapping next:getChoiceElementMappingsByClass().values()) { if(!(mappingsList.contains(next))) { mappingsList.add(next); } } for(XMLMapping next:getChoiceElementMappingsByClass().values()) { if(!(mappingsList.contains(next))) { mappingsList.add(next); } } Iterator<XMLMapping> mappings = mappingsList.iterator(); while(mappings.hasNext()){ DatabaseMapping nextMapping = (DatabaseMapping)mappings.next(); nextMapping.setDescriptor(getDescriptor()); nextMapping.setAttributeName(this.getAttributeName()); if(nextMapping.getAttributeAccessor() == temporaryAccessor){ nextMapping.setAttributeAccessor(getAttributeAccessor()); } nextMapping.preInitialize(session); } }
private DatabaseMapping buildXMLChoiceObjectMapping(String mappingUri) { XMLChoiceObjectMapping mapping = new XMLChoiceObjectMapping(); mapping.setAttributeName(getName()); //First add XPath for this property String xPath = getQualifiedXPath(mappingUri, getType().isDataType()); mapping.addChoiceElement(xPath, getType().getImplClass()); //For each substitutable property, create the xpath and add it. Iterator<SDOProperty> properties = this.getSubstitutableElements().iterator(); while(properties.hasNext()) { SDOProperty nextProp = properties.next(); xPath = nextProp.getQualifiedXPath(mappingUri, nextProp.getType().isDataType(), getContainingType()); mapping.addChoiceElement(xPath, nextProp.getType().getImplClass()); } return mapping; }
try { if (jaxbMapping.isAbstractCompositeObjectMapping()) { XMLChoiceObjectMapping xmlChoiceMapping = new XMLChoiceObjectMapping(); xmlChoiceMapping.setAttributeName(attributeName); copyAccessorToMapping(jaxbMapping, xmlChoiceMapping); xmlChoiceMapping.setProperties(jaxbMapping.getProperties()); xmlChoiceMapping.addChoiceElement(compositeMapping.getXPath(), Link.class); xmlChoiceMapping.addChoiceElement(compositeMapping.getXPath(), refDesc.getJavaClass()); xmlChoiceMapping.setConverter(new XMLJavaTypeConverter(Class.forName(adapterClassName, true, cl))); jaxbDescriptor.removeMappingForAttributeName(jaxbMapping.getAttributeName()); jaxbDescriptor.addMapping(xmlChoiceMapping);
public void setChoiceFieldToClassAssociations(ArrayList associations) { if(associations.size() > 0) { for(Object next:associations) { XMLChoiceFieldToClassAssociation<Converter, XMLField> association = (XMLChoiceFieldToClassAssociation<Converter, XMLField>)next; this.addChoiceElement(association.getXmlField(), association.getClassName()); if(association.getConverter() != null) { this.addConverter(association.getXmlField(), association.getConverter()); } } } } private void addChoiceElementMapping(XMLField xmlField, String className){