if (isNullable != null || maxLength != null || precision != null || scale != null || isFixedLength != null || isUnicode != null || concurrencyMode != null || defaultValue != null || collation != null) { Facets facets = new Facets(); if (isNullable != null) { facets.setNullable("true".equalsIgnoreCase(isNullable)); facets.setMaxLength(Integer.MAX_VALUE); } else { facets.setMaxLength(Integer.parseInt(maxLength)); facets.setPrecision(Integer.parseInt(precision)); facets.setScale(Integer.parseInt(scale)); facets.setFixedLength("true".equalsIgnoreCase(isFixedLength)); facets.setUnicode("true".equalsIgnoreCase(isUnicode)); facets.setConcurrencyMode(EdmConcurrencyMode.values()[i]); facets.setDefaultValue(defaultValue); facets.setCollation(collation); return facets; } else {
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; }
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); } } } }
private static void setNullable(final Column column, final SimpleProperty edmProperty) { ((Facets) edmProperty.getFacets()).setNullable(column.nullable()); }
private static void setMaxLength(final Column column, final SimpleProperty edmProperty) { if (column.length() > 0) { ((Facets) edmProperty.getFacets()).setMaxLength(column.length()); } }
private static void setScale(final Column column, final SimpleProperty edmProperty) { if (column.scale() > 0) { ((Facets) edmProperty.getFacets()).setScale(column.scale()); } } }
private static void setPrecision(final Column column, final SimpleProperty edmProperty) { if (column.precision() > 0) { ((Facets) edmProperty.getFacets()).setPrecision(column.precision()); } }
Facets facets = new Facets(); edmProperty.setFacets(facets);
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; }
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); } } } }
private static void setNullable(final Column column, final SimpleProperty edmProperty) { ((Facets) edmProperty.getFacets()).setNullable(column.nullable()); }
private static void setMaxLength(final Column column, final SimpleProperty edmProperty) { if (column.length() > 0) { ((Facets) edmProperty.getFacets()).setMaxLength(column.length()); } }
private static void setScale(final Column column, final SimpleProperty edmProperty) { if (column.scale() > 0) { ((Facets) edmProperty.getFacets()).setScale(column.scale()); } } }
private static void setPrecision(final Column column, final SimpleProperty edmProperty) { if (column.precision() > 0) { ((Facets) edmProperty.getFacets()).setPrecision(column.precision()); } }
Facets facets = new Facets(); edmProperty.setFacets(facets);
if (isNullable != null || maxLength != null || precision != null || scale != null || isFixedLength != null || isUnicode != null || concurrencyMode != null || defaultValue != null || collation != null) { EdmFacets facets = new Facets(); if (isNullable != null) { ((Facets) facets).setNullable("true".equalsIgnoreCase(isNullable)); ((Facets) facets).setMaxLength(Integer.MAX_VALUE); } else { ((Facets) facets).setMaxLength(Integer.parseInt(maxLength)); ((Facets) facets).setPrecision(Integer.parseInt(precision)); ((Facets) facets).setScale(Integer.parseInt(scale)); ((Facets) facets).setFixedLength("true".equalsIgnoreCase(isFixedLength)); ((Facets) facets).setUnicode("true".equalsIgnoreCase(isUnicode)); ((Facets) facets).setConcurrencyMode(EdmConcurrencyMode.values()[i]); ((Facets) facets).setDefaultValue(defaultValue); ((Facets) facets).setCollation(collation); return facets; } else {
Facets facets = new Facets(); if (annotation.facets().maxLength() > 0) { facets.setMaxLength(annotation.facets().maxLength()); facets.setNullable(false); } else { facets.setNullable(true); facets.setPrecision(annotation.facets().precision()); facets.setScale(annotation.facets().scale());
@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; }
if (isNullable != null || maxLength != null || precision != null || scale != null || isFixedLength != null || isUnicode != null || concurrencyMode != null || defaultValue != null || collation != null) { Facets facets = new Facets(); if (isNullable != null) { facets.setNullable("true".equalsIgnoreCase(isNullable)); facets.setMaxLength(Integer.MAX_VALUE); } else { facets.setMaxLength(Integer.parseInt(maxLength)); facets.setPrecision(Integer.parseInt(precision)); facets.setScale(Integer.parseInt(scale)); facets.setFixedLength("true".equalsIgnoreCase(isFixedLength)); facets.setUnicode("true".equalsIgnoreCase(isUnicode)); facets.setConcurrencyMode(EdmConcurrencyMode.values()[i]); facets.setDefaultValue(defaultValue); facets.setCollation(collation); return facets; } else {