public final CuOrSe checkSe1(final Map<String, Object> pRqVs,
    final List<CuOrSe> pOrds) throws Exception {
    StringBuffer ordIds = null;
    for (CuOrSe co : pOrds) {
      co.setGoods(new ArrayList<CuOrSeGdLn>());
      co.setServs(new ArrayList<CuOrSeSrLn>());
      if (ordIds == null) {
        ordIds = new StringBuffer();
        ordIds.append(co.getItsId().toString());
      } else {
        ordIds.append("," + co.getItsId());
      }
    }
    Set<String> ndFlNm = new HashSet<String>();
    ndFlNm.add("itsId");
    ndFlNm.add("itsName");
    Set<String> ndFl = new HashSet<String>();
    ndFl.add("itsId");
    ndFl.add("itsOwner");
    ndFl.add("itsName");
    ndFl.add("good");
    ndFl.add("uom");
    ndFl.add("quant");
    ndFl.add("price");
    ndFl.add("tot");
    ndFl.add("totTx");
    String tbn = CuOrSeGdLn.class.getSimpleName();
    String tbnUom = UnitOfMeasure.class.getSimpleName();
    pRqVs.put(tbn + "neededFields", ndFl);
    pRqVs.put(tbn + "gooddeepLevel", 1);
    pRqVs.put(tbn + "itsOwnerdeepLevel", 1);
    pRqVs.put(tbnUom + "neededFields", ndFlNm);
    List<CuOrSeGdLn> allGoods = new ArrayList<CuOrSeGdLn>();
    List<CuOrSeSrLn> allServs = new ArrayList<CuOrSeSrLn>();
    String quer = lazyGetQuOrGdChk().replace(":TORLN", "CUORSEGDLN")
      .replace(":TITPL", "SEGOODSPLACE").replace(":ORIDS", ordIds.toString());
    List<CuOrSeGdLn> allGds = this.srvOrm.retrieveListByQuery(
      pRqVs, CuOrSeGdLn.class, quer);
    for (CuOrSeGdLn gl : allGds) {
      if (gl.getQuant().compareTo(BigDecimal.ZERO) == 0) {
        throw new Exception("S.E.Good is not available #"
          + gl.getGood().getItsId());
      }
    }
    for (CuOrSeGdLn gl : allGds) {
      for (CuOrSe co : pOrds) {
        if (co.getItsId().equals(gl.getItsOwner().getItsId())) {
          gl.setItsOwner(co);
          co.getGoods().add(gl);
        }
      }
      CuOrSeGdLn cgl = new CuOrSeGdLn();
      cgl.setItsId(gl.getItsId());
      cgl.setGood(gl.getGood());
      cgl.setQuant(gl.getQuant());
      allGoods.add(cgl);
    }
    pRqVs.remove(tbn + "gooddeepLevel");
    pRqVs.remove(tbn + "neededFields");
    pRqVs.remove(tbn + "itsOwnerdeepLevel");
    ndFl.remove("good");
    ndFl.add("service");
    ndFl.add("dt1");
    ndFl.add("dt2");
    tbn = CuOrSeSrLn.class.getSimpleName();
    pRqVs.put(tbn + "neededFields", ndFl);
    pRqVs.put(tbn + "servicedeepLevel", 1);
    pRqVs.put(tbn + "itsOwnerdeepLevel", 1);
    //non-bookable service checkout and bookable services half-checkout:
    quer = lazyGetQuOrSrChk().replace(":TORLN", "CUORSESRLN")
      .replace(":TITPL", "SESERVICEPLACE").replace(":ORIDS", ordIds.toString());
    List<CuOrSeSrLn> allSrvs = this.srvOrm.retrieveListByQuery(
      pRqVs, CuOrSeSrLn.class, quer);
    for (CuOrSeSrLn sl : allSrvs) {
      if (sl.getQuant().compareTo(BigDecimal.ZERO) == 0) {
        throw new Exception("Service is not available #"
          + sl.getService().getItsId());
      }
    }
    for (CuOrSeSrLn sl : allSrvs) {
      for (CuOrSe co : pOrds) {
        if (co.getItsId().equals(sl.getItsOwner().getItsId())) {
          sl.setItsOwner(co);
          co.getServs().add(sl);
        }
      }
      CuOrSeSrLn csl = new CuOrSeSrLn();
      csl.setItsId(sl.getItsId());
      csl.setService(sl.getService());
      csl.setQuant(sl.getQuant());
      csl.setDt1(sl.getDt1());
      csl.setDt2(sl.getDt2());
      allServs.add(csl);
    }
    pRqVs.remove(tbn + "servicedeepLevel");
    pRqVs.remove(tbn + "neededFields");
    pRqVs.remove(tbn + "itsOwnerdeepLevel");
    pRqVs.remove(tbnUom + "neededFields");
    CuOrSe cor = new CuOrSe();
    cor.setGoods(allGoods);
    cor.setServs(allServs);
    return cor;
  }
