Package uk.ac.bbsrc.tgac.miso.core.exception

Examples of uk.ac.bbsrc.tgac.miso.core.exception.MisoNamingException


                 "runtime unless a custom regex is specified at MISO startup!");
        validationMap.put(fieldName, Pattern.compile(regex));
      }
    }
    else {
      throw new MisoNamingException("Cannot set validation regex for a field (via 'get"+ LimsUtils.capitalise(fieldName)+"') that doesn't exist in " + namingSchemeFor().getCanonicalName());
    }
  }
View Full Code Here


      String customName = lng.generateName(o);
      if (validateField(fieldName, customName)) {
        return customName;
      }
      else {
        throw new MisoNamingException("Custom naming generator '"+lng.getGeneratorName()+"' supplied for entity field '"+fieldName+"' generated an invalid name according to the validation scheme '"+validationMap.get(fieldName)+"'");
      }
    }
    else {
      if (DefaultMisoEntityPrefix.get(o.getClass().getSimpleName()) == null) {
        for (Class<?> i : LimsUtils.getAllInterfaces(o.getClass())) {
          if (DefaultMisoEntityPrefix.get(i.getSimpleName()) != null) {
            log.info("Generating name based on interface :: " + DefaultMisoEntityPrefix.get(i.getSimpleName()).name() + o.getId());
            return DefaultMisoEntityPrefix.get(i.getSimpleName()).name() + o.getId();
          }
        }
        throw new MisoNamingException("Cannot generate a MISO name from an object of type: " + o.getClass().getSimpleName());
      }
      log.info("Generating name :: " + DefaultMisoEntityPrefix.get(o.getClass().getSimpleName()).name() + o.getId());
      return DefaultMisoEntityPrefix.get(o.getClass().getSimpleName()).name() + o.getId();
    }
  }
View Full Code Here

    Pattern p = validationMap.get(fieldName);
    if (p != null) {
      return validationMap.get(fieldName).pattern();
    }
    else {
      throw new MisoNamingException("No such field registered for validation");
    }
  }
View Full Code Here

                 "runtime unless a custom regex is specified at MISO startup!");
        validationMap.put(fieldName, Pattern.compile(regex));
      }
    }
    else {
      throw new MisoNamingException("Cannot set validation regex for a field (via 'get"+ LimsUtils.capitalise(fieldName)+"') that doesn't exist in " + namingSchemeFor().getCanonicalName());
    }
  }
View Full Code Here

      String customName = sng.generateName(s);
      if (validateField(fieldName, customName)) {
        return customName;
      }
      else {
        throw new MisoNamingException("Custom naming generator '"+sng.getGeneratorName()+"' supplied for Sample field '"+fieldName+"' generated an invalid name according to the validation scheme '"+validationMap.get(fieldName)+"'");
      }
    }
    else {
      if ("alias".equals(fieldName)) {
        throw new MisoNamingException("Alias generation not available. Validation via validateName is available.");
      }
      else {
        if (validationMap.keySet().contains(fieldName)) {
          Method m = fieldCheck(fieldName);
          if (m != null) {
            log.info("Generating name for '"+fieldName+"' :: " + DefaultMisoEntityPrefix.get(Sample.class.getSimpleName()).name() + s.getId());
            return DefaultMisoEntityPrefix.get(Sample.class.getSimpleName()).name() + s.getId();
          }
          else {
            throw new MisoNamingException("No such nameable field.");
          }
        }
        else {
          throw new MisoNamingException("Generation of names on field '"+fieldName+"' not available.");
        }
      }
    }
  }
View Full Code Here

    Pattern p = validationMap.get(fieldName);
    if (p != null) {
      return validationMap.get(fieldName).pattern();
    }
    else {
      throw new MisoNamingException("No such field registered for validation");
    }
  }
View Full Code Here

                 "runtime unless a custom regex is specified at MISO startup!");
        validationMap.put(fieldName, Pattern.compile(regex));
      }
    }
    else {
      throw new MisoNamingException("Cannot set validation regex for a field (via 'get"+ LimsUtils.capitalise(fieldName)+"') that doesn't exist in " + namingSchemeFor().getCanonicalName());
    }
  }
View Full Code Here

      String customName = lng.generateName(o);
      if (validateField(fieldName, customName)) {
        return customName;
      }
      else {
        throw new MisoNamingException("Custom naming generator '"+lng.getGeneratorName()+"' supplied for entity field '"+fieldName+"' generated an invalid name according to the validation scheme '"+validationMap.get(fieldName)+"'");
      }
    }
    else {
      log.info("Generating name for " + o.getClass().getSimpleName() +" :: " + o.getId());
      return ""+o.getId();
View Full Code Here

    Pattern p = validationMap.get(fieldName);
    if (p != null) {
      return validationMap.get(fieldName).pattern();
    }
    else {
      throw new MisoNamingException("No such field registered for validation");
    }
  }
View Full Code Here

                 "runtime unless a custom regex is specified at MISO startup!");
        validationMap.put(fieldName, Pattern.compile(regex));
      }
    }
    else {
      throw new MisoNamingException("Cannot set validation regex for a field (via 'get"+LimsUtils.capitalise(fieldName)+"') that doesn't exist in " + namingSchemeFor().getCanonicalName());
    }
  }
View Full Code Here

TOP

Related Classes of uk.ac.bbsrc.tgac.miso.core.exception.MisoNamingException

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.