Search in sources :

Example 6 with IValue

use of org.jboss.tools.hibernate.runtime.spi.IValue in project jbosstools-hibernate by jbosstools.

the class ShapeEditPart method getSelectionColor.

protected Color getSelectionColor() {
    Color result = ResourceManager.getInstance().getColor(new RGB(255, 0, 0));
    final Object el = getElement();
    if (el instanceof IPersistentClass || el instanceof IProperty) {
        result = ResourceManager.getInstance().getColor(new RGB(112, 161, 99));
    } else if (el instanceof IValue) {
        IValue value = (IValue) el;
        if (value.isSimpleValue() || value.isOneToMany()) {
            result = ResourceManager.getInstance().getColor(new RGB(112, 161, 99));
        }
    } else if (el instanceof ITable || el instanceof IColumn) {
        result = ResourceManager.getInstance().getColor(new RGB(66, 173, 247));
    }
    return result;
}
Also used : IValue(org.jboss.tools.hibernate.runtime.spi.IValue) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) Color(org.eclipse.swt.graphics.Color) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) RGB(org.eclipse.swt.graphics.RGB) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass)

Example 7 with IValue

use of org.jboss.tools.hibernate.runtime.spi.IValue in project jbosstools-hibernate by jbosstools.

the class HbmExporterTest method testList.

public void testList() {
    // $NON-NLS-1$
    IConfiguration config = getConfigurationFor("pack.A");
    // $NON-NLS-1$ //$NON-NLS-2$
    checkClassesMaped(config, "pack.A", "pack.B");
    // $NON-NLS-1$
    IPersistentClass a = config.getClassMapping("pack.A");
    // $NON-NLS-1$
    IPersistentClass b = config.getClassMapping("pack.B");
    // $NON-NLS-1$
    IProperty listProp = a.getProperty("list");
    assertNotNull(listProp.getValue());
    IValue value = listProp.getValue();
    assertTrue("Expected to get List-type mapping", value.isList());
    assertTrue(value.getCollectionElement().isOneToMany());
    assertTrue(value.getCollectionTable().equals(b.getTable()));
    assertNotNull(value.getIndex());
    assertNotNull(value.getKey());
}
Also used : IValue(org.jboss.tools.hibernate.runtime.spi.IValue) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass)

Example 8 with IValue

use of org.jboss.tools.hibernate.runtime.spi.IValue in project jbosstools-hibernate by jbosstools.

the class HbmExporterTest method testMap.

public void testMap() {
    // $NON-NLS-1$
    IConfiguration config = getConfigurationFor("pack.A");
    // $NON-NLS-1$ //$NON-NLS-2$
    checkClassesMaped(config, "pack.A", "pack.B");
    // $NON-NLS-1$
    IPersistentClass a = config.getClassMapping("pack.A");
    // $NON-NLS-1$
    IPersistentClass b = config.getClassMapping("pack.B");
    // $NON-NLS-1$
    IProperty mapValue = a.getProperty("mapValue");
    assertNotNull(mapValue.getValue());
    IValue value = mapValue.getValue();
    assertTrue("Expected to get Map-type mapping", value.isMap());
    assertTrue(value.getCollectionElement().isOneToMany());
    assertTrue(value.getCollectionTable().equals(b.getTable()));
    assertNotNull(value.getKey());
    // $NON-NLS-1$
    assertEquals("string", value.getKey().getType().getName());
}
Also used : IValue(org.jboss.tools.hibernate.runtime.spi.IValue) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass)

Example 9 with IValue

use of org.jboss.tools.hibernate.runtime.spi.IValue in project jbosstools-hibernate by jbosstools.

the class FacadeFactoryTest method testCreateValue.

@Test
public void testCreateValue() {
    Value value = (Value) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { Value.class }, new TestInvocationHandler());
    IValue facade = facadeFactory.createValue(value);
    Assert.assertSame(value, ((IFacade) facade).getTarget());
}
Also used : IValue(org.jboss.tools.hibernate.runtime.spi.IValue) IValue(org.jboss.tools.hibernate.runtime.spi.IValue) SimpleValue(org.hibernate.mapping.SimpleValue) Value(org.hibernate.mapping.Value) PersistentClass(org.hibernate.mapping.PersistentClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) POJOClass(org.hibernate.tool.hbm2x.pojo.POJOClass) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) Test(org.junit.Test)

Example 10 with IValue

use of org.jboss.tools.hibernate.runtime.spi.IValue in project jbosstools-hibernate by jbosstools.

the class FacadeFactoryTest method testCreateValue.

@Test
public void testCreateValue() {
    Value value = (Value) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { Value.class }, new TestInvocationHandler());
    IValue facade = facadeFactory.createValue(value);
    Assert.assertSame(value, ((IFacade) facade).getTarget());
}
Also used : IValue(org.jboss.tools.hibernate.runtime.spi.IValue) IValue(org.jboss.tools.hibernate.runtime.spi.IValue) SimpleValue(org.hibernate.mapping.SimpleValue) Value(org.hibernate.mapping.Value) PersistentClass(org.hibernate.mapping.PersistentClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) POJOClass(org.hibernate.tool.hbm2x.pojo.POJOClass) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) Test(org.junit.Test)

Aggregations

IValue (org.jboss.tools.hibernate.runtime.spi.IValue)144 Test (org.junit.Test)105 SimpleValue (org.hibernate.mapping.SimpleValue)68 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)59 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)40 Bag (org.hibernate.mapping.Bag)20 Set (org.hibernate.mapping.Set)20 IProperty (org.jboss.tools.hibernate.runtime.spi.IProperty)20 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)17 IdentifierBag (org.hibernate.mapping.IdentifierBag)16 KeyValue (org.hibernate.mapping.KeyValue)16 RootClass (org.hibernate.mapping.RootClass)16 Value (org.hibernate.mapping.Value)16 IConfiguration (org.jboss.tools.hibernate.runtime.spi.IConfiguration)13 Collection (org.hibernate.mapping.Collection)8 Component (org.hibernate.mapping.Component)8 List (org.hibernate.mapping.List)8 PersistentClass (org.hibernate.mapping.PersistentClass)8 PrimitiveArray (org.hibernate.mapping.PrimitiveArray)8 Table (org.hibernate.mapping.Table)8