Package it.eng.spago.paginator.basic

Examples of it.eng.spago.paginator.basic.PaginatorIFace


    RequestContainer requestContainer = getRequestContainer();
    SessionContainer session = requestContainer.getSessionContainer();
    String parameterFieldName = (String)request.getAttribute("parameterFieldName");
    logger.debug("parameterFieldName="+parameterFieldName);
    // define the spago paginator and list object
    PaginatorIFace paginator = new GenericPaginator();
    ListIFace list = new GenericList();
    // define variable for value column name
    String valColName = "";
    // recover lov object 
    IParameterDAO pardao = DAOFactory.getParameterDAO();
    Parameter par = pardao.loadForExecutionByParameterIDandRoleName(parId, roleName);
    ModalitiesValue modVal = par.getModalityValue();
    // get the lov provider
    String looProvider = modVal.getLovProvider();
    // get from the request the type of lov
    String typeLov = LovDetailFactory.getLovTypeCode(looProvider);
    // get the user profile
    IEngUserProfile profile = null;
    SessionContainer permanentSession = session.getPermanentContainer();
    profile = (IEngUserProfile) permanentSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
//    HttpServletRequest httpReq = (HttpServletRequest)requestContainer.getInternalRequest();
//    HttpSession httpSess = httpReq.getSession();
//    profile = (IEngUserProfile)httpSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
    // based on lov type fill the spago list / paginator object / valColName
    SourceBean rowsSourceBean = null;
    if(typeLov.equalsIgnoreCase("QUERY")) {
      QueryDetail qd = QueryDetail.fromXML(looProvider);
//      if (qd.requireProfileAttributes()) {
//        String message = PortletUtilities.getMessage("scheduler.noProfileAttributesSupported", "component_scheduler_messages");
//        response.setAttribute(SpagoBIConstants.MESSAGE_INFO, message);
//        return list;
//      }
      valColName = qd.getValueColumnName();     
      //String pool = qd.getConnectionName();
      String datasource = qd.getDataSource();
      String statement = qd.getQueryDefinition();
      // execute query
      try {
        statement = StringUtilities.substituteProfileAttributesInString(statement, profile);
        //rowsSourceBean = (SourceBean) executeSelect(getRequestContainer(), getResponseContainer(), pool, statement);
        rowsSourceBean = (SourceBean) executeSelect(getRequestContainer(), getResponseContainer(), datasource, statement);
      } catch (Exception e) {
        String stacktrace = e.toString();
        response.setAttribute("stacktrace", stacktrace);
        int startIndex = stacktrace.indexOf("java.sql.");
        int endIndex = stacktrace.indexOf("\n\tat ", startIndex);
        if (endIndex == -1) endIndex = stacktrace.indexOf(" at ", startIndex);
        if (startIndex != -1 && endIndex != -1)
          response.setAttribute("errorMessage", stacktrace.substring(startIndex, endIndex));
        response.setAttribute("testExecuted", "false");
      }
    } else if(typeLov.equalsIgnoreCase("FIXED_LIST")) {
      FixedListDetail fixlistDet = FixedListDetail.fromXML(looProvider);
//      if (fixlistDet.requireProfileAttributes()) {
//        String message = PortletUtilities.getMessage("scheduler.noProfileAttributesSupported", "component_scheduler_messages");
//        response.setAttribute(SpagoBIConstants.MESSAGE_INFO, message);
//        return list;
//      }
      valColName = fixlistDet.getValueColumnName();
      try{
        String result = fixlistDet.getLovResult(profile, null, null);
        rowsSourceBean = SourceBean.fromXMLString(result);
        if(!rowsSourceBean.getName().equalsIgnoreCase("ROWS")) {
          throw new Exception("The fix list is empty");
        } else if (rowsSourceBean.getAttributeAsList(DataRow.ROW_TAG).size()==0) {
          throw new Exception("The fix list is empty");
        }
      } catch (Exception e) {
        SpagoBITracer.major(SpagoBIConstants.NAME_MODULE, this.getClass().getName(),
                        "getList", "Error while converting fix lov into spago list", e);
        String stacktrace = e.toString();
        response.setAttribute("stacktrace", stacktrace);
        response.setAttribute("errorMessage", "Error while executing fix list lov");
        response.setAttribute("testExecuted", "false");
        return list;
      }
    } else if(typeLov.equalsIgnoreCase("SCRIPT")) {
      ScriptDetail scriptDetail = ScriptDetail.fromXML(looProvider);
//      if (scriptDetail.requireProfileAttributes()) {
//        String message = PortletUtilities.getMessage("scheduler.noProfileAttributesSupported", "component_scheduler_messages");
//        response.setAttribute(SpagoBIConstants.MESSAGE_INFO, message);
//        return list;
//      }
      valColName = scriptDetail.getValueColumnName();
      try{
        String result = scriptDetail.getLovResult(profile, null, null);
        rowsSourceBean = SourceBean.fromXMLString(result);
      } catch (Exception e) {
        SpagoBITracer.major(SpagoBIConstants.NAME_MODULE, this.getClass().getName(),
                        "getList", "Error while executing the script lov", e);
        String stacktrace = e.toString();
        response.setAttribute("stacktrace", stacktrace);
        response.setAttribute("errorMessage", "Error while executing script");
        response.setAttribute("testExecuted", "false");
        return list;
      }
    } else if(typeLov.equalsIgnoreCase("JAVA_CLASS")) {
      JavaClassDetail javaClassDetail = JavaClassDetail.fromXML(looProvider);
//      if (javaClassDetail.requireProfileAttributes()) {
//        String message = PortletUtilities.getMessage("scheduler.noProfileAttributesSupported", "component_scheduler_messages");
//        response.setAttribute(SpagoBIConstants.MESSAGE_INFO, message);
//        return list;
//      }
      valColName = javaClassDetail.getValueColumnName();
      try{   
        String javaClassName = javaClassDetail.getJavaClassName();
        IJavaClassLov javaClassLov = (IJavaClassLov) Class.forName(javaClassName).newInstance();
          String result = javaClassLov.getValues(profile);
            rowsSourceBean = SourceBean.fromXMLString(result);
      } catch (Exception e) {
        SpagoBITracer.major(SpagoBIConstants.NAME_MODULE, this.getClass().getName(),
                              "getList", "Error while executing the java class lov", e);
        String stacktrace = e.toString();
        response.setAttribute("stacktrace", stacktrace);
        response.setAttribute("errorMessage", "Error while executing java class");
        response.setAttribute("testExecuted", "false");
        return list;
      }
    }
    // fill paginator
    int count = 0;
    if(rowsSourceBean != null) {
      List rows = rowsSourceBean.getAttributeAsList(DataRow.ROW_TAG);
      for (int i = 0; i < rows.size(); i++){
        paginator.addRow(rows.get(i));
        count++;
      }
    }
    paginator.setPageSize(count);
    list.setPaginator(paginator);
   
    // get all the columns name
      rowsSourceBean = list.getPaginator().getAll();
    List colNames = new ArrayList();
