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; }
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; }