use of siena.core.Relation in project siena by mandubian.
the class GaePersistenceManager method _insertMultiple.
private <T> int _insertMultiple(Iterable<T> objects) {
List<Entity> entities = new ArrayList<Entity>();
for (Object obj : objects) {
Class<?> clazz = obj.getClass();
ClassInfo info = ClassInfo.getClassInfo(clazz);
if (info.hasAggregator) {
Relation rel = (Relation) Util.readField(obj, info.aggregator);
if (rel != null && rel.mode == RelationMode.AGGREGATION) {
ClassInfo parentInfo = ClassInfo.getClassInfo(rel.target.getClass());
Key parentKey = GaeMappingUtils.makeKey(parentInfo, rel.target);
_insertAddEntity(entities, obj, info, parentKey, parentInfo, (Field) rel.discriminator);
} else {
_insertAddEntity(entities, obj, info, null, null, null);
}
} else {
_insertAddEntity(entities, obj, info, null, null, null);
}
}
return _insertPutEntities(entities, objects);
}
use of siena.core.Relation in project siena by mandubian.
the class GaePersistenceManager method _insertSingle.
private <T> void _insertSingle(T obj) {
Class<?> clazz = obj.getClass();
ClassInfo info = ClassInfo.getClassInfo(clazz);
if (info.hasAggregator) {
Relation rel = (Relation) Util.readField(obj, info.aggregator);
if (rel != null && rel.mode == RelationMode.AGGREGATION) {
ClassInfo parentInfo = ClassInfo.getClassInfo(rel.target.getClass());
Key parentKey = GaeMappingUtils.makeKey(parentInfo, rel.target);
_insertSingle(obj, parentKey, rel.target, parentInfo, (Field) rel.discriminator);
} else {
_insertSingle(obj, null, null, null, null);
}
} else {
_insertSingle(obj, null, null, null, null);
}
}
Aggregations