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