001package ca.uhn.hl7v2.validation.impl; 002 003import ca.uhn.hl7v2.validation.builder.BuilderSupport; 004 005/** 006 * <p> 007 * Validation Rule which will not accept any content (i.e. length must be 0). 008 * </p> 009 * <p> 010 * This class is expected to be used for withdrawn fields/components, and will 011 * provide a failure description indicating that the type is withdrawn. 012 * </p> 013 * <p> 014 * If you wish to disable this rule globally, invoke the following code: 015 * </p> 016 * <code>System.setProperty(ca.uhn.hl7v2.validation.impl.WithdrawnDatatypeRule.PROP_DISABLE_RULE, "true");</code> 017 * </p> Note that this property is only checked the first time the class is 018 * loaded (i.e. not at runtime). To disable for an individual parser at runtime, 019 * call </p> <code>parser.setValidationContext(new NoValidation());</code> 020 * 021 * @deprecated use {@link BuilderSupport#withdrawn()} instead 022 */ 023@SuppressWarnings("serial") 024public class WithdrawnDatatypeRule extends SizeRule { 025 026 /** 027 * Set the value of a system property to "true" to disable this rule 028 * globally. 029 */ 030 public static final String PROP_DISABLE_RULE = "ca.uhn.hl7v2.validation.impl.WithdrawnDatatypeRule"; 031 032 private static final int RULE_SIZE; 033 034 static { 035 if (Boolean.getBoolean(PROP_DISABLE_RULE)) { 036 RULE_SIZE = Integer.MAX_VALUE; 037 } else { 038 RULE_SIZE = 0; 039 } 040 } 041 042 /** 043 * Constructor 044 */ 045 public WithdrawnDatatypeRule() { 046 super(RULE_SIZE); 047 } 048 049 /** 050 * {@inheritDoc} 051 */ 052 public String getDescription() { 053 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."; 054 } 055 056}