View Full Code Here


        String formatSB = config.getConfigValue("SPAGOBI.DATE-FORMAT.format");
        String format = (formatSB==null)?"": formatSB;
      format = format.replaceAll("D", "d");
      format = format.replaceAll("m", "M");
      format = format.replaceAll("Y", "y");
    PaginatorIFace paginator = new GenericPaginator();
    Iterator it = firedEventsList.iterator();
    while (it.hasNext()) {
      EventLog eventLog = (EventLog) it.next();
      String rowSBStr = "<ROW ";
      rowSBStr += "    ID=\"" + eventLog.getId() + "\"";
      String date = StringUtils.dateToString(eventLog.getDate(), format);
      rowSBStr += "    DATE=\"" + date + "\"";
      rowSBStr += "    USER=\"" + eventLog.getUser() + "\"";
      String description = eventLog.getDesc();
      if (description != null) {
        description = GeneralUtilities.replaceInternationalizedMessages(description);
        description = description.replaceAll("<br/>", " ");
        if (description.length() > 50) description = description.substring(0, 50) + "...";
        description = description.replaceAll(">", "&gt;");
        description = description.replaceAll("<", "&lt;");
        description = description.replaceAll("\"", "&quot;");
      }
      rowSBStr += "    DESCRIPTION=\"" + (description != null ? description : "") + "\"";
      rowSBStr += "     />";
      SourceBean rowSB = SourceBean.fromXMLString(rowSBStr);
      paginator.addRow(rowSB);
    }
    ListIFace list = new GenericList();
    list.setPaginator(paginator);
    // filter the list
    String valuefilter = (String) request.getAttribute(SpagoBIConstants.VALUE_FILTER);
