Package org.molgenis.model

Examples of org.molgenis.model.MolgenisModelException


  public String getXrefEntityName() throws MolgenisModelException
  {
    if (!(this.type instanceof XrefField) && !(this.type instanceof MrefField))
    {
      throw new MolgenisModelException("Field '" + this.getEntity().getName() + "." + this.getName()
          + "' is not a XREF, so xref-table cannot be retrieved.");
    }

    return this.xref_entity;
View Full Code Here


   */
  public Field getXrefField() throws MolgenisModelException
  {
    if (!(this.type instanceof XrefField) && !(this.type instanceof MrefField))
    {
      throw new MolgenisModelException("Field is not a XREF, so xref-field cannot be retrieved.");
    }

    Field result = this.getXrefEntity().getAllField(this.getXrefFieldName());
    if (result == null)
    {
      throw new MolgenisModelException("xref_field is not known for field " + getEntity().getName() + "."
          + getName());
    }
    return result;
  }
View Full Code Here

  {
    if (xref_labels == null || xref_labels.size() == 0)
    {
      if (this.getXrefEntity() == null)
      {
        throw new MolgenisModelException("Cannot find xref_entity='" + getXrefEntityName() + "' for "
            + getEntity().getName() + "." + getName());
      }
      if (this.getXrefEntity().getXrefLabels() != null)
      {
        return this.getXrefEntity().getXrefLabels();
View Full Code Here

  public Map<String, List<Field>> allPossibleXrefLabels() throws MolgenisModelException, DatabaseException
  {
    if (!(this.getType() instanceof XrefField) && !(this.getType() instanceof MrefField))
    {
      throw new MolgenisModelException("asking xref labels for non-xref field");
    }

    Map<String, List<Field>> result = new LinkedHashMap<String, List<Field>>();
    for (Unique key : getXrefEntity().getAllKeys()) // get all except
                            // primary key
View Full Code Here

   */
  public void addField(String field) throws MolgenisModelException
  {
    if (fields.contains(field))
    {
      throw new MolgenisModelException("Field with name " + field + " already in index.");
    }

    fields.add(field);
  }
View Full Code Here

      entity = tok.nextToken();
      field = tok.nextToken();
    }
    else
    {
      throw new MolgenisModelException("field with name '" + f + " is unknown" + tok.countTokens());
    }

    // get entity
    Field result = null;
    if (entity != null)
    {
      Entity em;
      try
      {
        // todo: make case insensitive?
        em = this.getEntity(entity);
      }
      catch (Exception e)
      {
        throw new MolgenisModelException("field with name '" + f + " is unknown: " + e.getMessage());
      }

      // get field
      result = em.getAllField(field);
    }
    else
    {
      int count = 0;
      for (Entity em : getEntities())
      {
        for (Field fm : em.getAllFields())
        {
          if (fm.getName().equalsIgnoreCase(field))
          {
            result = fm;
            count++;
            if (count > 1) throw new MolgenisModelException("field with name '" + f
                + " is not unique, please provide entity also in format {entity}.{field}");
          }
        }
      }
    }
    if (result != null)
    {
      return result;
    }
    else
    {
      throw new MolgenisModelException("field with name '" + f + "' is unknown: ");
    }
  }
View Full Code Here

  public void addDataset(Dataset dataset) throws MolgenisModelException
  {
    if (datasets.contains(dataset))
    {
      throw new MolgenisModelException("Dataset with name " + dataset.getName() + " already in processor.");
    }

    datasets.add(dataset);
  }
View Full Code Here

  public void addParameter(Parameter parameter) throws MolgenisModelException
  {
    if (parameters.contains(parameter))
    {
      throw new MolgenisModelException("Parameter with name " + parameter.getName() + " already in method.");
    }

    parameters.add(parameter);
  }
View Full Code Here

   */
  public void setEnumOptions(List<String> options) throws MolgenisModelException
  {
    if (this.type != Type.ENUM)
    {
      throw new MolgenisModelException("Field is not a ENUM, so options cannot be set.");
    }
    if (options.size() == 0)
    {
      throw new MolgenisModelException("Enum must have at least one option");
    }

    this.enum_options = options;
  }
View Full Code Here

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

    return this.enum_options;
  }
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.