use of siena.ClassInfo in project siena by mandubian.
the class PersistenceManagerLifeCycleWrapper method insert.
@Override
public void insert(Object obj) {
ClassInfo ci = ClassInfo.getClassInfo(obj.getClass());
LifeCycleUtils.executeMethods(LifeCyclePhase.PRE_INSERT, ci, obj);
pm.insert(obj);
LifeCycleUtils.executeMethods(LifeCyclePhase.POST_INSERT, ci, obj);
}
use of siena.ClassInfo in project siena by mandubian.
the class SdbMappingUtils method mapSelectResultToListKeysOnly.
public static <T> void mapSelectResultToListKeysOnly(SelectResult res, List<T> resList, Class<T> clazz, int offset) {
List<Item> items = res.getItems();
ClassInfo info = ClassInfo.getClassInfo(clazz);
for (int i = offset; i < items.size(); i++) {
Item item = items.get(i);
T obj = Util.createObjectInstance(clazz);
fillModelKeysOnly(item, clazz, info, obj);
resList.add(obj);
}
}
use of siena.ClassInfo in project siena by mandubian.
the class SdbMappingUtils method mapSelectResultToListKeysOnly.
public static <T> void mapSelectResultToListKeysOnly(SelectResult res, List<T> resList, Class<T> clazz) {
List<Item> items = res.getItems();
ClassInfo info = ClassInfo.getClassInfo(clazz);
for (Item item : items) {
T obj = Util.createObjectInstance(clazz);
fillModelKeysOnly(item, clazz, info, obj);
resList.add(obj);
}
}
use of siena.ClassInfo in project siena by mandubian.
the class SdbMappingUtils method mapSelectResultToList.
public static <T> void mapSelectResultToList(SelectResult res, List<T> resList, Class<T> clazz) {
List<Item> items = res.getItems();
ClassInfo info = ClassInfo.getClassInfo(clazz);
for (Item item : items) {
T obj = Util.createObjectInstance(clazz);
fillModel(item, clazz, info, obj);
resList.add(obj);
}
}
use of siena.ClassInfo in project siena by mandubian.
the class SdbMappingUtils method mapSelectResult.
public static <T> int mapSelectResult(SelectResult res, Iterable<T> objects) {
List<Item> items = res.getItems();
Class<?> clazz = null;
ClassInfo info = null;
int nb = 0;
for (T obj : objects) {
if (clazz == null) {
clazz = obj.getClass();
info = ClassInfo.getClassInfo(clazz);
}
String itemName = getItemName(clazz, obj);
Item theItem = null;
for (Item item : items) {
if (item.getName().equals(itemName)) {
theItem = item;
items.remove(item);
break;
}
}
if (theItem != null) {
fillModel(theItem, clazz, info, obj);
nb++;
}
}
return nb;
}
Aggregations