@Override public String getOwningCommunity(Context context, Item item) { try { List<Community> comms = itemService.getCommunities(context, item); if (comms.size() > 0) { return comms.get(0).getName(); } else { return " "; } } catch (SQLException e) { log.error(e.getMessage()); return e.getMessage(); } }
/** * @param context DSpace context * @param myitem the item for which our locations are to be retrieved * @return a list containing the identifiers of the communities and collections * @throws SQLException sql exception */ protected List<String> getItemLocations(Context context, Item myitem) throws SQLException { List<String> locations = new Vector<String>(); // build list of community ids List<Community> communities = itemService.getCommunities(context, myitem); // build list of collection ids List<Collection> collections = myitem.getCollections(); // now put those into strings int i = 0; for (i = 0; i < communities.size(); i++) { locations.add("m" + communities.get(i).getID()); } for (i = 0; i < collections.size(); i++) { locations.add("l" + collections.get(i).getID()); } return locations; }
List<org.dspace.content.Community> communities = itemService.getCommunities(context, item);