public boolean apply(OProperty<?> input) { return input.getName().equals(propName); } };
public boolean apply(OProperty<?> input) { return input.getName().equals(propName); } };
public boolean apply(OProperty<?> input) { return input.getName().equals(propName); } };
public OProperty<?> apply(String input) { for (OProperty<?> entityProperty : entityProperties) if (entityProperty.getName().equals(input)) return entityProperty; throw new IllegalArgumentException("Key property '" + input + "' is invalid"); } }).cast(Object.class).toArray(Object.class);
public OProperty<?> apply(String input) { for (OProperty<?> entityProperty : entityProperties) if (entityProperty.getName().equals(input)) return entityProperty; throw new IllegalArgumentException("Key property '" + input + "' is invalid"); } }).cast(Object.class).toArray(Object.class);
public OProperty<?> apply(String input) { for (OProperty<?> entityProperty : entityProperties) if (entityProperty.getName().equals(input)) return entityProperty; throw new IllegalArgumentException("Key property '" + input + "' is invalid"); } }).cast(Object.class).toArray(Object.class);
private static OProperty<?> getProp(List<OProperty<?>> props, String name) { for (OProperty<?> prop : props) if (prop.getName().equals(name)) return prop; throw new IllegalArgumentException(String.format( "Property %s not found in %s", name, props)); }
private static OProperty<?> getProp(List<OProperty<?>> props, String name) { for (OProperty<?> prop : props) if (prop.getName().equals(name)) return prop; throw new IllegalArgumentException(String.format( "Property %s not found in %s", name, props)); }
private static OProperty<?> getProp(List<OProperty<?>> props, String name) { for (OProperty<?> prop : props) if (prop.getName().equals(name)) return prop; throw new IllegalArgumentException(String.format( "Property %s not found in %s", name, props)); }
protected void writeProperty(XMLWriter2 writer, OProperty<?> prop, boolean isDocumentElement) { writeProperty(writer, prop.getName(), prop.getType(), prop.getValue(), isDocumentElement, true); }
protected void writeProperty(XMLWriter2 writer, OProperty<?> prop, boolean isDocumentElement) { writeProperty(writer, prop.getName(), prop.getType(), prop.getValue(), isDocumentElement, true); }
protected void writeProperty(JsonWriter jw, OProperty<?> prop) { jw.writeName(prop.getName()); writeValue(jw, prop.getType(), prop.getValue()); }
protected void writeProperty(JsonWriter jw, OProperty<?> prop) { jw.writeName(prop.getName()); writeValue(jw, prop.getType(), prop.getValue()); }
protected static void reportEntity(String caption, OEntity entity) { report(caption); if (entity.getEntityTag() != null) report(" ETag: %s", entity.getEntityTag()); for (OProperty<?> p : entity.getProperties()) { Object v = p.getValue(); if (p.getType().equals(EdmSimpleType.BINARY) && v != null) v = org.odata4j.repack.org.apache.commons.codec.binary.Base64.encodeBase64String((byte[]) v).trim(); report(" %s: %s", p.getName(), v); } }
private void run(String[] args) { ODataConsumer c = ODataConsumers.create(ODataEndpoints.NETFLIX); // locate the netflix id for Morgan Spurlock int morganSpurlockId = c.getEntities("People").filter("substringof('Spurlock',Name)").execute().first().getProperty("Id", Integer.class).getValue(); // lookup and print all titles he's acted in List<OEntity> titlesActedIn = c.getEntities("People").nav(morganSpurlockId, "TitlesActedIn").execute().toList(); for (OEntity title : titlesActedIn) { for (OProperty<?> p : title.getProperties()) { report("%s: %s", p.getName(), p.getValue()); } report("\n"); } report("count: " + titlesActedIn.size()); }