public final CuOrSe checkSe1 ( final Map < String , Object > pRqVs , final List < CuOrSe > pOrds ) throws Exception { StringBuffer ordIds = null ; for ( CuOrSe co : pOrds ) { co . setGoods ( new ArrayList < CuOrSeGdLn > ( ) ) ; co . setServs ( new ArrayList < CuOrSeSrLn > ( ) ) ; if ( ordIds == null ) { ordIds = new StringBuffer ( ) ; ordIds . append ( co . getItsId ( ) . toString ( ) ) ; } else { ordIds . append ( "," + co . getItsId ( ) ) ; } } Set < String > ndFlNm = new HashSet < String > ( ) ; ndFlNm . add ( "itsId" ) ; ndFlNm . add ( "itsName" ) ; Set < String > ndFl = new HashSet < String > ( ) ; ndFl . add ( "itsId" ) ; ndFl . add ( "itsOwner" ) ; ndFl . add ( "itsName" ) ; ndFl . add ( "good" ) ; ndFl . add ( "uom" ) ; ndFl . add ( "quant" ) ; ndFl . add ( "price" ) ; ndFl . add ( "tot" ) ; ndFl . add ( "totTx" ) ; String tbn = CuOrSeGdLn . class . getSimpleName ( ) ; String tbnUom = UnitOfMeasure . class . getSimpleName ( ) ; pRqVs . put ( tbn + "neededFields" , ndFl ) ; pRqVs . put ( tbn + "gooddeepLevel" , 1 ) ; pRqVs . put ( tbn + "itsOwnerdeepLevel" , 1 ) ; pRqVs . put ( tbnUom + "neededFields" , ndFlNm ) ; List < CuOrSeGdLn > allGoods = new ArrayList < CuOrSeGdLn > ( ) ; List < CuOrSeSrLn > allServs = new ArrayList < CuOrSeSrLn > ( ) ; String quer = lazyGetQuOrGdChk ( ) . replace ( ":TORLN" , "CUORSEGDLN" ) . replace ( ":TITPL" , "SEGOODSPLACE" ) . replace ( ":ORIDS" , ordIds . toString ( ) ) ; List < CuOrSeGdLn > allGds = this . srvOrm . retrieveListByQuery ( pRqVs , CuOrSeGdLn . class , quer ) ; for ( CuOrSeGdLn gl : allGds ) { if ( gl . getQuant ( ) . compareTo ( BigDecimal . ZERO ) == 0 ) { throw new Exception ( "S.E.Good is not available #" + gl . getGood ( ) . getItsId ( ) ) ; } } for ( CuOrSeGdLn gl : allGds ) { for ( CuOrSe co : pOrds ) { if ( co . getItsId ( ) . equals ( gl . getItsOwner ( ) . getItsId ( ) ) ) { gl . setItsOwner ( co ) ; co . getGoods ( ) . add ( gl ) ; } } CuOrSeGdLn cgl = new CuOrSeGdLn ( ) ; cgl . setItsId ( gl . getItsId ( ) ) ; cgl . setGood ( gl . getGood ( ) ) ; cgl . setQuant ( gl . getQuant ( ) ) ; allGoods . add ( cgl ) ; } pRqVs . remove ( tbn + "gooddeepLevel" ) ; pRqVs . remove ( tbn + "neededFields" ) ; pRqVs . remove ( tbn + "itsOwnerdeepLevel" ) ; ndFl . remove ( "good" ) ; ndFl . add ( "service" ) ; ndFl . add ( "dt1" ) ; ndFl . add ( "dt2" ) ; tbn = CuOrSeSrLn . class . getSimpleName ( ) ; pRqVs . put ( tbn + "neededFields" , ndFl ) ; pRqVs . put ( tbn + "servicedeepLevel" , 1 ) ; pRqVs . put ( tbn + "itsOwnerdeepLevel" , 1 ) ; quer = lazyGetQuOrSrChk ( ) . replace ( ":TORLN" , "CUORSESRLN" ) . replace ( ":TITPL" , "SESERVICEPLACE" ) . replace ( ":ORIDS" , ordIds . toString ( ) ) ; List < CuOrSeSrLn > allSrvs = this . srvOrm . retrieveListByQuery ( pRqVs , CuOrSeSrLn . class , quer ) ; for ( CuOrSeSrLn sl : allSrvs ) { if ( sl . getQuant ( ) . compareTo ( BigDecimal . ZERO ) == 0 ) { throw new Exception ( "Service is not available #" + sl . getService ( ) . getItsId ( ) ) ; } } for ( CuOrSeSrLn sl : allSrvs ) { for ( CuOrSe co : pOrds ) { if ( co . getItsId ( ) . equals ( sl . getItsOwner ( ) . getItsId ( ) ) ) { sl . setItsOwner ( co ) ; co . getServs ( ) . add ( sl ) ; } } CuOrSeSrLn csl = new CuOrSeSrLn ( ) ; csl . setItsId ( sl . getItsId ( ) ) ; csl . setService ( sl . getService ( ) ) ; csl . setQuant ( sl . getQuant ( ) ) ; csl . setDt1 ( sl . getDt1 ( ) ) ; csl . setDt2 ( sl . getDt2 ( ) ) ; allServs . add ( csl ) ; } pRqVs . remove ( tbn + "servicedeepLevel" ) ; pRqVs . remove ( tbn + "neededFields" ) ; pRqVs . remove ( tbn + "itsOwnerdeepLevel" ) ; pRqVs . remove ( tbnUom + "neededFields" ) ; CuOrSe cor = new CuOrSe ( ) ; cor . setGoods ( allGoods ) ; cor . setServs ( allServs ) ; return cor ; }
<p>It half-checks items. Order can has items from several places.</p>
@param pRqVs additional request scoped parameters
@param pOrds S.E. orders
@return consolidated order with bookable items
@throws Exception - an exception if checking fail