Package org.molgenis.fieldtypes

Examples of org.molgenis.fieldtypes.XrefField


    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 ImageField());
      addType(new LongField());
      addType(new MrefField());
      addType(new StringField());
      addType(new TextField());
      addType(new XrefField());
      addType(new IntField());
      addType(new RichtextField());
      addType(new FreemarkerField());

      init = true;
View Full Code Here

    when(xrefEntity.getAllField("xrefField")).thenReturn(xrefField);

    Model model = when(mock(Model.class).getEntity("xrefEntity")).thenReturn(xrefEntity).getMock();
    Entity entity = when(mock(Entity.class).getModel()).thenReturn(model).getMock();

    Field field = new Field(entity, "field", new XrefField());
    field.setXRefEntity("xrefEntity");
    field.setXrefField("xrefField");
    assertEquals(field.getFormatString(), "%d%s");
  }
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

  }

  @Test
  public void testIsCyclic_selfXref() throws MolgenisModelException
  {
    Field field = new Field(mock(Entity.class), "field", new XrefField());
    field.setXRefEntity("field");
    assertTrue(field.isCyclic());
  }
View Full Code Here

  public void testIsCyclic_cyclicXref() throws MolgenisModelException
  {
    Vector<Field> fields = new Vector<Field>();
    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);

    Entity rootEntity = mock(Entity.class);
    when(rootEntity.get("xrefEntity")).thenReturn(xrefEntity);

    Entity entity = mock(Entity.class);
    when(entity.getRoot()).thenReturn(rootEntity);

    Field field = new Field(entity, "cyclic_field", new XrefField());
    field.setXRefEntity("xrefEntity");
    assertTrue(field.isCyclic());
  }
View Full Code Here

  public void testIsCyclic_nonCyclicXref() throws MolgenisModelException
  {
    Vector<Field> fields = new Vector<Field>();
    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);

    Entity rootEntity = mock(Entity.class);
    when(rootEntity.get("xrefEntity")).thenReturn(xrefEntity);

    Entity entity = mock(Entity.class);
    when(entity.getRoot()).thenReturn(rootEntity);

    Field field = new Field(entity, "field", new XrefField());
    field.setXRefEntity("xrefEntity");
    assertFalse(field.isCyclic());
  }
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

  {
    Entity xrefEntity = mock(Entity.class);
    Model model = when(mock(Model.class).getEntity("xrefEntity")).thenReturn(xrefEntity).getMock();
    Entity entity = when(mock(Entity.class).getModel()).thenReturn(model).getMock();

    Field field = new Field(entity, "field", new XrefField());
    field.setXRefEntity("xrefEntity");
    assertEquals(field.getXrefEntity(), xrefEntity);
  }
View Full Code Here

TOP

Related Classes of org.molgenis.fieldtypes.XrefField

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.