public class Expander
extends java.lang.Object
Expample use of this class is shown below:
Expander.Result result = Expander.create(objectId) .expandFrom() .expandFully() .typePattern() .add("type_Part") .add("type_DOCUMENTS") .done() .relPattern() .add("relationship_EBOM") .add("relationship_ReferenceDocument") .add("relationship_PartSpecification") .done() .objectWhere() .startSubExpr() .add("current != Obsolete") .and() .add("current != Release") .endSubExpr() .or() .startSubExpr() .add("policy == 'EC Part'") .or() .add("policy == 'Development Part'") .endSubExpr() .done() .objectSelects() .add("id", "type", "name", "revision", "current", "policy") .addAttribute("attribute_Weight") .addAttribute("attribute_Classification") .done() .relSelects() .add("id", "type") .addAttribute("attribute_FindNumber") .addAttribute("attribute_ReferenceDesignator") .done() .perform(); for (Expander.Row row : result) { String objectId = row.objectSelect(0); String weight = row.objectSelect(6); ... String relId = row.relSelect(0); String relType = row.relSelect(1); String fn = row.relSelect(2); String refDes = row.relSelect(3); ... } result.close();
Modifier and Type | Class and Description |
---|---|
class |
Expander.Pattern |
static class |
Expander.Result |
static class |
Expander.Row |
class |
Expander.Selects |
class |
Expander.Where |
Modifier and Type | Method and Description |
---|---|
static Expander |
create(java.lang.String objectId)
Creates a new
Expander instance. |
Expander |
expandFully()
Sets the expand depth to 0 (e.g.
|
Expander |
expandInBothDirections()
Shorthand method for setting both expand from and expand to to TRUE.
|
Expander |
expandInFromDirection()
Shorthand method for setting the expand FROM to true and expand TO to
false.
|
Expander |
expandInToDirection()
Shorthand method for setting the expand TO to true and expand FROM to
false.
|
Expander |
expandOneLevel()
Sets the expand depth to 1.
|
Expander |
expandTo(int expandDepth)
Sets the expand depth to the specified value.
|
Expander |
expandTo(short expandDepth)
Sets the expand depth to the specified value.
|
Expander |
objectSelect(java.lang.String... select) |
Expander |
objectSelect(java.lang.String select) |
Expander |
objectSelect(matrix.util.StringList sl) |
Expander.Selects |
objectSelects() |
Expander.Where |
objectWhere() |
Expander |
objectWhere(java.lang.String whereExpression) |
Expander.Result |
perform()
Performs the expansion and encapsulates the result in a convenient
wrapper around the selected data.
|
StructureUtils.Node |
perform(StructureUtils.NodeFactory factory)
Performs the expansion and encapsulates the structure into a
corresponding Java object structure, where the nodes are built up with
the provided
factory |
Expander |
rel(java.lang.String... item)
Adds an arbitrary amount of relationship types to the relationship
pattern.
|
Expander |
rel(SymbolicName... item)
Adds an arbitrary amount of relationship types to the relationship
pattern.
|
Expander.Pattern |
relPattern() |
Expander |
relSelect(java.lang.String... select) |
Expander |
relSelect(java.lang.String select) |
Expander |
relSelect(matrix.util.StringList sl) |
Expander.Selects |
relSelects() |
Expander.Where |
relWhere() |
Expander |
relWhere(java.lang.String whereExpression) |
void |
reset()
Resets this expander and makes it reusable for new expansions.
|
Expander |
setCheckHidden(boolean checkHidden)
Controls if you want the expansion logic to check for hidden types.
|
Expander |
setExpandDirection(boolean from,
boolean to)
Specifies the expansion direction.
|
Expander |
setLimit(int limit)
Specifies the expand limit, e.g.
|
Expander |
setLimit(short limit)
Specifies the expand limit, e.g.
|
Expander |
setPageSize(int pageSize)
Specifies the page size when using an expansion iterator.
|
Expander |
setUseExpansionIterator(boolean useExpansionIterator)
Specifies if we should use an expansion iterator when performing the
expansion, or if we should use the traditional expand-select.
|
java.lang.String |
toString() |
Expander |
type(java.lang.String... item)
A convenient method for adding business object types to the type pattern.
|
Expander |
type(SymbolicName... item)
A convenient method for adding business object types to the type pattern.
|
Expander.Pattern |
typePattern() |
public static Expander create(java.lang.String objectId)
Expander
instance.objectId
- The id of the object that you intend to expand.java.lang.IllegalArgumentException
- If the objectId argument is null.public void reset()
The objectId is of course same as when you created the expander, however, any where expression or select statement are removed. The expand depth and find limit are both set to -1. The page size is set to 100.
From is set to true, while to is set to false.
Check hidden is set to true.
public java.lang.String toString()
toString
in class java.lang.Object
public Expander setUseExpansionIterator(boolean useExpansionIterator)
useExpansionIterator
- True if you want to use it.Expander
public Expander setPageSize(int pageSize)
The default page size is 100 if not specified.
pageSize
- The page size.Expander
public Expander setCheckHidden(boolean checkHidden)
checkHidden
- True to check hidden types, false to return hidden
types.Expander
public Expander setLimit(int limit)
limit
- The expand limitExpander
public Expander setLimit(short limit)
limit
- The expand limitExpander
public Expander setExpandDirection(boolean from, boolean to)
from
- True if to expand in the FROM direction, false to not do so.to
- True if to expand in the TO direction, false to not do so.Expander
public Expander expandInFromDirection()
Expander
public Expander expandInToDirection()
Expander
public Expander expandInBothDirections()
Expander
public Expander expandFully()
Expander
public Expander expandTo(short expandDepth)
expandDepth
- The depthExpander
public Expander expandTo(int expandDepth)
expandDepth
- The depthExpander
public Expander.Pattern typePattern()
public Expander type(java.lang.String... item)
item
- The types to be added. Can be either real names or symbolic
names.Expander
.public Expander type(SymbolicName... item)
item
- The types to be added.Expander
.public Expander.Pattern relPattern()
public Expander rel(java.lang.String... item)
item
- The relationship types to be added.Expander
public Expander rel(SymbolicName... item)
item
- The relationship types to be added.Expander
public Expander.Selects objectSelects()
object select
statements instance.public Expander.Selects relSelects()
relationship select
statements instance.public Expander objectSelect(java.lang.String select)
public Expander objectSelect(java.lang.String... select)
public Expander objectSelect(matrix.util.StringList sl)
public Expander relSelect(java.lang.String select)
public Expander relSelect(java.lang.String... select)
public Expander relSelect(matrix.util.StringList sl)
public Expander.Where objectWhere()
public Expander objectWhere(java.lang.String whereExpression)
public Expander.Where relWhere()
public Expander relWhere(java.lang.String whereExpression)
public StructureUtils.Node perform(StructureUtils.NodeFactory factory) throws TVCException
factory
factory
- The factory
used to convert the
object/connection into a Java object.TVCException
- Upon failure when expanding the structure.public Expander.Result perform() throws TVCException
result
TVCException
- Upon failure when expanding the structureCopyright ? Technia AB. All Rights Reserved.