private Property readSimpleProperty(final XMLStreamReader reader, final FullQualifiedName fqName) throws XMLStreamException { SimpleProperty property = new SimpleProperty(); property.setName(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAME)); property.setType(EdmSimpleTypeKind.valueOf(fqName.getName())); return property; }
private Property readSimpleProperty(final XMLStreamReader reader, final FullQualifiedName fqName) throws XMLStreamException { SimpleProperty property = new SimpleProperty(); property.setName(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAME)); property.setType(EdmSimpleTypeKind.valueOf(fqName.getName())); return property; }
private Property readSimpleProperty(final XMLStreamReader reader, final FullQualifiedName fqName) throws XMLStreamException { SimpleProperty property = new SimpleProperty(); property.setName(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAME)); property.setType(EdmSimpleTypeKind.valueOf(fqName.getName())); return property; }
private Property createSimpleProperty(final EdmProperty ep, final Field field) { SimpleProperty sp = new SimpleProperty(); String entityName = ANNOTATION_HELPER.getPropertyName(field); sp.setName(entityName); // EdmType type = ep.type(); if (type == EdmType.NULL) { type = getEdmType(field.getType()); } sp.setType(ANNOTATION_HELPER.mapTypeKind(type)); return sp; }
private Property createSimpleProperty(final EdmProperty ep, final Field field) { SimpleProperty sp = new SimpleProperty(); String entityName = ANNOTATION_HELPER.getPropertyName(field); sp.setName(entityName); // EdmType type = ep.type(); if (type == EdmType.NULL) { type = getEdmType(field.getType()); } sp.setType(ANNOTATION_HELPER.mapTypeKind(type)); sp.setFacets(createFacets(ep.facets(), field.getAnnotation(EdmConcurrencyControl.class))); return sp; }
private Property createSimpleProperty(final EdmProperty ep, final Field field) { SimpleProperty sp = new SimpleProperty(); String entityName = ANNOTATION_HELPER.getPropertyName(field); sp.setName(entityName); // EdmType type = ep.type(); if (type == EdmType.NULL) { type = getEdmType(field.getType()); } sp.setType(ANNOTATION_HELPER.mapTypeKind(type)); sp.setFacets(createFacets(ep.facets(), field.getAnnotation(EdmConcurrencyControl.class))); return sp; }
private SimpleProperty buildSimpleProperty(final Attribute<?, ?> jpaAttribute, final SimpleProperty simpleProperty, final JoinColumn joinColumn) throws ODataJPAModelException, ODataJPARuntimeException { boolean isForeignKey = joinColumn != null; JPAEdmNameBuilder.build(JPAEdmProperty.this, isBuildModeComplexType, skipDefaultNaming, isForeignKey); EdmSimpleTypeKind simpleTypeKind = JPATypeConverter .convertToEdmSimpleType(jpaAttribute .getJavaType(), jpaAttribute); simpleProperty.setType(simpleTypeKind); Facets facets = JPAEdmFacets.createAndSet(jpaAttribute, simpleProperty); if(isForeignKey) { facets.setNullable(joinColumn.nullable()); } return simpleProperty; }
private SimpleProperty buildSimpleProperty(final Attribute<?, ?> jpaAttribute, final SimpleProperty simpleProperty, final JoinColumn joinColumn) throws ODataJPAModelException, ODataJPARuntimeException { boolean isForeignKey = joinColumn != null; JPAEdmNameBuilder.build(JPAEdmProperty.this, isBuildModeComplexType, skipDefaultNaming, isForeignKey); EdmSimpleTypeKind simpleTypeKind = JPATypeConverter .convertToEdmSimpleType(jpaAttribute .getJavaType(), jpaAttribute); simpleProperty.setType(simpleTypeKind); Facets facets = JPAEdmFacets.createAndSet(jpaAttribute, simpleProperty); if(isForeignKey) { facets.setNullable(joinColumn.nullable()); } int total = 0; String name = simpleProperty.getName(); for (Property property: properties) { if (property.getName().equals(name)) { total++; name = simpleProperty.getName() + "_"+ total; } } if (total > 0) { simpleProperty.setName(name); } return simpleProperty; }
newSimpleProperty.setMimeType(oldSimpleProperty.getMimeType()); newSimpleProperty.setName(oldSimpleProperty.getName()); newSimpleProperty.setType(oldSimpleProperty.getType()); JPAEdmMappingImpl newMapping = new JPAEdmMappingImpl(); Mapping mapping = oldSimpleProperty.getMapping();
newSimpleProperty.setMimeType(oldSimpleProperty.getMimeType()); newSimpleProperty.setName(oldSimpleProperty.getName()); newSimpleProperty.setType(oldSimpleProperty.getType()); JPAEdmMappingImpl newMapping = new JPAEdmMappingImpl(); Mapping mapping = oldSimpleProperty.getMapping();
private Property clone(Property property) { if (property == null) { return null; } Property newAbstractProperty; if (property instanceof ComplexProperty) { ComplexProperty newProperty = new ComplexProperty(); newProperty.setType(((ComplexProperty) property).getType()); newAbstractProperty = newProperty; } else { SimpleProperty newProperty = new SimpleProperty(); newProperty.setType(((SimpleProperty) property).getType()); newAbstractProperty = newProperty; } newAbstractProperty.setAnnotationAttributes(property .getAnnotationAttributes()); newAbstractProperty.setAnnotationElements(property .getAnnotationElements()); newAbstractProperty.setCustomizableFeedMappings(property .getCustomizableFeedMappings()); newAbstractProperty.setDocumentation(property.getDocumentation()); newAbstractProperty.setFacets(property.getFacets()); newAbstractProperty.setMapping(property.getMapping()); newAbstractProperty.setMimeType(property.getMimeType()); newAbstractProperty.setName(property.getName()); return newAbstractProperty; }