Package org.molgenis.fieldtypes

Examples of org.molgenis.fieldtypes.XrefField


    Entity xrefEntity = mock(Entity.class);

    Model model = mock(Model.class);
    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


  }

  @Test
  public void testGetSetXRefVariables() throws MolgenisModelException
  {
    Field field = new Field(mock(Entity.class), "field", new XrefField());
    field.setXRefVariables("a", "b", Arrays.asList("c", "d"));
    assertEquals(field.getXrefEntityName(), "a");
    assertEquals(field.getXrefFieldName(), "b");
    assertEquals(field.getXrefLabelNames(), Arrays.asList("c", "d"));
  }
View Full Code Here

  @Test
  public void testGetSetXrefEntityName() throws MolgenisModelException
  {
    {
      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());
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

  {
    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("unknownXrefEntity");
    assertEquals(field.getXrefEntity(), xrefEntity);
  }
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");
    field.setXrefLabelNames(Arrays.asList("a", "b", "c"));
    assertEquals(field.getXrefLabelNames(), Arrays.asList("a", "b", "c"));
  }
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");
    field.setXrefLabelNames(Arrays.asList("xrefEntity.1", "xrefEntity.2", "xrefEntity.3"));
    assertEquals(field.getXrefLabelNames(), Arrays.asList("1", "2", "3"));
  }
View Full Code Here

    Entity xrefEntity = when(mock(Entity.class).getAllKeys()).thenReturn(keys).getMock();
    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");
    assertTrue(field.allPossibleXrefLabels().isEmpty());
  }
View Full Code Here

            // create the fields for the linktable
            Field field;
            Vector<String> unique = new Vector<String>();

            field = new Field(mrefEntity, new XrefField(), xref_field_from.getMrefRemoteid(), null, false,
                false, false, null);
            field.setXRefVariables(xref_entity_to.getName(), xref_field_to.getName(),
                xref_field_from.getXrefLabelNames());
            if (xref_field_from.isXrefCascade()) field.setXrefCascade(true);
            mrefEntity.addField(field);

            unique.add(field.getName());

            // add all the key-fields of xref_entity_from
            for (Field key : xref_entity_from.getKeyFields(Entity.PRIMARY_KEY))
            {
              field = new Field(mrefEntity, new XrefField(), xref_field_from.getMrefLocalid(), null,
                  false, false, false, null);

              // null xreflabel
              field.setXRefVariables(xref_entity_from.getName(), key.getName(), null);
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.