use of org.odata4j.core.OProperty in project teiid by teiid.
the class ODataUpdateVisitor method visit.
@Override
public void visit(Insert obj) {
// $NON-NLS-1$
this.method = "POST";
this.entity = obj.getTable().getMetadataObject();
this.uri = this.entity.getName();
final List<OProperty<?>> props = new ArrayList<OProperty<?>>();
int elementCount = obj.getColumns().size();
for (int i = 0; i < elementCount; i++) {
Column column = obj.getColumns().get(i).getMetadataObject();
List<Expression> values = ((ExpressionValueSource) obj.getValueSource()).getValues();
OProperty<?> property = readProperty(column, values.get(i));
props.add(property);
}
this.payload = props;
}
use of org.odata4j.core.OProperty in project teiid by teiid.
the class ODataUpdateVisitor method visit.
@Override
public void visit(Update obj) {
// $NON-NLS-1$
this.method = "PUT";
this.entity = obj.getTable().getMetadataObject();
visitNode(obj.getTable());
// only pk are allowed, no other criteria not allowed
obj.setWhere(buildEntityKey(obj.getWhere()));
// this will build with entity keys
this.uri = getEnitityURL();
if (this.uri.indexOf('(') == -1) {
this.exceptions.add(new TranslatorException(ODataPlugin.Util.gs(ODataPlugin.Event.TEIID17011, this.filter.toString())));
}
if (this.filter.length() > 0) {
this.exceptions.add(new TranslatorException(ODataPlugin.Util.gs(ODataPlugin.Event.TEIID17009, this.filter.toString())));
}
final List<OProperty<?>> props = new ArrayList<OProperty<?>>();
int elementCount = obj.getChanges().size();
for (int i = 0; i < elementCount; i++) {
Column column = obj.getChanges().get(i).getSymbol().getMetadataObject();
OProperty<?> property = readProperty(column, obj.getChanges().get(i).getValue());
props.add(property);
}
this.payload = props;
}
Aggregations