Exemplo n.º 1
0
  @Override
  public void addMetadata(
      Context context,
      T dso,
      String schema,
      String element,
      String qualifier,
      String lang,
      List<String> values,
      List<String> authorities,
      List<Integer> confidences)
      throws SQLException {

    // We will not verify that they are valid entries in the registry
    // until update() is called.
    MetadataField metadataField =
        metadataFieldService.findByElement(context, schema, element, qualifier);
    if (metadataField == null) {
      throw new SQLException("bad_dublin_core schema=" + schema + "." + element + "." + qualifier);
    }
    addMetadata(context, dso, metadataField, lang, values, authorities, confidences);
  }
Exemplo n.º 2
0
  private List<List<MetadataField>> getMetadataFieldsList(
      org.dspace.core.Context context, List<String> query_field) throws SQLException {
    List<List<MetadataField>> listFieldList = new ArrayList<List<MetadataField>>();
    for (String s : query_field) {
      ArrayList<MetadataField> fields = new ArrayList<MetadataField>();
      listFieldList.add(fields);
      if (s.equals("*")) {
        continue;
      }
      String schema = "";
      String element = "";
      String qualifier = null;
      String[] parts = s.split("\\.");
      if (parts.length > 0) {
        schema = parts[0];
      }
      if (parts.length > 1) {
        element = parts[1];
      }
      if (parts.length > 2) {
        qualifier = parts[2];
      }

      if (Item.ANY.equals(qualifier)) {
        for (MetadataField mf :
            metadataFieldService.findFieldsByElementNameUnqualified(context, schema, element)) {
          fields.add(mf);
        }
      } else {
        MetadataField mf = metadataFieldService.findByElement(context, schema, element, qualifier);
        if (mf != null) {
          fields.add(mf);
        }
      }
    }
    return listFieldList;
  }