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;
}
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());
}
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());
}
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());
}
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());
}
Aggregations