public class MessageRuleBuilder extends RuleTypeBuilder<MessageRuleBuilder,MessageRule>
RuleTypeBuilder.MessageExpressionBuilder
Modifier | Constructor and Description |
---|---|
protected |
MessageRuleBuilder(List<RuleBinding<? extends Rule<?>>> rules,
Set<Version> versions,
String messageType,
String... triggerEvents) |
Modifier and Type | Method and Description |
---|---|
MessageRuleBuilder |
choiceElementsRespected()
Builds a
MessageRule that enforces choice elements. |
MessageRuleBuilder |
conformance()
Builds a
MessageRule that evaluates the message against the Conformance Profile
referred to in MSH-21. |
MessageRuleBuilder |
conformance(String profileId)
Builds a
MessageRule that evaluates the message against the Conformance Profile
referred to by the profileId parameter |
protected Collection<RuleBinding<MessageRule>> |
getRuleBindings(MessageRule rule,
String version)
Builder implementation must overwrite this method to return all
RuleBinding s for
rules that have been built. |
MessageRuleBuilder |
inspect(MessageVisitorFactory<? extends ValidatingMessageVisitor> visitorFactory)
Builds a
MessageRule that runs a
ValidatingMessageVisitor
over the message that collects ValidationExceptions
in a single pass. |
MessageRuleBuilder |
onlyAllowableSegmentsInSuperStructure()
Builds a
MessageRule that disallows the existence of segments which
are not alowed in a given message type when the message is an instance
of SuperStructure (e.g. |
MessageRuleBuilder |
onlyKnownSegments()
Builds a
MessageRule that disallows the existence of GenericSegment s, i.e. |
MessageRuleBuilder |
terser(String spec,
Predicate predicate)
Builds a
MessageRule that extracts a primitive value using a Terser
expression and evaluates the specified Predicate . |
MessageRuleBuilder |
wrongVersion()
Builds a
MessageRule that disallows the selected HL7 version(s). |
activate, active, addRuleBindings, description, encoding, getRules, instance, message, message, prepareRule, primitive, refersToSection, severity, test
allOf, allOf, always, alwaysFails, anyOf, anyOf, date, dateTime, dateTime25, empty, emptyOr, in, in, isEqual, isEqualIgnoreCase, matches, matches, matches, maxLength, nonNegativeInteger, not, number, oid, startsWith, time, usPhoneNumber, uuid, withdrawn
protected MessageRuleBuilder(List<RuleBinding<? extends Rule<?>>> rules, Set<Version> versions, String messageType, String... triggerEvents)
public MessageRuleBuilder terser(String spec, Predicate predicate)
MessageRule
that extracts a primitive value using a Terser
expression and evaluates the specified Predicate
.spec
- Terser expressionpredicate
- Predicate to evaluate against the valuepublic MessageRuleBuilder inspect(MessageVisitorFactory<? extends ValidatingMessageVisitor> visitorFactory)
MessageRule
that runs a
ValidatingMessageVisitor
over the message that collects ValidationExceptions
in a single pass.visitorFactory
- MessageVisitorFactory that creates ValidatingMessageVisitor instancespublic MessageRuleBuilder onlyKnownSegments()
MessageRule
that disallows the existence of GenericSegment
s, i.e.
segments that are not defined in the structure of a message.public MessageRuleBuilder onlyAllowableSegmentsInSuperStructure()
MessageRule
that disallows the existence of segments which
are not alowed in a given message type when the message is an instance
of SuperStructure
(e.g. PID2 within an ADT^A01)public MessageRuleBuilder choiceElementsRespected()
MessageRule
that enforces choice elements. This means that
if several segments are listed as being a possible choice for the first segment
in a group, only one of them may have content.public MessageRuleBuilder wrongVersion()
MessageRule
that disallows the selected HL7 version(s). It is basically
equivalent with:
forAllVersions().message(....).terser("MSH-12", in(allowedVersions))However, when using this specific rule the builder expression and the resulting exception message is more specific:
forVersion().except(allowedVersions).message(...).wrongVersion()
public MessageRuleBuilder conformance()
MessageRule
that evaluates the message against the Conformance Profile
referred to in MSH-21.public MessageRuleBuilder conformance(String profileId)
MessageRule
that evaluates the message against the Conformance Profile
referred to by the profileId parameterprofileId
- conformance profile id (file name)protected Collection<RuleBinding<MessageRule>> getRuleBindings(MessageRule rule, String version)
RuleTypeBuilder
RuleBinding
s for
rules that have been built.getRuleBindings
in class RuleTypeBuilder<MessageRuleBuilder,MessageRule>
rule
- the rule for which bindings shall be retrievedversion
- the HL7 version for which bindings shall be retrievedRuleBinding
sCopyright © 2001–2017 University Health Network. All rights reserved.