@Override
  public boolean validate(ValidatorContext context, List<FileVO> files) {

    boolean ok = true;

    if (!files.isEmpty()) {

      int i = 1;
      for (FileVO fileVO : files) {

        if (fileVO.getContent() == null) {

          if (fileVO.getDefaultMetadata() != null
              && fileVO.getDefaultMetadata().getTitle() != null) {
            context.addError(
                ValidationError.create(ErrorMessages.COMPONENT_FILE_NAME_NOT_PROVIDED)
                    .setField("file[" + i + "]"));
            ok = false;
          }

          if (fileVO.getContentCategory() != null) {
            context.addError(
                ValidationError.create(ErrorMessages.COMPONENT_CONTENT_CATEGORY_NOT_PROVIDED)
                    .setField("file[" + i + "]"));
            ok = false;
          }

          if (fileVO.getMimeType() != null) {
            context.addError(
                ValidationError.create(ErrorMessages.COMPONENT_MIME_TYPE_NOT_PROVIDED)
                    .setField("file[" + i + "]"));
            ok = false;
          }

          if (fileVO.getVisibility() != null) {
            context.addError(
                ValidationError.create(ErrorMessages.COMPONENT_VISIBILITY_NOT_PROVIDED)
                    .setField("file[" + i + "]"));
            ok = false;
          }
        } // if

        i++;
      } // for
    } // if

    return ok;
  }
  @Override
  public boolean validate(ValidatorContext context, List<SourceVO> sources) {

    boolean ok = true;

    if (sources != null) {

      int i = 1;
      for (SourceVO sourceVO : sources) {

        if (sourceVO.getCreators() != null) {

          int j = 1;
          for (CreatorVO creatorVO : sourceVO.getCreators()) {

            if (creatorVO.getRole() == null) {

              switch (creatorVO.getType()) {
                case ORGANIZATION:
                  OrganizationVO o = creatorVO.getOrganization();
                  if (o.getName() != null || o.getAddress() != null) {
                    context.addError(
                        ValidationError.create(ErrorMessages.SOURCE_CREATOR_ROLE_NOT_PROVIDED)
                            .setField("source[" + i + "].creator[" + j + "]"));
                    ok = false;
                  }

                  break;

                case PERSON:
                  PersonVO p = creatorVO.getPerson();
                  if (p.getFamilyName() != null || p.getGivenName() != null) {
                    context.addError(
                        ValidationError.create(ErrorMessages.SOURCE_CREATOR_ROLE_NOT_PROVIDED)
                            .setField("source[" + i + "].creator[" + j + "]"));
                    ok = false;
                  }

                  List<OrganizationVO> orgs = p.getOrganizations();

                  int z = 1;
                  for (OrganizationVO organizationVO : orgs) {

                    if (organizationVO.getName() != null || organizationVO.getAddress() != null)
                      context.addError(
                          ValidationError.create(ErrorMessages.SOURCE_CREATOR_ROLE_NOT_PROVIDED)
                              .setField(
                                  "source[" + i + "].creator[" + j + "].organization[" + z + "]"));
                    ok = false;

                    z++;
                  } // for

                  break;
              } // switch
            } // if

            j++;
          } // for
        } // if

        i++;
      } // for
    } // if

    return ok;
  }