gt:         if (child.getName().equals(name)) {
context: package com.google.code.magja.service.category;
  
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Map;
  
  import org.apache.axis2.AxisFault;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
  import com.google.code.magja.magento.ResourcePath;
  import com.google.code.magja.model.category.Category;
  import com.google.code.magja.model.product.Product;
  import com.google.code.magja.service.GeneralServiceImpl;
  import com.google.code.magja.service.RemoteServiceFactory;
  import com.google.code.magja.service.ServiceException;
  import com.google.code.magja.soap.SoapClient;
  import com.google.common.base.Function;
  import com.google.common.collect.Maps;
  
  /**
   * Category service implementation.
   * 
   * @author andre
   * @author Simon Zambrovski
   */
  public class CategoryRemoteServiceImpl extends GeneralServiceImpl<Category> implements CategoryRemoteService {
  
    private transient Logger log = LoggerFactory.getLogger(CategoryRemoteServiceImpl.class);
    private RemoteServiceFactory serviceFactory;
    private static final long serialVersionUID = 5806879316902937610L;
  
    public CategoryRemoteServiceImpl(SoapClient soapClient, RemoteServiceFactory serviceFactory) {
      super(soapClient);
      this.serviceFactory = serviceFactory;
    }
  
    /**
     * Load children for the category
     *
     * @param category
     * @throws ServiceException
     */
    private void loadChildren(Category category) throws ServiceException {
      if (category.get("children") != null) {
        if (category.get("children").toString().length() > 0) {
          String str_children = (String) category.get("children");
          String[] arr_children = str_children.split(",");
          for (String str_child : arr_children) {
            Category child = getByIdClean(new Integer(str_child));
            if (child != null)
              category.addChild(child);
          }
        }
      }
    }
  
    /**
     * load parent for the category
     *
     * @param category
     * @throws ServiceException
     */
    private void loadParent(Category category) throws ServiceException {
      if (category.get("parent_id") != null) {
        Category parent = getByIdClean((Integer) category.get("parent_id"));
        category.setParent(parent);
      }
    }
  
    @Override
    public Category getByIdClean(Integer id) throws ServiceException {
      Category category = new Category();
  
      if (id == null) {
        return null;
      }
  
      Map<String, Object> cat;
  
      try {
        cat = (Map<String, Object>) soapClient.callSingle(ResourcePath.CategoryInfo, id);
      } catch (AxisFault e) {
        if (debug)
          e.printStackTrace();
        throw new ServiceException(e.getMessage());
      }
  
      if (cat == null)
        return null;
  
      log.debug("Mappping to Category #{} from {}", id, cat);
      for (Map.Entry<String, Object> attribute : cat.entrySet()) {
        if (attribute.getKey().equals("available_sort_by")) {
          // category.set(attribute.getKey(), attribute.getValue());
          category.set(attribute.getKey(), (String) attribute.getValue());
        } else {
          category.set(attribute.getKey(), attribute.getValue());
        }
      }
  
      return category;
    }
  
    @Override
    public Category getByIdWithChildren(Integer id) throws ServiceException {
  
      Category category = getByIdClean(id);
  
      // load category children
      loadChildren(category);
  
      return category;
    }
  
    @Override
    public Category getByIdWithParent(Integer id) throws ServiceException {
  
      Category category = getByIdClean(id);
  
      // load category parent
      loadParent(category);
  
      return category;
    }
  
    @Override
    public Category getByIdWithParentAndChildren(Integer id) throws ServiceException {
  
      Category category = getByIdClean(id);
  
      // load category parent and children
      loadChildren(category);
      loadParent(category);
  
      return category;
    }
  
    @SuppressWarnings("unchecked")
    public Category getTree(Integer id) throws ServiceException {
  
      Category category = new Category();
  
      if (id == null)
        return null;
  
      Map<String, Object> cat;
  
      try {
        cat = (Map<String, Object>) soapClient.callSingle(ResourcePath.CategoryTree, id);
      } catch (AxisFault e) {
        log.error("Error calling CategoryRemoteServiceImpl.getTree()", e);
        if (debug) {
          e.printStackTrace();
        }
        throw new ServiceException("Error calling CategoryRemoteServiceImpl.getTree()", e);
      }
  
      if (cat == null)
        return null;
  
      category = getCategoryFromMap(cat);
  
      return category;
    }
  
    /**
     * build category from Map
     *
     * @param Map
     *          <String, Object>
     */
    @SuppressWarnings("unchecked")
    private Category getCategoryFromMap(Map<String, Object> cat) {
      Category category = new Category();
  
      for (Map.Entry<String, Object> attribute : cat.entrySet()) {
        if (attribute.getKey().equals("children")) {
          List<Category> children = new ArrayList<Category>();
  
          List<Map<String, Object>> childrenList = (List<Map<String, Object>>) attribute.getValue();
  
          for (Map<String, Object> child : childrenList) {
            Category c = getCategoryFromMap(child);
            children.add(c);
          }
  
          category.setChildren(children);
        } else {
          category.set(attribute.getKey(), attribute.getValue());
        }
      }
  
      return category;
    }
  
    /**
     * print all categories
     *
     * @param id
     */
    public void print(Category category) {
      if (category != null) {
        String s = "";
        for (int i = 1; i < category.getLevel(); i++) {
          s += " ";
        }
  
        log.debug(s + category.getName());
  
        for (Category child : category.getChildren()) {
          print(child);
        }
      }
    }
  
    /**
     * search categories
     *
     * @param id
     */
    public List<Category> search(Category category, List<String> categoryNames) throws ServiceException {
      List<Category> categories = new ArrayList<Category>();
  
      for (String name : categoryNames) {
        boolean found = false;
        for (Category child : category.getChildren()) {
  