static public ExpressionParserException createEXPRESSION_EXPECTED_AFTER_POS(final int position, final String expression) { MessageReference msgRef = ExpressionParserException.EXPRESSION_EXPECTED_AFTER_POS.create(); msgRef.addContent(position); msgRef.addContent(expression); return new ExpressionParserException(msgRef); }
public static Message getMessage(final Locale language, final MessageReference context) { Object[] contentAsArray = context.getContent().toArray(new Object[0]); return getMessage(language, context.getKey(), contentAsArray); }
private static UriSyntaxException convertEdmLiteralException(final EdmLiteralException e) { final MessageReference messageReference = e.getMessageReference(); if (EdmLiteralException.LITERALFORMAT.equals(messageReference)) { return new UriSyntaxException(UriSyntaxException.LITERALFORMAT.addContent(messageReference.getContent()), e); } else if (EdmLiteralException.NOTEXT.equals(messageReference)) { return new UriSyntaxException(UriSyntaxException.NOTEXT.addContent(messageReference.getContent()), e); } else if (EdmLiteralException.UNKNOWNLITERAL.equals(messageReference)) { return new UriSyntaxException(UriSyntaxException.UNKNOWNLITERAL.addContent(messageReference.getContent()), e); } else { return new UriSyntaxException(ODataBadRequestException.COMMON, e); } }
private void checkEdmNamespace() throws EntityProviderException { if (!edmNamespaces.contains(edmNamespace)) { throw new EntityProviderException(EntityProviderException.INVALID_NAMESPACE .addContent(XmlMetadataConstants.EDM_SCHEMA)); } }
private static String createEntryKey(final EntityInfoAggregator entityInfo, final Map<String, Object> data) throws EntityProviderException { final List<EntityPropertyInfo> keyPropertyInfos = entityInfo.getKeyPropertyInfos(); StringBuilder keys = new StringBuilder(); for (final EntityPropertyInfo keyPropertyInfo : keyPropertyInfos) { if (keys.length() > 0) { keys.append(','); } final String name = keyPropertyInfo.getName(); if (keyPropertyInfos.size() > 1) { keys.append(Encoder.encode(name)).append('='); } final EdmSimpleType type = (EdmSimpleType) keyPropertyInfo.getType(); try { keys.append(Encoder.encode(type.valueToString(data.get(name), EdmLiteralKind.URI, keyPropertyInfo.getFacets()))); } catch (final EdmSimpleTypeException e) { throw new EntityProviderProducerException( EdmSimpleTypeException.getMessageReference(e.getMessageReference()). updateContent(e.getMessageReference().getContent(), name), e); } } return keys.toString(); }
} else { throw new EntityProviderProducerException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("A complex property must have a Map as data")); } catch (EdmSimpleTypeException e) { throw new EntityProviderProducerException(EdmSimpleTypeException.getMessageReference( e.getMessageReference()).updateContent(e.getMessageReference().getContent(), propertyInfo.getName()), e);
public static MessageReference getMessageReference(final MessageReference messageReference) { if (EdmSimpleTypeException.VALUE_NULL_NOT_ALLOWED.equals(messageReference)) { return EdmSimpleTypeException.PROPERTY_VALUE_NULL_NOT_ALLOWED; } else if (EdmSimpleTypeException.VALUE_FACETS_NOT_MATCHED.equals(messageReference)) { return EdmSimpleTypeException.PROPERTY_VALUE_FACETS_NOT_MATCHED; } return messageReference; } }
/** * {@inheritDoc} */ @Override public String getMessage() { if (messageReference == null) { return "No message reference given. Inherit message is = '" + super.getMessage() + "'"; } String message = RuntimeDelegate.extractExceptionMessage(this); if (message == null) { return "Message Reference key = '" + messageReference.getKey() + "' and inherit message = '" + super.getMessage() + "'"; } return message; } }
private void validate(final boolean codeFound, final boolean messageFound) throws EntityProviderException { if (!codeFound) { throw new EntityProviderException( EntityProviderException.MISSING_PROPERTY.addContent("Mandatory 'code' property not found.'")); } else if (!messageFound) { throw new EntityProviderException( EntityProviderException.MISSING_PROPERTY.addContent("Mandatory 'message' property not found.'")); } }
private static String createEntryKey(final EntityInfoAggregator entityInfo, final Map<String, Object> data) throws EntityProviderException { final List<EntityPropertyInfo> keyPropertyInfos = entityInfo.getKeyPropertyInfos(); StringBuilder keys = new StringBuilder(); for (final EntityPropertyInfo keyPropertyInfo : keyPropertyInfos) { if (keys.length() > 0) { keys.append(','); } final String name = keyPropertyInfo.getName(); if (keyPropertyInfos.size() > 1) { keys.append(Encoder.encode(name)).append('='); } final EdmSimpleType type = (EdmSimpleType) keyPropertyInfo.getType(); try { keys.append(Encoder.encode(type.valueToString(data.get(name), EdmLiteralKind.URI, keyPropertyInfo.getFacets()))); } catch (final EdmSimpleTypeException e) { throw new EntityProviderProducerException( EdmSimpleTypeException.getMessageReference(e.getMessageReference()). updateContent(e.getMessageReference().getContent(), name), e); } } return keys.toString(); }
} else { throw new EntityProviderProducerException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("A complex property must have a Map as data")); } catch (EdmSimpleTypeException e) { throw new EntityProviderProducerException(EdmSimpleTypeException.getMessageReference( e.getMessageReference()).updateContent(e.getMessageReference().getContent(), propertyInfo.getName()), e);
public static MessageReference getMessageReference(final MessageReference messageReference) { if (EdmSimpleTypeException.VALUE_NULL_NOT_ALLOWED.equals(messageReference)) { return EdmSimpleTypeException.PROPERTY_VALUE_NULL_NOT_ALLOWED; } else if (EdmSimpleTypeException.VALUE_FACETS_NOT_MATCHED.equals(messageReference)) { return EdmSimpleTypeException.PROPERTY_VALUE_FACETS_NOT_MATCHED; } return messageReference; } }
/** * {@inheritDoc} */ @Override public String getMessage() { if (messageReference == null) { return "No message reference given. Inherit message is = '" + super.getMessage() + "'"; } String message = RuntimeDelegate.extractExceptionMessage(this); if (message == null) { return "Message Reference key = '" + messageReference.getKey() + "' and inherit message = '" + super.getMessage() + "'"; } return message; } }
public static ExpressionParserException createMISSING_CLOSING_PARENTHESIS(final int position, final String expression, final TokenizerExpectError e) { MessageReference msgRef = ExpressionParserException.MISSING_CLOSING_PARENTHESIS.create(); msgRef.addContent(position + 1); msgRef.addContent(expression); return new ExpressionParserException(msgRef, e); }
private void checkEdmNamespace() throws EntityProviderException { if (!edmNamespaces.contains(edmNamespace)) { throw new EntityProviderException(EntityProviderException.INVALID_NAMESPACE .addContent(XmlMetadataConstants.EDM_SCHEMA)); } }
private static UriSyntaxException convertEdmLiteralException(final EdmLiteralException e) { final MessageReference messageReference = e.getMessageReference(); if (EdmLiteralException.LITERALFORMAT.equals(messageReference)) { return new UriSyntaxException(UriSyntaxException.LITERALFORMAT.addContent(messageReference.getContent()), e); } else if (EdmLiteralException.NOTEXT.equals(messageReference)) { return new UriSyntaxException(UriSyntaxException.NOTEXT.addContent(messageReference.getContent()), e); } else if (EdmLiteralException.UNKNOWNLITERAL.equals(messageReference)) { return new UriSyntaxException(UriSyntaxException.UNKNOWNLITERAL.addContent(messageReference.getContent()), e); } else { return new UriSyntaxException(ODataBadRequestException.COMMON, e); } }
throw new EntityProviderProducerException( EdmSimpleTypeException.getMessageReference(e.getMessageReference()). updateContent(e.getMessageReference().getContent(), titleInfo.getName()), e);
} else { throw new EntityProviderProducerException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("A complex property must have a Map as data")); } catch (EdmSimpleTypeException e) { throw new EntityProviderProducerException(EdmSimpleTypeException.getMessageReference( e.getMessageReference()).updateContent(e.getMessageReference().getContent(), propertyInfo.getName()), e);
public static Message getMessage(final Locale language, final MessageReference context) { Object[] contentAsArray = context.getContent().toArray(new Object[0]); return getMessage(language, context.getKey(), contentAsArray); }
public static MessageReference getMessageReference(final MessageReference messageReference) { if (EdmSimpleTypeException.VALUE_NULL_NOT_ALLOWED.equals(messageReference)) { return EdmSimpleTypeException.PROPERTY_VALUE_NULL_NOT_ALLOWED; } else if (EdmSimpleTypeException.VALUE_FACETS_NOT_MATCHED.equals(messageReference)) { return EdmSimpleTypeException.PROPERTY_VALUE_FACETS_NOT_MATCHED; } return messageReference; } }