Package it.eng.spago.paginator.basic

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


    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);
        // gets SourceBean from filtered list
        toReturn = list.getPaginator().getAll();
      }
    }
    logger.debug("OUT");
    return toReturn;
  }
View Full Code Here


    } // if ((rowsSourceBean == null) || (rowsVector.size() == 0))
    else{
      for (int i = 0; i < rowsVector.size(); i++)
        paginator.addRow(rowsVector.get(i));
    }
    ListIFace list = new GenericList();
    list.setPaginator(paginator);
    // list.addStaticData(firstData);
    return list;
  } // public static ListIFace getList(ServiceIFace service, SourceBean)
View Full Code Here

    return list;
  }
 
 
  private ListIFace evaluateExpression(String expr, ListIFace list, List ops, BIObject obj) {
    ListIFace previusCalculated = list;
    try {
      // check number of left and right break, if numbers are different the expression is wrong
      int numberOfLeftRound = 0;
      String tmpExpr = expr;
      while(tmpExpr.indexOf("(")!=-1) {
        numberOfLeftRound ++;
        int indLR = tmpExpr.indexOf("(");
        tmpExpr = tmpExpr.substring(indLR+1);
      }
      int numberOfRightRound = 0;
      tmpExpr = expr;
      while(tmpExpr.indexOf(")")!=-1) {
        numberOfRightRound ++;
        int indRR = tmpExpr.indexOf(")");
        tmpExpr = tmpExpr.substring(indRR+1);
      }
      if(numberOfLeftRound!=numberOfRightRound) {
        SpagoBITracer.warning(SpagoBIConstants.NAME_MODULE, this.getClass().getName(),
                        "evaluateExpression", "Expression is wrong: number of left breaks is" +
                        "different from right breaks. Returning list without evaluating expression");
        return list;
      }
     
      //TODO make some more formal check on the expression before start to process it
     
      // calculate the list filtered based on each objparuse setting
      Map calculatedLists = new HashMap();
      int posinlist = 0;
      Iterator opsIter = ops.iterator();
      while(opsIter.hasNext()) {
        ObjParuse op = (ObjParuse)opsIter.next();
        ListIFace listop = filterForCorrelation(list, op, obj);
        calculatedLists.put(String.valueOf(posinlist), listop);
        posinlist ++;
      }
     
      // generate final list evaluating expression
     
      while(expr.indexOf("(")!=-1) {
        int indLR = expr.indexOf("(");
        int indNextLR = expr.indexOf("(", indLR+1);
        int indNextRR = expr.indexOf(")", indLR+1);
        while( (indNextLR<indNextRR) && (indNextLR!=-1) ) {
          indLR = indNextLR;
          indNextLR = expr.indexOf("(", indLR+1);
          indNextRR = expr.indexOf(")", indLR+1);
        }
        int indRR = indNextRR;
       
        String exprPart = expr.substring(indLR, indRR+1);
        if(exprPart.indexOf("AND")!=-1) {
          int indexOper = exprPart.indexOf("AND");
          String firstListName = (exprPart.substring(1, indexOper)).replace("null", " ");
          String secondListName = (exprPart.substring(indexOper+3, exprPart.length()-1)).replace("null", " ");
          ListIFace firstList = null;
          if(!firstListName.trim().equals("previousList")) {
            firstList = (ListIFace)calculatedLists.get(firstListName.trim());
          } else {
            firstList = previusCalculated;
          }
          ListIFace secondList = null;
          if(!secondListName.trim().equals("previousList")) {
            secondList = (ListIFace)calculatedLists.get(secondListName.trim());
          } else {
            secondList = previusCalculated;
          }
          previusCalculated = intersectLists(firstList, secondList);
        } else if( exprPart.indexOf("OR")!=-1 ) {
          int indexOper = exprPart.indexOf("OR");
          String firstListName = (exprPart.substring(1, indexOper)).replace("null", " ");
          String secondListName = (exprPart.substring(indexOper+2, exprPart.length()-1)).replace("null", " ");
          ListIFace firstList = null;
          if(!firstListName.trim().equals("previousList")) {
            firstList = (ListIFace)calculatedLists.get(firstListName.trim());
          } else {
            firstList = previusCalculated;
          }
          ListIFace secondList = null;
          if(!secondListName.trim().equals("previousList")) {
            secondList = (ListIFace)calculatedLists.get(secondListName.trim());
          } else {
            secondList = previusCalculated;
          }
View Full Code Here

    return previusCalculated;
  }
 

  private ListIFace evaluateSingleLogicOperation(ObjParuse obpuLeft, ObjParuse obpuRight, ListIFace list, BIObject obj) {
    ListIFace listToReturn = list;
    ListIFace listLeft = filterForCorrelation(list, obpuLeft, obj);
    String lo = obpuLeft.getLogicOperator();
    if(lo.equalsIgnoreCase("AND")) {
      listToReturn = filterForCorrelation(listLeft, obpuRight, obj);
    } else if(lo.equalsIgnoreCase("OR")) {
      ListIFace listRight = filterForCorrelation(list, obpuRight, obj);
      listToReturn = mergeLists(listLeft, listRight);
    } else {
      listToReturn = list;
    }
    return listToReturn;
View Full Code Here

      SourceBean rowSBList2 = (SourceBean)rowsSBList2Iter.next();
      String rowStrList2 = rowSBList2.toXML(false).toLowerCase();
      rowsList2.add(rowStrList2);
    }
   
    ListIFace newlist = new GenericList()
    PaginatorIFace newpaginator = new GenericPaginator();
    newpaginator.setPageSize(pagLis2.getPageSize());
   
   
    // if a row of the list one is contained into list 2 then add it to the reulting list
    SourceBean allRowsList1 = list1.getPaginator().getAll();
    List rowsSBList1 = allRowsList1.getAttributeAsList("ROW");
    Iterator rowsSBList1Iter = rowsSBList1.iterator();
    while(rowsSBList1Iter.hasNext()) {
      SourceBean rowSBList1 = (SourceBean)rowsSBList1Iter.next();
      String rowStrList1 = rowSBList1.toXML(false).toLowerCase();
      if(rowsList2.contains(rowStrList1)) {
        newpaginator.addRow(rowSBList1);
      }
    }
    // return list 2
    newlist.setPaginator(newpaginator);
    return newlist;
  }
View Full Code Here

        SourceBean rowSB = new SourceBean("ROW");
        setRowAttribute(rowSB, 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);
    if (valuefilter != null) {
        String columnfilter = (String) request.getAttribute(SpagoBIConstants.COLUMN_FILTER);
        String typeFilter = (String) request.getAttribute(SpagoBIConstants.TYPE_FILTER);
View Full Code Here

    }
    else
      for (int i = 0; i < rowsVector.size(); i++)
        paginator.addRow(rowsVector.get(i));   
   
    ListIFace list = new GenericList();
    list.setPaginator(paginator);
   
    // filter the list
    Object valuefilterObj = (Object)request.getAttribute(SpagoBIConstants.VALUE_FILTER);
    String valuefilter = null;
    if(valuefilterObj!=null){
View Full Code Here

    /* (non-Javadoc)
     * @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 {
  logger.debug("IN");
  ListIFace list = null;
  // get role / par id / par field name name
  String roleName = (String) request.getAttribute("roleName");
  String parIdStr = (String) request.getAttribute("parameterId");
  String returnParam = (String) request.getAttribute(RETURN_PARAM);
  String selectAllS = (String) request.getAttribute("selectAll");
View Full Code Here

      return list;
   
  }

  private static ListIFace evaluateExpression(String expr, ListIFace list, List ops, SourceBean request, HashMap parametersMap, EMFErrorHandler errorHandler) {
    ListIFace previusCalculated = list;
    try {
      // check number of left and right break, if numbers are different the expression is wrong
      int numberOfLeftRound = 0;
      String tmpExpr = expr;
      while(tmpExpr.indexOf("(")!=-1) {
        numberOfLeftRound ++;
        int indLR = tmpExpr.indexOf("(");
        tmpExpr = tmpExpr.substring(indLR+1);
      }
      int numberOfRightRound = 0;
      tmpExpr = expr;
      while(tmpExpr.indexOf(")")!=-1) {
        numberOfRightRound ++;
        int indRR = tmpExpr.indexOf(")");
        tmpExpr = tmpExpr.substring(indRR+1);
      }
      if(numberOfLeftRound!=numberOfRightRound) {
        logger.warn("Expression is wrong: number of left breaks is different from right breaks. Returning list without evaluating expression");
        return list;
      }
       
      //TODO make some more formal check on the expression before start to process it
     
      // calculate the list filtered based on each objparuse setting
      Map calculatedLists = new HashMap();
      int posinlist = 0;
      Iterator opsIter = ops.iterator();
      while(opsIter.hasNext()) {
        ObjParuse op = (ObjParuse)opsIter.next();
        ListIFace listop = filterForCorrelation(list, op, request, parametersMap, errorHandler);
        calculatedLists.put(String.valueOf(posinlist), listop);
        posinlist ++;
      }
     
      // generate final list evaluating expression
     
      while(expr.indexOf("(")!=-1) {
        int indLR = expr.indexOf("(");
        int indNextLR = expr.indexOf("(", indLR+1);
        int indNextRR = expr.indexOf(")", indLR+1);
        while( (indNextLR<indNextRR) && (indNextLR!=-1) ) {
          indLR = indNextLR;
          indNextLR = expr.indexOf("(", indLR+1);
          indNextRR = expr.indexOf(")", indLR+1);
        }
        int indRR = indNextRR;
       
        String exprPart = expr.substring(indLR, indRR+1);
        if(exprPart.indexOf("AND")!=-1) {
          int indexOper = exprPart.indexOf("AND");
          String firstListName = (exprPart.substring(1, indexOper)).replace("null", " ");
          String secondListName = (exprPart.substring(indexOper+3, exprPart.length()-1)).replace("null", " ");
          ListIFace firstList = null;
          if(!firstListName.trim().equals("previousList")) {
            firstList = (ListIFace)calculatedLists.get(firstListName.trim());
          } else {
            firstList = previusCalculated;
          }
          ListIFace secondList = null;
          if(!secondListName.trim().equals("previousList")) {
            secondList = (ListIFace)calculatedLists.get(secondListName.trim());
          } else {
            secondList = previusCalculated;
          }
          previusCalculated = intersectLists(firstList, secondList);
        } else if( exprPart.indexOf("OR")!=-1 ) {
          int indexOper = exprPart.indexOf("OR");
          String firstListName = (exprPart.substring(1, indexOper)).replace("null", " ");
          String secondListName = (exprPart.substring(indexOper+2, exprPart.length()-1)).replace("null", " ");
          ListIFace firstList = null;
          if(!firstListName.trim().equals("previousList")) {
            firstList = (ListIFace)calculatedLists.get(firstListName.trim());
          } else {
            firstList = previusCalculated;
          }
          ListIFace secondList = null;
          if(!secondListName.trim().equals("previousList")) {
            secondList = (ListIFace)calculatedLists.get(secondListName.trim());
          } else {
            secondList = previusCalculated;
          }
View Full Code Here

    }
    return previusCalculated;
  }

  private static ListIFace evaluateSingleLogicOperation(ObjParuse obpuLeft, ObjParuse obpuRight, ListIFace list, SourceBean request, HashMap parametersMap, EMFErrorHandler errorHandler) {
    ListIFace listToReturn = list;
    ListIFace listLeft = filterForCorrelation(list, obpuLeft, request, parametersMap, errorHandler);
    String lo = obpuLeft.getLogicOperator();
    if(lo.equalsIgnoreCase("AND")) {
      listToReturn = filterForCorrelation(listLeft, obpuRight, request, parametersMap, errorHandler);
    } else if(lo.equalsIgnoreCase("OR")) {
      ListIFace listRight = filterForCorrelation(list, obpuRight, request, parametersMap, errorHandler);
      listToReturn = mergeLists(listLeft, listRight);
    } else {
      listToReturn = list;
    }
    return listToReturn;
View Full Code Here

TOP

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

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.