本文整理汇总了Java中org.apache.olingo.commons.api.edm.FullQualifiedName.getFullQualifiedNameAsString方法的典型用法代码示例。如果您正苦于以下问题:Java FullQualifiedName.getFullQualifiedNameAsString方法的具体用法?Java FullQualifiedName.getFullQualifiedNameAsString怎么用?Java FullQualifiedName.getFullQualifiedNameAsString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.commons.api.edm.FullQualifiedName
的用法示例。
在下文中一共展示了FullQualifiedName.getFullQualifiedNameAsString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
@Before
public void setup() {
FullQualifiedName actionFqn = new FullQualifiedName("namespace", "actionName");
FullQualifiedName entityContainerFqn = new FullQualifiedName("namespace", "containerName");
String target = entityContainerFqn.getFullQualifiedNameAsString() + "/entitySetName";
CsdlActionImport providerActionImport =
new CsdlActionImport().setName("actionImportName").setAction(actionFqn).setEntitySet(target);
EdmProviderImpl edm = mock(EdmProviderImpl.class);
container = mock(EdmEntityContainer.class);
when(edm.getEntityContainer(entityContainerFqn)).thenReturn(container);
action = mock(EdmAction.class);
when(edm.getUnboundAction(actionFqn)).thenReturn(action);
entitySet = mock(EdmEntitySet.class);
when(container.getEntitySet("entitySetName")).thenReturn(entitySet);
actionImport = new EdmActionImportImpl(edm, container, providerActionImport);
}
示例2: parseBoundOperation
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
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);
}
}
示例3: parseFunction
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
private void parseFunction(final FullQualifiedName fullQualifiedName, UriInfoImpl uriInfo,
final EdmType lastType, final boolean lastIsCollection) throws UriParserException, UriValidationException {
final List<UriParameter> parameters =
ParserHelper.parseFunctionParameters(tokenizer, edm, referringType, true, aliases);
final List<String> parameterNames = ParserHelper.getParameterNames(parameters);
final EdmFunction boundFunction = edm.getBoundFunction(fullQualifiedName,
lastType.getFullQualifiedName(), lastIsCollection, parameterNames);
if (boundFunction != null) {
ParserHelper.validateFunctionParameters(boundFunction, parameters, edm, referringType, aliases);
parseFunctionRest(uriInfo, boundFunction, parameters);
return;
}
final EdmFunction unboundFunction = edm.getUnboundFunction(fullQualifiedName, parameterNames);
if (unboundFunction != null) {
ParserHelper.validateFunctionParameters(unboundFunction, parameters, edm, referringType, aliases);
parseFunctionRest(uriInfo, unboundFunction, parameters);
return;
}
throw new UriParserSemanticException("No function '" + fullQualifiedName + "' found.",
UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND, fullQualifiedName.getFullQualifiedNameAsString());
}
示例4: parseTypeCast
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
protected static EdmStructuredType parseTypeCast(UriTokenizer tokenizer, final Edm edm,
final EdmStructuredType referencedType) throws UriParserException {
if (tokenizer.next(TokenKind.QualifiedName)) {
final FullQualifiedName qualifiedName = new FullQualifiedName(tokenizer.getText());
final EdmStructuredType type = referencedType.getKind() == EdmTypeKind.ENTITY ?
edm.getEntityType(qualifiedName) :
edm.getComplexType(qualifiedName);
if (type == null) {
throw new UriParserSemanticException("Type '" + qualifiedName + "' not found.",
UriParserSemanticException.MessageKeys.UNKNOWN_PART, qualifiedName.getFullQualifiedNameAsString());
} else {
if (!type.compatibleTo(referencedType)) {
throw new UriParserSemanticException("The type cast '" + qualifiedName + "' is not compatible.",
UriParserSemanticException.MessageKeys.INCOMPATIBLE_TYPE_FILTER, type.getName());
}
}
return type;
}
return null;
}
示例5: findLastQualifiedTargetName
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
/**
* This looks for the correct entity set
* when the target entity set is part of some other namespace
* e.g <NavigationPropertyBinding Path="Products" Target="SomeModel.SomeContainer/SomeSet" />
* @param navBindingTarget
* @return String
*/
private String findLastQualifiedTargetName(String navBindingTarget) {
String[] targetPaths = navBindingTarget.split("/");
CsdlEntityContainer csdlContainer = csdlContainersMap.containsKey(new FullQualifiedName(targetPaths[0])) ?
csdlContainersMap.get(new FullQualifiedName(targetPaths[0])) :
csdlContainersMap.get(fetchCorrectNamespaceFromAlias(new FullQualifiedName(targetPaths[0])));
if (csdlContainer == null) {
throw new RuntimeException("Container with FullyQualifiedName " + targetPaths[0] + " not found.");
}
String targetEntitySetName = targetPaths[1];
CsdlEntitySet csdlEntitySet = csdlContainer.getEntitySet(targetEntitySetName);
if (csdlEntitySet == null) {
throw new RuntimeException("Target Entity Set mentioned in navigationBindingProperty "
+ "not found in the container " + csdlContainer.getName());
}
FullQualifiedName fqName = csdlEntitySet.getTypeFQN();
if (!(csdlEntityTypesMap.containsKey(fqName))) {
fqName = validateCsdlEntityTypeWithAlias(fqName);
}
return fqName.getFullQualifiedNameAsString();
}
示例6: boundOperationOrTypeCast
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
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());
}
示例7: functionCall
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
private UriResource functionCall(final EdmFunctionImport edmFunctionImport,
final FullQualifiedName boundFunctionName, final FullQualifiedName bindingParameterTypeName,
final boolean isBindingParameterCollection) throws UriParserException, UriValidationException {
final List<UriParameter> parameters = ParserHelper.parseFunctionParameters(tokenizer, edm, null, false, aliases);
final List<String> names = ParserHelper.getParameterNames(parameters);
EdmFunction function = null;
if (edmFunctionImport != null) {
function = edmFunctionImport.getUnboundFunction(names);
if (function == null) {
throw new UriParserSemanticException(
"Function of function import '" + edmFunctionImport.getName() + "' "
+ "with parameters " + names.toString() + " not found.",
UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND, edmFunctionImport.getName(), names.toString());
}
} else {
function = edm.getBoundFunction(boundFunctionName,
bindingParameterTypeName, isBindingParameterCollection, names);
if (function == null) {
throw new UriParserSemanticException(
"Function " + boundFunctionName + " not found.",
UriParserSemanticException.MessageKeys.UNKNOWN_PART, boundFunctionName.getFullQualifiedNameAsString());
}
}
ParserHelper.validateFunctionParameters(function, parameters, edm, null, aliases);
UriResourceFunctionImpl resource = new UriResourceFunctionImpl(edmFunctionImport, function, parameters);
if (tokenizer.next(TokenKind.OPEN)) {
if (function.getReturnType() != null
&& function.getReturnType().getType().getKind() == EdmTypeKind.ENTITY
&& function.getReturnType().isCollection()) {
resource.setKeyPredicates(
ParserHelper.parseKeyPredicate(tokenizer,
(EdmEntityType) function.getReturnType().getType(), null, edm, null, aliases));
} else {
throw new UriParserSemanticException("A key is not allowed.",
UriParserSemanticException.MessageKeys.KEY_NOT_ALLOWED);
}
}
ParserHelper.requireTokenEnd(tokenizer);
return resource;
}
示例8: parseBoundFunction
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
private void parseBoundFunction(final FullQualifiedName fullQualifiedName, UriInfoImpl uriInfo,
final UriResourcePartTyped lastResource) throws UriParserException, UriValidationException {
final EdmType type = lastResource.getType();
final List<UriParameter> parameters =
ParserHelper.parseFunctionParameters(tokenizer, edm, referringType, true, aliases);
final List<String> parameterNames = ParserHelper.getParameterNames(parameters);
final EdmFunction boundFunction = edm.getBoundFunction(fullQualifiedName,
type.getFullQualifiedName(), lastResource.isCollection(), parameterNames);
if (boundFunction == null) {
throw new UriParserSemanticException("Bound function '" + fullQualifiedName + "' not found.",
UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND, fullQualifiedName.getFullQualifiedNameAsString());
}
ParserHelper.validateFunctionParameters(boundFunction, parameters, edm, referringType, aliases);
parseFunctionRest(uriInfo, boundFunction, parameters);
}
示例9: parseCustomFunction
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
private CustomFunction parseCustomFunction(final FullQualifiedName functionName,
final EdmStructuredType referencedType) throws UriParserException, UriValidationException {
final List<UriParameter> parameters =
ParserHelper.parseFunctionParameters(tokenizer, edm, referencedType, true, aliases);
final List<String> parameterNames = ParserHelper.getParameterNames(parameters);
final EdmFunction function = edm.getBoundFunction(functionName,
referencedType.getFullQualifiedName(), true, parameterNames);
if (function == null) {
throw new UriParserSemanticException("No function '" + functionName + "' found.",
UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND,
functionName.getFullQualifiedNameAsString());
}
ParserHelper.validateFunctionParameters(function, parameters, edm, referencedType, aliases);
// The binding parameter and the return type must be of type complex or entity collection.
final EdmParameter bindingParameter = function.getParameter(function.getParameterNames().get(0));
final EdmReturnType returnType = function.getReturnType();
if (bindingParameter.getType().getKind() != EdmTypeKind.ENTITY
&& bindingParameter.getType().getKind() != EdmTypeKind.COMPLEX
|| !bindingParameter.isCollection()
|| returnType.getType().getKind() != EdmTypeKind.ENTITY
&& returnType.getType().getKind() != EdmTypeKind.COMPLEX
|| !returnType.isCollection()) {
throw new UriParserSemanticException("Only entity- or complex-collection functions are allowed.",
UriParserSemanticException.MessageKeys.FUNCTION_MUST_USE_COLLECTIONS,
functionName.getFullQualifiedNameAsString());
}
return new CustomFunctionImpl().setFunction(function).setParameters(parameters);
}
示例10: getAliasedFullQualifiedName
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
private String getAliasedFullQualifiedName(final FullQualifiedName fqn) {
final String name;
if (namespaceToAlias.get(fqn.getNamespace()) != null) {
name = namespaceToAlias.get(fqn.getNamespace()) + "." + fqn.getName();
} else {
name = fqn.getFullQualifiedNameAsString();
}
return name;
}
示例11: appendFunctionImports
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
private void appendFunctionImports(final XMLStreamWriter writer, final List<EdmFunctionImport> functionImports,
final String containerNamespace) throws XMLStreamException {
for (EdmFunctionImport functionImport : functionImports) {
writer.writeStartElement(XML_FUNCTION_IMPORT);
writer.writeAttribute(XML_NAME, functionImport.getName());
String functionFQNString;
FullQualifiedName functionFqn = functionImport.getFunctionFqn();
if (namespaceToAlias.get(functionFqn.getNamespace()) != null) {
functionFQNString = namespaceToAlias.get(functionFqn.getNamespace()) + "." + functionFqn.getName();
} else {
functionFQNString = functionFqn.getFullQualifiedNameAsString();
}
writer.writeAttribute(XML_FUNCTION, functionFQNString);
EdmEntitySet returnedEntitySet = functionImport.getReturnedEntitySet();
if (returnedEntitySet != null) {
writer.writeAttribute(XML_ENTITY_SET, containerNamespace + "." + returnedEntitySet.getName());
}
// Default is false and we do not write the default
if (functionImport.isIncludeInServiceDocument()) {
writer.writeAttribute(XML_INCLUDE_IN_SERVICE_DOCUMENT, "" + functionImport.isIncludeInServiceDocument());
}
appendAnnotations(writer, functionImport);
writer.writeEndElement();
}
}
示例12: getAliasedFullQualifiedName
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
private String getAliasedFullQualifiedName(final FullQualifiedName fqn, final boolean isCollection) {
final String name;
if (namespaceToAlias.get(fqn.getNamespace()) != null) {
name = namespaceToAlias.get(fqn.getNamespace()) + "." + fqn.getName();
} else {
name = fqn.getFullQualifiedNameAsString();
}
return isCollection ? "Collection(" + name + ")" : name;
}
示例13: typeCast
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
private UriResource typeCast(final FullQualifiedName name, final EdmStructuredType type,
final UriResourcePartTyped previousTyped) throws UriParserException, UriValidationException {
if (type.compatibleTo(previousTyped.getType())) {
EdmType previousTypeFilter = null;
if (previousTyped instanceof UriResourceWithKeysImpl) {
if (previousTyped.isCollection()) {
previousTypeFilter = ((UriResourceWithKeysImpl) previousTyped).getTypeFilterOnCollection();
if (previousTypeFilter != null) {
throw new UriParserSemanticException("Type filters are not chainable.",
UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE,
previousTypeFilter.getName(), type.getName());
}
((UriResourceWithKeysImpl) previousTyped).setCollectionTypeFilter(type);
} else {
previousTypeFilter = ((UriResourceWithKeysImpl) previousTyped).getTypeFilterOnEntry();
if (previousTypeFilter != null) {
throw new UriParserSemanticException("Type filters are not chainable.",
UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE,
previousTypeFilter.getName(), type.getName());
}
((UriResourceWithKeysImpl) previousTyped).setEntryTypeFilter(type);
}
if (tokenizer.next(TokenKind.OPEN)) {
final List<UriParameter> keys =
ParserHelper.parseKeyPredicate(tokenizer, (EdmEntityType) type, null, edm, null, aliases);
if (previousTyped.isCollection()) {
((UriResourceWithKeysImpl) previousTyped).setKeyPredicates(keys);
} else {
throw new UriParserSemanticException("Key not allowed here.",
UriParserSemanticException.MessageKeys.KEY_NOT_ALLOWED);
}
}
} else {
previousTypeFilter = ((UriResourceTypedImpl) previousTyped).getTypeFilter();
if (previousTypeFilter != null) {
throw new UriParserSemanticException("Type filters are not chainable.",
UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE,
previousTypeFilter.getName(), type.getName());
}
((UriResourceTypedImpl) previousTyped).setTypeFilter(type);
}
ParserHelper.requireTokenEnd(tokenizer);
return null;
} else {
throw new UriParserSemanticException(
"Type filter not compatible to previous path segment: " + name.getFullQualifiedNameAsString(),
UriParserSemanticException.MessageKeys.INCOMPATIBLE_TYPE_FILTER, name.getFullQualifiedNameAsString());
}
}
示例14: addSelectPath
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
private void addSelectPath(UriTokenizer tokenizer, final EdmStructuredType referencedType, UriInfoImpl resource)
throws UriParserException {
final String name = tokenizer.getText();
final EdmProperty property = referencedType.getStructuralProperty(name);
if (property == null) {
final EdmNavigationProperty navigationProperty = referencedType.getNavigationProperty(name);
if (navigationProperty == null) {
throw new UriParserSemanticException("Selected property not found.",
UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE,
referencedType.getName(), name);
} else {
resource.addResourcePart(new UriResourceNavigationPropertyImpl(navigationProperty));
}
} else if (property.isPrimitive()
|| property.getType().getKind() == EdmTypeKind.ENUM
|| property.getType().getKind() == EdmTypeKind.DEFINITION) {
resource.addResourcePart(new UriResourcePrimitivePropertyImpl(property));
} else {
UriResourceComplexPropertyImpl complexPart = new UriResourceComplexPropertyImpl(property);
resource.addResourcePart(complexPart);
if (tokenizer.next(TokenKind.SLASH)) {
if (tokenizer.next(TokenKind.QualifiedName)) {
final FullQualifiedName qualifiedName = new FullQualifiedName(tokenizer.getText());
final EdmComplexType type = edm.getComplexType(qualifiedName);
if (type == null) {
throw new UriParserSemanticException("Type not found.",
UriParserSemanticException.MessageKeys.UNKNOWN_TYPE, qualifiedName.getFullQualifiedNameAsString());
} else if (type.compatibleTo(property.getType())) {
complexPart.setTypeFilter(type);
if (tokenizer.next(TokenKind.SLASH)) {
if (tokenizer.next(TokenKind.ODataIdentifier)) {
addSelectPath(tokenizer, type, resource);
} else {
throw new UriParserSemanticException("Unknown part after '/'.",
UriParserSemanticException.MessageKeys.UNKNOWN_PART, "");
}
}
} else {
throw new UriParserSemanticException("The type cast is not compatible.",
UriParserSemanticException.MessageKeys.INCOMPATIBLE_TYPE_FILTER, type.getName());
}
} else if (tokenizer.next(TokenKind.ODataIdentifier)) {
addSelectPath(tokenizer, (EdmStructuredType) property.getType(), resource);
} else if (tokenizer.next(TokenKind.SLASH)) {
throw new UriParserSyntaxException("Illegal $select expression.",
UriParserSyntaxException.MessageKeys.SYNTAX);
} else {
throw new UriParserSemanticException("Unknown part after '/'.",
UriParserSemanticException.MessageKeys.UNKNOWN_PART, "");
}
}
}
}
示例15: parseMemberExpression
import org.apache.olingo.commons.api.edm.FullQualifiedName; //导入方法依赖的package包/类
private void parseMemberExpression(final TokenKind lastTokenKind, UriInfoImpl uriInfo,
final UriResourcePartTyped lastResource, final boolean allowTypeFilter)
throws UriParserException, UriValidationException {
if (lastTokenKind == TokenKind.QualifiedName) {
// Type cast to an entity type or complex type or bound function
final FullQualifiedName fullQualifiedName = new FullQualifiedName(tokenizer.getText());
final EdmEntityType edmEntityType = edm.getEntityType(fullQualifiedName);
if (edmEntityType != null) {
if (allowTypeFilter) {
setTypeFilter(lastResource, edmEntityType);
if (tokenizer.next(TokenKind.SLASH)) {
if (tokenizer.next(TokenKind.QualifiedName)) {
parseBoundFunction(fullQualifiedName, uriInfo, lastResource);
} else if (tokenizer.next(TokenKind.ODataIdentifier)) {
parsePropertyPathExpr(uriInfo, lastResource);
} else {
throw new UriParserSyntaxException("Expected OData Identifier or Full Qualified Name.",
UriParserSyntaxException.MessageKeys.SYNTAX);
}
}
} else {
throw new UriParserSemanticException("Type filters are not chainable.",
UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE,
lastResource.getType().getFullQualifiedName().getFullQualifiedNameAsString(),
fullQualifiedName.getFullQualifiedNameAsString());
}
} else if (edm.getComplexType(fullQualifiedName) != null) {
if (allowTypeFilter) {
setTypeFilter(lastResource, edm.getComplexType(fullQualifiedName));
if (tokenizer.next(TokenKind.SLASH)) {
if (tokenizer.next(TokenKind.QualifiedName)) {
parseBoundFunction(fullQualifiedName, uriInfo, lastResource);
} else if (tokenizer.next(TokenKind.ODataIdentifier)) {
parsePropertyPathExpr(uriInfo, lastResource);
} else {
throw new UriParserSyntaxException("Expected OData Identifier or Full Qualified Name.",
UriParserSyntaxException.MessageKeys.SYNTAX);
}
}
} else {
throw new UriParserSemanticException("Type filters are not chainable.",
UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE,
lastResource.getType().getFullQualifiedName().getFullQualifiedNameAsString(),
fullQualifiedName.getFullQualifiedNameAsString());
}
} else {
parseBoundFunction(fullQualifiedName, uriInfo, lastResource);
}
} else if (lastTokenKind == TokenKind.ODataIdentifier) {
parsePropertyPathExpr(uriInfo, lastResource);
} else {
throw new UriParserSyntaxException("Unexpected token.", UriParserSyntaxException.MessageKeys.SYNTAX);
}
}