public FieldMapping getFieldMapping() { return (FieldMapping) getFieldMetaData(); }
protected ValueMetaData newValueMetaData(FieldMetaData owner) { return new ValueMappingImpl((FieldMapping) owner); }
public ClassMapping getDeclaredTypeMapping() { return (ClassMapping) getDeclaredTypeMetaData(); }
public boolean resolve(int mode) { int cur = getResolve(); if (super.resolve(mode)) return true; ClassMapping embed = getEmbeddedMapping(); if (embed != null) embed.resolve(mode); if ((mode & MODE_MAPPING) != 0 && (cur & MODE_MAPPING) == 0) resolveMapping(); if ((mode & MODE_MAPPING_INIT) != 0 && (cur & MODE_MAPPING_INIT) == 0) initializeMapping(); return false; }
public void syncMappingInfo() { if (getValueMappedBy() != null) _info.clear(); else { _info.syncWith(this); ClassMapping embed = getEmbeddedMapping(); if (embed != null) embed.syncMappingInfo(); } }
public ForeignKey getForeignKey(ClassMapping target, int targetNumber) { if (_fk == null && getValueMappedBy() != null) return getValueMappedByMapping().getForeignKey(target); if (target == null) return _fk; ClassMapping embeddedMeta = (ClassMapping)getEmbeddedMetaData(); if (embeddedMeta != null) { FieldMapping[] fields = embeddedMeta.getFieldMappings(); if (sup == getTypeMetaData()) return _fk; target = sup; ? newForwardForeignKey(target) : newInverseForeignKey(target); _targetFKs.put(target, newfk); return newfk;
public void copyMappingInfo(ValueMapping vm) { setValueMappedBy(vm.getValueMappedBy()); setPolymorphic(vm.getPolymorphic()); _info.copy(vm.getValueInfo()); ClassMapping embed = vm.getEmbeddedMapping(); if (embed != null && getEmbeddedMapping() != null) { FieldMapping[] tmplates = embed.getFieldMappings(); FieldMapping[] fms = getEmbeddedMapping().getFieldMappings(); if (tmplates.length == fms.length) for (int i = 0; i < fms.length; i++) fms[i].copyMappingInfo(tmplates[i]); } }
/** * Setup mapping. Our handler will already have been set by our owning * field. */ private void resolveMapping() { // mark mapped columns Column[] cols; int insertFlag; if (_fk != null) { cols = _fk.getColumns(); insertFlag = Column.FLAG_FK_INSERT; } else { cols = getColumns(); insertFlag = Column.FLAG_DIRECT_INSERT; } ColumnIO io = getColumnIO(); for (int i = 0; i < cols.length; i++) { if (io.isInsertable(i, false)) cols[i].setFlag(insertFlag, true); if (io.isUpdatable(i, false)) cols[i].setFlag(insertFlag, true); } }
/** * The mapping's primary table. */ public Table getTable() { if (_fk != null) return _fk.getTable(); if (_val.getForeignKey() != null) return _val.getForeignKey().getTable(); // if this is a map of bi-directional relation, // the column of this field should be in the table // of the entity that is the value of the map if (_val.getDeclaredTypeCode() == JavaTypes.MAP) { ClassMapping meta = _elem.getDeclaredTypeMapping(); if (meta != null) return meta.getTable(); } ValueMappingImpl vm = (ValueMappingImpl)getDefiningMapping(). getEmbeddingMetaData(); if (vm != null && vm.getValueMappedBy() != null) { return vm.getFieldMapping().getElementMapping(). getDeclaredTypeMapping().getTable(); } return getDefiningMapping().getTable(); }
public ForeignKey getForeignKey(ClassMapping target) { return getForeignKey(target, 0); } /**
private ClassMapping getDefiningMapping(FieldMapping field) { ClassMapping clm = field.getDefiningMapping(); ValueMappingImpl value = (ValueMappingImpl)clm.getEmbeddingMetaData(); if (value == null) return clm; FieldMapping field1 = value.getFieldMapping(); return getDefiningMapping(field1); }
public ClassMapping getEmbeddedMapping() { return (ClassMapping) getEmbeddedMetaData(); }
public void refSchemaComponents() { for (int i = 0; i < _cols.length; i++) _cols[i].ref(); if (_fk != null) { _fk.ref(); _fk.refColumns(); } ClassMapping embed = getEmbeddedMapping(); if (embed != null) embed.refSchemaComponents(); }
for (int i = 0; i < cols.length; i++) { if (cols[i].getTargetField() != null) tcols[i] = getEquivalentColumn(cols[i], target, cols[i].getTargetField()); else if (_fk != null) tcols[i] = getEquivalentColumn(_fk.getPrimaryKeyColumn (cols[i]).getIdentifier(), target, true); else if (!DBIdentifier.isNull(cols[i].getTargetIdentifier())) tcols[i] = getEquivalentColumn(cols[i].getTargetIdentifier(), target, true); else tcols[i] = getEquivalentColumn(cols[i].getIdentifier(), target, false); for (int i = 0; i < cols.length; i++) newfk.joinConstant(_fk.getPrimaryKeyConstant(cols[i]), getEquivalentColumn(cols[i].getIdentifier(), target, true));
public static void getIdColumns(FieldMapping fmd, List cols) { Column[] pkCols = ((ValueMappingImpl)fmd.getValue()).getColumns(); for (int j = 0; j < pkCols.length; j++) { Column newCol = new Column(); newCol.copy(pkCols[j]); cols.add(newCol); } } }
public ForeignKey getForeignKey(ClassMapping target, int targetNumber) { if (_fk == null && getValueMappedBy() != null) return getValueMappedByMapping().getForeignKey(target); if (target == null) return _fk; ClassMapping embeddedMeta = (ClassMapping)getEmbeddedMetaData(); if (embeddedMeta != null) { FieldMapping[] fields = embeddedMeta.getFieldMappings(); if (sup == getTypeMetaData()) return _fk; target = sup; ? newForwardForeignKey(target) : newInverseForeignKey(target); _targetFKs.put(target, newfk); return newfk;
public boolean resolve(int mode) { int cur = getResolve(); if (super.resolve(mode)) return true; ClassMapping embed = getEmbeddedMapping(); if (embed != null) embed.resolve(mode); if ((mode & MODE_MAPPING) != 0 && (cur & MODE_MAPPING) == 0) resolveMapping(); if ((mode & MODE_MAPPING_INIT) != 0 && (cur & MODE_MAPPING_INIT) == 0) initializeMapping(); return false; }
public void copyMappingInfo(ValueMapping vm) { setValueMappedBy(vm.getValueMappedBy()); setPolymorphic(vm.getPolymorphic()); _info.copy(vm.getValueInfo()); ClassMapping embed = vm.getEmbeddedMapping(); if (embed != null && getEmbeddedMapping() != null) { FieldMapping[] tmplates = embed.getFieldMappings(); FieldMapping[] fms = getEmbeddedMapping().getFieldMappings(); if (tmplates.length == fms.length) for (int i = 0; i < fms.length; i++) fms[i].copyMappingInfo(tmplates[i]); } }
public void syncMappingInfo() { if (getValueMappedBy() != null) _info.clear(); else { _info.syncWith(this); ClassMapping embed = getEmbeddedMapping(); if (embed != null) embed.syncMappingInfo(); } }
/** * Setup mapping. Our handler will already have been set by our owning * field. */ private void resolveMapping() { // mark mapped columns Column[] cols; int insertFlag; if (_fk != null) { cols = _fk.getColumns(); insertFlag = Column.FLAG_FK_INSERT; } else { cols = getColumns(); insertFlag = Column.FLAG_DIRECT_INSERT; } ColumnIO io = getColumnIO(); for (int i = 0; i < cols.length; i++) { if (io.isInsertable(i, false)) cols[i].setFlag(insertFlag, true); if (io.isUpdatable(i, false)) cols[i].setFlag(insertFlag, true); } }