Package org.jesterj.ingest.routers
Class RouteByStepName
- java.lang.Object
-
- org.jesterj.ingest.routers.RouterBase
-
- org.jesterj.ingest.routers.RouteByStepName
-
- All Implemented Interfaces:
Configurable,Router
public class RouteByStepName extends RouterBase
A router that sends documents to subsequent steps by comparing the value in a standard field in the document to the name of subsequent steps. Only the first value in the standard field is consulted, and only one step may be returned (because all steps must hae a unique value for name). Therefore this router will never duplicate the document. Also note that if this router does not find a next destination it will cause an error for the document.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRouteByStepName.Builder
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringJESTERJ_NEXT_STEP_NAME-
Fields inherited from interface org.jesterj.ingest.model.Configurable
VALID_NAME
-
-
Constructor Summary
Constructors Constructor Description RouteByStepName()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetKeyFieldName()java.lang.StringgetName()A name for this object to distinguish it from other objects.intgetNumberOfOutputCopies()Indicates how many copies of a document may be omitted by this router.java.util.Map<java.lang.String,java.lang.String>getValueToStepNameMap()booleanisConstantNumberOfOutputDocs()Indicates if the number documents entering this router have a constant linear relationship to the number of documents exiting the router.booleanisDeterministic()Indicates if this router will always route an identical document to the same downstream step or steps.NextStepsroute(Document doc)Decide where to send this document.protected voidsetKeyFieldName(java.lang.String keyFieldName)-
Methods inherited from class org.jesterj.ingest.routers.RouterBase
getStep, updateExcludedDestinations
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jesterj.ingest.model.Configurable
isValidName
-
-
-
-
Field Detail
-
JESTERJ_NEXT_STEP_NAME
public static final java.lang.String JESTERJ_NEXT_STEP_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
isDeterministic
public boolean isDeterministic()
Description copied from interface:RouterIndicates if this router will always route an identical document to the same downstream step or steps. It is important to understand that this attribute refers to determinism with respect to document content and anything that depends on the order in which documents are fed, is NOT deterministic.- Returns:
- True if the document's destination is deterministic, false if it may vary.
-
isConstantNumberOfOutputDocs
public boolean isConstantNumberOfOutputDocs()
Description copied from interface:RouterIndicates if the number documents entering this router have a constant linear relationship to the number of documents exiting the router. This relationship need only be constant for a particular plan configuration, and may vary when configured differently in different plans. A document may be considered to have exited the router if it records a terminal status (i.e.Status.DROPPED, or if it is included in the NextSteps object returned fromRouter.route(Document)- Returns:
- True if one document in produces a constant number of documents out.
-
getNumberOfOutputCopies
public int getNumberOfOutputCopies()
Description copied from interface:RouterIndicates how many copies of a document may be omitted by this router. IfRouter.isConstantNumberOfOutputDocs()returns false this number represents the maximum output. A negative value indicates that there is no constraint on the number of copies that may be omitted.- Returns:
- the number of output copies expected.
-
route
public NextSteps route(Document doc)
Description copied from interface:RouterDecide where to send this document. The result may represent some or all of the steps down stream. Note that it is illegal for a router not to select at least one destination, and this will cause errors. It is also prohibited for the router to select a destination not listed on the document.- Parameters:
doc- The document to route- Returns:
- An object encapsulating the destinations to which the document (or copies of it) will be sent.
- See Also:
Step.getEligibleNextSteps(Document)
-
getName
public java.lang.String getName()
Description copied from interface:ConfigurableA name for this object to distinguish it from other objects. This value is generally supplied by the plan author. Every object in a plan must have a unique name, begin with a letter and only contain letters, digits, underscores and periods.- Returns:
- The user supplied name for this step
-
getKeyFieldName
public java.lang.String getKeyFieldName()
-
setKeyFieldName
protected void setKeyFieldName(java.lang.String keyFieldName)
-
getValueToStepNameMap
public java.util.Map<java.lang.String,java.lang.String> getValueToStepNameMap()
-
-