Ejemplo n.º 1
0
 public static String removeCategory(Connection conn, String marketId, String catKey)
     throws SQLException {
   String catValue =
       CategoryFactory.getValueforCategoryKey(
           CategoryFactory.getCategories(conn, marketId), catKey);
   CategoryFactory.removeCategory(conn, marketId, catKey);
   String res = XMLFactory.getMessageElement("marketid", marketId);
   res += XMLFactory.getMessageElement("catkey", catKey);
   res += XMLFactory.getMessageElement("catvalue", catValue);
   return res;
 }
Ejemplo n.º 2
0
  public static String addCategory(Connection conn, String marketId, String catKey, String catValue)
      throws SQLException {
    Category category = new Category();
    category.marketId = marketId;
    category.categoryKey = catKey;
    category.categoryValue = catValue;
    try {
      CategoryFactory.save(conn, category);
    } catch (MySQLIntegrityConstraintViolationException e) {
      return "<errmsg>Category already in the list.</errmsg>";
    }

    String res = XMLFactory.getMessageElement("marketid", marketId);
    res += XMLFactory.getMessageElement("catkey", catKey);
    res += XMLFactory.getMessageElement("catvalue", catValue);
    return res;
  }