Search in sources :

Example 1 with ICfg2HbmTool

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

the class FacadeFactoryTest method testCreateCfg2HbmTool.

@Test
public void testCreateCfg2HbmTool() {
    Cfg2HbmTool cfg2HbmTool = new Cfg2HbmTool();
    ICfg2HbmTool facade = facadeFactory.createCfg2HbmTool(cfg2HbmTool);
    Assert.assertSame(cfg2HbmTool, ((IFacade) facade).getTarget());
}
Also used : ICfg2HbmTool(org.jboss.tools.hibernate.runtime.spi.ICfg2HbmTool) Cfg2HbmTool(org.hibernate.tool.hbm2x.Cfg2HbmTool) ICfg2HbmTool(org.jboss.tools.hibernate.runtime.spi.ICfg2HbmTool) Test(org.junit.Test)

Example 2 with ICfg2HbmTool

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

the class FacadeFactoryTest method testCreateCfg2HbmTool.

@Test
public void testCreateCfg2HbmTool() {
    Cfg2HbmTool cfg2HbmTool = new Cfg2HbmTool();
    ICfg2HbmTool facade = facadeFactory.createCfg2HbmTool(cfg2HbmTool);
    Assert.assertSame(cfg2HbmTool, ((IFacade) facade).getTarget());
}
Also used : ICfg2HbmTool(org.jboss.tools.hibernate.runtime.spi.ICfg2HbmTool) Cfg2HbmTool(org.hibernate.tool.hbm2x.Cfg2HbmTool) ICfg2HbmTool(org.jboss.tools.hibernate.runtime.spi.ICfg2HbmTool) Test(org.junit.Test)

Example 3 with ICfg2HbmTool

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

the class FacadeFactoryTest method testCreateCfg2HbmTool.

@Test
public void testCreateCfg2HbmTool() {
    Cfg2HbmTool cfg2HbmTool = new Cfg2HbmTool();
    ICfg2HbmTool facade = facadeFactory.createCfg2HbmTool(cfg2HbmTool);
    Assert.assertSame(cfg2HbmTool, ((IFacade) facade).getTarget());
}
Also used : ICfg2HbmTool(org.jboss.tools.hibernate.runtime.spi.ICfg2HbmTool) Cfg2HbmTool(org.hibernate.tool.hbm2x.Cfg2HbmTool) ICfg2HbmTool(org.jboss.tools.hibernate.runtime.spi.ICfg2HbmTool) Test(org.junit.Test)

Example 4 with ICfg2HbmTool

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

the class FacadeFactoryTest method testCreateCfg2HbmTool.

@Test
public void testCreateCfg2HbmTool() {
    Cfg2HbmTool cfg2HbmTool = new Cfg2HbmTool();
    ICfg2HbmTool facade = facadeFactory.createCfg2HbmTool(cfg2HbmTool);
    Assert.assertSame(cfg2HbmTool, ((IFacade) facade).getTarget());
}
Also used : ICfg2HbmTool(org.jboss.tools.hibernate.runtime.spi.ICfg2HbmTool) Cfg2HbmTool(org.hibernate.tool.hbm2x.Cfg2HbmTool) ICfg2HbmTool(org.jboss.tools.hibernate.runtime.spi.ICfg2HbmTool) Test(org.junit.Test)

Example 5 with ICfg2HbmTool

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

the class OpenMappingUtils method generatePersistentClassPatterns.

/**
 * Generates a persistent class xml tag search patterns.
 *
 * @param persClass
 * @return an arrays of search patterns
 */
public static String[] generatePersistentClassPatterns(IPersistentClass persClass, IService service) {
    String fullClassName = null;
    String shortClassName = null;
    if (persClass.getEntityName() != null) {
        fullClassName = persClass.getEntityName();
    } else {
        fullClassName = persClass.getClassName();
    }
    shortClassName = getShortClassName(fullClassName);
    final ICfg2HbmTool tool = service.newCfg2HbmTool();
    final String tagName = tool.getTag(persClass);
    persistentClassPairs[0][0] = tagName;
    persistentClassPairs[1][0] = tagName;
    List<String> patterns = new ArrayList<String>();
    for (int i = 0; i < persistentClassPairs.length; i++) {
        patterns.add(createPattern(persistentClassPairs[i][0], persistentClassPairs[i][1], shortClassName));
        patterns.add(createPattern(persistentClassPairs[i][0], persistentClassPairs[i][1], fullClassName));
    }
    return patterns.toArray(new String[0]);
}
Also used : ICfg2HbmTool(org.jboss.tools.hibernate.runtime.spi.ICfg2HbmTool) ArrayList(java.util.ArrayList)

Aggregations

ICfg2HbmTool (org.jboss.tools.hibernate.runtime.spi.ICfg2HbmTool)15 Cfg2HbmTool (org.hibernate.tool.hbm2x.Cfg2HbmTool)12 Test (org.junit.Test)12 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)4 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)2 ArrayList (java.util.ArrayList)1 BadLocationException (org.eclipse.jface.text.BadLocationException)1 IRegion (org.eclipse.jface.text.IRegion)1 Region (org.eclipse.jface.text.Region)1