Community[] parents = item.getCommunities(); for (int j = 0; j < parents.length; j++) { TableRow row = DatabaseManager.create(context, "Communities2Item"); row.setColumn("item_id", item.getID()); row.setColumn("community_id", parents[j].getID()); DatabaseManager.update(context, row); }
    public static void itemAdded(Context context, Item item)        throws SQLException    {        Map table2dc = new HashMap();        table2dc.put("ItemsByTitle",                     item.getDC("title", null, Item.ANY));        table2dc.put("ItemsByAuthor",                     item.getDC("contributor", Item.ANY, Item.ANY));        table2dc.put("ItemsByDate",                     item.getDC("date", "issued", Item.ANY));        table2dc.put("ItemsByDateAccessioned",                     item.getDC("date", "accessioned", Item.ANY));        for (Iterator iterator = table2dc.keySet().iterator();             iterator.hasNext(); )        {            String table = (String) iterator.next();            DCValue[] dc = (DCValue[]) table2dc.get(table);            for (int i = 0; i < dc.length; i++ )            {                TableRow row = DatabaseManager.create(context, table);                row.setColumn("item_id", item.getID());                String value = dc[i].value;                if ("ItemsByDateAccessioned".equals(table))                    row.setColumn("date_accessioned", value);                else if ("ItemsByDate".equals(table))                    row.setColumn("date_issued", value);                else if ("ItemsByAuthor".equals(table))                {                    // author name, and normalized sorting name                    // (which for now is simple lower-case)                    row.setColumn("author", value);                    row.setColumn("sort_author", value.toLowerCase() );                }                else if ("ItemsByTitle".equals(table))                {                    String title = NormalizedTitle.normalize(value, dc[i].language);                    row.setColumn("title", value);                    row.setColumn("sort_title", title.toLowerCase() );                }                DatabaseManager.update(context, row);            }        }    }