Package beans.report

Source Code of beans.report.DiseaseReportSearchBean

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package beans.report;

import framework.beans.SecuredBean;
import framework.beans.security.BeanRights;
import framework.generic.ESecurity;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.Stateful;
import javax.persistence.NoResultException;
import javax.persistence.Query;
import beans.UserRightsSet; import framework.security.RightChecker;

/**
*
* @author finder
*/
@Stateful(mappedName="clips-beans/DiseaseReportSearchBean")
public class DiseaseReportSearchBean extends SecuredBean implements DiseaseReportSearchBeanRemote {
    public static int COMMAND_READ = 0;   
 
    @Override
    protected void initBeanRights() {
        int[] r = new int[1];
        r[COMMAND_READ] = RightPresence(UserRightsSet.READ_REPORT_STRUCTURE.id);
        rights = new BeanRights(r);
    }

    @Override
    public List<DiseaseReportDetals> getList() throws ESecurity {
    checkCommandAccessibility(COMMAND_READ);
   
        List<DiseaseReportDetals> resould = new ArrayList<DiseaseReportDetals>();
        try {
            Query query = manager.createQuery("SELECT a FROM " + DiseaseReport.class.getSimpleName() + " a");
            @SuppressWarnings("unchecked")
            List<DiseaseReport> set = query.getResultList();
            for (int i = 0; i < set.size(); i++) {
                resould.add(set.get(i).getDetails((RightChecker) this));
            }
        } catch (NoResultException ex) {
            // drop
        }
        return resould;
    }
}
TOP

Related Classes of beans.report.DiseaseReportSearchBean

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.