use of org.apache.olingo.commons.api.ex.ODataException in project teiid by teiid.
the class OlingoBridge method getHandler.
public ODataHttpHandler getHandler(String baseUri, Client client, String schemaName) throws ServletException {
if (this.handlers.get(schemaName) == null) {
org.teiid.metadata.Schema teiidSchema = client.getMetadataStore().getSchema(schemaName);
if (teiidSchema == null || !isVisible(client.getVDB(), teiidSchema)) {
throw new ServletException(ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16022));
}
try {
OData odata = OData4Impl.newInstance();
VDBMetaData vdb = client.getVDB();
CsdlSchema schema = ODataSchemaBuilder.buildMetadata(vdb.getFullName(), teiidSchema);
TeiidEdmProvider edmProvider = new TeiidEdmProvider(baseUri, schema, client.getProperty(Client.INVALID_CHARACTER_REPLACEMENT));
ServiceMetadata metadata = odata.createServiceMetadata(edmProvider, edmProvider.getReferences());
ODataHttpHandler handler = odata.createHandler(metadata);
handler.register(new TeiidServiceHandler(schemaName));
this.handlers.put(schemaName, handler);
} catch (XMLStreamException e) {
throw new ServletException(ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16054));
} catch (ODataException e) {
throw new ServletException(ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16054));
}
}
return this.handlers.get(schemaName);
}
use of org.apache.olingo.commons.api.ex.ODataException in project arctic-sea by 52North.
the class ODataFesParser method decode.
@Override
public Filter<?> decode(String objectToDecode) throws DecodingException {
LOG.debug("Parsing filter: {}", objectToDecode);
if (objectToDecode == null || objectToDecode.isEmpty()) {
return null;
}
try {
String encode = urlEscaper.escape(objectToDecode);
// >=4.4.0
// UriInfo parseUri = parser.parseUri(PATH, "$filter=" + encode, FRAGMENT, BASE_URI);
// >=4.2.0 <4.4.0
// UriInfo parseUri = parser.parseUri(PATH, "$filter=" + encode, FRAGMENT);
// >=4.0.0 <4.2.0
UriInfo parseUri = parser.parseUri(PATH, "$filter=" + encode, FRAGMENT, this.edm);
return parseUri.getFilterOption().getExpression().accept(new ExpressionGenerator()).accept(new RenamingVisitor(csdlProvider::mapProperty)).accept(new FilterGenerator());
} catch (ODataException ex) {
throw new DecodingException(ex);
}
}
Aggregations