private static Property createPrimitive(final String name, EdmPrimitiveType type, final Object value) { return new Property(type.getFullQualifiedName().getFullQualifiedNameAsString(), name, (type instanceof AbstractGeospatialType?ValueType.GEOSPATIAL:ValueType.PRIMITIVE), value); }
private static Property createCollection(final String name, EdmPrimitiveType type, final ArrayList<Object> values) { return new Property(type.getFullQualifiedName().getFullQualifiedNameAsString(), name, (type instanceof AbstractGeospatialType?ValueType.COLLECTION_GEOSPATIAL:ValueType.COLLECTION_PRIMITIVE), values); }
@Override public InputStream primitiveValue(final EdmPrimitiveType type, final Object value, final PrimitiveValueSerializerOptions options) throws SerializerException { try { final String result = type.valueToString(value, options.isNullable(), options.getMaxLength(), options.getPrecision(), options.getScale(), options.isUnicode()); return new ByteArrayInputStream(result.getBytes("UTF-8")); } catch (final EdmPrimitiveTypeException e) { throw new SerializerException("Error in primitive-value formatting.", e, SerializerException.MessageKeys.WRONG_PRIMITIVE_VALUE, type.getFullQualifiedName().getFullQualifiedNameAsString(), value.toString()); } catch (final UnsupportedEncodingException e) { throw new SerializerException("Encoding exception.", e, SerializerException.MessageKeys.IO_EXCEPTION); } }
@Override public InputStream primitiveValue(final EdmPrimitiveType type, final Object value, final PrimitiveValueSerializerOptions options) throws SerializerException { try { final String result = type.valueToString(value, options.isNullable(), options.getMaxLength(), options.getPrecision(), options.getScale(), options.isUnicode()); return new ByteArrayInputStream(result.getBytes("UTF-8")); } catch (final EdmPrimitiveTypeException e) { throw new SerializerException("Error in primitive-value formatting.", e, SerializerException.MessageKeys.WRONG_PRIMITIVE_VALUE, type.getFullQualifiedName().getFullQualifiedNameAsString(), value.toString()); } catch (final UnsupportedEncodingException e) { throw new SerializerException("Encoding exception.", e, SerializerException.MessageKeys.IO_EXCEPTION); } }
private void writePrimitive(final EdmPrimitiveType type, final Property property, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode, final String xml10InvalidCharReplacement, final XMLStreamWriter writer) throws EdmPrimitiveTypeException, XMLStreamException, SerializerException { if (property.isPrimitive()) { if (type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String)) { writer.writeAttribute(METADATA, NS_METADATA, Constants.ATTR_TYPE, type.getKind() == EdmTypeKind.DEFINITION ? "#" + type.getFullQualifiedName().getFullQualifiedNameAsString() : type.getName()); } writePrimitiveValue(type, property.asPrimitive(), isNullable, maxLength, precision, scale, isUnicode, xml10InvalidCharReplacement, writer); } else if (property.isGeospatial()) { throw new SerializerException("Property type not yet supported!", SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, property.getName()); } else if (property.isEnum()) { writer.writeAttribute(METADATA, NS_METADATA, Constants.ATTR_TYPE, "#" + type.getFullQualifiedName().getFullQualifiedNameAsString()); writePrimitiveValue(type, property.asEnum(), isNullable, maxLength, precision, scale, isUnicode, xml10InvalidCharReplacement, writer); } else { throw new SerializerException("Inconsistent property type!", SerializerException.MessageKeys.INCONSISTENT_PROPERTY_TYPE, property.getName()); } }
writeMetadataETag(metadata, json); if (isODataMetadataFull) { json.writeStringField(constants.getType(), "#Collection("+type.getFullQualifiedName().getName()+")");
private void writePrimitive(final EdmPrimitiveType type, final Property property, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode, final String xml10InvalidCharReplacement, final XMLStreamWriter writer) throws EdmPrimitiveTypeException, XMLStreamException, SerializerException { if (property.isPrimitive()) { if (type != EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String)) { writer.writeAttribute(METADATA, NS_METADATA, Constants.ATTR_TYPE, type.getKind() == EdmTypeKind.DEFINITION ? "#" + type.getFullQualifiedName().getFullQualifiedNameAsString() : type.getName()); } writePrimitiveValue(type, property.asPrimitive(), isNullable, maxLength, precision, scale, isUnicode, xml10InvalidCharReplacement, writer); } else if (property.isGeospatial()) { throw new SerializerException("Property type not yet supported!", SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, property.getName()); } else if (property.isEnum()) { writer.writeAttribute(METADATA, NS_METADATA, Constants.ATTR_TYPE, "#" + type.getFullQualifiedName().getFullQualifiedNameAsString()); writePrimitiveValue(type, property.asEnum(), isNullable, maxLength, precision, scale, isUnicode, xml10InvalidCharReplacement, writer); } else { throw new SerializerException("Inconsistent property type!", SerializerException.MessageKeys.INCONSISTENT_PROPERTY_TYPE, property.getName()); } }
writeMetadataETag(metadata, json); if (isODataMetadataFull) { json.writeStringField(constants.getType(), "#Collection("+type.getFullQualifiedName().getName()+")");
col.setType(ColumnType.Scalar); col.setColumnDataType(((EdmTypeDefinition) targetEntityType.getProperty(propertyName).getType()) .getUnderlyingType().getFullQualifiedName().getFullQualifiedNameAsString()); } else {
public Column formNewColumnObject(EdmStructuredType targetEntityType, String propertyName, String dbalias, boolean isKey, String parentComplexName,ReadEntityInfo eInfo) { Column col =null; col = new Column(); col.setpKey(isKey); col.setName(propertyName); col.setDbaliasName(convertToUpperCaseIfRequired(dbalias + ALIASHLP + propertyName)); if (parentComplexName != null) { col.setPathName(parentComplexName + "." + propertyName); } else { col.setPathName(propertyName); } if (targetEntityType.getProperty(propertyName).getType() instanceof EdmTypeDefinition) { col.setType(ColumnType.Scalar); col.setColumnDataType(((EdmTypeDefinition) targetEntityType.getProperty(propertyName).getType()) .getUnderlyingType().getFullQualifiedName().getFullQualifiedNameAsString()); } else { col.setType(ColumnType.Primitive); col.setColumnDataType(targetEntityType.getProperty(propertyName).getType().getFullQualifiedName() .getFullQualifiedNameAsString()); } return col; }