Package org.apache.padaf.preflight.ValidationResult

Examples of org.apache.padaf.preflight.ValidationResult.ValidationError


    }
  }

  protected void checkPartNumber(List<ValidationError> ve, int value) {
    if (value != 1) {
      ve.add(new ValidationError(
          ValidationConstants.ERROR_METADATA_INVALID_PDFA_VERSION_ID));
    }
  }
View Full Code Here


  protected boolean checkMandatoryFields(List<ValidationError> result) {
    boolean lastMod = this.xobject.getItem(COSName.getPDFName("LastModified")) != null;
    boolean pieceInfo = this.xobject.getItem(COSName.getPDFName("PieceInfo")) != null;
    // type and subtype checked before to create the Validator.
    if (lastMod ^ pieceInfo) {
      result.add(new ValidationError(ERROR_GRAPHIC_MISSING_FIELD));
      return false;
    }

    COSBase bbBase = this.xobject.getItem(COSName
        .getPDFName(XOBJECT_DICTIONARY_KEY_BBOX));
    // ---- BBox is an Array (Rectangle)
    if (bbBase == null || !COSUtils.isArray(bbBase, cosDocument)) {
      result.add(new ValidationError(ERROR_GRAPHIC_INVALID_BBOX));
      return false;
    }
    return true;
  }
View Full Code Here

      }

      String sVal = groupDictionary
          .getNameAsString(XOBJECT_DICTIONARY_KEY_GROUP_S);
      if (sVal == null || XOBJECT_DICTIONARY_VALUE_S_TRANSPARENCY.equals(sVal)) {
        error.add(new ValidationError(ERROR_GRAPHIC_TRANSPARENCY_GROUP , "Group has a transparency S entry or the S entry is null."));
        return false;
      }
    }
    return true;
  }
View Full Code Here

   * @return true if PS entry is missing, false otherwise
   */
  protected boolean checkPS(List<ValidationError> errors) {
    // 6.2.4 and 6.2.5 no PS
    if (this.xobject.getItem(COSName.getPDFName("PS")) != null) {
      errors.add(new ValidationError(
          ValidationConstants.ERROR_GRAPHIC_UNEXPECTED_KEY,
          "Unexpected 'PS' Key"));
      return false;
    }
    return true;
View Full Code Here

  protected boolean checkSubtype2Value(List<ValidationError> errors) {
    // 6.2.5 if Subtype2, value not PS
    if (this.xobject.getItem(COSName.getPDFName("Subtype2")) != null) {
      if ("PS".equals(this.xobject.getNameAsString(COSName
          .getPDFName("Subtype2")))) {
        errors.add(new ValidationError(
            ValidationConstants.ERROR_GRAPHIC_UNEXPECTED_VALUE_FOR_KEY,
            "Unexpected 'PS' value for 'Subtype2' Key"));
        return false;
      }
    }
View Full Code Here

    String n = this.actionDictionnary.getNameAsString(COSName
        .getPDFName(ACTION_DICTIONARY_KEY_N));

    // ---- N entry is mandatory
    if (n == null || "".equals(n)) {
      error.add(new ValidationError(ERROR_ACTION_MISING_KEY,
          "N entry is mandatory for the NamedActions"));
      return false;
    }

    // ---- Only Predefine name actions are authorized
    if (!(ACTION_DICTIONARY_VALUE_ATYPE_NAMED_FIRST.equals(n)
        || ACTION_DICTIONARY_VALUE_ATYPE_NAMED_LAST.equals(n)
        || ACTION_DICTIONARY_VALUE_ATYPE_NAMED_NEXT.equals(n) || ACTION_DICTIONARY_VALUE_ATYPE_NAMED_PREV
        .equals(n))) {
      error.add(new ValidationError(ERROR_ACTION_FORBIDDEN_ACTIONS_NAMED, n + " isn't authorized as named action"));
      return false;
    }

    return true;
  }
View Full Code Here

    case Pattern:
      return processPatternColorSpace(result);

    default:
      result
      .add(new ValidationError(ERROR_GRAPHIC_INVALID_UNKNOWN_COLOR_SPACE, cs.getLabel() + " is unknown as ColorSpace"));
      return false;
    }
  }
View Full Code Here

   * @return true if the color space is valid, false otherwise.
   */
  protected boolean processRGBColorSpace(List<ValidationError> result) {
    // ---- ICCProfile must contain a RGB Color Space
    if (iccpw == null) {
      result.add(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_MISSING, "DestOutputProfile is missing"));
      return false;     
    } if (!iccpw.isRGBColorSpace()) {
      result.add(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_RGB, "DestOutputProfile isn't RGB ColorSpace"));
      return false;
    }
    return true;
  }
View Full Code Here

   * @throws ValidationException
   */
  public boolean valid(boolean additonalActionAuth, List<ValidationError> error)
      throws ValidationException {
    if (isAdditionalAction() && !additonalActionAuth) {
      error.add(new ValidationError(ERROR_ACTION_FORBIDDEN_ADDITIONAL_ACTION, "Additional Action are forbidden" ));
      return false;
    }

    if (innerValid(error)) {
      return validNextActions(error);
View Full Code Here

            documentHandler, ColorSpaceRestriction.ONLY_DEVICE);
      }
      List<ValidationError> errors = new ArrayList<ValidationError>();
      try {
        if (!csHelper.validate(errors)) {
          ValidationError ve = errors.get(0);
          throwContentStreamException(ve.getDetails(), ve.getErrorCode());
        }
      } catch (ValidationException e) {
        throw new IOException(e.getMessage());
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.padaf.preflight.ValidationResult.ValidationError

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.