Package gov.nara.nwts.ftapp.nameValidation

Examples of gov.nara.nwts.ftapp.nameValidation.RenameDetails


  }
 
  public Object compute(File f, FileTest fileTest) {
    Object ret = fileTest.fileTest(f);
    if (ret instanceof RenameDetails) {
      RenameDetails rdet = (RenameDetails)ret;
      vals.set(0, rdet.getPassFail());
      vals.set(1, rdet.getRenameStatus());
      vals.set(2, rdet.getMessage());
      vals.set(3, rdet.getDetailNote(fileTest.getRoot()));
    }
    return ret;
  }
View Full Code Here


  public String toString() {
    return name +  (allowRename ? " Rename" : " Test");
  }

  public Object dirTest(File f) {
    return new RenameDetails(RenameStatus.DIRECTORY, null, "");
  }
View Full Code Here

  }
 
  public Object fileTest(File f) {
    if (f.isDirectory()) {
      for(NameValidationPattern nvp: dirTestPatterns) {
        RenameDetails det = nvp.checkFile(f);
        if (det.status == RenameStatus.NEXT) continue;
        return det;
      }
      return new RenameDetails(RenameStatus.DIRECTORY, null, null);
    }
    for(NameValidationPattern nvp: testPatterns) {
      RenameDetails det = nvp.checkFile(f);
      if (det.status == RenameStatus.NEXT) continue;
      File newFile = det.getFile();
      if (newFile != null) {
        if (valPatt.checkFile(newFile).status != RenameStatus.VALID) {
          det.status = RenameStatus.NEW_NAME_INVALID;
          return det;
        }
        if (f.equals(newFile)) {
        } else if (newFile.exists()) {
          det.status = RenameStatus.RENAME_FILE_EXISTS;
          return det;
        }
        if (allowRename) {
          return renameFile(f, det);
        }
      }
      return det;
    }
    return new RenameDetails(RenameStatus.PARSE_ERR, null, "");
  }
View Full Code Here

TOP

Related Classes of gov.nara.nwts.ftapp.nameValidation.RenameDetails

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.