org.odata4j.producer
Class PropertyPathHelper

java.lang.Object
  extended by org.odata4j.producer.PropertyPathHelper

public class PropertyPathHelper
extends Object

Helps producers determine if a property is $selected and/or $expanded.

Note on recursive extensions: The idea here is that when one has an object graph that is a tree of like nodes (such as a class hierarchy), it should be possible to specify a $expand that is applied recursively.

Two new custom options are proposed:

expandR and selectR

ABNF:

 expandRQueryOp = "expandR=" recursiveExpandClause *("," recursiveExpandClause)
 recursiveExpandClause = entityNavProperty "/" expandDepth
 expandDepth = integer

 selectRQueryOp = "selectR=" recursiveSelectClause *("," recursiveSelectClause)
 recursiveSelectClause = rSelectItem *("," recursiveSelectClause)
 rSelectItem = selectedNavProperty "/" rPropItem
 rPropItem = "*" / selectedProperty
 

expandDepth drives the number of traversal iterations. An expandDepth of 0 is unlimited. During query processing, the max expandDepth of all recursivExpandClauses is computed and drives processing.

example: expandR=SubTypes/0,Properties/1

This says that at each position in the object graph traversal during query we will expand the SubTypes navigation property. At the first level we will also expand the Properties navigation property

 selectR=SubTypes/Namespace,SubTypes/Type
 

This says that whenever we expand the SubTypes navigation property we will only include Namespace and Type properties.


Field Summary
protected  List<PropertyPath> expandPaths
           
protected  List<RecursivePropertyPath> expandRPaths
           
static String OptionExpandR
           
static String OptionSelectR
           
protected  List<PropertyPath> selectPaths
           
protected  List<PropertyPath> selectRPaths
           
 
Constructor Summary
PropertyPathHelper()
           
PropertyPathHelper(List<EntitySimpleProperty> select, List<EntitySimpleProperty> expand)
           
PropertyPathHelper(List<EntitySimpleProperty> select, List<EntitySimpleProperty> expand, String selectR, String expandR)
           
PropertyPathHelper(QueryInfo qi)
           
PropertyPathHelper(String select, String expand)
           
PropertyPathHelper(String select, String expand, String selectR, String expandR)
           
 
Method Summary
 int getCurrentDepth()
           
 PropertyPath getCurrentNavPath()
           
 boolean isExpanded(String navPropName)
           
protected  boolean isExpandedExplicit(String navPropName)
          determines if the given navigation property is expanded on the current navigation path
protected  boolean isExpandedRecursive(String navPropName)
           
 boolean isRecursive()
           
 boolean isSelected(String propName)
          Determines if the given property is selected on the current navigation path.
protected  boolean isSelectionLimited()
          Returns true if the $select contains any limiting items on the current navPath.
protected  boolean isSelectionLimitedRecursive()
           
 void navigate(String propName)
           
 void popPath()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

expandPaths

protected List<PropertyPath> expandPaths

expandRPaths

protected List<RecursivePropertyPath> expandRPaths

OptionExpandR

public static final String OptionExpandR
See Also:
Constant Field Values

OptionSelectR

public static final String OptionSelectR
See Also:
Constant Field Values

selectPaths

protected List<PropertyPath> selectPaths

selectRPaths

protected List<PropertyPath> selectRPaths
Constructor Detail

PropertyPathHelper

public PropertyPathHelper()

PropertyPathHelper

public PropertyPathHelper(List<EntitySimpleProperty> select,
                          List<EntitySimpleProperty> expand)

PropertyPathHelper

public PropertyPathHelper(List<EntitySimpleProperty> select,
                          List<EntitySimpleProperty> expand,
                          String selectR,
                          String expandR)

PropertyPathHelper

public PropertyPathHelper(QueryInfo qi)

PropertyPathHelper

public PropertyPathHelper(String select,
                          String expand)

PropertyPathHelper

public PropertyPathHelper(String select,
                          String expand,
                          String selectR,
                          String expandR)
Method Detail

getCurrentDepth

public int getCurrentDepth()

getCurrentNavPath

public PropertyPath getCurrentNavPath()

isExpanded

public boolean isExpanded(String navPropName)

isExpandedExplicit

protected boolean isExpandedExplicit(String navPropName)
determines if the given navigation property is expanded on the current navigation path


isExpandedRecursive

protected boolean isExpandedRecursive(String navPropName)

isRecursive

public boolean isRecursive()

isSelected

public boolean isSelected(String propName)
Determines if the given property is selected on the current navigation path.

Parameters:
propName - name of a regular property or a navigation property
Returns:
true if property is selected, false if not

isSelectionLimited

protected boolean isSelectionLimited()
Returns true if the $select contains any limiting items on the current navPath.

Returns:
true if select is limited, false if not

isSelectionLimitedRecursive

protected boolean isSelectionLimitedRecursive()

navigate

public void navigate(String propName)

popPath

public void popPath()

toString

public String toString()
Overrides:
toString in class Object


http://odata4j.org