org.sormula.annotation.cascade
Annotation Type SelectCascade


@Retention(value=RUNTIME)
@Target(value={FIELD,ANNOTATION_TYPE})
public @interface SelectCascade

Used within a Cascade annotation to define a cascade select operation.

Since:
1.0
Author:
Jeff Miller

Optional Element Summary
 boolean lazy
          Marks a select cascade to be performed some later time after source row is selected.
 java.lang.Class<? extends ScalarSelectOperation> operation
          Specifics operation to perform as a select cascade.
 boolean post
          Specifies when the cascade is to occur.
 java.lang.String[] sourceParameterFieldNames
          Specifies fields from source row to be used as parameters in cascade operation for target row.
 java.lang.String targetKeyMethodName
          Method name in target class that returns row key value for adding to map results.
 java.lang.String targetOrderByName
          Specifies the order condition to use in cascade.
 java.lang.String targetWhereName
          Specifies the where condition to use in cascade.
 

operation

public abstract java.lang.Class<? extends ScalarSelectOperation> operation
Specifics operation to perform as a select cascade. Typical operations would be ScalarSelectOperation, ArrayListSelectOperation, HashMapSelectOperation or some subclass of those.

The default value of ArrayListSelectOperation works correctly for source fields that are scalar or List. If the source field is not scalar or List, then some other select operation must be used.

Returns:
operation to use for cascade
Default:
org.sormula.operation.ArrayListSelectOperation.class

sourceParameterFieldNames

public abstract java.lang.String[] sourceParameterFieldNames
Specifies fields from source row to be used as parameters in cascade operation for target row. Names must be in same order as defined in where condition on target row with targetWhereName() or in same order as primary key fields of target row if primary key is used as where condition.

Returns:
field names of fields to be used as parameters
Default:
{}

targetWhereName

public abstract java.lang.String targetWhereName
Specifies the where condition to use in cascade. Name is one of names specified on target class by Where.name() or "primaryKey" for primary key. An empty string indicates no where condition (select all). Typically is the name of the where condition that uses foreign key(s) in target row that correspond to primary key(s) in source row.

Returns:
where condition name of target row; "primaryKey" to select by primary key; empty string will select all rows
Default:
"primaryKey"

targetOrderByName

public abstract java.lang.String targetOrderByName
Specifies the order condition to use in cascade. Name is one of names specified on target class by OrderBy.name() or empty string for unordered.

Returns:
order condition name of target row; empty string for none
Default:
""

post

public abstract boolean post
Specifies when the cascade is to occur. This value is ignored if lazy() is true.

Returns:
true to perform cascade after source row operation; false to perform cascade before source row operation
Default:
true

targetKeyMethodName

public abstract java.lang.String targetKeyMethodName
Method name in target class that returns row key value for adding to map results. Key method name is required when operation() is instance of MapSelectOperation; otherwise it is ignored.

Returns:
name of method that gets key value from target row
Default:
"hashCode"

lazy

public abstract boolean lazy
Marks a select cascade to be performed some later time after source row is selected. The target row is selected when LazySelectable.checkLazySelects(String) is invoked or when ActiveRecord.checkLazySelects(String) is invoked.

Returns:
true to skip select when source row is selected and add it to list of pending lazy select fields; false to perform select cascade when source row is selected
Since:
1.8 and 2.2
See Also:
AbstractLazySelector, SimpleLazySelector, DurableLazySelector
Default:
false