View Full Code Here

   */
  public ListIFace getLovAsListService() throws Exception {
    ListIFace list = null
    LovResultHandler lovResultHandler = new LovResultHandler( getLovResult() );
    SourceBean lovResultSB = lovResultHandler.getLovResultSB();
    PaginatorIFace paginator = new GenericPaginator();
   
    int numRows = 10;
    try{
      SingletonConfig spagoconfig = SingletonConfig.getInstance();
      String lookupnumRows = spagoconfig.getConfigValue("SPAGOBI.LOOKUP.numberRows");
      if(lookupnumRows!=null) {
        numRows = Integer.parseInt(lookupnumRows);
      }
    } catch(Exception e) {
      numRows = 10;
      SpagoBITracer.major(SpagoBIConstants.NAME_MODULE, this.getClass().getName(),
                      "getListServiceBaseConfig", "Error while recovering number rows for " +
                      "lookup from configuration, usign default 10", e);
    }
    paginator.setPageSize(numRows);
   
   
    List rows = null;
    if (lovResultSB != null) {
      rows = lovResultSB.getAttributeAsList("ROW");
      for (int i = 0; i < rows.size(); i++)
        paginator.addRow(rows.get(i));
    }
    list = new GenericList();
    list.setPaginator(paginator);
    return list;
  }
