Package de.innovationgate.wga.model

Examples of de.innovationgate.wga.model.ValidationError


       
        if (_schema != null) {
            try {
                _schema.validate();
            } catch (Exception e) {
                errors.add(new ValidationError(e.getMessage(), new String[] {PROPERTY_HINT_SCHEMADEF}));
            }
        }

        return errors;
    }
View Full Code Here


      _hasError = false;
      _canLeave = true;
      if (errors != null) {
        Iterator<ValidationError> it = errors.iterator();
        while (it.hasNext()) {
          ValidationError error = it.next();
          String[] propHints = error.getPropertyHints();
          for (int i = 0; i < propHints.length; i++) {
            String propHint = propHints[i];         
            Control control = _fields.get(propHint);
            if (control != null) {
              addError(form.getMessageManager(), propHint, error, control);
View Full Code Here

        }       
      } catch (ConfigValidationException e) {
          log.fatal("WGA configuration integrity check fails:");
          Iterator<ValidationError> errors = e.getValidationErrors().iterator();
          while (errors.hasNext()) {
            ValidationError error = errors.next();
            log.fatal("- " + error.getMessage());
          }
          throw e;
        }     
    }
View Full Code Here

                    catch (ConfigValidationException e) {
                       
                        getLog().error("Configuration update failed because of validation errors:");
                        Iterator<ValidationError> errors = e.getValidationErrors().iterator();
                        while (errors.hasNext()) {
                            ValidationError validationError = (ValidationError) errors.next();
                            getLog().error(validationError.getMessage());   
                        }
                    }
                    catch (Exception e) {
                        getLog().error("Exception updating configuration", e);
                    }
View Full Code Here

    Iterator<DesignSource> designSources = getDesignSources().iterator();
    Set<String> uids = new HashSet<String>();
    while (designSources.hasNext()) {
      DesignSource designSource = designSources.next();
      if (uids.contains(designSource.getUid())) {
        errors.add(new ValidationError("Duplicate designsource uid '" + designSource.getUid()  + "'.", new String[]{"designSources"}, this));
      }
    }
  }
View Full Code Here

    Set<String> uids = new HashSet<String>();
    Set<String> names = new HashSet<String>();
    while (jobs.hasNext()) {
      Job job = jobs.next();
      if (uids.contains(job.getUid())) {
        errors.add(new ValidationError("Duplicate job uid '" + job.getUid()  + "'.", new String[]{"jobs"}, this));
      } else {
        uids.add(job.getUid());
      }
      if (names.contains(job.getName())) {
        errors.add(new ValidationError("Duplicate job name '" + job.getName()  + "'.", new String[]{"jobs"}, this));
      } else {
        names.add(job.getName());
      }
    }
  }
View Full Code Here

        // validate cron expression
        if (getType().equals(TYPE_CRON)) {
          try {
            new CronTrigger().setCronExpression(getData());
          } catch (ParseException e) {
            errors.add(new ValidationError("Invalid cron expression '" + getData() + "' (" + e.getMessage() + ").", new String[] {"data"}, this));
          }
        }
      }
    }
  }
