public boolean isVerticalStrategy() { String strat = getMappingInfo().getHierarchyStrategy(); if (strat != null && strat.equals(VerticalClassStrategy.ALIAS)) return true; return false; } }
/** * Determines whether an inhertance strategy has been set on the * specified mapping. */ protected boolean hasInheritanceStrategy(ClassMapping mapping) { ClassMappingInfo info = mapping.getMappingInfo(); if (info != null && info.getHierarchyStrategy() != null) return true; return false; } }
public boolean isVerticalStrategy() { String strat = getMappingInfo().getHierarchyStrategy(); if (strat != null && strat.equals(VerticalClassStrategy.ALIAS)) return true; return false; } }
/** * Parse inheritance @PrimaryKeyJoinColumn(s). */ private void parsePrimaryKeyJoinColumns(ClassMapping cm, PrimaryKeyJoinColumn... joins) { List<Column> cols = new ArrayList<Column>(joins.length); for (PrimaryKeyJoinColumn join : joins) cols.add(newColumn(join)); cm.getMappingInfo().setColumns(cols); }
/** * Parse inheritance @PrimaryKeyJoinColumn(s). */ private void parsePrimaryKeyJoinColumns(ClassMapping cm, PrimaryKeyJoinColumn... joins) { List<Column> cols = new ArrayList<Column>(joins.length); for (PrimaryKeyJoinColumn join : joins) cols.add(newColumn(join)); cm.getMappingInfo().setColumns(cols); }
public boolean isVerticalType(Value val) { if (!(val instanceof Type)) return false; ClassMapping cm = (ClassMapping)((Type)val).getMetaData(); String strat = cm.getMappingInfo().getHierarchyStrategy(); if (strat != null && strat.equals(VerticalClassStrategy.ALIAS)) return true; return false; } }
public boolean isVerticalType(Value val) { if (!(val instanceof Type)) return false; ClassMapping cm = (ClassMapping)((Type)val).getMetaData(); String strat = cm.getMappingInfo().getHierarchyStrategy(); if (strat != null && strat.equals(VerticalClassStrategy.ALIAS)) return true; return false; } }
/** * Instantiate the given class' named strategy, or return null if no * named strategy. */ protected ClassStrategy namedStrategy(ClassMapping cls) { String name = cls.getMappingInfo().getStrategy(); return instantiateClassStrategy(name, cls); }
/** * If an inheritance strategy has not been set on this mapping, set it * to the default (flat). This method should be called before strategies * are created for the specified mapping. */ protected void setDefaultInheritanceStrategy(ClassMapping mapping) { ClassMappingInfo info = mapping.getMappingInfo(); if (info != null && info.getHierarchyStrategy() == null) info.setHierarchyStrategy(FlatClassStrategy.ALIAS); }
/** * If an inheritance strategy has not been set on this mapping, set it * to the default (flat). This method should be called before strategies * are created for the specified mapping. */ protected void setDefaultInheritanceStrategy(ClassMapping mapping) { ClassMappingInfo info = mapping.getMappingInfo(); if (info != null && info.getHierarchyStrategy() == null) info.setHierarchyStrategy(FlatClassStrategy.ALIAS); }
/** * Instantiate the given class' named strategy, or return null if no * named strategy. */ protected ClassStrategy namedStrategy(ClassMapping cls) { String name = cls.getMappingInfo().getStrategy(); return instantiateClassStrategy(name, cls); }
/** * Parse table. */ private boolean startTable(Attributes attrs) throws SAXException { String table = toTableName(attrs.getValue("schema"), attrs.getValue("name")); if (table != null) ((ClassMapping) currentElement()).getMappingInfo().setTableName (table); return true; }
/** * Start tracking secondary table information and columns */ private boolean startSecondaryTable(Attributes attrs) throws SAXException { _secondaryTable = toTableIdentifier(attrs.getValue("schema"), attrs.getValue("name")).getName(); ((ClassMapping)currentElement()).getMappingInfo() .addSecondaryTable(DBIdentifier.newTable(_secondaryTable)); return true; }
/** * Set the secondary table information back to the owning class mapping. */ private void endSecondaryTable() { ClassMapping cm = (ClassMapping) currentElement(); ClassMappingInfo info = cm.getMappingInfo(); info.setSecondaryTableJoinColumns(_secondaryTable, _joinCols); clearSecondaryTableInfo(); }
protected void addCommments(Object obj) throws SAXException { if (isMappingMode() && !isMetaDataMode()) { if (obj instanceof ClassMapping) obj = ((ClassMapping) obj).getMappingInfo(); else if (obj instanceof FieldMapping) obj = ((FieldMapping) obj).getMappingInfo(); } super.addComments(obj); }
/** * Set class table. */ private void parseTable(ClassMapping cm, Table table) { if (cm.isAbstract()) throw new UserException(_loc.get("table-not-allowed", cm)); DBIdentifier tName = toTableIdentifier(table.schema(), table.name()); if (!DBIdentifier.isNull(tName)) { cm.getMappingInfo().setTableIdentifier(tName); } addUniqueConstraints(tName.getName(), cm, cm.getMappingInfo(), table.uniqueConstraints()); }
@Override protected void serializeClassMappingContent(ClassMetaData mapping) throws SAXException { ClassMapping cls = (ClassMapping) mapping; ClassMappingInfo info = cls.getMappingInfo(); serializeTable(info.getTableName(), "table", ClassUtil.getClassName(mapping.getDescribedType()), null, info.getUniques(info.getTableName())); for (String second : info.getSecondaryTableNames()) serializeTable(second, "secondary-table", null, info, info.getUniques(second)); serializeColumns(info, ColType.PK_JOIN, null); }
public void map(boolean adapt) { ValueMapping vm = cls.getEmbeddingMapping(); if (vm == null || vm.getType() != cls.getDescribedType() || vm.getTypeCode() != JavaTypes.OID) throw new MetaDataException(_loc.get("not-oid", cls)); ClassMappingInfo info = cls.getMappingInfo(); info.assertNoSchemaComponents(cls, true); cls.setTable(vm.getFieldMapping().getTable()); } }
public void map(boolean adapt) { ValueMapping vm = cls.getEmbeddingMapping(); if (vm == null || vm.getType() != cls.getDescribedType() || vm.getTypeCode() != JavaTypes.OID) throw new MetaDataException(_loc.get("not-oid", cls)); ClassMappingInfo info = cls.getMappingInfo(); info.assertNoSchemaComponents(cls, true); cls.setTable(vm.getFieldMapping().getTable()); } }
public void map(boolean adapt) { ValueMapping vm = cls.getEmbeddingMapping(); if (vm == null || vm.getType() != cls.getDescribedType() || vm.getTypeCode() != JavaTypes.OID) throw new MetaDataException(_loc.get("not-oid", cls)); ClassMappingInfo info = cls.getMappingInfo(); info.assertNoSchemaComponents(cls, true); cls.setTable(vm.getFieldMapping().getTable()); } }