public static String searchRemoveFeature(HttpServletRequest request,HttpServletResponse response){
  Delegator delegator=(Delegator)request.getAttribute("delegator");
  Locale locale=UtilHttp.getLocale(request);
  String productFeatureId=request.getParameter("productFeatureId");
  try {
    boolean beganTransaction=TransactionUtil.begin(DEFAULT_TX_TIMEOUT);
    try {
      EntityListIterator eli=getProductSearchResults(request);
      if (eli == null) {
        String errMsg=UtilProperties.getMessage(resource,"productsearchevents.no_results_found_probably_error_constraints",UtilHttp.getLocale(request));
        request.setAttribute("_ERROR_MESSAGE_",errMsg);
        return "error";
      }
      GenericValue searchResultView=null;
      int numRemoved=0;
      while ((searchResultView=eli.next()) != null) {
        String productId=searchResultView.getString("mainProductId");
        numRemoved+=delegator.removeByAnd("ProductFeatureAppl",UtilMisc.toMap("productId",productId,"productFeatureId",productFeatureId));
      }
      Map<String,Object> messageMap=UtilMisc.toMap("numRemoved",Integer.valueOf(numRemoved),"productFeatureId",productFeatureId);
      String eventMsg=UtilProperties.getMessage(resource,"productSearchEvents.removed_param_features",messageMap,locale) + ".";
      request.setAttribute("_EVENT_MESSAGE_",eventMsg);
      eli.close();
    }
 catch (    GenericEntityException e) {
      String errorMsg=UtilProperties.getMessage(resource,"productSearchEvents.error_getting_results",locale) + " : " + e.toString();
      request.setAttribute("_ERROR_MESSAGE_",errorMsg);
      Debug.logError(e,errorMsg,module);
      TransactionUtil.rollback(beganTransaction,errorMsg,e);
      return "error";
    }
 finally {
      TransactionUtil.commit(beganTransaction);
    }
  }
 catch (  GenericTransactionException e) {
    String errorMsg=UtilProperties.getMessage(resource,"productSearchEvents.error_getting_results",locale) + " : " + e.toString();
    request.setAttribute("_ERROR_MESSAGE_",errorMsg);
    Debug.logError(e,errorMsg,module);
    return "error";
  }
  return "success";
}

public static String searchRemoveFeature ( HttpServletRequest request , HttpServletResponse response ) { Delegator delegator = ( Delegator ) request . getAttribute ( "delegator" ) ; Locale locale = UtilHttp . getLocale ( request ) ; String productFeatureId = request . getParameter ( "productFeatureId" ) ; try { boolean beganTransaction = TransactionUtil . begin ( DEFAULT_TX_TIMEOUT ) ; try { EntityListIterator eli = getProductSearchResults ( request ) ; if ( eli == null ) { String errMsg = UtilProperties . getMessage ( resource , "productsearchevents.no_results_found_probably_error_constraints" , UtilHttp . getLocale ( request ) ) ; request . setAttribute ( "_ERROR_MESSAGE_" , errMsg ) ; return "error" ; } GenericValue searchResultView = null ; int numRemoved = 0 ; while ( ( searchResultView = eli . next ( ) ) != null ) { String productId = searchResultView . getString ( "mainProductId" ) ; numRemoved += delegator . removeByAnd ( "ProductFeatureAppl" , UtilMisc . toMap ( "productId" , productId , "productFeatureId" , productFeatureId ) ) ; } Map < String , Object > messageMap = UtilMisc . toMap ( "numRemoved" , Integer . valueOf ( numRemoved ) , "productFeatureId" , productFeatureId ) ; String eventMsg = UtilProperties . getMessage ( resource , "productSearchEvents.removed_param_features" , messageMap , locale ) + "." ; request . setAttribute ( "_EVENT_MESSAGE_" , eventMsg ) ; eli . close ( ) ; } catch ( GenericEntityException e ) { String errorMsg = UtilProperties . getMessage ( resource , "productSearchEvents.error_getting_results" , locale ) + " : " + e . toString ( ) ; request . setAttribute ( "_ERROR_MESSAGE_" , errorMsg ) ; Debug . logError ( e , errorMsg , module ) ; TransactionUtil . rollback ( beganTransaction , errorMsg , e ) ; return "error" ; } finally { TransactionUtil . commit ( beganTransaction ) ; } } catch ( GenericTransactionException e ) { String errorMsg = UtilProperties . getMessage ( resource , "productSearchEvents.error_getting_results" , locale ) + " : " + e . toString ( ) ; request . setAttribute ( "_ERROR_MESSAGE_" , errorMsg ) ; Debug . logError ( e , errorMsg , module ) ; return "error" ; } return "success" ; }
removes a feature from search results
