@Override @SuppressWarnings("unchecked") public <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getBoundActionInvokeRequest( final URI bindingParameterURI, final FullQualifiedName actionName, final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection, final Map<String, ClientValue> parameters) { final EdmAction action = edmClient.getCachedEdm().getBoundAction( actionName, bindingParameterTypeName, isBindingParameterCollection); if (action == null) { throw new IllegalArgumentException("Could not find Action for name " + actionName); } return (ODataInvokeRequest<RES>) getInvokeRequest(HttpMethod.POST, edmClient.newURIBuilder(bindingParameterURI.toASCIIString()). appendOperationCallSegment(action.getFullQualifiedName().toString()).build(), getResultReference(action.getReturnType()), parameters); } }
@Override @SuppressWarnings("unchecked") public <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getBoundActionInvokeRequest( final URI bindingParameterURI, final FullQualifiedName actionName, final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection, final Map<String, ClientValue> parameters) { final EdmAction action = edmClient.getCachedEdm().getBoundAction( actionName, bindingParameterTypeName, isBindingParameterCollection); if (action == null) { throw new IllegalArgumentException("Could not find Action for name " + actionName); } return (ODataInvokeRequest<RES>) getInvokeRequest(HttpMethod.POST, edmClient.newURIBuilder(bindingParameterURI.toASCIIString()). appendOperationCallSegment(action.getFullQualifiedName().toString()).build(), getResultReference(action.getReturnType()), parameters); } }
private Map.Entry<URI, EdmOperation> getCollectionBoundOperation( final Operation operation, final List<String> parameterNames) { EdmOperation edmOperation; if (operation.type() == OperationType.FUNCTION) { edmOperation = getClient().getCachedEdm().getBoundFunction( new FullQualifiedName(targetFQN.getNamespace(), operation.name()), targetFQN, true, parameterNames); } else { edmOperation = getClient().getCachedEdm().getBoundAction( new FullQualifiedName(targetFQN.getNamespace(), operation.name()), targetFQN, true); } return new AbstractMap.SimpleEntry<URI, EdmOperation>( URI.create(((EntityCollectionInvocationHandler<?>) target).getURI().toASCIIString() + "/" + edmOperation.getName()), edmOperation); } }
private Map.Entry<URI, EdmOperation> getCollectionBoundOperation( final Operation operation, final List<String> parameterNames) { EdmOperation edmOperation; if (operation.type() == OperationType.FUNCTION) { edmOperation = getClient().getCachedEdm().getBoundFunction( new FullQualifiedName(targetFQN.getNamespace(), operation.name()), targetFQN, true, parameterNames); } else { edmOperation = getClient().getCachedEdm().getBoundAction( new FullQualifiedName(targetFQN.getNamespace(), operation.name()), targetFQN, true); } return new AbstractMap.SimpleEntry<URI, EdmOperation>( URI.create(((EntityCollectionInvocationHandler<?>) target).getURI().toASCIIString() + "/" + edmOperation.getName()), edmOperation); } }
private UriResourcePartTyped parseBoundOperation(UriTokenizer tokenizer, final FullQualifiedName qualifiedName, final EdmStructuredType referencedType, final boolean referencedIsCollection) throws UriParserException { final EdmAction boundAction = edm.getBoundAction(qualifiedName, referencedType.getFullQualifiedName(), referencedIsCollection); if (boundAction == null) { final List<String> parameterNames = parseFunctionParameterNames(tokenizer); final EdmFunction boundFunction = edm.getBoundFunction(qualifiedName, referencedType.getFullQualifiedName(), referencedIsCollection, parameterNames); if (boundFunction == null) { throw new UriParserSemanticException("Function not found.", UriParserSemanticException.MessageKeys.UNKNOWN_PART, qualifiedName.getFullQualifiedNameAsString()); } else { return new UriResourceFunctionImpl(null, boundFunction, null); } } else { return new UriResourceActionImpl(boundAction); } }
private UriResourcePartTyped parseBoundOperation(UriTokenizer tokenizer, final FullQualifiedName qualifiedName, final EdmStructuredType referencedType, final boolean referencedIsCollection) throws UriParserException { final EdmAction boundAction = edm.getBoundAction(qualifiedName, referencedType.getFullQualifiedName(), referencedIsCollection); if (boundAction == null) { final List<String> parameterNames = parseFunctionParameterNames(tokenizer); final EdmFunction boundFunction = edm.getBoundFunction(qualifiedName, referencedType.getFullQualifiedName(), referencedIsCollection, parameterNames); if (boundFunction == null) { throw new UriParserSemanticException("Function not found.", UriParserSemanticException.MessageKeys.UNKNOWN_PART, qualifiedName.getFullQualifiedNameAsString()); } else { return new UriResourceFunctionImpl(null, boundFunction, null); } } else { return new UriResourceActionImpl(boundAction); } }
while (boundOp == null && baseType != null) { final EdmAction action = this.getClient().getCachedEdm().getBoundAction( new FullQualifiedName(targetFQN.getNamespace(), operation.name()), baseType.getFullQualifiedName(), ? getClient().getCachedEdm().getBoundFunction( operationFQN, entityType.getFullQualifiedName(), false, parameterNames) : getClient().getCachedEdm().getBoundAction( operationFQN, entityType.getFullQualifiedName(), false); if (entityType.getBaseType() != null) {
while (boundOp == null && baseType != null) { final EdmAction action = this.getClient().getCachedEdm().getBoundAction( new FullQualifiedName(targetFQN.getNamespace(), operation.name()), baseType.getFullQualifiedName(), ? getClient().getCachedEdm().getBoundFunction( operationFQN, entityType.getFullQualifiedName(), false, parameterNames) : getClient().getCachedEdm().getBoundAction( operationFQN, entityType.getFullQualifiedName(), false); if (entityType.getBaseType() != null) {
private UriResource boundOperationOrTypeCast(UriResource previous) throws UriParserException, UriValidationException { final FullQualifiedName name = new FullQualifiedName(tokenizer.getText()); requireTyped(previous, name.getFullQualifiedNameAsString()); final UriResourcePartTyped previousTyped = (UriResourcePartTyped) previous; final EdmType previousTypeFilter = getPreviousTypeFilter(previousTyped); final EdmType previousType = previousTypeFilter == null ? previousTyped.getType() : previousTypeFilter; // We check for bound actions first because they cannot be followed by anything. final EdmAction boundAction = edm.getBoundAction(name, previousType.getFullQualifiedName(), previousTyped.isCollection()); if (boundAction != null) { ParserHelper.requireTokenEnd(tokenizer); return new UriResourceActionImpl(boundAction); } // Type casts can be syntactically indistinguishable from bound function calls in the case of additional keys. // But normally they are shorter, so they come next. final EdmStructuredType type = previousTyped.getType() instanceof EdmEntityType ? edm.getEntityType(name) : edm.getComplexType(name); if (type != null) { return typeCast(name, type, previousTyped); } if (tokenizer.next(TokenKind.EOF)) { throw new UriParserSemanticException("Type '" + name.getFullQualifiedNameAsString() + "' not found.", UriParserSemanticException.MessageKeys.UNKNOWN_TYPE, name.getFullQualifiedNameAsString()); } // Now a bound function call is the only remaining option. return functionCall(null, name, previousType.getFullQualifiedName(), previousTyped.isCollection()); }
private UriResource boundOperationOrTypeCast(UriResource previous) throws UriParserException, UriValidationException { final FullQualifiedName name = new FullQualifiedName(tokenizer.getText()); requireTyped(previous, name.getFullQualifiedNameAsString()); final UriResourcePartTyped previousTyped = (UriResourcePartTyped) previous; final EdmType previousTypeFilter = getPreviousTypeFilter(previousTyped); final EdmType previousType = previousTypeFilter == null ? previousTyped.getType() : previousTypeFilter; // We check for bound actions first because they cannot be followed by anything. final EdmAction boundAction = edm.getBoundAction(name, previousType.getFullQualifiedName(), previousTyped.isCollection()); if (boundAction != null) { ParserHelper.requireTokenEnd(tokenizer); return new UriResourceActionImpl(boundAction); } // Type casts can be syntactically indistinguishable from bound function calls in the case of additional keys. // But normally they are shorter, so they come next. final EdmStructuredType type = previousTyped.getType() instanceof EdmEntityType ? edm.getEntityType(name) : edm.getComplexType(name); if (type != null) { return typeCast(name, type, previousTyped); } if (tokenizer.next(TokenKind.EOF)) { throw new UriParserSemanticException("Type '" + name.getFullQualifiedNameAsString() + "' not found.", UriParserSemanticException.MessageKeys.UNKNOWN_TYPE, name.getFullQualifiedNameAsString()); } // Now a bound function call is the only remaining option. return functionCall(null, name, previousType.getFullQualifiedName(), previousTyped.isCollection()); }