Package org.molgenis.model

Examples of org.molgenis.model.MolgenisModelException


      return ft;
    }
    catch (InstantiationException e)
    {
      logger.error(e);
      throw new MolgenisModelException(e.getMessage());
    }
    catch (IllegalAccessException e)
    {
      logger.error(e);
      throw new MolgenisModelException(e.getMessage());
    }
  }
View Full Code Here


  {
    // create test model
    Model model = getModel();
    if (model == null || model.getModules() == null || model.getModules().isEmpty())
    {
      throw new MolgenisModelException("model should contain at least one module");
    }
    MODEL = model;
    MODEL_OPTIONS = new MolgenisOptions();
    MODEL_OPTIONS.output_src = SRC_PATH;
View Full Code Here

    Vector<Entity> implements_entities = new Vector<Entity>();

    for (String iface : this.implements_parents)
    {
      Entity iface_entity = (Entity) getParent().get(iface);
      if (iface_entity == null) throw new MolgenisModelException("interface '" + iface
          + "' is undefined for entity " + this.getName());
      implements_entities.add(iface_entity);
    }
    return implements_entities;
  }
View Full Code Here

    Vector<Entity> implements_entities = new Vector<Entity>();

    for (String iface : this.implements_parents)
    {
      Entity iface_entity = (Entity) getParent().get(iface);
      if (iface_entity == null) throw new MolgenisModelException("interface " + iface
          + " is undefined in entity " + this.getName());

      implements_entities.addAll(iface_entity.getAllImplements());
      implements_entities.add(iface_entity);
    }
View Full Code Here

   */
  public void addField(Integer pos, Field field) throws MolgenisModelException
  {
    if (fields.contains(field))
    {
      throw new MolgenisModelException("Duplicate Field with name " + field.getName() + "  in entity "
          + this.getName());
    }
    if (pos != null) fields.add(pos, field);
    else
      fields.add(field);
View Full Code Here

    // get primary key from parent
    if (hasAncestor())
    {
      Entity parent_entity = (Entity) getParent().get(this.parents.lastElement());
      if (parent_entity == null) throw new MolgenisModelException("Superclass " + this.parents.lastElement()
          + " unknown for entity " + this.getName());
      if (parent_entity.getKeys().size() == 0) throw new MolgenisModelException(this.parents.lastElement()
          + " or the interface it implements doesn't define primary key (unique,int,not null)");
      result.add(parent_entity.getKeys().firstElement());

    }
View Full Code Here

  {
    Vector<Field> result = new Vector<Field>();
    for (String fieldName : fields)
    {
      Field f = entity.getAllField(fieldName);
      if (f == null) throw new MolgenisModelException("Unknown unique field: " + this.getEntity().getName() + "."
          + fieldName);
      result.add(f);
    }
    return result;
  }
View Full Code Here

     */
  public Vector<String> getEnumOptions() throws MolgenisModelException
  {
    if (!(this.type instanceof EnumField))
    {
      throw new MolgenisModelException("Field is not a ENUM, so options cannot be set.");
    }

    return this.enum_options;
  }
View Full Code Here

   */
  public int getVarCharLength() throws MolgenisModelException
  {
    if (!(this.type instanceof StringField) && !(this.type instanceof CharField))
    {
      throw new MolgenisModelException("Field is not a VARCHAR, so length cannot be retrieved.");
    }

    return this.varchar_length;
  }
View Full Code Here

  public Entity getXrefEntity() throws MolgenisModelException
  {
    Entity e = this.getEntity().getModel().getEntity(this.getXrefEntityName());
    if (e == null)
    {
      throw new MolgenisModelException("Xref entity '" + this.getXrefEntityName() + "' for entity '"
          + this.getEntity().getName() + "' not part of model.");
    }
    return e;
  }
View Full Code Here

TOP

Related Classes of org.molgenis.model.MolgenisModelException

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.