@Override
  public Record addGlobalMetadataIdentifier(
      Record record, String reposIdentifier, String ctlg, String oaiID)
      throws IllegalStateException, JDOMException {
    // TODO Auto-generated method stub
    String ident = ctlg + "_" + reposIdentifier + "_";

    Element metametadata =
        JDomUtils.getXpathNode(
            "//lom:lom/lom:metaMetadata", Namespace.NO_NAMESPACE, record.getMetadata());

    if (metametadata != null) {

      if (xmlString.equals(""))
        xmlString = JDomUtils.parseXml2string(record.getMetadata().getDocument(), null);

      ident = ident.concat(createHash(xmlString));

      Element newIdentifier = new Element("identifier", Namespace.NO_NAMESPACE);
      metametadata.addContent(0, newIdentifier);

      Element catalog = new Element("catalog", Namespace.NO_NAMESPACE);
      catalog.setText(ctlg);
      newIdentifier.addContent(catalog);

      Element entry = new Element("entry", Namespace.NO_NAMESPACE);
      ident = ident.replace("/", ".");
      ident = ident.replace(":", ".");
      entry.setText(ident);
      newIdentifier.addContent(entry);
      gLOMID = ident;

    } else {
      if (xmlString.equals(""))
        xmlString = JDomUtils.parseXml2string(record.getMetadata().getDocument(), null);

      ident = ident.concat(createHash(xmlString));

      Element lom =
          JDomUtils.getXpathNode("//lom:lom", Namespace.NO_NAMESPACE, record.getMetadata());
      metametadata = new Element("metaMetadata", Namespace.NO_NAMESPACE);
      lom.addContent(2, metametadata);

      Element newIdentifier = new Element("identifier", Namespace.NO_NAMESPACE);
      metametadata.addContent(0, newIdentifier);

      Element catalog = new Element("catalog", Namespace.NO_NAMESPACE);
      catalog.setText(ctlg);
      newIdentifier.addContent(catalog);

      Element entry = new Element("entry", Namespace.NO_NAMESPACE);
      ident = ident.replace("/", ".");
      ident = ident.replace(":", ".");
      entry.setText(ident);
      newIdentifier.addContent(entry);
      gLOMID = ident;
    }
    return record;
  }
  @Override
  public Record addGlobalLOIdentifier(Record record, String reposIdentifier, String ctlg)
      throws IllegalStateException, JDOMException {
    // TODO Auto-generated method stub

    String ident = ctlg + "_" + reposIdentifier + "_";

    String loIdent = "";

    // try {
    Element general =
        JDomUtils.getXpathNode(
            "//lom:lom/lom:general", Namespace.NO_NAMESPACE, record.getMetadata());

    // /lom:lom/lom:general
    if (general != null) {
      Element generalIdentifier = general.getChild("identifier", Namespace.NO_NAMESPACE);

      if (generalIdentifier != null) {
        if (!(Boolean) gIdOaiCatalog.selectSingleNode(record.getMetadata())) {
          loIdent = generalIdentifier.getChildText("entry", generalIdentifier.getNamespace());

          if (loIdent != null) {
            ident = ident.concat(loIdent);

            Element newIdentifier = new Element("identifier", Namespace.NO_NAMESPACE);
            general.addContent(0, newIdentifier);

            Element catalog = new Element("catalog", Namespace.NO_NAMESPACE);
            catalog.setText(ctlg);
            newIdentifier.addContent(catalog);

            Element entry = new Element("entry", Namespace.NO_NAMESPACE);
            ident = ident.replace("/", ".");
            ident = ident.replace(":", ".");
            entry.setText(ident);
            newIdentifier.addContent(entry);

            gLOID = ident;
          } else {

            System.err.println("Missing LOM Identifier");
          }
        }
      } else {
        Element technical =
            JDomUtils.getXpathNode(
                "//lom:lom/lom:technical", Namespace.NO_NAMESPACE, record.getMetadata());

        if (technical != null) {
          Element location = technical.getChild("location", Namespace.NO_NAMESPACE);

          if (location != null) {
            loIdent = location.getText();

            ident = ident.concat(loIdent);

            Element newIdentifier = new Element("identifier", Namespace.NO_NAMESPACE);
            general.addContent(0, newIdentifier);

            Element catalog = new Element("catalog", Namespace.NO_NAMESPACE);
            catalog.setText(ctlg);
            newIdentifier.addContent(catalog);

            Element entry = new Element("entry", Namespace.NO_NAMESPACE);
            ident = ident.replace("/", ".");
            ident = ident.replace(":", ".");
            entry.setText(ident);
            newIdentifier.addContent(entry);

            gLOID = ident;
          }
        }
      }
    } else {

    }

    return record;
  }