SimpleProperty newSimpleProperty = new SimpleProperty(); SimpleProperty oldSimpleProperty = (SimpleProperty) property; newSimpleProperty.setAnnotationAttributes(oldSimpleProperty.getAnnotationAttributes()); newSimpleProperty.setAnnotationElements(oldSimpleProperty.getAnnotationElements()); newSimpleProperty.setCustomizableFeedMappings(oldSimpleProperty.getCustomizableFeedMappings()); newSimpleProperty.setDocumentation(oldSimpleProperty.getDocumentation()); newSimpleProperty.setFacets(oldSimpleProperty.getFacets()); newSimpleProperty.setMimeType(oldSimpleProperty.getMimeType()); newSimpleProperty.setName(oldSimpleProperty.getName()); newSimpleProperty.setType(oldSimpleProperty.getType()); JPAEdmMappingImpl newMapping = new JPAEdmMappingImpl(); Mapping mapping = oldSimpleProperty.getMapping(); JPAEdmMapping oldMapping = (JPAEdmMapping) mapping; newMapping.setJPAColumnName(oldMapping.getJPAColumnName()); newMapping.setObject(mapping.getObject()); newMapping.setJPAType(oldMapping.getJPAType()); newSimpleProperty.setMapping(newMapping); expandedList.add(newSimpleProperty); } catch (ClassCastException e) {
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)); sp.setFacets(createFacets(ep.facets(), field.getAnnotation(EdmConcurrencyControl.class))); return sp; }
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; }
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; }
public EdmSimplePropertyImplProv(final EdmImplProv edm, final SimpleProperty property) throws EdmException { super(edm, property.getType().getFullQualifiedName(), property); this.property = property; }
public void normalizeComplexKey(final ComplexType complexType, final List<PropertyRef> propertyRefList) { for (Property property : complexType.getProperties()) { try { SimpleProperty simpleProperty = (SimpleProperty) property; Facets facets = (Facets) simpleProperty.getFacets(); if (facets == null) { simpleProperty.setFacets(new Facets().setNullable(false)); } else { facets.setNullable(false); } PropertyRef propertyRef = new PropertyRef(); propertyRef.setName(simpleProperty.getName()); propertyRefList.add(propertyRef); } catch (ClassCastException e) { ComplexProperty complexProperty = (ComplexProperty) property; normalizeComplexKey(complexTypeView.searchEdmComplexType(complexProperty.getType()), propertyRefList); } } } }
.addContent(joinColumn.referencedColumnName() + " -> " + referencedEntityType.getName()), null); currentSimpleProperty = new SimpleProperty(); properties.add(buildSimpleProperty(currentRefAttribute, currentSimpleProperty, joinColumn)); if(joinColumn.nullable()) { currentSimpleProperty.getFacets();
view.getEdmSimpleProperty().setName(propertyName); view.getEdmSimpleProperty().setMapping((Mapping) mapping);
currentSimpleProperty = new SimpleProperty(); properties.add(buildSimpleProperty(currentAttribute, currentSimpleProperty)); if (((SingularAttribute<?, ?>) currentAttribute).isId()) {
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 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)); sp.setFacets(createFacets(ep.facets(), field.getAnnotation(EdmConcurrencyControl.class))); return sp; }
public EdmSimplePropertyImplProv(final EdmImplProv edm, final SimpleProperty property) throws EdmException { super(edm, property.getType().getFullQualifiedName(), property); this.property = property; }
public void normalizeComplexKey(final ComplexType complexType, final List<PropertyRef> propertyRefList) { for (Property property : complexType.getProperties()) { try { SimpleProperty simpleProperty = (SimpleProperty) property; Facets facets = (Facets) simpleProperty.getFacets(); if (facets == null) { simpleProperty.setFacets(new Facets().setNullable(false)); } else { facets.setNullable(false); } PropertyRef propertyRef = new PropertyRef(); propertyRef.setName(simpleProperty.getName()); propertyRefList.add(propertyRef); } catch (ClassCastException e) { ComplexProperty complexProperty = (ComplexProperty) property; normalizeComplexKey(complexTypeView.searchEdmComplexType(complexProperty.getType()), propertyRefList); } } } }
currentSimpleProperty = new SimpleProperty(); properties.add(buildSimpleProperty(currentRefAttribute, currentSimpleProperty, joinColumn)); if(joinColumn.nullable()) { currentSimpleProperty.getFacets();
view.getEdmSimpleProperty().setName(propertyName); view.getEdmSimpleProperty().setMapping((Mapping) mapping);
currentSimpleProperty = new SimpleProperty(); properties.add(buildSimpleProperty(currentAttribute, currentSimpleProperty)); break;