Java Code Examples for org.apache.olingo.commons.api.edm.FullQualifiedName#getFullQualifiedNameAsString()
The following examples show how to use
org.apache.olingo.commons.api.edm.FullQualifiedName#getFullQualifiedNameAsString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EdmActionImportImplTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@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); }
Example 2
Source File: ParserHelper.java From olingo-odata4 with Apache License 2.0 | 6 votes |
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; }
Example 3
Source File: CsdlTypeValidator.java From olingo-odata4 with Apache License 2.0 | 6 votes |
/** * 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(); }
Example 4
Source File: ExpressionParser.java From olingo-odata4 with Apache License 2.0 | 6 votes |
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()); }
Example 5
Source File: MetadataDocumentXmlSerializer.java From olingo-odata4 with Apache License 2.0 | 5 votes |
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; }
Example 6
Source File: MetadataDocumentXmlSerializer.java From olingo-odata4 with Apache License 2.0 | 5 votes |
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) { String returnedEntitySetNamespace = returnedEntitySet.getEntityContainer().getNamespace(); if ((null != returnedEntitySetNamespace && returnedEntitySetNamespace.equals(containerNamespace)) || ( namespaceToAlias.get(returnedEntitySetNamespace) != null && namespaceToAlias.get(returnedEntitySetNamespace).equals(containerNamespace))) { writer.writeAttribute(XML_ENTITY_SET, returnedEntitySet.getName()); } else { 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(); } }
Example 7
Source File: MetadataDocumentJsonSerializer.java From olingo-odata4 with Apache License 2.0 | 5 votes |
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; }
Example 8
Source File: MetadataDocumentJsonSerializer.java From olingo-odata4 with Apache License 2.0 | 5 votes |
private void appendFunctionImports(final JsonGenerator json, final List<EdmFunctionImport> functionImports, final String containerNamespace) throws SerializerException, IOException { for (EdmFunctionImport functionImport : functionImports) { json.writeObjectFieldStart(functionImport.getName()); json.writeStringField(KIND, Kind.FunctionImport.name()); String functionFQNString; FullQualifiedName functionFqn = functionImport.getFunctionFqn(); if (namespaceToAlias.get(functionFqn.getNamespace()) != null) { functionFQNString = namespaceToAlias.get(functionFqn.getNamespace()) + "." + functionFqn.getName(); } else { functionFQNString = functionFqn.getFullQualifiedNameAsString(); } json.writeStringField(DOLLAR + Kind.Function.name(), functionFQNString); EdmEntitySet returnedEntitySet = functionImport.getReturnedEntitySet(); if (returnedEntitySet != null) { json.writeStringField(DOLLAR + Kind.EntitySet.name(), containerNamespace + "." + returnedEntitySet.getName()); } // Default is false and we do not write the default if (functionImport.isIncludeInServiceDocument()) { json.writeBooleanField(INCLUDE_IN_SERV_DOC, functionImport.isIncludeInServiceDocument()); } appendAnnotations(json, functionImport, null); json.writeEndObject(); } }
Example 9
Source File: ApplyParser.java From olingo-odata4 with Apache License 2.0 | 5 votes |
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); }
Example 10
Source File: ExpressionParser.java From olingo-odata4 with Apache License 2.0 | 5 votes |
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); }
Example 11
Source File: ResourcePathParser.java From olingo-odata4 with Apache License 2.0 | 5 votes |
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()); }
Example 12
Source File: ExpressionParser.java From olingo-odata4 with Apache License 2.0 | 4 votes |
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); } }
Example 13
Source File: SelectParser.java From olingo-odata4 with Apache License 2.0 | 4 votes |
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, ""); } } } }
Example 14
Source File: ResourcePathParser.java From olingo-odata4 with Apache License 2.0 | 4 votes |
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); ParserHelper.validateFunctionParameterFacets(function, parameters, edm, 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; }
Example 15
Source File: ResourcePathParser.java From olingo-odata4 with Apache License 2.0 | 4 votes |
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()); } }
Example 16
Source File: MetadataDocumentJsonSerializer.java From olingo-odata4 with Apache License 2.0 | 4 votes |
private void appendEntityContainer(final JsonGenerator json, final EdmEntityContainer container) throws SerializerException, IOException { if (container != null) { json.writeObjectFieldStart(container.getName()); json.writeStringField(KIND, Kind.EntityContainer.name()); FullQualifiedName parentContainerName = container.getParentContainerName(); if (parentContainerName != null) { String parentContainerNameString; if (namespaceToAlias.get(parentContainerName.getNamespace()) != null) { parentContainerNameString = namespaceToAlias.get(parentContainerName.getNamespace()) + "." + parentContainerName.getName(); } else { parentContainerNameString = parentContainerName.getFullQualifiedNameAsString(); } json.writeObjectFieldStart(Kind.Extending.name()); json.writeStringField(KIND, Kind.EntityContainer.name()); json.writeStringField(EXTENDS, parentContainerNameString); json.writeEndObject(); } // EntitySets appendEntitySets(json, container.getEntitySets()); String containerNamespace; if (namespaceToAlias.get(container.getNamespace()) != null) { containerNamespace = namespaceToAlias.get(container.getNamespace()); } else { containerNamespace = container.getNamespace(); } // ActionImports appendActionImports(json, container.getActionImports(), containerNamespace); // FunctionImports appendFunctionImports(json, container.getFunctionImports(), containerNamespace); // Singletons appendSingletons(json, container.getSingletons()); // Annotations appendAnnotations(json, container, null); json.writeEndObject(); } }
Example 17
Source File: MetadataDocumentXmlSerializer.java From olingo-odata4 with Apache License 2.0 | 4 votes |
private void appendEntityContainer(final XMLStreamWriter writer, final EdmEntityContainer container) throws XMLStreamException { if (container != null) { writer.writeStartElement(XML_ENTITY_CONTAINER); writer.writeAttribute(XML_NAME, container.getName()); FullQualifiedName parentContainerName = container.getParentContainerName(); if (parentContainerName != null) { String parentContainerNameString; if (namespaceToAlias.get(parentContainerName.getNamespace()) != null) { parentContainerNameString = namespaceToAlias.get(parentContainerName.getNamespace()) + "." + parentContainerName.getName(); } else { parentContainerNameString = parentContainerName.getFullQualifiedNameAsString(); } writer.writeAttribute(XML_EXTENDS, parentContainerNameString); } // EntitySets appendEntitySets(writer, container.getEntitySets()); // ActionImports appendActionImports(writer, container.getActionImports()); // FunctionImports String containerNamespace; if (namespaceToAlias.get(container.getNamespace()) != null) { containerNamespace = namespaceToAlias.get(container.getNamespace()); } else { containerNamespace = container.getNamespace(); } appendFunctionImports(writer, container.getFunctionImports(), containerNamespace); // Singletons appendSingletons(writer, container.getSingletons()); // Annotations appendAnnotations(writer, container); writer.writeEndElement(); } }
Example 18
Source File: CsdlReturnType.java From olingo-odata4 with Apache License 2.0 | 2 votes |
/** * Sets type. * * @param type the type * @return the type */ public CsdlReturnType setType(final FullQualifiedName type) { this.type = type.getFullQualifiedNameAsString(); return this; }
Example 19
Source File: CsdlProperty.java From olingo-odata4 with Apache License 2.0 | 2 votes |
/** * Sets type. * * @param fqnName the fqn name * @return the type */ public CsdlProperty setType(final FullQualifiedName fqnName) { type = fqnName.getFullQualifiedNameAsString(); return this; }
Example 20
Source File: CsdlParameter.java From olingo-odata4 with Apache License 2.0 | 2 votes |
/** * Sets type. * * @param type the type * @return the type */ public CsdlParameter setType(final FullQualifiedName type) { this.type = type.getFullQualifiedNameAsString(); return this; }