View Full Code Here

   * @see it.eng.spago.dispatching.service.list.basic.IFaceBasicListService#getList(it.eng.spago.base.SourceBean, it.eng.spago.base.SourceBean)
   */
  public ListIFace getList(SourceBean request, SourceBean response) throws Exception {
     
    // define the spago paginator and list object
    PaginatorIFace paginator = new GenericPaginator();
    ListIFace list = new GenericList();
    // recover lov object 
    RequestContainer requestContainer = getRequestContainer();
    SessionContainer session = requestContainer.getSessionContainer();
    ModalitiesValue modVal = (ModalitiesValue) session.getAttribute(SpagoBIConstants.MODALITY_VALUE_OBJECT);
    // get the lov provider
    String looProvider = modVal.getLovProvider();
    // get from the request the type of lov
    String typeLov = LovDetailFactory.getLovTypeCode(looProvider);
    // get the usser profile
    IEngUserProfile profile = null;
    profile = (IEngUserProfile)session.getAttribute(SpagoBIConstants.USER_PROFILE_FOR_TEST);
    if(profile==null) {
      SessionContainer permSess = session.getPermanentContainer();
      profile = (IEngUserProfile) permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
    } else {
      session.delAttribute(SpagoBIConstants.USER_PROFILE_FOR_TEST);
    }
    // based on lov type fill the spago list and paginator object
    SourceBean rowsSourceBean = null;
    List colNames = new ArrayList();
    if(typeLov.equalsIgnoreCase("QUERY")) {
      QueryDetail qd = QueryDetail.fromXML(looProvider);
      //String pool = qd.getConnectionName();
      String datasource = qd.getDataSource();
      String statement = qd.getQueryDefinition();
      // execute query
      try {
        statement = StringUtilities.substituteProfileAttributesInString(statement, profile);
        //rowsSourceBean = (SourceBean) executeSelect(getRequestContainer(), getResponseContainer(), pool, statement, colNames);
        rowsSourceBean = (SourceBean) executeSelect(getRequestContainer(), getResponseContainer(), datasource, statement, colNames);
      } catch (Exception e) {
        String stacktrace = e.toString();
        response.setAttribute("stacktrace", stacktrace);
        int startIndex = stacktrace.indexOf("java.sql.");
        int endIndex = stacktrace.indexOf("\n\tat ", startIndex);
        if (endIndex == -1) endIndex = stacktrace.indexOf(" at ", startIndex);
        if (startIndex != -1 && endIndex != -1)
          response.setAttribute("errorMessage", stacktrace.substring(startIndex, endIndex));
        response.setAttribute("testExecuted", "false");
      }
    } else if(typeLov.equalsIgnoreCase("FIXED_LIST")) {
      FixedListDetail fixlistDet = FixedListDetail.fromXML(looProvider);
      try{
        String result = fixlistDet.getLovResult(profile, null, null);
        rowsSourceBean = SourceBean.fromXMLString(result);
        colNames = findFirstRowAttributes(rowsSourceBean);
        if(!rowsSourceBean.getName().equalsIgnoreCase("ROWS")) {
          throw new Exception("The fix list is empty");
        } else if (rowsSourceBean.getAttributeAsList(DataRow.ROW_TAG).size()==0) {
          throw new Exception("The fix list is empty");
        }
      } catch (Exception e) {
        SpagoBITracer.major(SpagoBIConstants.NAME_MODULE, this.getClass().getName(),
                        "getList", "Error while converting fix lov into spago list", e);
        String stacktrace = e.toString();
        response.setAttribute("stacktrace", stacktrace);
        response.setAttribute("errorMessage", "Error while executing fix list lov");
        response.setAttribute("testExecuted", "false");
        return list;
      }
    } else if(typeLov.equalsIgnoreCase("SCRIPT")) {
      ScriptDetail scriptDetail = ScriptDetail.fromXML(looProvider);
      try{
        String result = scriptDetail.getLovResult(profile, null, null);
        rowsSourceBean = SourceBean.fromXMLString(result);
        colNames = findFirstRowAttributes(rowsSourceBean);
      } catch (Exception e) {
        SpagoBITracer.major(SpagoBIConstants.NAME_MODULE, this.getClass().getName(),
                        "getList", "Error while executing the script lov", e);
        String stacktrace = e.toString();
        response.setAttribute("stacktrace", stacktrace);
        response.setAttribute("errorMessage", "Error while executing script");
        response.setAttribute("testExecuted", "false");
        return list;
      }
    } else if(typeLov.equalsIgnoreCase("JAVA_CLASS")) {
      JavaClassDetail javaClassDetail = JavaClassDetail.fromXML(looProvider);
      try{   
        String javaClassName = javaClassDetail.getJavaClassName();
        IJavaClassLov javaClassLov = (IJavaClassLov) Class.forName(javaClassName).newInstance();
          String result = javaClassLov.getValues(profile);
            rowsSourceBean = SourceBean.fromXMLString(result);
            colNames = findFirstRowAttributes(rowsSourceBean);
      } catch (Exception e) {
        SpagoBITracer.major(SpagoBIConstants.NAME_MODULE, this.getClass().getName(),
                              "getList", "Error while executing the java class lov", e);
        String stacktrace = e.toString();
        response.setAttribute("stacktrace", stacktrace);
        response.setAttribute("errorMessage", "Error while executing java class");
        response.setAttribute("testExecuted", "false");
        return list;
      }
    }
    // fill paginator
    if(rowsSourceBean != null) {
      List rows = rowsSourceBean.getAttributeAsList(DataRow.ROW_TAG);
      for (int i = 0; i < rows.size(); i++)
        paginator.addRow(rows.get(i));
    }
    list.setPaginator(paginator);
   
    // build module configuration for the list
    String moduleConfigStr = "";
View Full Code Here

      currentFieldOrder = currentFieldOrder.toLowerCase() + currentTypOrder.toLowerCase();

  SourceBean moduleConfig = makeListConfiguration(profile);
  response.setAttribute(moduleConfig);

  PaginatorIFace paginator = new GenericPaginator();

  int numRows = 10;
  try {
      SingletonConfig spagoconfig = SingletonConfig.getInstance();
      String lookupnumRows = spagoconfig.getConfigValue("SPAGOBI.LOOKUP.numberRows");
      if (lookupnumRows != null) {
    numRows = Integer.parseInt(lookupnumRows);
      }
  } catch (Exception e) {
      numRows = 10;
      logger.error("Error while recovering number rows for " + "lookup from configuration, usign default 10", e);
  }
  paginator.setPageSize(numRows);
  logger.debug("setPageSize="+numRows);
  IBIObjectDAO objDAO = DAOFactory.getBIObjectDAO();
  List objectsList = null;
  logger.debug("Loading the documents list");
  if (initialPath != null && !initialPath.trim().equals("")) {
      objectsList = objDAO.loadAllBIObjectsFromInitialPath(initialPath, currentFieldOrder);
  } else {
      objectsList = objDAO.loadAllBIObjects(currentFieldOrder);
  }

  for (Iterator it = objectsList.iterator(); it.hasNext();) {
      BIObject obj = (BIObject) it.next();
      SourceBean rowSB = makeListRow(profile, obj);
      if (rowSB != null)
    paginator.addRow(rowSB);
  }
  ListIFace list = new GenericList();
  list.setPaginator(paginator);
  // filter the list
  String valuefilter = (String) request.getAttribute(SpagoBIConstants.VALUE_FILTER);
View Full Code Here

        String objIdStr = (String) sessionContainer.getAttribute("SUBJECT_ID");
        Integer objId = null;
        if (objIdStr != null) objId = new Integer (objIdStr);
        response.setAttribute("SUBJECT_ID",objIdStr);
   
    PaginatorIFace paginator = new GenericPaginator();   
    IBIObjectDAO objDAO = DAOFactory.getBIObjectDAO();
    List objectsList = null;
    if (initialPath != null && !initialPath.trim().equals("")) {
      objectsList = objDAO.loadAllBIObjectsFromInitialPath(initialPath, currentFieldOrder+ " " + currentTypOrder);
    } else {
      objectsList = objDAO.loadAllBIObjects(currentFieldOrder + " " + currentTypOrder);
    }
   
    String checked = (String)request.getAttribute("checked");
    if (checked  == null )
      checked = (String)request.getAttribute("optChecked");
    if(checked==null){
      checked = "true";
    }
    request.delAttribute("optChecked");
    request.setAttribute("optChecked", checked);
    response.setAttribute("optChecked", (String)request.getAttribute("optChecked"));
    if(checked.equals("true")){
    //if the request is to show only checked objects (it is settled by default when page is loaded at the first time
      for (Iterator it = objectsList.iterator(); it.hasNext(); ) {
        BIObject obj = (BIObject) it.next();
        if (objId != null && obj.getId().equals(objId)) continue;
        //boolean bool = isCheckedObject(obj.getId().toString());
        if(isCheckedObject(obj.getId().toString())){
          SourceBean rowSB = null;
          /*if (SpagoBIConstants.ADMIN_ACTOR.equalsIgnoreCase(actor)) {
            rowSB = makeAdminListRow(obj);
          } else if (SpagoBIConstants.DEV_ACTOR.equalsIgnoreCase(actor)) {
            rowSB = makeDevListRow(obj);
          }
          */
          if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)) {
            rowSB = makeAdminListRow(obj);
          } else if (!profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN) &&
                 profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_DEV)) {
            rowSB = makeDevListRow(obj);
          }
            if (rowSB != null) paginator.addRow(rowSB);
        }
      }
    }
    //else if it is false, show all objects
    else if (checked.equals("false")){
      for (Iterator it = objectsList.iterator(); it.hasNext(); ) {
        BIObject obj = (BIObject) it.next();
        if (objId != null && obj.getId().equals(objId)) continue;
        //boolean bool = isCheckedObject(obj.getId().toString());
        SourceBean rowSB = null;
        /*
          if (SpagoBIConstants.ADMIN_ACTOR.equalsIgnoreCase(actor)) {
            rowSB = makeAdminListRow(obj);
          } else if (SpagoBIConstants.DEV_ACTOR.equalsIgnoreCase(actor)) {
            rowSB = makeDevListRow(obj);
          }
          */
        if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)) {
          rowSB = makeAdminListRow(obj);
        } else if (!profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN) &&
               profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_DEV)) {
          rowSB = makeDevListRow(obj);
        }
        if (rowSB != null) paginator.addRow(rowSB);
      }
    }
   
    ListIFace list = new GenericList();
    list.setPaginator(paginator);
