private ComplexType clone(ComplexType type) { if (type == null) { return null; } ComplexType newType = new ComplexType(); newType.setAbstract(type.isAbstract()); newType.setAnnotationAttributes(type.getAnnotationAttributes()); newType.setAnnotationElements(type.getAnnotationElements()); newType.setBaseType(type.getBaseType()); newType.setDocumentation(type.getDocumentation()); newType.setMapping(type.getMapping()); newType.setName(type.getName()); newType.setProperties(cloneProperties(type.getProperties())); return newType; }
public ComplexType buildComplexType() { ComplexType complexType = new ComplexType(); if (baseEntityType != null) { complexType.setBaseType(baseEntityType); } return complexType.setName(name).setProperties(properties); }
private ComplexType readComplexType(final XMLStreamReader reader) throws XMLStreamException, EntityProviderException { reader.require(XMLStreamConstants.START_ELEMENT, edmNamespace, XmlMetadataConstants.EDM_COMPLEX_TYPE); ComplexType complexType = new ComplexType(); List<Property> properties = new ArrayList<Property>(); List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>(); complexType.setName(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAME)); String baseType = reader.getAttributeValue(null, XmlMetadataConstants.EDM_BASE_TYPE); if (baseType != null) { complexType.setBaseType(extractFQName(baseType)); complexType.setAbstract("true".equalsIgnoreCase(reader.getAttributeValue(null, XmlMetadataConstants.EDM_TYPE_ABSTRACT))); complexType.setAnnotationAttributes(readAnnotationAttribute(reader)); while (reader.hasNext() && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI()) complexType.setAnnotationElements(annotationElements); complexType.setProperties(properties); if (complexType.getName() != null) { FullQualifiedName fqName = new FullQualifiedName(currentNamespace, complexType.getName()); complexTypesMap.put(fqName, complexType); } else {
for (ComplexType complexType : complexTypes) { xmlStreamWriter.writeStartElement(XmlMetadataConstants.EDM_COMPLEX_TYPE); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAME, complexType.getName()); if (complexType.getBaseType() != null) { xmlStreamWriter .writeAttribute(XmlMetadataConstants.EDM_BASE_TYPE, complexType.getBaseType().toString()); if (complexType.isAbstract()) { xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_TYPE_ABSTRACT, "true"); writeAnnotationAttributes(complexType.getAnnotationAttributes(), predefinedNamespaces, null, xmlStreamWriter); writeDocumentation(complexType.getDocumentation(), predefinedNamespaces, xmlStreamWriter); Collection<Property> properties = complexType.getProperties(); if (properties != null) { writeProperties(properties, predefinedNamespaces, xmlStreamWriter); writeAnnotationElements(complexType.getAnnotationElements(), predefinedNamespaces, xmlStreamWriter);
propertyView.getBuilder().build(); currentComplexType = new ComplexType(); currentComplexType.setProperties(propertyView.getEdmPropertyList()); JPAEdmNameBuilder.build(JPAEdmComplexType.this);
public static void build(final JPAEdmComplexType view) { JPAEdmMappingModelAccess mappingModelAccess = view.getJPAEdmMappingModelAccess(); String jpaEmbeddableTypeName = view.getJPAEmbeddableType().getJavaType().getSimpleName(); String edmComplexTypeName = null; if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) { edmComplexTypeName = mappingModelAccess.mapJPAEmbeddableType(jpaEmbeddableTypeName); } if (edmComplexTypeName == null) { edmComplexTypeName = jpaEmbeddableTypeName; } view.getEdmComplexType().setName(edmComplexTypeName); ComplexType complexType = view.getEdmComplexType(); complexType.setName(edmComplexTypeName); JPAEdmMapping mapping = new JPAEdmMappingImpl(); mapping.setJPAType(view.getJPAEmbeddableType().getJavaType()); complexType.setMapping((Mapping) mapping); }
private void includeComplexType(Schema targetSchema, IServiceInfo service, ComplexType sourceType) throws ODataException { List<ComplexType> types = targetSchema.getComplexTypes(); if (types != null) { for (ComplexType type : types) { if (type.getName().equals(sourceType.getName())) { throw new ODataException("complex type " + sourceType.getName() + " already defined"); } } } else { types = new ArrayList<ComplexType>(); } ComplexType newType = clone(sourceType); if (newType.getProperties() != null) { for (Property property : newType.getProperties()) { if (property instanceof ComplexProperty) { ((ComplexProperty) property).setType(new FullQualifiedName( targetSchema.getNamespace(), ((ComplexProperty) property).getType().getName())); } } } types.add(newType); targetSchema.setComplexTypes(types); }
/** * @param properties * @return {@link EntityType} for method chaining */ @Override public EntityType setProperties(final List<Property> properties) { super.setProperties(properties); return this; }
/** * @param name * @return {@link EntityType} for method chaining */ @Override public EntityType setName(final String name) { super.setName(name); return this; }
private void buildPropertiesInternal() throws EdmException { properties = new HashMap<String, Property>(); if (structuralType.getProperties() != null) { for (final Property property : structuralType.getProperties()) { properties.put(property.getName(), property); } } }
/** * @param baseType * @return {@link EntityType} for method chaining */ @Override public EntityType setBaseType(final FullQualifiedName baseType) { super.setBaseType(baseType); return this; }
/** * @param mapping * @return {@link EntityType} for method chaining */ @Override public EntityType setMapping(final Mapping mapping) { super.setMapping(mapping); return this; }
/** * Sets the collection of {@link AnnotationAttribute} for this {@link EntityType} * @param annotationAttributes * @return {@link EntityType} for method chaining */ @Override public EntityType setAnnotationAttributes(final List<AnnotationAttribute> annotationAttributes) { super.setAnnotationAttributes(annotationAttributes); return this; }
/** * @param isAbstract * @return {@link EntityType} for method chaining */ @Override public EntityType setAbstract(final boolean isAbstract) { super.setAbstract(isAbstract); return this; }
/** * Sets the collection of {@link AnnotationElement} for this {@link EntityType} * @param annotationElements * @return {@link EntityType} for method chaining */ @Override public EntityType setAnnotationElements(final List<AnnotationElement> annotationElements) { super.setAnnotationElements(annotationElements); return this; } }
private ComplexType readComplexType(final XMLStreamReader reader) throws XMLStreamException, EntityProviderException { reader.require(XMLStreamConstants.START_ELEMENT, edmNamespace, XmlMetadataConstants.EDM_COMPLEX_TYPE); ComplexType complexType = new ComplexType(); List<Property> properties = new ArrayList<Property>(); List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>(); complexType.setName(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAME)); String baseType = reader.getAttributeValue(null, XmlMetadataConstants.EDM_BASE_TYPE); if (baseType != null) { complexType.setBaseType(extractFQName(baseType)); complexType.setAbstract("true".equalsIgnoreCase(reader.getAttributeValue(null, XmlMetadataConstants.EDM_TYPE_ABSTRACT))); complexType.setAnnotationAttributes(readAnnotationAttribute(reader)); while (reader.hasNext() && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI()) complexType.setAnnotationElements(annotationElements); complexType.setProperties(properties); if (complexType.getName() != null) { FullQualifiedName fqName = new FullQualifiedName(currentNamespace, complexType.getName()); complexTypesMap.put(fqName, complexType); } else {
public ComplexType buildComplexType() { ComplexType complexType = new ComplexType(); if (baseEntityType != null) { complexType.setBaseType(baseEntityType); } return complexType.setName(name).setProperties(properties); }
for (ComplexType complexType : complexTypes) { xmlStreamWriter.writeStartElement(XmlMetadataConstants.EDM_COMPLEX_TYPE); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAME, complexType.getName()); if (complexType.getBaseType() != null) { xmlStreamWriter .writeAttribute(XmlMetadataConstants.EDM_BASE_TYPE, complexType.getBaseType().toString()); if (complexType.isAbstract()) { xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_TYPE_ABSTRACT, "true"); writeAnnotationAttributes(complexType.getAnnotationAttributes(), predefinedNamespaces, null, xmlStreamWriter); writeDocumentation(complexType.getDocumentation(), predefinedNamespaces, xmlStreamWriter); Collection<Property> properties = complexType.getProperties(); if (properties != null) { writeProperties(properties, predefinedNamespaces, xmlStreamWriter); writeAnnotationElements(complexType.getAnnotationElements(), predefinedNamespaces, xmlStreamWriter);