Package org.molgenis.fieldtypes

Examples of org.molgenis.fieldtypes.MrefField


    MolgenisFieldTypes.addType(new EnumField());
    MolgenisFieldTypes.addType(new FileField());
    MolgenisFieldTypes.addType(new ImageField());
    MolgenisFieldTypes.addType(new HyperlinkField());
    MolgenisFieldTypes.addType(new LongField());
    MolgenisFieldTypes.addType(new MrefField());
    MolgenisFieldTypes.addType(new StringField());
    MolgenisFieldTypes.addType(new TextField());
    MolgenisFieldTypes.addType(new XrefField());
    MolgenisFieldTypes.addType(new IntField());
  }
View Full Code Here


      addType(new EmailField());
      addType(new FileField());
      addType(new HyperlinkField());
      addType(new ImageField());
      addType(new LongField());
      addType(new MrefField());
      addType(new StringField());
      addType(new TextField());
      addType(new XrefField());
      addType(new IntField());
      addType(new RichtextField());
View Full Code Here

  @Test
  public void testIsLocal()
  {
    assertFalse(new Field(mock(Entity.class), "field", mock(FieldType.class)).isLocal());
    assertFalse(new Field(mock(Entity.class), "field", new XrefField()).isLocal());
    assertTrue(new Field(mock(Entity.class), "field", new MrefField()).isLocal());
  }
View Full Code Here

    Field field1 = new Field(mock(Entity.class), "field1", mock(FieldType.class));
    fields.add(field1);
    Field field2 = new Field(mock(Entity.class), "field2", new XrefField());
    field2.setXRefEntity("cyclic_field");
    fields.add(field2);
    Field field3 = new Field(mock(Entity.class), "field3", new MrefField());
    fields.add(field3);

    Entity xrefEntity = mock(Entity.class);
    when(xrefEntity.getAllFields()).thenReturn(fields);
View Full Code Here

    Field field1 = new Field(mock(Entity.class), "field1", mock(FieldType.class));
    fields.add(field1);
    Field field2 = new Field(mock(Entity.class), "field2", new XrefField());
    field2.setXRefEntity("field4");
    fields.add(field2);
    Field field3 = new Field(mock(Entity.class), "field3", new MrefField());
    field3.setXRefEntity("field5");
    fields.add(field3);

    Entity xrefEntity = mock(Entity.class);
    when(xrefEntity.getAllFields()).thenReturn(fields);
View Full Code Here

  @Test
  public void testIsXRef()
  {
    assertFalse(new Field(mock(Entity.class), "field", mock(FieldType.class)).isXRef());
    assertTrue(new Field(mock(Entity.class), "field", new XrefField()).isXRef());
    assertTrue(new Field(mock(Entity.class), "field", new MrefField()).isXRef());
  }
View Full Code Here

  @Test
  public void testIsMRef()
  {
    assertFalse(new Field(mock(Entity.class), "field", mock(FieldType.class)).isMRef());
    assertFalse(new Field(mock(Entity.class), "field", new XrefField()).isMRef());
    assertTrue(new Field(mock(Entity.class), "field", new MrefField()).isMRef());
  }
View Full Code Here

      Field field = new Field(mock(Entity.class), "field", new XrefField());
      field.setXRefEntity("entity");
      assertEquals(field.getXrefEntityName(), "entity");
    }
    {
      Field field = new Field(mock(Entity.class), "field", new MrefField());
      field.setXRefEntity("entity");
      assertEquals(field.getXrefEntityName(), "entity");
    }
  }
View Full Code Here

    // also rename the target from interface to entity
    for (Entity entity : model.getEntities())
    {
      for (Entity iface : entity.getImplements())
      {
        for (Field mref : iface.getFieldsOf(new MrefField()))
        {
          Field f = new Field(mref);
          f.setEntity(entity);

          String mrefName = entity.getName() + "_" + f.getName();
          if (mrefName.length() > 30)
          {
            mrefName = mrefName.substring(0, 25) + Integer.toString(mrefName.hashCode()).substring(0, 5);
          }
          f.setMrefName(mrefName);
          entity.addField(0, f);
        }
      }
    }

    // remove interfaces from entities
    for (Entity entity : model.getEntities())
    {
      if (entity.isAbstract()) for (Field mref : entity.getFieldsOf(new MrefField()))
      {
        entity.removeField(mref);
      }
    }
  }
View Full Code Here

    for (Entity xref_entity_from : model.getEntities())
    {

      // iterate through all fields including those inherited from
      // interfaces
      for (Field xref_field_from : xref_entity_from.getImplementedFieldsOf(new MrefField()))
      {
        try
        {
          // retrieve the references to the entity+field
          Entity xref_entity_to = xref_field_from.getXrefEntity();
View Full Code Here

TOP

Related Classes of org.molgenis.fieldtypes.MrefField

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.