コード例 #1
0
  public Order createOrderFromAssets(WebPageRequest inReq) {
    String catalogId = inReq.findValue("catalogid");
    MediaArchive archive = getMediaArchive(catalogId);
    String[] assetids = inReq.getRequestParameters("assetid");
    Order order =
        getOrderManager()
            .createNewOrder(inReq.findValue("applicationid"), catalogId, inReq.getUserName());

    for (int i = 0; i < assetids.length; i++) {
      String id = assetids[i];
      if (id.startsWith("multiedit:hits")) {
        HitTracker hits = (HitTracker) inReq.getSessionValue(id.substring("multiedit:".length()));
        if (hits != null) {
          for (Iterator iterator = hits.iterator(); iterator.hasNext(); ) {
            Data data = (Data) iterator.next();
            Asset asset = archive.getAssetBySourcePath(data.getSourcePath());
            getOrderManager().addItemToOrder(catalogId, order, asset, null);
          }
        }
      } else {
        Asset asset = archive.getAsset(id);
        getOrderManager().addItemToOrder(catalogId, order, asset, null);
      }
    }

    getOrderManager().saveOrder(catalogId, inReq.getUser(), order);
    inReq.putPageValue("order", order);

    return order;
  }
コード例 #2
0
 public void clearOrderItems(WebPageRequest inReq) {
   MediaArchive archive = getMediaArchive(inReq);
   HitTracker items = findOrderItems(inReq);
   Searcher searcher = getSearcherManager().getSearcher(archive.getCatalogId(), "orderitem");
   for (Iterator iterator = items.iterator(); iterator.hasNext(); ) {
     Data item = (Data) iterator.next();
     searcher.delete(item, inReq.getUser());
   }
 }