com.clickntap.hub.BOManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Stripecube Show documentation
Show all versions of Stripecube Show documentation
Stripecube is an open source Java framework for Web Applications
package com.clickntap.hub;
import java.util.ArrayList;
import java.util.List;
import com.clickntap.tool.bean.Bean;
import com.clickntap.tool.bean.ProxyBeanManager;
public class BOManager extends ProxyBeanManager {
public BOManager() {
System.setProperty("java.awt.headless", "true");
}
public T getBO(Class clazz, Number id) throws Exception {
return (T) read(id, clazz);
}
public T getBO(Class clazz, BO bo, String filter) throws Exception {
return (T) readByFilter(bo, filter, clazz);
}
public T getBO(Class clazz, String filter) throws Exception {
return (T) readByFilter(null, filter, clazz);
}
public List getBOList(BO bo, String filter) throws Exception {
List items = new ArrayList();
for (Number id : readList(bo, filter))
items.add((T) read(id, bo.getClass()));
return items;
}
public List getBOListByClass(Class clazz, String filter) throws Exception {
List items = new ArrayList();
for (Number id : readListByClass(clazz, filter))
items.add(getBO(clazz, id));
return items;
}
public List getBOListByFilter(Class clazz, BO bo, String filter) throws Exception {
List items = new ArrayList();
for (Number id : readListByFilter(bo.getClass(), bo, filter))
items.add(getBO(clazz, id));
return items;
}
public List exportBOList(BO bo, String filter) throws Exception {
List beans = exportList(bo.getClass(), bo, filter);
List items = new ArrayList();
for (Bean bean : beans)
items.add((T) bean);
return items;
}
public List exportBOListByClass(Class clazz, String filter) throws Exception {
List beans = exportList(clazz, (BO) clazz.newInstance(), filter);
List items = new ArrayList();
for (Bean bean : beans)
items.add((T) bean);
return items;
}
public List exportBOListByFilter(Class clazz, BO bo, String filter) throws Exception {
List beans = exportList(clazz, bo, filter);
List items = new ArrayList();
for (Bean bean : beans)
items.add((T) bean);
return items;
}
}