Example #1
0
  /**
   * Map the namespace of the given qualified name to a short identifier and return the adapted
   * name.
   *
   * @param org the original qualified name
   * @return the adapted qualified name
   */
  public static QName map(QName org) {
    if (XMLConstants.NULL_NS_URI.equals(org.getNamespaceURI())) {
      return org;
    }

    return new QName(IDS.getId(org.getNamespaceURI()), org.getLocalPart());
  }
Example #2
0
  /**
   * Encode a {@link QName} for runtime use with OrientDB.
   *
   * @param org the qualified name
   * @return the encoded name
   */
  public static String encode(QName org) {
    String ns = org.getNamespaceURI();
    if (!XMLConstants.NULL_NS_URI.equals(ns)) {
      ns = IDS.getId(org.getNamespaceURI());
    }

    return ns + "_" + ONameUtil.encodeName(org.getLocalPart());
  }