View Javadoc

1   package ca.uhn.hl7v2.validation.impl;
2   
3   import ca.uhn.hl7v2.validation.builder.BuilderSupport;
4   
5   /**
6    * <p>
7    * Validation Rule which will not accept any content (i.e. length must be 0).
8    * </p>
9    * <p>
10   * This class is expected to be used for withdrawn fields/components, and will
11   * provide a failure description indicating that the type is withdrawn.
12   * </p>
13   * <p>
14   * If you wish to disable this rule globally, invoke the following code:
15   * </p>
16   * <code>System.setProperty(ca.uhn.hl7v2.validation.impl.WithdrawnDatatypeRule.PROP_DISABLE_RULE, "true");</code>
17   * </p> Note that this property is only checked the first time the class is
18   * loaded (i.e. not at runtime). To disable for an individual parser at runtime,
19   * call </p> <code>parser.setValidationContext(new NoValidation());</code>
20   * 
21   * @deprecated use {@link BuilderSupport#withdrawn()} instead
22   */
23  @SuppressWarnings("serial")
24  public class WithdrawnDatatypeRule extends SizeRule {
25  
26  	/**
27  	 * Set the value of a system property to "true" to disable this rule
28  	 * globally.
29  	 */
30  	public static final String PROP_DISABLE_RULE = "ca.uhn.hl7v2.validation.impl.WithdrawnDatatypeRule";
31  
32  	private static final int RULE_SIZE;
33  
34  	static {
35  		if (Boolean.getBoolean(PROP_DISABLE_RULE)) {
36  			RULE_SIZE = Integer.MAX_VALUE;
37  		} else {
38  			RULE_SIZE = 0;
39  		}
40  	}
41  
42  	/**
43  	 * Constructor
44  	 */
45  	public WithdrawnDatatypeRule() {
46  		super(RULE_SIZE);
47  	}
48  
49  	/**
50  	 * {@inheritDoc}
51  	 */
52  	public String getDescription() {
53  		return "The field/component is withdrawn from the current HL7 version and should not be used. See the JavaDoc for WithdrawnDatatypeRule for information on disabling this rule.";
54  	}
55  
56  }