public void editCommunity(EntityReference ref, Map<String, Object> inputVar, Context context) {
try {
Integer id = Integer.parseInt(ref.getId());
Community community = Community.find(context, id);
String name = (String) inputVar.get("name");
String shortDescription = (String) inputVar.get("shortDescription");
String copyrightText = (String) inputVar.get("copyrightText");
String sidebarText = (String) inputVar.get("sidebarText");
String introductoryText = (String) inputVar.get("introductoryText");
if (community != null) {
community.setMetadata("name", name);
community.setMetadata("short_description", shortDescription);
community.setMetadata("copyright_text", copyrightText);
community.setMetadata("side_bar_text", sidebarText);
community.setMetadata("introductory_text", introductoryText);
community.update();
} else {
throw new EntityException("Internal server error", "Could not update community", 500);
}
} catch (SQLException ex) {
throw new EntityException("Internal server error", "SQL error", 500);