private CommerceEvent matchProductFields(CommerceEvent event) {
   int hash = Integer.parseInt(commerceMatchPropertyName);
   int type = CommerceEventUtils.getEventType(event);
   List<Product> productList = event.getProducts();
   if (productList == null || productList.size() == 0) {
     return null;
   }
   List<Product> matchedProducts = new LinkedList<Product>();
   Map<String, String> productFields = new HashMap<String, String>();
   for (Product product : productList) {
     productFields.clear();
     CommerceEventUtils.extractProductFields(product, productFields);
     if (productFields != null) {
       for (Map.Entry<String, String> entry : productFields.entrySet()) {
         int attributeHash = KitUtils.hashForFiltering(type + entry.getKey());
         if (attributeHash == hash) {
           if (commerceMatchPropertyValues.contains(entry.getValue().toLowerCase(Locale.US))) {
             matchedProducts.add(product);
           }
         }
       }
     }
   }
   if (matchedProducts.size() == 0) {
     return null;
   } else if (matchedProducts.size() != productList.size()) {
     return new CommerceEvent.Builder(event).products(matchedProducts).build();
   } else {
     return event;
   }
 }
 private boolean matchCommerceFields(CommerceEvent event) {
   int hash = Integer.parseInt(commerceMatchPropertyName);
   Map<String, String> fields = new HashMap<String, String>();
   CommerceEventUtils.extractActionAttributes(event, fields);
   for (Map.Entry<String, String> entry : fields.entrySet()) {
     int fieldHash =
         KitUtils.hashForFiltering(CommerceEventUtils.getEventType(event) + entry.getKey());
     if (fieldHash == hash) {
       return commerceMatchPropertyValues.contains(entry.getValue().toLowerCase(Locale.US));
     }
   }
   return false;
 }
 private boolean matchCommerceAttributes(CommerceEvent event) {
   Map<String, String> attributes = event.getCustomAttributes();
   if (attributes == null || attributes.size() < 1) {
     return false;
   }
   int hash = Integer.parseInt(commerceMatchPropertyName);
   for (Map.Entry<String, String> entry : attributes.entrySet()) {
     int attributeHash =
         KitUtils.hashForFiltering(CommerceEventUtils.getEventType(event) + entry.getKey());
     if (attributeHash == hash) {
       return commerceMatchPropertyValues.contains(entry.getValue().toLowerCase(Locale.US));
     }
   }
   return false;
 }