/** * Refresh or add the mapping for the given instance. */ private void refresh(Class<?> cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new RefreshStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) { _flush = true; _flushSchema = true; } }
/** * Add the mapping for the given instance. */ private void add(Class cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new MappingStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) { _flush = true; _flushSchema = true; } }
/** * Add the mapping for the given instance. */ private void add(Class<?> cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new MappingStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) { _flush = true; _flushSchema = true; } }
/** * Add the mapping for the given instance. */ private void add(Class<?> cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new MappingStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) { _flush = true; _flushSchema = true; } }
/** * Add the mapping for the given instance. */ private void add(Class<?> cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new MappingStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) { _flush = true; _flushSchema = true; } }
/** * Refresh or add the mapping for the given instance. */ private void refresh(Class<?> cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new RefreshStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) { _flush = true; _flushSchema = true; } }
/** * Refresh or add the mapping for the given instance. */ private void refresh(Class cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new RefreshStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) { _flush = true; _flushSchema = true; } }
/** * Add the mapping for the given instance. */ private void add(Class<?> cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new MappingStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) { _flush = true; _flushSchema = true; } }
/** * Refresh or add the mapping for the given instance. */ private void refresh(Class<?> cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new RefreshStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) { _flush = true; _flushSchema = true; } }
/** * Refresh or add the mapping for the given instance. */ private void refresh(Class<?> cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new RefreshStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) { _flush = true; _flushSchema = true; } }
/** * Drop mapping for given class. */ private void drop(Class<?> cls) { if (cls == null) return; if (_dropCls == null) _dropCls = new HashSet<Class<?>>(); _dropCls.add(cls); if (!contains(_schemaActions,SchemaTool.ACTION_DROP)) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new RuntimeStrategyInstaller(repos)); ClassMapping mapping = null; try { mapping = repos.getMapping(cls, null, false); } catch (Exception e) { } if (mapping != null) { _flushSchema = true; if (_dropMap == null) _dropMap = new HashSet<ClassMapping>(); _dropMap.add(mapping); } else _log.warn(_loc.get("no-drop-meta", cls)); }
/** * Validate the mappings for the given class and its fields. */ private void validate(Class<?> cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new RuntimeStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) _flushSchema = !contains(_schemaActions,SCHEMA_ACTION_NONE) && !contains(_schemaActions,SchemaTool.ACTION_ADD); }
/** * Validate the mappings for the given class and its fields. */ private void validate(Class<?> cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new RuntimeStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) _flushSchema = !contains(_schemaActions,SCHEMA_ACTION_NONE) && !contains(_schemaActions,SchemaTool.ACTION_ADD); }
/** * Validate the mappings for the given class and its fields. */ private void validate(Class<?> cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new RuntimeStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) _flushSchema = !contains(_schemaActions,SCHEMA_ACTION_NONE) && !contains(_schemaActions,SchemaTool.ACTION_ADD); }
/** * Validate the mappings for the given class and its fields. */ private void validate(Class cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new RuntimeStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) _flushSchema = !contains(_schemaActions,SCHEMA_ACTION_NONE) && !contains(_schemaActions,SchemaTool.ACTION_ADD); }
/** * Validate the mappings for the given class and its fields. */ private void validate(Class<?> cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new RuntimeStrategyInstaller(repos)); if (getMapping(repos, cls, true) != null) _flushSchema = !contains(_schemaActions,SCHEMA_ACTION_NONE) && !contains(_schemaActions,SchemaTool.ACTION_ADD); }
/** * Create a metadata for the given instance. */ private void addMeta(Class<?> cls) { if (cls == null) return; _flush = true; MappingRepository repos = getRepository(); repos.setResolve(MODE_MAPPING, false); MetaDataFactory factory = repos.getMetaDataFactory(); factory.getDefaults().setIgnoreNonPersistent(false); factory.setStoreMode(MetaDataFactory.STORE_VERBOSE); ClassMetaData meta = repos.addMetaData(cls); FieldMetaData[] fmds = meta.getDeclaredFields(); for (int i = 0; i < fmds.length; i++) { if (fmds[i].getDeclaredTypeCode() == JavaTypes.OBJECT && fmds[i].getDeclaredType() != Object.class) fmds[i].setDeclaredTypeCode(JavaTypes.PC); } meta.setSource(_file, meta.getSourceType(), _file == null ? "": _file.getPath() ); meta.setResolve(MODE_META, true); }
/** * Create a metadata for the given instance. */ private void addMeta(Class<?> cls) { if (cls == null) return; _flush = true; MappingRepository repos = getRepository(); repos.setResolve(MODE_MAPPING, false); MetaDataFactory factory = repos.getMetaDataFactory(); factory.getDefaults().setIgnoreNonPersistent(false); factory.setStoreMode(MetaDataFactory.STORE_VERBOSE); ClassMetaData meta = repos.addMetaData(cls); FieldMetaData[] fmds = meta.getDeclaredFields(); for (int i = 0; i < fmds.length; i++) { if (fmds[i].getDeclaredTypeCode() == JavaTypes.OBJECT && fmds[i].getDeclaredType() != Object.class) fmds[i].setDeclaredTypeCode(JavaTypes.PC); } meta.setSource(_file, meta.getSourceType(), _file == null ? "": _file.getPath() ); meta.setResolve(MODE_META, true); }
/** * Create a metadata for the given instance. */ private void addMeta(Class<?> cls) { if (cls == null) return; _flush = true; MappingRepository repos = getRepository(); repos.setResolve(MODE_MAPPING, false); MetaDataFactory factory = repos.getMetaDataFactory(); factory.getDefaults().setIgnoreNonPersistent(false); factory.setStoreMode(MetaDataFactory.STORE_VERBOSE); ClassMetaData meta = repos.addMetaData(cls); FieldMetaData[] fmds = meta.getDeclaredFields(); for (int i = 0; i < fmds.length; i++) { if (fmds[i].getDeclaredTypeCode() == JavaTypes.OBJECT && fmds[i].getDeclaredType() != Object.class) fmds[i].setDeclaredTypeCode(JavaTypes.PC); } meta.setSource(_file, meta.getSourceType(), _file == null ? "": _file.getPath() ); meta.setResolve(MODE_META, true); }
/** * Create the schema using the mapping for the given instance. */ private void buildSchema(Class<?> cls) { if (cls == null) return; MappingRepository repos = getRepository(); repos.setStrategyInstaller(new RuntimeStrategyInstaller(repos)); if (getMapping(repos, cls, true) == null) return; // set any logical pks to non-logical so they get flushed _flushSchema = true; Schema[] schemas = _schema.getSchemas(); Table[] tables; Column[] cols; for (int i = 0; i < schemas.length; i++) { tables = schemas[i].getTables(); for (int j = 0; j < tables.length; j++) { if (tables[j].getPrimaryKey() == null) continue; tables[j].getPrimaryKey().setLogical(false); cols = tables[j].getPrimaryKey().getColumns(); for (int k = 0; k < cols.length; k++) cols[k].setNotNull(true); } } }