Package ca.uhn.hl7v2.validation

Examples of ca.uhn.hl7v2.validation.Validator


//    if (a == null) a = element.getLayoutFactory().getActivator();
    MActivator a = element.getLayoutFactory().getActivator();
   
    String[] va = string.split(",");
    for (String v : va) {
      Validator validator;
      try {
        validator = (Validator) a.getObject(Validator.class,v);
      } catch (Exception e) {
        e.printStackTrace();
        return false;
      }
      if (validator != null && !validator.validate(this,element,value))
        return false;
    }
    return true;
  }
View Full Code Here


    fValidator.setFile(false);
    // fValidator.setReadable(true);
    gBuilder.withOption(aBuilder.reset().withName(CONF_FILE).withDescription("is the wrapper.conf to use.  Name must be absolute or relative")
        .withMinimum(0).withMaximum(10).create());

    Validator pValidator = new Validator()
    {

      public void validate(List values) throws InvalidArgumentException
      {
        for (Iterator it = values.iterator(); it.hasNext();)
View Full Code Here

    return builder.withLongName(name).withDescription(desc).create();
  }
 
  private void setupOptions(){

    final Validator fileValidator = new Validator(){
      public void validate(final List values) throws InvalidArgumentException {
        // Note : This code doesnt belong here, it should be changed to
        // an can exec check in java 6
        for (String file : (List<String>)values) {
          File f = new File(file)
          if ( ! f.exists() ) {
            throw new InvalidArgumentException("Argument : " +
                f.getAbsolutePath() + " doesn't exist.");
          }
          if ( ! f.isFile() ) {
            throw new InvalidArgumentException("Argument : " +
                f.getAbsolutePath() + " is not a file.");
          }
          if ( ! f.canRead() ) {
            throw new InvalidArgumentException("Argument : " +
                f.getAbsolutePath() + " is not accessible");
          }
        }
      }     
    };

    // Note: not extending CLI2's FileValidator, that overwrites
    // the String arg into File and causes ClassCastException
    // in inheritance tree.
    final Validator execValidator = new Validator(){
      public void validate(final List values) throws InvalidArgumentException {
        // Note : This code doesnt belong here, it should be changed to
        // an can exec check in java 6
        for (String file : (List<String>)values) {
          try{
View Full Code Here

    return builder.withLongName(name).withDescription(desc).create();
  }
 
  private void setupOptions(){

    final Validator fileValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            File f = new File(file)
            if (!f.exists()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " doesn't exist.");
            }
            if (!f.isFile()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not a file.");
            }
            if (!f.canRead()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not accessible");
            }
          }
        }     
      };

    // Note: not extending CLI2's FileValidator, that overwrites
    // the String arg into File and causes ClassCastException
    // in inheritance tree.
    final Validator execValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            try{
View Full Code Here

    return builder.withLongName(name).withDescription(desc).create();
  }
 
  private void setupOptions(){

    final Validator fileValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            File f = new File(file)
            if (!f.exists()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " doesn't exist.");
            }
            if (!f.isFile()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not a file.");
            }
            if (!f.canRead()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not accessible");
            }
          }
        }     
      };

    // Note: not extending CLI2's FileValidator, that overwrites
    // the String arg into File and causes ClassCastException
    // in inheritance tree.
    final Validator execValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            try{
View Full Code Here

    return builder.withLongName(name).withDescription(desc).create();
  }
 
  private void setupOptions(){

    final Validator fileValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            File f = new File(file)
            if (!f.exists()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " doesn't exist.");
            }
            if (!f.isFile()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not a file.");
            }
            if (!f.canRead()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not accessible");
            }
          }
        }     
      };

    // Note: not extending CLI2's FileValidator, that overwrites
    // the String arg into File and causes ClassCastException
    // in inheritance tree.
    final Validator execValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            try{
View Full Code Here

    return builder.withLongName(name).withDescription(desc).create();
  }
 
  private void setupOptions(){

    final Validator fileValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            File f = new File(file)
            if (!f.exists()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " doesn't exist.");
            }
            if (!f.isFile()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not a file.");
            }
            if (!f.canRead()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not accessible");
            }
          }
        }     
      };

    // Note: not extending CLI2's FileValidator, that overwrites
    // the String arg into File and causes ClassCastException
    // in inheritance tree.
    final Validator execValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            try{
View Full Code Here

    return builder.withLongName(name).withDescription(desc).create();
  }
 
  private void setupOptions(){

    final Validator fileValidator = new Validator(){
      public void validate(final List values) throws InvalidArgumentException {
        // Note : This code doesnt belong here, it should be changed to
        // an can exec check in java 6
        for (String file : (List<String>)values) {
          File f = new File(file)
          if ( ! f.exists() ) {
            throw new InvalidArgumentException("Argument : " +
                f.getAbsolutePath() + " doesn't exist.");
          }
          if ( ! f.isFile() ) {
            throw new InvalidArgumentException("Argument : " +
                f.getAbsolutePath() + " is not a file.");
          }
          if ( ! f.canRead() ) {
            throw new InvalidArgumentException("Argument : " +
                f.getAbsolutePath() + " is not accessible");
          }
        }
      }     
    };

    // Note: not extending CLI2's FileValidator, that overwrites
    // the String arg into File and causes ClassCastException
    // in inheritance tree.
    final Validator execValidator = new Validator(){
      public void validate(final List values) throws InvalidArgumentException {
        // Note : This code doesnt belong here, it should be changed to
        // an can exec check in java 6
        for (String file : (List<String>)values) {
          try{
View Full Code Here

        argCommand = new ArgumentBuilder()
            .withName("command")
            .withDescription("Sync Command")
            .withMinimum(0)
            .withMaximum(1)
            .withValidator(new Validator() {
                public void validate(List list) throws InvalidArgumentException {
                    if (list.size() > 0) {
                        String cmd = list.get(0).toString();
                        try {
                            list.set(0, Sync.Command.valueOf(cmd.toUpperCase()));
View Full Code Here

    return builder.withLongName(name).withDescription(desc).create();
  }
 
  private void setupOptions(){

    final Validator fileValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            File f = new File(file)
            if (!f.exists()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " doesn't exist.");
            }
            if (!f.isFile()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not a file.");
            }
            if (!f.canRead()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not accessible");
            }
          }
        }     
      };

    // Note: not extending CLI2's FileValidator, that overwrites
    // the String arg into File and causes ClassCastException
    // in inheritance tree.
    final Validator execValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            try{
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.validation.Validator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.