Ejemplo n.º 1
0
  /**
   * Find the field corresponding to the given numeric ID. The ID is a database key internal to
   * DSpace.
   *
   * @param context context, in case we need to read it in from DB
   * @param id the metadata field ID
   * @return the metadata field object
   * @throws SQLException
   */
  public static MetadataField find(Context context, int id) throws SQLException {
    if (!isCacheInitialized()) {
      initCache(context);
    }

    // 'sanity check' first.
    Integer iid = Integer.valueOf(id);
    if (!id2field.containsKey(iid)) {
      return null;
    }

    return id2field.get(iid);
  }