Package jcmdline.dto

Examples of jcmdline.dto.PdfFile


       * @throws              RuntimeException if the value of the FileParam
       *                      has not been set.
       * @see Parameter#isSet()
       */
      public PdfFile getPdfFile() {
          PdfFile retVal = null;
        if (!set) {
              throw new RuntimeException(Strings.get(
                      "PdfFileParam.valueNotSet", new Object[] { tag }));
          }
          retVal = getPdfFile((String)values.get(0));
View Full Code Here


       * @throws              CmdLineException if <code>value</code> is not valid.
       * @see #setAttributes(int) setAttributes()
       */
      public void validateValue(String val) throws CmdLineException {
          super.validateValue(val);
          PdfFile f = null;
          try {
            f = getPdfFile(val);
          } catch (Exception e) {
              throwIllegalValueException(val);
          }
          if (attrSpecified(EXISTS) && !f.getFile().exists()) {
              throwIllegalValueException(val);
          }        
          if (attrSpecified(IS_READABLE) && !f.getFile().canRead()) {
              throwIllegalValueException(val);
          }
          if (attrSpecified(IS_WRITEABLE) && !f.getFile().canWrite()) {
              throwIllegalValueException(val);
          }
      }
View Full Code Here

      /**
       * @param value
       * @return the PdfFile
       */
      private PdfFile getPdfFile(String value){
        PdfFile retVal = null;
        int k = value.toLowerCase().lastIndexOf(".pdf:");
        if (k < 0){
          retVal =  new PdfFile(new File(value),null);
        }else{
          retVal =  new PdfFile(new File(value.substring(0, k+4)),value.substring(k+5, value.length()));
        }
        return retVal;
      }
View Full Code Here

          }

          //-f
          PdfFileParam fOption = (PdfFileParam) cmdLineHandler.getOption(SlideShowParsedCommand.F_ARG);          
          if(fOption.isSet()){
            PdfFile inputFile = fOption.getPdfFile();
            ValidationUtility.assertValidPdfExtension(inputFile.getFile().getName())
              parsedCommandDTO.setInputFile(FileUtility.getPdfFile(inputFile));                 
          }else{
            throw new ParseException(ParseException.ERR_NO_F)
          }
         
View Full Code Here

          //-f
          PdfFileParam fOption = (PdfFileParam) cmdLineHandler.getOption(RotateParsedCommand.F_ARG);
          if(fOption.isSet()){
        //validate file extensions
            for(Iterator fIterator = fOption.getPdfFiles().iterator(); fIterator.hasNext();){
              PdfFile currentFile = (PdfFile) fIterator.next();
                //checking extension
                ValidationUtility.assertValidPdfExtension(currentFile.getFile().getName());
            }
            parsedCommandDTO.setInputFileList(FileUtility.getPdfFiles(fOption.getPdfFiles()));
          }
         
          //-r
View Full Code Here

        if(fOption.isSet() || dOption.isSet()){
          //-f
              if(fOption.isSet()){
            //validate file extensions
                for(Iterator fIterator = fOption.getPdfFiles().iterator(); fIterator.hasNext();){
                  PdfFile currentFile = (PdfFile) fIterator.next();
                  ValidationUtility.assertValidPdfExtension(currentFile.getFile().getName());                 
                }
                parsedCommandDTO.setInputFileList(FileUtility.getPdfFiles(fOption.getPdfFiles()));
              }
              //-d
          if ((dOption.isSet())){
View Full Code Here

          //-f
          PdfFileParam fOption = (PdfFileParam) cmdLineHandler.getOption(DecryptParsedCommand.F_ARG);
          if(fOption.isSet()){
        //validate file extensions
            for(Iterator fIterator = fOption.getPdfFiles().iterator(); fIterator.hasNext();){
              PdfFile currentFile = (PdfFile) fIterator.next();
                //checking extension
                ValidationUtility.assertValidPdfExtension(currentFile.getFile().getName());
            }
            parsedCommandDTO.setInputFileList(FileUtility.getPdfFiles(fOption.getPdfFiles()));
          }
         
    }else{
View Full Code Here

      if (fOption.isSet() || dOption.isSet()) {
        // -f
        if (fOption.isSet()) {
          // validate file extensions
          for (Iterator fIterator = fOption.getPdfFiles().iterator(); fIterator.hasNext();) {
            PdfFile currentFile = (PdfFile) fIterator.next();
            ValidationUtility.assertValidPdfExtension(currentFile.getFile().getName());           
          }
          parsedCommandDTO.setInputFileList(FileUtility.getPdfFiles(fOption.getPdfFiles()));
        }
        // -d
        if ((dOption.isSet())) {
View Full Code Here

          }

          //-f
          PdfFileParam fOption = (PdfFileParam) cmdLineHandler.getOption(SplitParsedCommand.F_ARG);          
          if(fOption.isSet()){
            PdfFile inputFile = fOption.getPdfFile();
            ValidationUtility.assertValidPdfExtension(inputFile.getFile().getName());
              parsedCommandDTO.setInputFile(FileUtility.getPdfFile(inputFile));                 
          }else{
            throw new ParseException(ParseException.ERR_NO_F)
          }
View Full Code Here

          }

          //-f
          PdfFileParam fOption = (PdfFileParam) cmdLineHandler.getOption("f");          
          if(fOption.isSet()){
            PdfFile inputFile = fOption.getPdfFile();
            ValidationUtility.assertValidPdfExtension(inputFile.getFile().getName());
              parsedCommandDTO.setInputFile(FileUtility.getPdfFile(inputFile));                 
          }else{
            throw new ParseException(ParseException.ERR_NO_F)
          }
         
View Full Code Here

TOP

Related Classes of jcmdline.dto.PdfFile

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.