All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.clickntap.hub.BOManager Maven / Gradle / Ivy

There is a newer version: 1.30
Show newest version
package com.clickntap.hub;

import com.clickntap.tool.bean.Bean;
import com.clickntap.tool.bean.ProxyBeanManager;

import java.util.ArrayList;
import java.util.List;

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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy