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; }
/** * This validates the namespace to alias mapping * @param fQName * @return FullQualifiedName */ private FullQualifiedName fetchCorrectNamespaceFromAlias(FullQualifiedName fqName) { if (aliasNamespaceMap.containsKey(fqName.getNamespace())) { String namespace = aliasNamespaceMap.get(fqName.getNamespace()); fqName = new FullQualifiedName(namespace, fqName.getName()); } return fqName; }
@Override public CsdlEntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) { if (entityContainerName == null || containerFullQName.equals(entityContainerName)) { return csdlEntityContainerInfo; } return null; }
@Override public CsdlTypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) throws ODataException { CsdlSchema schema = xmlSchemas.get(typeDefinitionName.getNamespace()); if (schema != null) { return schema.getTypeDefinition(typeDefinitionName.getName()); } return null; }
/** * Sets type. * * @param fqnName the fqn name * @return the type */ public CsdlProperty setType(final FullQualifiedName fqnName) { type = fqnName.getFullQualifiedNameAsString(); return this; }
/** * Sets base type. * * @param baseType the base type * @return the base type */ public CsdlStructuralType setBaseType(final String baseType) { this.baseType = new FullQualifiedName(baseType); return this; }
@Override public CsdlAnnotations getAnnotationsGroup(FullQualifiedName targetName, String qualifier) throws ODataException { CsdlSchema schema = getSchema(targetName.getNamespace()); if (schema != null) { return schema.getAnnotationGroup(targetName.getFullQualifiedNameAsString(), qualifier); } return null; } }
@Override public EC getResult() { final URIBuilder uriBuilder = client.newURIBuilder(this.baseURI.toASCIIString()). appendDerivedEntityTypeSegment(new FullQualifiedName( ClassUtils.getNamespace(typeRef), ClassUtils.getEntityTypeName(typeRef)).toString()); if (StringUtils.isNotBlank(search)) { uriBuilder.search(search); } return handler.fetchWholeEntitySet(uriBuilder, typeRef, collTypeRef); } }
@Override public CsdlSingleton getSingleton(final FullQualifiedName entityContainer, final String singletonName) throws ODataException { CsdlSchema schema = xmlSchemas.get(entityContainer.getNamespace()); if (schema != null) { return schema.getEntityContainer().getSingleton(singletonName); } return null; }
public EdmEntityContainerImpl(final Edm edm, final CsdlEdmProvider provider, final CsdlEntityContainerInfo entityContainerInfo) { super(edm, entityContainerInfo.getContainerName().getName(), null); this.provider = provider; entityContainerName = entityContainerInfo.getContainerName(); parentContainerName = entityContainerInfo.getExtendsContainer(); }
@Override public CsdlAnnotations getAnnotationsGroup(FullQualifiedName targetName, String qualifier) throws ODataException { CsdlSchema schema = xmlSchemas.get(targetName.getNamespace()); if (schema != null) { return schema.getAnnotationGroup(targetName.getName(), qualifier); } return null; } }
/** * Sets type. * * @param type the type * @return the type */ public CsdlReturnType setType(final FullQualifiedName type) { this.type = type.getFullQualifiedNameAsString(); return this; }
/** * Gets type fQN. * * @return the type fQN */ public FullQualifiedName getTypeFQN() { return new FullQualifiedName(type); }
@Override public EC getResult() { final URIBuilder uriBuilder = client.newURIBuilder(this.baseURI.toASCIIString()). appendDerivedEntityTypeSegment(new FullQualifiedName( ClassUtils.getNamespace(typeRef), ClassUtils.getEntityTypeName(typeRef)).toString()); if (StringUtils.isNotBlank(search)) { uriBuilder.search(search); } return handler.fetchWholeEntitySet(uriBuilder, typeRef, collTypeRef); } }
@Override public JPAEnumerationAttribute getEnumType(EdmEnumType type) { final IntermediateSchema schema = schemaListInternalKey.get(type.getFullQualifiedName().getNamespace()); if (schema != null) return schema.getEnumerationType(type); return null; }
@Override protected void lazyBuildEdmItem() throws ODataJPAModelException { super.lazyBuildEdmItem(); if (isComplex() && schema.getComplexType(this.edmProperty.getTypeAsFQNObject().getName()) == null) // Base type of collection '%1$s' of structured type '%2$s' not found throw new ODataJPAModelException(MessageKeys.INVALID_COLLECTION_TYPE, getInternalName(), sourceType .getInternalName()); edmProperty.setCollection(true); }
@Override public CsdlComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException { CsdlSchema schema = xmlSchemas.get(complexTypeName.getNamespace()); if (schema != null) { return schema.getComplexType(complexTypeName.getName()); } return null; }
/** * This validates the namespace to alias mapping * @param fqName * @return FullQualifiedName */ private FullQualifiedName fetchCorrectNamespaceFromAlias(FullQualifiedName fqName) { if (aliasNamespaceMap.containsKey(fqName.getNamespace())) { String namespace = aliasNamespaceMap.get(fqName.getNamespace()); fqName = new FullQualifiedName(namespace, fqName.getName()); } return fqName; }