public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
   Community community = new Community();
   community.id = Long.valueOf(rs.getInt("community_id"));
   community.copyright = rs.getString("copyright_text");
   community.shortDescription = rs.getString("short_description");
   community.name = rs.getString("name");
   community.introductoryText = rs.getString("introductory_text");
   community.sideBarText = rs.getString("side_bar_text");
   community.logoId = rs.getLong("logo_bitstream_id");
   return community;
 }
Ejemplo n.º 2
-1
  /**
   * Get all the community records.
   *
   * @param xmlFileName
   * @return
   * @throws IOException
   */
  @SuppressWarnings("unchecked")
  public List<Community> getCommunities() throws IOException {
    List<Community> communities =
        jdbcTemplate.query("select * from community", new CommunityMapper());

    for (Community c : communities) {
      if (c.logoId != null && c.logoId > 0) {
        System.out.println(c.logoId);
        BitstreamFileInfo info = bitstreamFileLoader.getBitstreamFileInfo(c.logoId);
        File bitstreamFile = new File(info.dspaceFileName);
        info.newFileName = "community_" + c.id + "." + info.extension;
        System.out.println(bitstreamFile.getCanonicalPath());
        System.out.println("file name = " + info.newFileName);
        c.logoFileInfo = info;
      }

      c.links =
          jdbcTemplate.query(
              "select * from community_link where community_id = " + c.id,
              new CollectionLinkMapper());
      String groupPermissionsSelect =
          "select * from resourcepolicy where resource_type_id = 4 and epersongroup_id is not null and resource_id = "
              + c.id;
      String epersonPermissionsSelect =
          "select * from resourcepolicy where resource_type_id = 4 and eperson_id is not null and resource_id = "
              + c.id;

      c.groupPermissions = jdbcTemplate.query(groupPermissionsSelect, new GroupPermissionMapper());
      c.epersonPermissions =
          jdbcTemplate.query(epersonPermissionsSelect, new EpersonPermissionMapper());
    }

    return communities;
  }