View Full Code Here

                charset = Charset.forName(getCharacterEncoding());
            }
            catch (Exception e) {
            }
            if (charset == null) {
                errors.add(new ValidationError("Character encoding '" + getCharacterEncoding() + "' is not available on this system", new String[]{"characterEncoding"}, this));
            }
    }
   
    // check content dbs
    Iterator<ContentDatabase> contentDBs = getContentDatabases().iterator();
    Set<String> uniqueKeys = new HashSet<String>();
    while (contentDBs.hasNext()) {
      ContentDatabase cDB = contentDBs.next();
      checkReferences(errors, cDB);
      if (uniqueKeys.contains(cDB.getKey())) {
        errors.add(new ValidationError("Duplicate dbkey '" + cDB.getKey()  + "'.", new String[]{"contentDatabases"}, this));
      } else {
        uniqueKeys.add(cDB.getKey());
      }
    }
       
   
    // check for duplicate domain uids / names
    Iterator<Domain> domains = getDomains().iterator();
    Set<String> uids = new HashSet<String>();
    Set<String> names = new HashSet<String>();
    while (domains.hasNext()) {
      Domain domain = domains.next();
      if (uids.contains(domain.getUid())) {
        errors.add(new ValidationError("Duplicate domain uid '" + domain.getUid()  + "'.", new String[]{"domains"}, this));
      } else {
        uids.add(domain.getUid());
      }
      if (names.contains(domain.getName())) {
        errors.add(new ValidationError("Duplicate domain name '" + domain.getName()  + "'.", new String[]{"domains"}, this));
      } else {
        names.add(domain.getName());
      }
    }

    // check for duplicate dbserver uids
    Iterator<DatabaseServer> dbservers = getDatabaseServers().iterator();
    uids = new HashSet<String>();
    while (dbservers.hasNext()) {
      DatabaseServer dbServer = dbservers.next();
      if (uids.contains(dbServer.getUid())) {
        errors.add(new ValidationError("Duplicate database server uid '" + dbServer.getUid()  + "'.", new String[]{"databaseServers"}, this));
      } else {
        uids.add(dbServer.getUid());
      }
    }
   
    // check share uniqueness
        Iterator<Share> shares = getShares().iterator();
        Set<String> uniqueNames = new HashSet<String>();
        while (shares.hasNext()) {
            Share share = shares.next();
            String shareKey = share.getImplClassName() + "//" + share.getName();
            if (uniqueNames.contains(shareKey)) {
                errors.add(new ValidationError("Duplicate share name '" + share.getName()  + "' of type '" + share.getImplClassName() + "'", new String[]{"shares"}, this));
            } else {
                uniqueNames.add(shareKey);
            }
        }
   
View Full Code Here

   
  }

  private void checkReferences(List<ValidationError> errors, ContentDatabase cdb) {
    if (getDomain(cdb.getDomain()) == null) {
      errors.add(new ValidationError("Domain reference '" + cdb.getDomain() + "' on content database '" + cdb.getKey() + "' does not exist.", new String[]{"domain"}, cdb));
    }
    if (getDatabaseServer(cdb.getDbServer()) == null) {
        if (!cdb.getDbServer().startsWith(SINGLETON_SERVER_PREFIX)) {
            errors.add(new ValidationError("DatabaseServer reference '" + cdb.getDbServer() + "'on content database '" + cdb.getKey() + "' does not exist.", new String[]{"dbServer"}, cdb));
        }
    }   
  }
View Full Code Here

        Iterator<LuceneIndexItemRule> itemRulesIt = itemRules.iterator();
        Set<String> expressions = new HashSet<String>();
        while (itemRulesIt.hasNext()) {
          LuceneIndexItemRule rule = itemRulesIt.next();
          if (expressions.contains(rule.getItemExpression())) {
            errors.add(new ValidationError("Duplicate item rule for expression '" + rule.getItemExpression() + "'.", new String[] {"itemRules"}));
          } else {
            expressions.add(rule.getItemExpression());
          }
        }
        if (!expressions.contains(LuceneIndexItemRule.DEFAULT_RULE.getItemExpression()) || itemRules.isEmpty()) {
          errors.add(new ValidationError("Default item rule '" + LuceneIndexItemRule.DEFAULT_RULE.getItemExpression() + "' is missing.", new String[] {"itemRules"}));
        }
       
        // check for duplicate file rules and default rule
        Iterator<LuceneIndexFileRule> fileRulesIt = fileRules.iterator();
        expressions.clear();
        while (fileRulesIt.hasNext()) {
          LuceneIndexFileRule rule = fileRulesIt.next();
          if (expressions.contains(rule.getFilePattern())) {
            errors.add(new ValidationError("Duplicate file rule for pattern '" + rule.getFilePattern() + "'.", new String[] {"fileRules"}));
          } else {
            expressions.add(rule.getFilePattern());
          }
        }
        if (!expressions.contains(LuceneIndexFileRule.DEFAULT_RULE.getFilePattern()) || fileRules.isEmpty()) {
          errors.add(new ValidationError("Default file rule '" + LuceneIndexFileRule.DEFAULT_RULE.getFilePattern() + "' is missing.", new String[] {"fileRules"}));
        }   
      }
    }
  }
View Full Code Here

TOP

Related Classes of de.innovationgate.wga.model.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.