@Test public void testJdbcManagerName() throws Exception { EntityMeta entityMeta = entityMetaFactory.getEntityMeta(Bbb.class); ServiceModelFactoryImpl serviceModelFactory = new ServiceModelFactoryImpl( "aaa.bbb", "Service", namesModelFactory, true, "myJdbcManager"); ServiceModel serviceModel = serviceModelFactory .getServiceModel(entityMeta); assertNotNull(serviceModel); assertEquals("aaa.bbb", serviceModel.getPackageName()); assertEquals("ServiceModelFactoryImplTest$BbbService", serviceModel .getShortClassName()); assertEquals(2, serviceModel.getIdPropertyMetaList().size()); assertEquals("myJdbcManager", serviceModel.getJdbcManagerName()); assertTrue(serviceModel.isJdbcManagerSetterNecessary()); assertEquals(8, serviceModel.getImportNameSet().size()); Iterator<String> iterator = serviceModel.getImportNameSet().iterator(); assertEquals(Date.class.getCanonicalName(), iterator.next()); assertEquals(List.class.getCanonicalName(), iterator.next()); assertEquals(Generated.class.getCanonicalName(), iterator.next()); assertEquals(Resource.class.getCanonicalName(), iterator.next()); assertEquals(TransactionAttribute.class.getCanonicalName(), iterator .next()); assertEquals(TransactionAttributeType.class.getCanonicalName(), iterator.next()); assertEquals(JdbcManager.class.getCanonicalName(), iterator.next()); assertEquals(Bbb.class.getCanonicalName(), iterator.next()); assertEquals(2, serviceModel.getStaticImportNameSet().size()); iterator = serviceModel.getStaticImportNameSet().iterator(); assertEquals("aaa.ccc.ServiceModelFactoryImplTest$BbbNames.*", iterator .next()); assertEquals(Operations.class.getCanonicalName() + ".*", iterator .next()); }
public ServiceModel getServiceModel(EntityMeta entityMeta) { ServiceModel serviceModel = new ServiceModel(); serviceModel.setPackageName(packageName); serviceModel.setShortClassName(entityMeta.getName() + serviceClassNameSuffix); serviceModel.setShortEntityClassName(entityMeta.getEntityClass() .getSimpleName()); serviceModel .setShortSuperclassName("Abstract" + serviceClassNameSuffix); serviceModel.setJdbcManagerName(jdbcManagerName); serviceModel.setJdbcManagerSetterNecessary(!DEFAULT_JDBC_MANAGER_NAME .equals(jdbcManagerName)); for (PropertyMeta idPropertyMeta : entityMeta.getIdPropertyMetaList()) { serviceModel.addIdPropertyMeta(idPropertyMeta); } if (entityMeta.hasVersionPropertyMeta()) { serviceModel.setVersionPropertyMeta(entityMeta .getVersionPropertyMeta()); } doNamesModel(serviceModel, entityMeta); doImportName(serviceModel, entityMeta); doGeneratedInfo(serviceModel, entityMeta); return serviceModel; }
ServiceModelFactoryImpl implements ServiceModelFactory { public ServiceModel getServiceModel(EntityMeta entityMeta) { ServiceModel serviceModel = new ServiceModel(); serviceModel.setPackageName(packageName); serviceModel.setShortClassName(entityMeta.getName() + serviceClassNameSuffix); serviceModel.setShortEntityClassName(entityMeta.getEntityClass() .getSimpleName()); serviceModel .setShortSuperclassName("Abstract" + serviceClassNameSuffix); serviceModel.setJdbcManagerName(jdbcManagerName); serviceModel.setJdbcManagerSetterNecessary(!DEFAULT_JDBC_MANAGER_NAME .equals(jdbcManagerName)); for (PropertyMeta idPropertyMeta : entityMeta.getIdPropertyMetaList()) { serviceModel.addIdPropertyMeta(idPropertyMeta); } if (entityMeta.hasVersionPropertyMeta()) { serviceModel.setVersionPropertyMeta(entityMeta .getVersionPropertyMeta()); } doNamesModel(serviceModel, entityMeta); doImportName(serviceModel, entityMeta); doGeneratedInfo(serviceModel, entityMeta); return serviceModel; } }
ServiceModelFactoryImpl implements ServiceModelFactory { public ServiceModel getServiceModel(EntityMeta entityMeta) { ServiceModel serviceModel = new ServiceModel(); serviceModel.setPackageName(packageName); serviceModel.setShortClassName(entityMeta.getName() + serviceClassNameSuffix); serviceModel.setShortEntityClassName(entityMeta.getEntityClass() .getSimpleName()); serviceModel .setShortSuperclassName("Abstract" + serviceClassNameSuffix); serviceModel.setJdbcManagerName(jdbcManagerName); serviceModel.setJdbcManagerSetterNecessary(!DEFAULT_JDBC_MANAGER_NAME .equals(jdbcManagerName)); for (PropertyMeta idPropertyMeta : entityMeta.getIdPropertyMetaList()) { serviceModel.addIdPropertyMeta(idPropertyMeta); } if (entityMeta.hasVersionPropertyMeta()) { serviceModel.setVersionPropertyMeta(entityMeta .getVersionPropertyMeta()); } doNamesModel(serviceModel, entityMeta); doImportName(serviceModel, entityMeta); doGeneratedInfo(serviceModel, entityMeta); return serviceModel; } ServiceModelFactoryImpl(String packageName,
            String serviceClassNameSuffix, NamesModelFactory namesModelFactory,
            boolean useNamesClass, String jdbcManagerName); }
