private static Map<String, Object> mapFunctionParameters(final Map<String, EdmLiteral> functionImportParameters) throws EdmSimpleTypeException { if (functionImportParameters == null) { return Collections.emptyMap(); } else { Map<String, Object> parameterMap = new HashMap<String, Object>(); for (final Entry<String, EdmLiteral> parameter : functionImportParameters.entrySet()) { final EdmLiteral literal = parameter.getValue(); final EdmSimpleType type = literal.getType(); parameterMap.put(parameter.getKey(), type.valueOfString(literal.getLiteral(), EdmLiteralKind.DEFAULT, null, type .getDefaultType())); } return parameterMap; } }
private static Map<String, Object> mapFunctionParameters(final Map<String, EdmLiteral> functionImportParameters) throws EdmSimpleTypeException { if (functionImportParameters == null) { return Collections.emptyMap(); } else { Map<String, Object> parameterMap = new HashMap<String, Object>(); for (final Entry<String, EdmLiteral> parameter : functionImportParameters.entrySet()) { final EdmLiteral literal = parameter.getValue(); final EdmSimpleType type = literal.getType(); parameterMap.put(parameter.getKey(), type.valueOfString(literal.getLiteral(), EdmLiteralKind.DEFAULT, null, type .getDefaultType())); } return parameterMap; } }
private static Map<String, Object> mapFunctionParameters(final Map<String, EdmLiteral> functionImportParameters) throws EdmSimpleTypeException { if (functionImportParameters == null) { return Collections.emptyMap(); } else { Map<String, Object> parameterMap = new HashMap<String, Object>(); for (final String parameterName : functionImportParameters.keySet()) { final EdmLiteral literal = functionImportParameters.get(parameterName); final EdmSimpleType type = literal.getType(); parameterMap.put(parameterName, type.valueOfString(literal.getLiteral(), EdmLiteralKind.DEFAULT, null, type .getDefaultType())); } return parameterMap; } }
public Object getFunctionImportParameterValue(EdmLiteral literal, EdmSimpleType paramType) throws EdmSimpleTypeException{ return paramType.valueOfString(literal.getLiteral(), EdmLiteralKind.DEFAULT, null, paramType.getDefaultType()); } }
private Object convert(final EntityPropertyInfo property, final String value, final Class<?> typeMapping) throws EdmSimpleTypeException { final EdmSimpleType type = (EdmSimpleType) property.getType(); return type.valueOfString(value, EdmLiteralKind.DEFAULT, property.getFacets(), typeMapping == null ? type.getDefaultType() : typeMapping); } }
private static Map<String, Object> mapKey(final List<KeyPredicate> keys) throws EdmException { Map<String, Object> keyMap = new HashMap<String, Object>(); for (final KeyPredicate key : keys) { final EdmProperty property = key.getProperty(); final EdmSimpleType type = (EdmSimpleType) property.getType(); keyMap.put(property.getName(), type.valueOfString(key.getLiteral(), EdmLiteralKind.DEFAULT, property.getFacets(), type.getDefaultType())); } return keyMap; }
private static Map<String, Object> mapKey(final List<KeyPredicate> keys) throws EdmException { Map<String, Object> keyMap = new HashMap<String, Object>(); for (final KeyPredicate key : keys) { final EdmProperty property = key.getProperty(); final EdmSimpleType type = (EdmSimpleType) property.getType(); keyMap.put(property.getName(), type.valueOfString(key.getLiteral(), EdmLiteralKind.DEFAULT, property.getFacets(), type.getDefaultType())); } return keyMap; }
private static Map<String, Object> mapKey(final List<KeyPredicate> keys) throws EdmException { Map<String, Object> keyMap = new HashMap<String, Object>(); for (final KeyPredicate key : keys) { final EdmProperty property = key.getProperty(); final EdmSimpleType type = (EdmSimpleType) property.getType(); keyMap.put(property.getName(), type.valueOfString(key.getLiteral(), EdmLiteralKind.DEFAULT, property.getFacets(), type.getDefaultType())); } return keyMap; }
public static Map<String, Object> convertKeyPredicatesToMap(List<KeyPredicate> kpList) { Map<String, Object> keys = new HashMap<String, Object>(); if(kpList == null) return keys; try{ for(KeyPredicate kp : kpList) { EdmProperty prop = kp.getProperty(); EdmSimpleType type = (EdmSimpleType) prop.getType(); String value = kp.getLiteral(); Object val = type.valueOfString(value, EdmLiteralKind.DEFAULT, prop.getFacets(), type.getDefaultType()); //Convert the UUID type used for Edm.Guid to String type for Extension. if(type instanceof EdmGuid){ keys.put(prop.getName(), val.toString()); }else{ keys.put(prop.getName(), val); } }} catch(EdmException e) { return new HashMap<String, Object>(); } return keys; }
private Object convert(final EntityPropertyInfo property, final String value, final Class<?> typeMapping, final EntityProviderReadProperties readProperties) throws EdmSimpleTypeException { final EdmSimpleType type = (EdmSimpleType) property.getType(); return type.valueOfString(value, EdmLiteralKind.DEFAULT, readProperties == null || readProperties.isValidatingFacets() ? property.getFacets() : null, typeMapping == null ? type.getDefaultType() : typeMapping); } }
private Object convert(final EntityPropertyInfo property, final String value, final Class<?> typeMapping, final EntityProviderReadProperties readProperties) throws EdmSimpleTypeException { final EdmSimpleType type = (EdmSimpleType) property.getType(); return type.valueOfString(value, EdmLiteralKind.DEFAULT, readProperties == null || readProperties.isValidatingFacets() ? property.getFacets() : null, typeMapping == null ? type.getDefaultType() : typeMapping); } }
private Object convert(final EntityPropertyInfo property, final String value, final Class<?> typeMapping, final DeserializerProperties readProperties) throws EdmSimpleTypeException { final EdmSimpleType type = (EdmSimpleType) property.getType(); return type.valueOfString(value, EdmLiteralKind.DEFAULT, readProperties == null || readProperties.isValidatingFacets() ? property.getFacets() : null, typeMapping == null ? type.getDefaultType() : typeMapping); } }
private Object formatSystemTypeValue( LiteralExpression literal) { String value = literal.getUriLiteral(); EdmLiteral uriLiteral; try { uriLiteral = EdmSimpleTypeKind.parseUriLiteral(value); return uriLiteral.getType().valueOfString(uriLiteral.getLiteral(), EdmLiteralKind.DEFAULT, null, uriLiteral.getType().getDefaultType()); } catch (EdmLiteralException | EdmSimpleTypeException e) { //Fallback as String return value; } }
final EdmSimpleType type = (EdmSimpleType) propertyInfo.getType(); final Object value = type.valueOfString(text, EdmLiteralKind.DEFAULT, propertyInfo.getFacets(), typeMapping == null ? type.getDefaultType() : typeMapping); properties.put(tagName, value);
final Object value = type.valueOfString(text, EdmLiteralKind.DEFAULT, readProperties == null || readProperties.isValidatingFacets() ? propertyInfo.getFacets() : null, typeMapping == null ? type.getDefaultType() : typeMapping); properties.put(tagName, value);
if (typeMapping == null) { return type.valueOfString(readText(content), EdmLiteralKind.DEFAULT, edmProperty.getFacets(), type .getDefaultType()); } else { return type.valueOfString(readText(content), EdmLiteralKind.DEFAULT, edmProperty.getFacets(), typeMapping);
@Override public ODataResponse build(final GetFunctionImportUriInfo resultsView, final Object result) throws ODataJPARuntimeException { try { final EdmFunctionImport functionImport = resultsView.getFunctionImport(); final EdmSimpleType type = (EdmSimpleType) functionImport.getReturnType().getType(); if (result != null) { ODataResponse response = null; if (type.getDefaultType().equals(byte[].class)) { response = EntityProvider.writeBinary("application/octet-stream", (byte[]) result); } else { final String value = type.valueToString(result, EdmLiteralKind.DEFAULT, null); response = EntityProvider.writeText(value); } return ODataResponse.fromResponse(response).build(); } else { throw new ODataNotFoundException(ODataHttpException.COMMON); } } catch (EdmException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } catch (EntityProviderException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e); } }
@Override public ODataResponse build(final GetFunctionImportUriInfo resultsView, final Object result) throws ODataJPARuntimeException { try { final EdmFunctionImport functionImport = resultsView.getFunctionImport(); final EdmSimpleType type = (EdmSimpleType) functionImport.getReturnType().getType(); if (result != null) { ODataResponse response = null; if (type.getDefaultType().equals(byte[].class)) { response = EntityProvider.writeBinary("application/octet-stream", (byte[]) result); } else { final String value = type.valueToString(result, EdmLiteralKind.DEFAULT, null); response = EntityProvider.writeText(value); } return ODataResponse.fromResponse(response).build(); } else { throw new ODataNotFoundException(ODataHttpException.COMMON); } } catch (EdmException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } catch (EntityProviderException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e); } }
if (typeMapping == null) { return type.valueOfString(readText(content), EdmLiteralKind.DEFAULT, edmProperty.getFacets(), type .getDefaultType()); } else { return type.valueOfString(readText(content), EdmLiteralKind.DEFAULT, edmProperty.getFacets(), typeMapping);
if (typeMapping == null) { return type.valueOfString(readText(content), EdmLiteralKind.DEFAULT, edmProperty.getFacets(), type .getDefaultType()); } else { return type.valueOfString(readText(content), EdmLiteralKind.DEFAULT, edmProperty.getFacets(), typeMapping);