private static void setNullable(final Column column, final SimpleProperty edmProperty) { ((Facets) edmProperty.getFacets()).setNullable(column.nullable()); }
private static void setNullable(final Column column, final SimpleProperty edmProperty) { ((Facets) edmProperty.getFacets()).setNullable(column.nullable()); }
Facets facets = new Facets(); if (isNullable != null) { facets.setNullable("true".equalsIgnoreCase(isNullable));
EdmFacets facets = new Facets(); if (isNullable != null) { ((Facets) facets).setNullable("true".equalsIgnoreCase(isNullable));
Facets facets = new Facets(); if (isNullable != null) { facets.setNullable("true".equalsIgnoreCase(isNullable));
Facets facets = new Facets(); if (isNullable != null) { facets.setNullable("true".equalsIgnoreCase(isNullable));
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); } } } }
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); } } } }
@Override public void build() throws ODataJPAModelException { List<PropertyRef> propertyRefList = null; if (key == null) { key = new Key(); } if (key.getKeys() == null) { propertyRefList = new ArrayList<PropertyRef>(); key.setKeys(propertyRefList); } else { propertyRefList = key.getKeys(); } if (isBuildModeComplexType) { ComplexType complexType = complexTypeView.searchEdmComplexType(propertyView.getJPAAttribute().getJavaType().getName()); normalizeComplexKey(complexType, propertyRefList); } else { PropertyRef propertyRef = new PropertyRef(); propertyRef.setName(propertyView.getEdmSimpleProperty().getName()); Facets facets = (Facets) propertyView.getEdmSimpleProperty().getFacets(); if (facets == null) { propertyView.getEdmSimpleProperty().setFacets(new Facets().setNullable(false)); } else { facets.setNullable(false); } propertyRefList.add(propertyRef); } }
@Override public void build() throws ODataJPAModelException { List<PropertyRef> propertyRefList = null; if (key == null) { key = new Key(); } if (key.getKeys() == null) { propertyRefList = new ArrayList<PropertyRef>(); key.setKeys(propertyRefList); } else { propertyRefList = key.getKeys(); } if (isBuildModeComplexType) { ComplexType complexType = complexTypeView.searchEdmComplexType(propertyView.getJPAAttribute().getJavaType().getName()); normalizeComplexKey(complexType, propertyRefList); } else { PropertyRef propertyRef = new PropertyRef(); propertyRef.setName(propertyView.getEdmSimpleProperty().getName()); Facets facets = (Facets) propertyView.getEdmSimpleProperty().getFacets(); if (facets == null) { propertyView.getEdmSimpleProperty().setFacets(new Facets().setNullable(false)); } else { facets.setNullable(false); } propertyRefList.add(propertyRef); } }
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; }
facets.setNullable(false); } else { facets.setNullable(true);
facets.setNullable(false); } else { facets.setNullable(true);
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; }
private Facets createFacets(final EdmFacets facets, final EdmConcurrencyControl concurrencyControl) { Facets resultFacets = new Facets().setNullable(facets.nullable()); if(facets.maxLength() > -1) { resultFacets.setMaxLength(facets.maxLength()); } if(facets.precision() > -1) { resultFacets.setPrecision(facets.precision()); } if(facets.scale() > -1) { resultFacets.setScale(facets.scale()); } if (concurrencyControl != null) { resultFacets.setConcurrencyMode(EdmConcurrencyMode.Fixed); } return resultFacets; }
private Facets createFacets(final EdmFacets facets, final EdmConcurrencyControl concurrencyControl) { Facets resultFacets = new Facets().setNullable(facets.nullable()); if(facets.maxLength() > -1) { resultFacets.setMaxLength(facets.maxLength()); } if(facets.precision() > -1) { resultFacets.setPrecision(facets.precision()); } if(facets.scale() > -1) { resultFacets.setScale(facets.scale()); } if (concurrencyControl != null) { resultFacets.setConcurrencyMode(EdmConcurrencyMode.Fixed); } return resultFacets; }