@Override public EdmTyped getReturnType() throws EdmException { final ReturnType returnType = functionImport.getReturnType(); return new EdmTypedImplProv(edm, functionImport.getName(), returnType.getTypeName(), returnType.getMultiplicity()); }
@Override public EdmTyped getReturnType() throws EdmException { if (edmReturnType == null) { final ReturnType returnType = functionImport.getReturnType(); if (returnType != null) { edmReturnType = new EdmTypedImplProv(edm, functionImport.getName(), returnType.getTypeName(), returnType.getMultiplicity()); } } return edmReturnType; }
@Override public EdmTyped getReturnType() throws EdmException { if (edmReturnType == null) { final ReturnType returnType = functionImport.getReturnType(); if (returnType != null) { edmReturnType = new EdmTypedImplProv(edm, functionImport.getName(), returnType.getTypeName(), returnType.getMultiplicity()); } } return edmReturnType; }
private void includeFunctionImport(Schema targetSchema, EntityContainer targetContainer, IServiceInfo service, FunctionImport sourceFunctionImport) throws ODataException { List<FunctionImport> functionImports = targetContainer .getFunctionImports(); if (functionImports != null) { for (FunctionImport functionImport : functionImports) { if (functionImport.getName().equals( sourceFunctionImport.getName())) { throw new ODataException("function import " + sourceFunctionImport.getName() + " already defined"); } } } else { functionImports = new ArrayList<FunctionImport>(); } FunctionImport newFunctionImport = clone(sourceFunctionImport); if (newFunctionImport.getReturnType() != null) { newFunctionImport.getReturnType().setTypeName( new FullQualifiedName(targetSchema.getNamespace(), newFunctionImport.getReturnType().getTypeName() .getName())); } functionImports.add(newFunctionImport); targetContainer.setFunctionImports(functionImports); MashServiceRegistry.setTargetService(_service, targetSchema, targetContainer, newFunctionImport, service); }
private void validateFunctionImport() throws EntityProviderException { for (FunctionImport functionImport : edmFunctionImportList) { ReturnType returnType = functionImport.getReturnType(); if (returnType != null) { String entitySet = functionImport.getEntitySet(); FullQualifiedName fqn = returnType.getTypeName(); if (returnType.getMultiplicity() == EdmMultiplicity.MANY && entitySet == null && entityTypesMap.get( fqn) != null) { throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent("EntitySet = " + entitySet, XmlMetadataConstants.EDM_FUNCTION_IMPORT + " = " + functionImport.getName())); } else if (returnType.getMultiplicity() != EdmMultiplicity.MANY && entitySet != null && entityTypesMap.get( fqn) == null) { throw new EntityProviderException(EntityProviderException.INVALID_ATTRIBUTE.addContent("EntitySet = " + entitySet, XmlMetadataConstants.EDM_FUNCTION_IMPORT + " = " + functionImport.getName())); } } } } /* This method gets the last base type of the EntityType
xmlStreamWriter.writeStartElement(XmlMetadataConstants.EDM_FUNCTION_IMPORT); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAME, functionImport.getName()); if (functionImport.getReturnType() != null) { xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_FUNCTION_IMPORT_RETURN, functionImport .getReturnType().toString());
xmlStreamWriter.writeStartElement(XmlMetadataConstants.EDM_FUNCTION_IMPORT); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAME, functionImport.getName()); if (functionImport.getReturnType() != null) { xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_FUNCTION_IMPORT_RETURN, functionImport .getReturnType().toString());
xmlStreamWriter.writeStartElement(XmlMetadataConstants.EDM_FUNCTION_IMPORT); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAME, functionImport.getName()); if (functionImport.getReturnType() != null) { xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_FUNCTION_IMPORT_RETURN, functionImport .getReturnType().toString());
private FunctionImport clone(FunctionImport functionImport) { if (functionImport == null) { return null; } FunctionImport newFunctionImport = new FunctionImport(); newFunctionImport.setAnnotationAttributes(functionImport .getAnnotationAttributes()); newFunctionImport.setAnnotationElements(functionImport .getAnnotationElements()); newFunctionImport.setDocumentation(functionImport.getDocumentation()); newFunctionImport.setEntitySet(functionImport.getEntitySet()); newFunctionImport.setHttpMethod(functionImport.getHttpMethod()); newFunctionImport.setMapping(functionImport.getMapping()); newFunctionImport.setName(functionImport.getName()); newFunctionImport.setParameters(functionImport.getParameters()); newFunctionImport.setReturnType(clone(functionImport.getReturnType())); return newFunctionImport; }