ServiceModelFactoryImpl implements ServiceModelFactory { public ServiceModel getServiceModel(EntityMeta entityMeta) { ServiceModel serviceModel = new ServiceModel(); serviceModel.setPackageName(packageName); serviceModel.setShortClassName(entityMeta.getName() + serviceClassNameSuffix); serviceModel.setShortEntityClassName(entityMeta.getEntityClass() .getSimpleName()); serviceModel .setShortSuperclassName("Abstract" + serviceClassNameSuffix); serviceModel.setJdbcManagerName(jdbcManagerName); serviceModel.setJdbcManagerSetterNecessary(!DEFAULT_JDBC_MANAGER_NAME .equals(jdbcManagerName)); for (PropertyMeta idPropertyMeta : entityMeta.getIdPropertyMetaList()) { serviceModel.addIdPropertyMeta(idPropertyMeta); } if (entityMeta.hasVersionPropertyMeta()) { serviceModel.setVersionPropertyMeta(entityMeta .getVersionPropertyMeta()); } doNamesModel(serviceModel, entityMeta); doImportName(serviceModel, entityMeta); doGeneratedInfo(serviceModel, entityMeta); return serviceModel; } ServiceModelFactoryImpl(String packageName,
            String serviceClassNameSuffix, NamesModelFactory namesModelFactory,
            boolean useNamesClass, String jdbcManagerName); ServiceModel getServiceModel(EntityMeta entityMeta); }
ServiceModelFactoryImpl implements ServiceModelFactory { public ServiceModel getServiceModel(EntityMeta entityMeta) { ServiceModel serviceModel = new ServiceModel(); serviceModel.setPackageName(packageName); serviceModel.setShortClassName(entityMeta.getName() + serviceClassNameSuffix); serviceModel.setShortEntityClassName(entityMeta.getEntityClass() .getSimpleName()); serviceModel .setShortSuperclassName("Abstract" + serviceClassNameSuffix); serviceModel.setJdbcManagerName(jdbcManagerName); serviceModel.setJdbcManagerSetterNecessary(!DEFAULT_JDBC_MANAGER_NAME .equals(jdbcManagerName)); for (PropertyMeta idPropertyMeta : entityMeta.getIdPropertyMetaList()) { serviceModel.addIdPropertyMeta(idPropertyMeta); } if (entityMeta.hasVersionPropertyMeta()) { serviceModel.setVersionPropertyMeta(entityMeta .getVersionPropertyMeta()); } doNamesModel(serviceModel, entityMeta); doImportName(serviceModel, entityMeta); doGeneratedInfo(serviceModel, entityMeta); return serviceModel; } ServiceModelFactoryImpl(String packageName,
            String serviceClassNameSuffix, NamesModelFactory namesModelFactory,
            boolean useNamesClass, String jdbcManagerName); ServiceModel getServiceModel(EntityMeta entityMeta);  }