private void checkEdmNamespace() throws EntityProviderException { if (!edmNamespaces.contains(edmNamespace)) { throw new EntityProviderException(EntityProviderException.INVALID_NAMESPACE .addContent(XmlMetadataConstants.EDM_SCHEMA)); } }
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 void checkEdmNamespace() throws EntityProviderException { if (!edmNamespaces.contains(edmNamespace)) { throw new EntityProviderException(EntityProviderException.INVALID_NAMESPACE .addContent(XmlMetadataConstants.EDM_SCHEMA)); } }
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 handleSystemQueryOptionSkip(final String skip) throws UriSyntaxException { try { uriResult.setSkip(Integer.valueOf(skip)); } catch (NumberFormatException e) { throw new UriSyntaxException(UriSyntaxException.INVALIDVALUE.addContent(skip), e); } if (skip.startsWith("-")) { throw new UriSyntaxException(UriSyntaxException.INVALIDNEGATIVEVALUE.addContent(skip)); } else if (skip.startsWith("+")) { throw new UriSyntaxException(UriSyntaxException.INVALIDVALUE.addContent(skip)); } }
private String parseHttpVersion(final String httpVersion) throws BatchException { if (!HTTP_VERSION.equals(httpVersion.trim())) { throw new BatchException(BatchException.INVALID_REQUEST_LINE .addContent(statusLine.toString()) .addContent(statusLine.getLineNumber())); } else { return HTTP_VERSION; } }
static public ExpressionParserException createEXPRESSION_EXPECTED_AFTER_POS(final Token token, final String expression) { MessageReference msgRef = ExpressionParserException.EXPRESSION_EXPECTED_AFTER_POS.create(); msgRef.addContent(Integer.toString(token.getPosition() + 1)); msgRef.addContent(expression); return new ExpressionParserException(msgRef); }
static public ExpressionParserException createCOMMA_OR_END_EXPECTED_AT_POS(final Token token, final String expression) { MessageReference msgRef = ExpressionParserException.COMMA_OR_END_EXPECTED_AT_POS.create(); msgRef.addContent(Integer.toString(token.getPosition() + 1)); msgRef.addContent(expression); return new ExpressionParserException(msgRef); }
protected Line consumeHttpStatusLine(final List<Line> message) throws BatchException { if (!message.isEmpty() && !"".equals(message.get(0).toString().trim())) { final Line method = message.get(0); message.remove(0); return method; } else { final int line = (!message.isEmpty()) ? message.get(0).getLineNumber() : 0; throw new BatchException(BatchException.MISSING_METHOD.addContent(line)); } }
static public ExpressionParserException createCOMMA_OR_END_EXPECTED_AT_POS(final Token token, final String expression) { MessageReference msgRef = ExpressionParserException.COMMA_OR_END_EXPECTED_AT_POS.create(); msgRef.addContent(Integer.toString(token.getPosition() + 1)); msgRef.addContent(expression); return new ExpressionParserException(msgRef); }
public static ExpressionParserException createLEFT_SIDE_NOT_A_PROPERTY(final Token token, final String expression) throws ExpressionParserInternalError { MessageReference msgRef = ExpressionParserException.LEFT_SIDE_NOT_A_PROPERTY.create(); msgRef.addContent(token.getPosition() + 1); msgRef.addContent(expression); return new ExpressionParserException(msgRef); }
static public ExpressionParserException createERROR_IN_TOKENIZER(final TokenizerException exceptionTokenizer, final String expression) { Token token = exceptionTokenizer.getToken(); MessageReference msgRef = ExpressionParserException.ERROR_IN_TOKENIZER.create(); msgRef.addContent(token.getUriLiteral()); msgRef.addContent(Integer.toString(token.getPosition() + 1)); msgRef.addContent(expression); return new ExpressionParserException(msgRef, exceptionTokenizer); }
private FullQualifiedName validateComplexTypeWithAlias(final FullQualifiedName aliasName) throws EntityProviderException { String namespace = aliasNamespaceMap.get(aliasName.getNamespace()); FullQualifiedName fqName = new FullQualifiedName(namespace, aliasName.getName()); if (!complexTypesMap.containsKey(fqName)) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT.addContent("Invalid BaseType") .addContent(fqName)); } return fqName; }
private void checkCount() throws UriSyntaxException { if ("$count".equals(percentDecode(currentPathSegment))) { if (pathSegments.isEmpty()) { uriResult.setCount(true); } else { throw new UriSyntaxException(UriSyntaxException.MUSTBELASTSEGMENT.addContent(currentPathSegment)); } } }
public static ExpressionParserInternalError createNO_TOKEN_AVAILABLE(final String expectedToken) { MessageReference msgRef = ExpressionParserInternalError.INVALID_TOKEN_AT.create(); msgRef.addContent(expectedToken); return new ExpressionParserInternalError(msgRef); }
private void checkSystemQueryOptionsCompatibility() throws UriSyntaxException { final UriType uriType = uriResult.getUriType(); for (SystemQueryOption queryOption : systemQueryOptions.keySet()) { if (queryOption == SystemQueryOption.$format && (uriType == UriType.URI4 || uriType == UriType.URI5) && uriResult.isValue()) { throw new UriSyntaxException(UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION.addContent(queryOption)); } if (!uriType.isCompatible(queryOption)) { throw new UriSyntaxException(UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION.addContent(queryOption)); } } }
private void checkSystemQueryOptionsCompatibility() throws UriSyntaxException { final UriType uriType = uriResult.getUriType(); for (SystemQueryOption queryOption : systemQueryOptions.keySet()) { if (queryOption == SystemQueryOption.$format && (uriType == UriType.URI4 || uriType == UriType.URI5) && uriResult.isValue()) { throw new UriSyntaxException(UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION.addContent(queryOption)); } if (!uriType.isCompatible(queryOption)) { throw new UriSyntaxException(UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION.addContent(queryOption)); } } }
public void validateHttpMethod(boolean isChangeSet) throws BatchException { Set<String> validMethods = (isChangeSet) ? HTTP_CHANGE_SET_METHODS : HTTP_BATCH_METHODS; if (!validMethods.contains(getMethod().toString())) { if (isChangeSet) { throw new BatchException(BatchException.INVALID_CHANGESET_METHOD.addContent(statusLine.getLineNumber())); } else { throw new BatchException(BatchException.INVALID_QUERY_OPERATION_METHOD .addContent(statusLine.getLineNumber())); } } }
public void appendAsArray(final Writer writer, final EntityInfoAggregator entityInfo, final List<Map<String, Object>> data) throws EntityProviderException { JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer); try { jsonStreamWriter.beginArray(); appendEntries(writer, entityInfo, data, jsonStreamWriter); jsonStreamWriter.endArray(); } catch (final IOException e) { throw new EntityProviderProducerException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } }
private void validateAssociationEnd(final AssociationSetEnd end, final Association association) throws EntityProviderException { if (!(association.getEnd1().getRole().equals(end.getRole()) ^ association .getEnd2().getRole().equals(end.getRole()))) { throw new EntityProviderException(EntityProviderException.COMMON.addContent("Invalid Association")); } }