private void checkCount() throws UriSyntaxException { if ("$count".equals(percentDecode(currentPathSegment))) { if (pathSegments.isEmpty()) { uriResult.setCount(true); } else { throw new UriSyntaxException(UriSyntaxException.MUSTBELASTSEGMENT.addContent(currentPathSegment)); } } }
private void checkCount() throws UriSyntaxException { if ("$count".equals(percentDecode(currentPathSegment))) { if (pathSegments.isEmpty()) { uriResult.setCount(true); } else { throw new UriSyntaxException(UriSyntaxException.MUSTBELASTSEGMENT.addContent(currentPathSegment)); } } }
private void handleResourcePath() throws UriSyntaxException, UriNotMatchingException, EdmException { if (pathSegments.isEmpty()) { uriResult.setUriType(UriType.URI0); } else { currentPathSegment = pathSegments.remove(0); final String decodedPath = percentDecode(currentPathSegment); if ("$metadata".equals(decodedPath)) { ensureLastSegment(); uriResult.setUriType(UriType.URI8); } else if ("$batch".equals(decodedPath)) { ensureLastSegment(); uriResult.setUriType(UriType.URI9); } else { handleNormalInitialSegment(); } } }
private void handleResourcePath() throws UriSyntaxException, UriNotMatchingException, EdmException { if (pathSegments.isEmpty()) { uriResult.setUriType(UriType.URI0); } else { currentPathSegment = pathSegments.remove(0); final String decodedPath = percentDecode(currentPathSegment); if ("$metadata".equals(decodedPath)) { ensureLastSegment(); uriResult.setUriType(UriType.URI8); } else if ("$batch".equals(decodedPath)) { ensureLastSegment(); uriResult.setUriType(UriType.URI9); } else { handleNormalInitialSegment(); } } }
@Override public List<KeyPredicate> getKeyFromEntityLink(final EdmEntitySet entitySet, final String entityLink, final URI serviceRoot) throws ODataException { final String relativeLink = serviceRoot == null ? entityLink : entityLink.startsWith(serviceRoot.toString()) ? entityLink.substring(serviceRoot.toString().length()) : entityLink; final Matcher matcher = INITIAL_SEGMENT_PATTERN.matcher(relativeLink); if (!matcher.matches()) { throw new UriNotMatchingException(UriNotMatchingException.MATCHPROBLEM.addContent(relativeLink)); } final String entityContainerName = percentDecode(matcher.group(1)); if (entityContainerName == null && !entitySet.getEntityContainer().isDefaultEntityContainer() || entityContainerName != null && !entityContainerName.equals(entitySet.getEntityContainer().getName())) { throw new UriNotMatchingException(UriNotMatchingException.CONTAINERNOTFOUND.addContent(entityContainerName)); } final String entitySetName = percentDecode(matcher.group(2)); if (!entitySetName.equals(entitySet.getName())) { throw new UriNotMatchingException(UriNotMatchingException.NOTFOUND.addContent(entitySetName)); } final String keyPredicate = matcher.group(3); if (keyPredicate == null) { throw new UriSyntaxException(UriSyntaxException.ENTITYSETINSTEADOFENTITY.addContent(entitySetName)); } return parseKey(keyPredicate, entitySet.getEntityType()); }
final String decodedString = percentDecode(queryOptionString); final List<String> valueList = queryParameters.get(queryOptionString);
final String decodedString = percentDecode(queryOptionString); final List<String> valueList = queryParameters.get(queryOptionString);
@Override public List<KeyPredicate> getKeyFromEntityLink(final EdmEntitySet entitySet, final String entityLink, final URI serviceRoot) throws ODataException { final String relativeLink = serviceRoot == null ? entityLink : entityLink.startsWith(serviceRoot.toString()) ? entityLink.substring(serviceRoot.toString().length()) : entityLink; final Matcher matcher = INITIAL_SEGMENT_PATTERN.matcher(relativeLink); if (!matcher.matches()) { throw new UriNotMatchingException(UriNotMatchingException.MATCHPROBLEM.addContent(relativeLink)); } final String entityContainerName = percentDecode(matcher.group(1)); if (entityContainerName == null && !entitySet.getEntityContainer().isDefaultEntityContainer() || entityContainerName != null && !entityContainerName.equals(entitySet.getEntityContainer().getName())) { throw new UriNotMatchingException(UriNotMatchingException.CONTAINERNOTFOUND.addContent(entityContainerName)); } final String entitySetName = percentDecode(matcher.group(2)); if (!entitySetName.equals(entitySet.getName())) { throw new UriNotMatchingException(UriNotMatchingException.NOTFOUND.addContent(entitySetName)); } final String keyPredicate = matcher.group(3); if (keyPredicate == null) { throw new UriSyntaxException(UriSyntaxException.ENTITYSETINSTEADOFENTITY.addContent(entitySetName)); } return parseKey(keyPredicate, entitySet.getEntityType()); } }
@Override public List<KeyPredicate> getKeyFromEntityLink(final EdmEntitySet entitySet, final String entityLink, final URI serviceRoot) throws ODataException { final String relativeLink = serviceRoot == null ? entityLink : entityLink.startsWith(serviceRoot.toString()) ? entityLink.substring(serviceRoot.toString().length()) : entityLink; final Matcher matcher = INITIAL_SEGMENT_PATTERN.matcher(relativeLink); if (!matcher.matches()) { throw new UriNotMatchingException(UriNotMatchingException.MATCHPROBLEM.addContent(relativeLink)); } final String entityContainerName = percentDecode(matcher.group(1)); if (entityContainerName == null && !entitySet.getEntityContainer().isDefaultEntityContainer() || entityContainerName != null && !entityContainerName.equals(entitySet.getEntityContainer().getName())) { throw new UriNotMatchingException(UriNotMatchingException.CONTAINERNOTFOUND.addContent(entityContainerName)); } final String entitySetName = percentDecode(matcher.group(2)); if (!entitySetName.equals(entitySet.getName())) { throw new UriNotMatchingException(UriNotMatchingException.NOTFOUND.addContent(entitySetName)); } final String keyPredicate = matcher.group(3); if (keyPredicate == null) { throw new UriSyntaxException(UriSyntaxException.ENTITYSETINSTEADOFENTITY.addContent(entitySetName)); } return parseKey(keyPredicate, entitySet.getEntityType()); } }
String name = percentDecode(matcher.group(1)); final String value = percentDecode(matcher.group(2));
String name = percentDecode(matcher.group(1)); final String value = percentDecode(matcher.group(2));
private void handleNormalInitialSegment() throws UriSyntaxException, UriNotMatchingException, EdmException { final Matcher matcher = INITIAL_SEGMENT_PATTERN.matcher(currentPathSegment); if (!matcher.matches()) { throw new UriNotMatchingException(UriNotMatchingException.MATCHPROBLEM.addContent(currentPathSegment)); } final String entityContainerName = percentDecode(matcher.group(1)); final String segmentName = percentDecode(matcher.group(2)); final String keyPredicate = matcher.group(3); final String emptyParentheses = matcher.group(4); final EdmEntityContainer entityContainer = entityContainerName == null ? edm.getDefaultEntityContainer() : edm.getEntityContainer(entityContainerName); if (entityContainer == null) { throw new UriNotMatchingException(UriNotMatchingException.CONTAINERNOTFOUND.addContent(entityContainerName)); } uriResult.setEntityContainer(entityContainer); final EdmEntitySet entitySet = entityContainer.getEntitySet(segmentName); if (entitySet != null) { uriResult.setStartEntitySet(entitySet); handleEntitySet(entitySet, keyPredicate); } else { final EdmFunctionImport functionImport = entityContainer.getFunctionImport(segmentName); if (functionImport == null) { throw new UriNotMatchingException(UriNotMatchingException.NOTFOUND.addContent(segmentName)); } uriResult.setFunctionImport(functionImport); handleFunctionImport(functionImport, emptyParentheses, keyPredicate); } }
private void handleNormalInitialSegment() throws UriSyntaxException, UriNotMatchingException, EdmException { final Matcher matcher = INITIAL_SEGMENT_PATTERN.matcher(currentPathSegment); if (!matcher.matches()) { throw new UriNotMatchingException(UriNotMatchingException.MATCHPROBLEM.addContent(currentPathSegment)); } final String entityContainerName = percentDecode(matcher.group(1)); final String segmentName = percentDecode(matcher.group(2)); final String keyPredicate = matcher.group(3); final String emptyParentheses = matcher.group(4); final EdmEntityContainer entityContainer = entityContainerName == null ? edm.getDefaultEntityContainer() : edm.getEntityContainer(entityContainerName); if (entityContainer == null) { throw new UriNotMatchingException(UriNotMatchingException.CONTAINERNOTFOUND.addContent(entityContainerName)); } uriResult.setEntityContainer(entityContainer); final EdmEntitySet entitySet = entityContainer.getEntitySet(segmentName); if (entitySet != null) { uriResult.setStartEntitySet(entitySet); handleEntitySet(entitySet, keyPredicate); } else { final EdmFunctionImport functionImport = entityContainer.getFunctionImport(segmentName); if (functionImport == null) { throw new UriNotMatchingException(UriNotMatchingException.NOTFOUND.addContent(segmentName)); } uriResult.setFunctionImport(functionImport); handleFunctionImport(functionImport, emptyParentheses, keyPredicate); } }
private void handleNormalInitialSegment() throws UriSyntaxException, UriNotMatchingException, EdmException { final Matcher matcher = INITIAL_SEGMENT_PATTERN.matcher(currentPathSegment); if (!matcher.matches()) { throw new UriNotMatchingException(UriNotMatchingException.MATCHPROBLEM.addContent(currentPathSegment)); } final String entityContainerName = percentDecode(matcher.group(1)); final String segmentName = percentDecode(matcher.group(2)); final String keyPredicate = matcher.group(3); final String emptyParentheses = matcher.group(4); final EdmEntityContainer entityContainer = entityContainerName == null ? edm.getDefaultEntityContainer() : edm.getEntityContainer(entityContainerName); if (entityContainer == null) { throw new UriNotMatchingException(UriNotMatchingException.CONTAINERNOTFOUND.addContent(entityContainerName)); } uriResult.setEntityContainer(entityContainer); final EdmEntitySet entitySet = entityContainer.getEntitySet(segmentName); if (entitySet != null) { uriResult.setStartEntitySet(entitySet); handleEntitySet(entitySet, keyPredicate); } else { final EdmFunctionImport functionImport = entityContainer.getFunctionImport(segmentName); if (functionImport == null) { throw new UriNotMatchingException(UriNotMatchingException.NOTFOUND.addContent(segmentName)); } uriResult.setFunctionImport(functionImport); handleFunctionImport(functionImport, emptyParentheses, keyPredicate); } }
private void handleNavigationPathOptions() throws UriSyntaxException, UriNotMatchingException, EdmException { currentPathSegment = pathSegments.remove(0); final String decodedPath = percentDecode(currentPathSegment); checkCount(); if (uriResult.isCount()) { uriResult.setUriType(UriType.URI16); // Count of multiple entities is handled elsewhere } else if ("$value".equals(decodedPath)) { if (uriResult.getTargetEntitySet().getEntityType().hasStream()) { ensureLastSegment(); uriResult.setUriType(UriType.URI17); uriResult.setValue(true); } else { throw new UriSyntaxException(UriSyntaxException.NOMEDIARESOURCE); } } else if ("$links".equals(decodedPath)) { uriResult.setLinks(true); if (pathSegments.isEmpty()) { throw new UriSyntaxException(UriSyntaxException.MUSTNOTBELASTSEGMENT.addContent(currentPathSegment)); } currentPathSegment = pathSegments.remove(0); handleNavigationProperties(); } else { handleNavigationProperties(); } }
private void handleNavigationPathOptions() throws UriSyntaxException, UriNotMatchingException, EdmException { currentPathSegment = pathSegments.remove(0); final String decodedPath = percentDecode(currentPathSegment); checkCount(); if (uriResult.isCount()) { uriResult.setUriType(UriType.URI16); // Count of multiple entities is handled elsewhere } else if ("$value".equals(decodedPath)) { if (uriResult.getTargetEntitySet().getEntityType().hasStream()) { ensureLastSegment(); uriResult.setUriType(UriType.URI17); uriResult.setValue(true); } else { throw new UriSyntaxException(UriSyntaxException.NOMEDIARESOURCE); } } else if ("$links".equals(decodedPath)) { uriResult.setLinks(true); if (pathSegments.isEmpty()) { throw new UriSyntaxException(UriSyntaxException.MUSTNOTBELASTSEGMENT.addContent(currentPathSegment)); } currentPathSegment = pathSegments.remove(0); handleNavigationProperties(); } else { handleNavigationProperties(); } }
} else { currentPathSegment = percentDecode(pathSegments.remove(0)); switch (type.getKind()) { case SIMPLE: if ("$value".equals(percentDecode(currentPathSegment))) { ensureLastSegment(); uriResult.setValue(true);
} else { currentPathSegment = percentDecode(pathSegments.remove(0)); switch (type.getKind()) { case SIMPLE:
if (uriResult.getUriType() == UriType.URI14) { currentPathSegment = pathSegments.remove(0); if ("$value".equals(percentDecode(currentPathSegment))) { uriResult.setValue(true); } else {
if (uriResult.getUriType() == UriType.URI14) { currentPathSegment = pathSegments.remove(0); if ("$value".equals(percentDecode(currentPathSegment))) { uriResult.setValue(true); } else {