@Override public Map<String, CsdlSchema> getSchemaByNsOrAlias() { final Map<String, CsdlSchema> schemaByNsOrAlias = new HashMap<String, CsdlSchema>(); for (CsdlSchema schema : getSchemas()) { schemaByNsOrAlias.put(schema.getNamespace(), schema); if (StringUtils.isNotBlank(schema.getAlias())) { schemaByNsOrAlias.put(schema.getAlias(), schema); } } return schemaByNsOrAlias; }
@Override public Map<String, CsdlSchema> getSchemaByNsOrAlias() { final Map<String, CsdlSchema> schemaByNsOrAlias = new HashMap<String, CsdlSchema>(); for (CsdlSchema schema : getSchemas()) { schemaByNsOrAlias.put(schema.getNamespace(), schema); if (StringUtils.isNotBlank(schema.getAlias())) { schemaByNsOrAlias.put(schema.getAlias(), schema); } } return schemaByNsOrAlias; }
private void storeAliasNamespace(CDXEdmProvider edmxMetadataProvider, String serviceName) { /*-- Read all schema namespaces and ALias from the EDMX ---*/ try { List<CsdlSchema> schemas = edmxMetadataProvider.getSchemas(); for (CsdlSchema schema : schemas) { namespaceMap.put(schema.getNamespace(), serviceName); aliasMap.put(schema.getAlias(), serviceName); } } catch (ODataException e) { log.error("Alias namespace storage failed " + e, e); } }
@Override public List<CsdlAliasInfo> getAliasInfos() throws ODataException { ArrayList<CsdlAliasInfo> aliasInfo = new ArrayList<CsdlAliasInfo>(); for (CsdlSchema schema : xmlSchemas.values()) { if (schema.getAlias() != null) { aliasInfo.add(new CsdlAliasInfo().setNamespace(schema.getNamespace()).setAlias(schema.getAlias())); } } return aliasInfo; }
@Override public List<CsdlAliasInfo> getAliasInfos() throws ODataException { ArrayList<CsdlAliasInfo> aliasInfo = new ArrayList<CsdlAliasInfo>(); for (CsdlSchema schema : xmlSchemas.values()) { if (schema.getAlias() != null) { aliasInfo.add(new CsdlAliasInfo().setNamespace(schema.getNamespace()).setAlias(schema.getAlias())); } } return aliasInfo; }
@Override public List<CsdlAliasInfo> getAliasInfos() throws ODataException { List<CsdlAliasInfo> csdlAliasInfo = new ArrayList<>(); List<CsdlSchema> csdlSchemas = xmlMetadata.getSchemas(); for (CsdlSchema csdlSchema : csdlSchemas) { csdlAliasInfo.add(new CsdlAliasInfo().setAlias(csdlSchema.getAlias())); // To-DO // CsdlAliasInfo().setNamaeSpace ??? } return csdlAliasInfo; }
@Override public CsdlComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException { for (final CsdlSchema schema : serviceDocument.getAllSchemas()) { if (schema.getNamespace().equals(complexTypeName.getNamespace()) || schema.getAlias() != null && schema.getAlias().equals(complexTypeName.getNamespace())) { return schema.getComplexType(complexTypeName.getName()); } } return null; }
@Override public ODataSchemaInfo getSchemaInfo(String name) { ODataSchemaInfo result = infoMap.get(name); if (result != null) { //add a bi-directional relationship info.edmProvider.addReferenceSchema( vdb.getFullName(), result.schema.getNamespace(), result.schema.getAlias(), result.edmProvider); result.edmProvider.addReferenceSchema( vdb.getFullName(), info.schema.getNamespace(), info.schema.getAlias(), info.edmProvider); } return result; } });
@Override public List<CsdlAction> getActions(FullQualifiedName actionName) throws ODataException { List<CsdlSchema> csdlSchemas = xmlMetadata.getSchemas(); for (CsdlSchema csdlSchema : csdlSchemas) { if (csdlSchema.getNamespace().equals(actionName.getNamespace())||csdlSchema.getAlias().equals(actionName.getNamespace())) { return csdlSchema.getActions(actionName.getName()); } } return Collections.emptyList(); }
@Override public List<CsdlFunction> getFunctions(FullQualifiedName functionName) throws ODataException { List<CsdlSchema> csdlSchemas = xmlMetadata.getSchemas(); for (CsdlSchema csdlSchema : csdlSchemas) { if (csdlSchema.getNamespace().equals(functionName.getNamespace())||csdlSchema.getAlias().equals(functionName.getNamespace())) { return csdlSchema.getFunctions(functionName.getName()); } } return null; }
public static String resolveAliasToNamespace(CDXEdmProvider edmxProvider, String fqnNamespace){ if(edmxProvider != null && fqnNamespace != null && !fqnNamespace.isEmpty()){ //first check in schema namespace try { if(fqnNamespace.equals(edmxProvider.getSchemas().get(0).getNamespace())){ return fqnNamespace; } else if(fqnNamespace.equals(edmxProvider.getSchemas().get(0).getAlias())){ return edmxProvider.getSchemas().get(0).getNamespace(); } //check in references else{ return resolveAliasToNamespaceForReferences(edmxProvider.getReferences(), fqnNamespace); } } catch (ODataException e) { PojoGenUtil.logDebug(log, "Could not fetch edm namespace or references called by resolveAliasToNamespace" + e.getMessage()); } } return fqnNamespace; }
ArrayList<CsdlAliasInfo> list = new ArrayList<CsdlAliasInfo>(); for (CsdlSchema s : this.edmSchemas) { if (s.getAlias() != null) { CsdlAliasInfo ai = new CsdlAliasInfo(); ai.setAlias(s.getAlias()); ai.setNamespace(s.getNamespace()); list.add(ai); if (s.getAlias() != null) { CsdlAliasInfo ai = new CsdlAliasInfo(); ai.setAlias(s.getAlias()); ai.setNamespace(s.getNamespace()); list.add(ai);
ArrayList<CsdlAliasInfo> list = new ArrayList<CsdlAliasInfo>(); for (CsdlSchema s : this.edmSchemas) { if (s.getAlias() != null) { CsdlAliasInfo ai = new CsdlAliasInfo(); ai.setAlias(s.getAlias()); ai.setNamespace(s.getNamespace()); list.add(ai); if (s.getAlias() != null) { CsdlAliasInfo ai = new CsdlAliasInfo(); ai.setAlias(s.getAlias()); ai.setNamespace(s.getNamespace()); list.add(ai);
@Override protected EdmTerm createTerm(final FullQualifiedName termName) { try { CsdlTerm providerTerm = provider.getTerm(termName); if (providerTerm != null) { return new EdmTermImpl(this, termName.getNamespace(), providerTerm); } else { for (CsdlSchema schema : termSchemaDefinition) { if (schema.getNamespace().equalsIgnoreCase(termName.getNamespace()) || (null != schema.getAlias() && schema.getAlias().equalsIgnoreCase(termName.getNamespace()))) { List<CsdlTerm> terms = schema.getTerms(); for (CsdlTerm term : terms) { if (term.getName().equals(termName.getName())) { return new EdmTermImpl(this, termName.getNamespace(), term); } } } } } return null; } catch (ODataException e) { throw new EdmException(e); } }
private static void addOperationParameterAnnotations( ProcedureParameter procedure, CsdlParameter parameter, CsdlSchema csdlSchema) { if (procedure.getAnnotation() != null) { addStringAnnotation(parameter, "Core.Description", procedure.getAnnotation()); } if (procedure.getNameInSource() != null) { addStringAnnotation(parameter, "teiid.NAMEINSOURCE", procedure.getNameInSource()); } // add all custom properties for (String str:procedure.getProperties().keySet()) { addTerm(normalizeTermName(str), new String[] {"Parameter"}, csdlSchema); addStringAnnotation(parameter, csdlSchema.getAlias()+"."+normalizeTermName(str), procedure.getProperties().get(str)); } } private static void addStringAnnotation(CsdlAnnotatable recipent, String term, String value) {
new FullQualifiedName(csdlSchema.getNamespace(), csdlFunction.getName()), csdlFunction); aliasNamespaceMap.put(csdlSchema.getAlias(), csdlSchema.getNamespace()); if (csdlSchema.getEntityContainer() != null) { csdlContainersMap.put(new FullQualifiedName(
private static void addOperationAnnotations(Procedure proc, CsdlOperation operation, CsdlSchema csdlSchema) { if (proc.getAnnotation() != null) { addStringAnnotation(operation, "Core.Description", proc.getAnnotation()); } if (proc.getNameInSource() != null) { addStringAnnotation(operation, "teiid.NAMEINSOURCE", proc.getNameInSource()); } if (proc.getUpdateCount() != Procedure.AUTO_UPDATECOUNT) { addIntAnnotation(operation, "teiid.UPDATECOUNT", proc.getUpdateCount()); } // add all custom properties for (String str:proc.getProperties().keySet()) { addTerm(normalizeTermName(str), new String[] {"Action", "Function"}, csdlSchema); addStringAnnotation(operation, csdlSchema.getAlias()+"."+normalizeTermName(str), proc.getProperties().get(str)); } }
public EdmSchemaImpl(final EdmProviderImpl edm, final CsdlEdmProvider provider, final CsdlSchema schema) { super(edm, schema); this.edm = edm; this.provider = provider; this.schema = schema; namespace = schema.getNamespace(); alias = schema.getAlias(); if (alias != null) { edm.cacheAliasNamespaceInfo(alias, namespace); } enumTypes = createEnumTypes(); typeDefinitions = createTypeDefinitions(); entityTypes = createEntityTypes(); complexTypes = createComplexTypes(); actions = createActions(); functions = createFunctions(); entityContainer = createEntityContainer(); annotationGroups = createAnnotationGroups(); annotations = createAnnotations(); terms = createTerms(); }
public EdmSchemaImpl(final EdmProviderImpl edm, final CsdlEdmProvider provider, final CsdlSchema schema) { super(edm, schema); this.edm = edm; this.provider = provider; this.schema = schema; namespace = schema.getNamespace(); alias = schema.getAlias(); if (alias != null) { edm.cacheAliasNamespaceInfo(alias, namespace); } enumTypes = createEnumTypes(); typeDefinitions = createTypeDefinitions(); entityTypes = createEntityTypes(); complexTypes = createComplexTypes(); actions = createActions(); functions = createFunctions(); entityContainer = createEntityContainer(); annotationGroups = createAnnotationGroups(); annotations = createAnnotations(); terms = createTerms(); }
addStringAnnotation(property, csdlSchema.getAlias()+"."+normalizeTermName(str), column.getProperties().get(str));