private static void bindImport(Element importNode, Mappings mappings) { String className = getClassName( importNode.attribute( "class" ), mappings ); Attribute renameNode = importNode.attribute( "rename" ); String rename = ( renameNode == null ) ? StringHelper.unqualify( className ) : renameNode.getValue(); log.debug( "Import: " + rename + " -> " + className ); mappings.addImport( className, rename ); }
private static void bindImport(Element importNode, Mappings mappings) { String className = getClassName( importNode.attribute( "class" ), mappings ); Attribute renameNode = importNode.attribute( "rename" ); String rename = ( renameNode == null ) ? StringHelper.unqualify( className ) : renameNode.getValue(); LOG.debugf( "Import: %s -> %s", rename, className ); mappings.addImport( className, rename ); }
private static void bindImport(Element importNode, Mappings mappings) { String className = getClassName( importNode.attribute( "class" ), mappings ); Attribute renameNode = importNode.attribute( "rename" ); String rename = ( renameNode == null ) ? StringHelper.unqualify( className ) : renameNode.getValue(); LOG.debugf( "Import: %s -> %s", rename, className ); mappings.addImport( className, rename ); }
: renameNode.getValue(); log.debug( "Import: " + rename + " -> " + className ); mappings.addImport( className, rename );
private Mappings classMapping(Database database, Mappings mappings) { for (Schema schema : database.getSchemas()) { for (com.manydesigns.portofino.model.database.Table aTable : schema.getTables()) { logger.debug("Class - {}", aTable.getQualifiedName()); com.manydesigns.portofino.model.database.PrimaryKey primaryKey = aTable.getPrimaryKey(); if (primaryKey == null) { logger.debug("Skipping table without primary key: {}", aTable.getQualifiedName()); continue; } if (!primaryKey.isValid()) { logger.debug("Skipping table with invalid primary key: {}", aTable.getQualifiedName()); continue; } RootClass clazz = createTableMapping(mappings, aTable); if(clazz != null) { mappings.addClass(clazz); mappings.addImport(clazz.getEntityName(), clazz.getEntityName()); } } } return mappings; }
private Mappings classMapping(Database database, Mappings mappings) { for (Schema schema : database.getSchemas()) { for (com.manydesigns.portofino.model.database.Table aTable : schema.getTables()) { logger.debug("Class - {}", aTable.getQualifiedName()); com.manydesigns.portofino.model.database.PrimaryKey primaryKey = aTable.getPrimaryKey(); if (primaryKey == null) { logger.debug("Skipping table without primary key: {}", aTable.getQualifiedName()); continue; } if (!primaryKey.isValid()) { logger.debug("Skipping table with invalid primary key: {}", aTable.getQualifiedName()); continue; } RootClass clazz = createTableMapping(mappings, aTable); if(clazz != null) { mappings.addClass(clazz); mappings.addImport(clazz.getEntityName(), clazz.getEntityName()); } } } return mappings; }
/** * Binds the specified persistant class to the runtime model based on the * properties defined in the domain class * * @param domainClass The Grails domain class * @param persistentClass The persistant class * @param mappings Existing mappings */ protected void bindClass(PersistentEntity domainClass, PersistentClass persistentClass, Mappings mappings) { // set lazy loading for now persistentClass.setLazy(true); final String entityName = domainClass.getName(); persistentClass.setEntityName(entityName); persistentClass.setJpaEntityName(unqualify(entityName)); persistentClass.setProxyInterfaceName(entityName); persistentClass.setClassName(entityName); // set dynamic insert to false persistentClass.setDynamicInsert(false); // set dynamic update to false persistentClass.setDynamicUpdate(false); // set select before update to false persistentClass.setSelectBeforeUpdate(false); // add import to mappings if (mappings.isAutoImport() && persistentClass.getEntityName().indexOf('.') > 0) { mappings.addImport(persistentClass.getEntityName(), unqualify(persistentClass.getEntityName())); } }
/** * Binds the specified persistant class to the runtime model based on the * properties defined in the domain class * * @param domainClass The Grails domain class * @param persistentClass The persistant class * @param mappings Existing mappings */ private static void bindClass(GrailsDomainClass domainClass, PersistentClass persistentClass, Mappings mappings) { // set lazy loading for now persistentClass.setLazy(true); persistentClass.setEntityName(domainClass.getFullName()); persistentClass.setProxyInterfaceName(domainClass.getFullName()); persistentClass.setClassName(domainClass.getFullName()); // set dynamic insert to false persistentClass.setDynamicInsert(false); // set dynamic update to false persistentClass.setDynamicUpdate(false); // set select before update to false persistentClass.setSelectBeforeUpdate(false); // add import to mappings if (mappings.isAutoImport() && persistentClass.getEntityName().indexOf('.') > 0) { mappings.addImport(persistentClass.getEntityName(), StringHelper.unqualify(persistentClass.getEntityName())); } }