View Full Code Here

   * @return the list
   *
   * @throws Exception If any exception occurred
   */
  public static ListIFace getList(ServiceIFace service, SourceBean request, SourceBean response) throws Exception {
    PaginatorIFace paginator = new GenericPaginator();
    InitializerIFace serviceInitializer = (InitializerIFace) service;
    RequestContextIFace serviceRequestContext = (RequestContextIFace) service;
    int pagedRows = 10;
    SourceBean rowsSourceBean = null;
    SourceBean config = serviceInitializer.getConfig();
    if (config != null) {
      pagedRows = Integer.parseInt((String) serviceInitializer.getConfig().getAttribute("ROWS"));
      paginator.setPageSize(pagedRows);
      String pool = (String) serviceInitializer.getConfig().getAttribute("POOL");
      SourceBean statement = (SourceBean) serviceInitializer.getConfig().getAttribute("QUERIES.SELECT_QUERY");
      rowsSourceBean =
        (SourceBean) QueryExecutor.executeQuery(
          serviceRequestContext.getRequestContainer(),
          serviceRequestContext.getResponseContainer(),
          pool,
          statement,
          "SELECT");
    } else {
      // in case the query is dinamically created, the config SourceBean is in response
      config = (SourceBean) response.getAttribute("CONFIG");
      pagedRows = Integer.parseInt((String) config.getAttribute("ROWS"));
      paginator.setPageSize(pagedRows);
      String pool = (String) config.getAttribute("POOL");
      String statement = (String) ((SourceBean) config.getAttribute("QUERIES.SELECT_QUERY")).getAttribute("statement");
      rowsSourceBean = (SourceBean) executeSelect(serviceRequestContext
          .getRequestContainer(), serviceRequestContext
          .getResponseContainer(), pool, statement);
    }

    List rowsVector = null;
    if (rowsSourceBean != null)
      rowsVector = rowsSourceBean.getAttributeAsList(DataRow.ROW_TAG);
    if ((rowsSourceBean == null)) {//|| (rowsVector.size() == 0)) {
      EMFErrorHandler engErrorHandler = serviceRequestContext.getErrorHandler();
      engErrorHandler.addError(new EMFUserError(EMFErrorSeverity.INFORMATION, 10001));
    } // if ((rowsSourceBean == null) || (rowsVector.size() == 0))
    else
      for (int i = 0; i < rowsVector.size(); i++)
        paginator.addRow(rowsVector.get(i));
   
       
   
        // chiamo la funzione di ricerca nelle colonne (se non vi sono dati di ricerca la funzione
    // non esegue nessuna operazione)
View Full Code Here

    // controls the correctness of the filtering conditions
    boolean filterConditionsAreCorrect = verifyFilterConditions(valuetypefilter, typeFilter, errorHandler);
    if (!filterConditionsAreCorrect) return list;

    PaginatorIFace newPaginator = new GenericPaginator();
    newPaginator.setPageSize(list.getPaginator().getPageSize());
    SourceBean allrowsSB = list.getPaginator().getAll();
    List rows = allrowsSB.getAttributeAsList("ROW");
    Iterator iterRow = rows.iterator();
    while (iterRow.hasNext()) {
      SourceBean row = (SourceBean) iterRow.next();
      boolean doesRowSatisfyCondition = false;
      Iterator valuesfilterIt = valuesfilter.iterator();
      while (valuesfilterIt.hasNext()) {
        String valuefilter = (String) valuesfilterIt.next();
        try {
          if (valuefilter != null && !valuefilter.equals(""))
            doesRowSatisfyCondition =
              doesRowSatisfyCondition(row, valuefilter, valuetypefilter, columnfilter, typeFilter);
          else doesRowSatisfyCondition = true;
        } catch (EMFValidationError error) {
          errorHandler.addError(error);
          return list;
        }
        if (doesRowSatisfyCondition) break;
      }
      if (doesRowSatisfyCondition) newPaginator.addRow(row);
    }
    ListIFace newList = new GenericList();
    newList.setPaginator(newPaginator);
    return newList;
  }
