public boolean checkItemApproval(WebPageRequest inReq) throws Exception {

    if (inReq.getUser() == null) {
      return false;
    }
    MediaArchive archive = getMediaArchive(inReq);

    // Searcher ordersearcher =
    // archive.getSearcherManager().getSearcher(archive.getCatalogId(),
    // "order");
    // SearchQuery search = ordersearcinKeyher.createSearchQuery();
    // search.addExact("userid", inReq.getUser().getId());
    // search.addExact("orderstatus", "processed");
    // search.addSortBy("date");
    // HitTracker hits = ordersearcher.search(search);
    // look for the most recent order for an approved asset
    Asset asset = (Asset) inReq.getPageValue("asset");
    String sourcepath = null;
    if (asset != null) {
      sourcepath = asset.getSourcePath();
    } else {
      sourcepath = archive.getSourcePathForPage(inReq);
    }
    if (sourcepath == null) {
      return false;
    }
    Searcher itemsearcher =
        archive.getSearcherManager().getSearcher(archive.getCatalogId(), "orderitem");
    SearchQuery search = itemsearcher.createSearchQuery();
    search.addExact("userid", inReq.getUser().getId());
    search.addExact("assetsourcepath", sourcepath);
    search.addMatches("status", "approved");
    HitTracker results = itemsearcher.search(search);
    if (results.size() > 0) {
      return true;
    }
    return false;
  }
 public Object searchByField(String inId, String inValue) {
   SearchQuery query = createSearchQuery();
   query.addExact(inId, inValue);
   HitTracker hits = search(query);
   hits.setHitsPerPage(1);
   Data first = (Data) hits.first();
   if (first == null) {
     return null;
   }
   Data baseData = createNewData();
   baseData.setProperties(first.getProperties());
   baseData.setId(first.getId());
   return baseData;
 }
  protected void processDeleteLog(File inLog, MediaArchive inArchive, ConvertStatus inStatus)
      throws FileNotFoundException, IOException, Exception {
    BufferedReader reader = new BufferedReader(new FileReader(inLog));
    try {
      String line = reader.readLine();
      int count = 0;
      while (line != null) {
        String[] tabs = line.split("\t");
        if (tabs.length > 3) {
          if ("Record deleted".equals(tabs[3])) {
            String catName = inLog.getName();
            if (catName.indexOf('-') != -1) {
              catName = catName.substring(0, catName.indexOf('-'));
            } else if (catName.indexOf('.') != -1) {
              catName = catName.substring(0, catName.lastIndexOf('.'));
            }
            String recordId = tabs[4];
            String cumulusid = catName + "_" + recordId; // /createCumulusID(catName, recordId);

            // catName = extractId(catName);
            // Category root =
            // inArchive.getStore().getCatalogArchive().getRootCatalog().getChildByName(catName);
            SearchQuery query = inArchive.getAssetSearcher().createSearchQuery();
            query.addExact("cumulusid", cumulusid);
            HitTracker hits = inArchive.getAssetSearcher().search(query);
            if (hits.getTotal() > 0) {
              count++;
              String id = hits.get(0).get("id");
              deleteAsset(inArchive, id);
            } else {
              log.debug("No record found " + catName + "dash" + recordId);
            }
          }
        }
        line = reader.readLine();
      }
      if (count > 0) {
        inArchive.getAssetSearcher().flush();
        logMessage(inStatus, "Removed " + count + " records");
      }
    } finally {
      FileUtils.safeClose(reader);
    }
  }