use of org.apache.olingo.commons.api.edm.FullQualifiedName in project teiid by teiid.
the class TestODataMetadataProcessor method functionMetadata.
static MetadataFactory functionMetadata(String name, CsdlReturnType returnType, Object other) throws TranslatorException {
ODataMetadataProcessor processor = new ODataMetadataProcessor();
MetadataFactory mf = new MetadataFactory("vdb", 1, "northwind", SystemMetadata.getInstance().getRuntimeTypeMap(), new Properties(), null);
CsdlFunction func = function(name, returnType);
CsdlFunctionImport funcImport = new CsdlFunctionImport();
funcImport.setFunction(new FullQualifiedName("namespace." + name));
funcImport.setName(name);
XMLMetadata metadata = buildXmlMetadata(funcImport, func, other);
processor.getMetadata(mf, metadata);
return mf;
}
use of org.apache.olingo.commons.api.edm.FullQualifiedName in project teiid by teiid.
the class TestODataMetadataProcessor method actionMetadata.
static MetadataFactory actionMetadata(String name, CsdlReturnType returnType, Object other) throws TranslatorException {
ODataMetadataProcessor processor = new ODataMetadataProcessor();
MetadataFactory mf = new MetadataFactory("vdb", 1, "northwind", SystemMetadata.getInstance().getRuntimeTypeMap(), new Properties(), null);
CsdlAction func = action(name, returnType);
CsdlActionImport funcImport = new CsdlActionImport();
funcImport.setAction(new FullQualifiedName("namespace." + name));
funcImport.setName(name);
XMLMetadata metadata = buildXmlMetadata(funcImport, func, other);
processor.getMetadata(mf, metadata);
return mf;
}
use of org.apache.olingo.commons.api.edm.FullQualifiedName in project teiid by teiid.
the class ODataSchemaBuilder method buildFunction.
static void buildFunction(String schemaName, Procedure proc, ArrayList<CsdlComplexType> complexTypes, ArrayList<CsdlFunction> functions, ArrayList<CsdlFunctionImport> functionImports, CsdlSchema csdlSchema) {
CsdlFunction edmFunction = new CsdlFunction();
edmFunction.setName(proc.getName());
edmFunction.setBound(false);
ArrayList<CsdlParameter> params = new ArrayList<CsdlParameter>();
for (ProcedureParameter pp : proc.getParameters()) {
EdmPrimitiveTypeKind odataType = ODataTypeManager.odataType(pp.getRuntimeType());
if (pp.getType().equals(ProcedureParameter.Type.ReturnValue)) {
edmFunction.setReturnType(new CsdlReturnType().setType(odataType.getFullQualifiedName()).setCollection(DataTypeManager.isArrayType(pp.getRuntimeType())));
continue;
}
if (pp.getType().equals(ProcedureParameter.Type.In) || pp.getType().equals(ProcedureParameter.Type.InOut)) {
CsdlParameter parameter = buildParameter(pp, odataType);
addOperationParameterAnnotations(pp, parameter, csdlSchema);
params.add(parameter);
}
}
edmFunction.setParameters(params);
// add a complex type for return resultset.
ColumnSet<Procedure> returnColumns = proc.getResultSet();
if (returnColumns != null) {
CsdlComplexType complexType = buildComplexType(proc, returnColumns, csdlSchema);
complexTypes.add(complexType);
FullQualifiedName odataType = new FullQualifiedName(schemaName, complexType.getName());
edmFunction.setReturnType((new CsdlReturnType().setType(odataType).setCollection(true)));
}
CsdlFunctionImport functionImport = new CsdlFunctionImport();
functionImport.setName(proc.getName()).setFunction(new FullQualifiedName(schemaName, proc.getName()));
addOperationAnnotations(proc, edmFunction, csdlSchema);
functions.add(edmFunction);
functionImports.add(functionImport);
}
use of org.apache.olingo.commons.api.edm.FullQualifiedName in project teiid by teiid.
the class ODataSchemaBuilder method buildAction.
static void buildAction(String schemaName, Procedure proc, ArrayList<CsdlComplexType> complexTypes, ArrayList<CsdlAction> actions, ArrayList<CsdlActionImport> actionImports, CsdlSchema csdlSchema) {
CsdlAction edmAction = new CsdlAction();
edmAction.setName(proc.getName());
edmAction.setBound(false);
ArrayList<CsdlParameter> params = new ArrayList<CsdlParameter>();
for (ProcedureParameter pp : proc.getParameters()) {
EdmPrimitiveTypeKind odatatype = ODataTypeManager.odataType(pp.getRuntimeType());
if (pp.getType().equals(ProcedureParameter.Type.ReturnValue)) {
edmAction.setReturnType(new CsdlReturnType().setType(odatatype.getFullQualifiedName()).setCollection(DataTypeManager.isArrayType(pp.getRuntimeType())));
continue;
}
if (pp.getType().equals(ProcedureParameter.Type.In) || pp.getType().equals(ProcedureParameter.Type.InOut)) {
CsdlParameter parameter = buildParameter(pp, odatatype);
addOperationParameterAnnotations(pp, parameter, csdlSchema);
params.add(parameter);
}
}
edmAction.setParameters(params);
// add a complex type for return resultset.
ColumnSet<Procedure> returnColumns = proc.getResultSet();
if (returnColumns != null) {
CsdlComplexType complexType = buildComplexType(proc, returnColumns, csdlSchema);
complexTypes.add(complexType);
edmAction.setReturnType((new CsdlReturnType().setType(new FullQualifiedName(schemaName, complexType.getName())).setCollection(true)));
}
CsdlActionImport actionImport = new CsdlActionImport();
actionImport.setName(proc.getName()).setAction(new FullQualifiedName(schemaName, proc.getName()));
addOperationAnnotations(proc, edmAction, csdlSchema);
actions.add(edmAction);
actionImports.add(actionImport);
}
use of org.apache.olingo.commons.api.edm.FullQualifiedName in project teiid by teiid.
the class DocumentNode method findTable.
static Table findTable(EdmEntityType entityType, MetadataStore store) {
FullQualifiedName fqn = entityType.getFullQualifiedName();
// remove the vdb name
String withoutVDB = fqn.getNamespace().substring(fqn.getNamespace().lastIndexOf('.') + 1);
Schema schema = store.getSchema(withoutVDB);
return schema.getTable(entityType.getName());
}
Aggregations