/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package framework.beans.reportgen;
import framework.beans.reportgen.item.ReportgenQuery;
import framework.beans.reportgen.item.QueryDetails;
import framework.beans.SecuredBean;
import java.util.Set;
import framework.beans.security.BeanRights;
import framework.generic.ClipsServerException;
import framework.security.UserRightsSetAbstract;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateful;
/**
*
* @author axe
*/
@Stateful(mappedName="clips-beans/ReportGeneratorBean")
public class ReportGeneratorBean extends SecuredBean
implements ReportGeneratorBeanRemote {
public final static int COMMAND_EXECUTE = 0;
@EJB
ReportEntitySetResource resource;
@Override
protected void initBeanRights() throws ClipsServerException {
int[] r = new int[1];
r[COMMAND_EXECUTE] = RightPresence(UserRightsSetAbstract.EXECUTE_REPORT.id);
rights = new BeanRights(r);
}
/**
*
* @return
* @throws framework.generic.ClipsServerException
*/
@Override
public List<QueryDetails> getQueryList(int id, Boolean bool) throws ClipsServerException {
checkCommandAccessibility(COMMAND_EXECUTE);
Field[] f = new Field[1];
if (id != 0) {
f[0] = new Field("reportType.id", id);
}
if (bool != null) {
f[0] = new Field("subsidiary", bool.booleanValue());
}
List<ReportgenQuery> list = findEntityList(ReportgenQuery.class, f);
List<QueryDetails> res = getEntytyDetailsList(list);
return res;
}
/*
@Override
public QueryDetails getQuery(int id) throws ClipsServerException {
checkCommandAccessibility(COMMAND_EXECUTE);
ReportgenQuery query = manager.find(ReportgenQuery.class, id);
if(query == null) {
throw new ClipsServerException("Запроса номером " + id + " не существует!");
}
QueryDetails details = query.getDetails(this);
details.query = ReportFactory.patch(details.query);
return details;
}*/
}