View Full Code Here

    }
    // controls the correctness of the filtering conditions
    boolean filterConditionsAreCorrect = verifyFilterConditions(valuetypefilter, typeFilter, errorHandler);
    if (!filterConditionsAreCorrect) return list;

    PaginatorIFace newPaginator = new GenericPaginator();
    newPaginator.setPageSize(list.getPaginator().getPageSize());
    SourceBean allrowsSB = list.getPaginator().getAll();
    List rows = allrowsSB.getAttributeAsList("ROW");
    Iterator iterRow = rows.iterator();
    while (iterRow.hasNext()) {
      SourceBean row = (SourceBean) iterRow.next();
      boolean doesRowSatisfyCondition = false;
      try {
        doesRowSatisfyCondition = doesRowSatisfyCondition(row, valuefilter, valuetypefilter, columnfilter, typeFilter);
      } catch (EMFValidationError error) {
        if(errorHandler!=null) {
          errorHandler.addError(error);
        }
        return list;
      }
      if (doesRowSatisfyCondition) newPaginator.addRow(row);
    }
    ListIFace newList = new GenericList();
    newList.setPaginator(newPaginator);
    return newList;
  }
View Full Code Here

    SourceBean toReturn = null;
    if (rowsSourceBean != null) {
      List rows = rowsSourceBean.getAttributeAsList(DataRow.ROW_TAG);
      if (rows != null && rows.size() != 0) {
        // builds list
        PaginatorIFace paginator = new GenericPaginator();
        ListIFace list = new GenericList();
        list.setPaginator(paginator);
        for (int i = 0; i < rows.size(); i++) {
          paginator.addRow(rows.get(i));
        }
        // filters for correlations
        IParameterUseDAO parusedao = DAOFactory.getParameterUseDAO();
        ParameterUse paruse = parusedao.loadByParameterIdandRole(currbiObjPar.getParID(), roleName);
        list = SelectParametersLookupModule.filterListForParametersCorrelation(paruse, request, list, new HashMap(), errorHandler);
View Full Code Here

TOP

Related Classes of it.eng.spago.paginator.basic.PaginatorIFace

Copyright © 2018 www.massapicom. 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.