Exemple #1
0
  /**
   * Translates the input string of a specified input level to a specified outbound level of the
   * same coding scheme. For example, the input string value may be a tag-encoding URI and the
   * outbound level specified by string outboundlevel may be BINARY, in which case the return value
   * is a binary representation expressed as a string.
   *
   * <p>Note that this version of the method requires that the user specify the input level, rather
   * than searching for it. However it still automatically finds the scheme used.
   *
   * @param input input tag coding
   * @param inputLevel level such as BINARY, or TAG_ENCODING.
   * @param tagLength tag length such as VALUE_64 or VALUE_96.
   * @param inputParameters a map with any additional properties.
   * @param outputLevel required output level.
   * @return output tag coding
   */
  public String convert(
      String input,
      LevelTypeList inputLevel,
      TagLengthList tagLength,
      Map<String, String> inputParameters,
      LevelTypeList outputLevel) {

    PrefixMatch match = findPrefixMatch(input, tagLength, inputLevel);

    return convertLevel(match.getScheme(), match.getLevel(), input, inputParameters, outputLevel);
  }
Exemple #2
0
  /**
   * The convert method translates a String input to a specified outbound level of the same coding
   * scheme. For example, the input string value may be a tag-encoding URI and the outbound level
   * specified by string outboundlevel may be BINARY, in which case the return value is a binary
   * representation expressed as a string.
   *
   * @param input the identifier to be converted.
   * @param inputParameters additional parameters which need to be provided because they cannot
   *     always be determined from the input value alone. Examples include the taglength,
   *     companyprefixlength and filter values.
   * @param outputLevel the outbound level required for the ouput. Permitted values include BINARY,
   *     TAG_ENCODING, PURE_IDENTITY, LEGACY and ONS_HOSTNAME.
   * @return the identifier converted to the output level.
   */
  public String convert(
      String input, Map<String, String> inputParameters, LevelTypeList outputLevel) {

    TagLengthList tagLength = null;
    if (inputParameters.containsKey("taglength")) {
      // in principle, the user should provide a
      // TagLengthList object in the parameter list.
      String s = inputParameters.get("taglength");
      tagLength = TagLengthList.valueOf(s);
    }

    PrefixMatch match = findPrefixMatch(input, tagLength);

    return convertLevel(match.getScheme(), match.getLevel(), input, inputParameters, outputLevel);
  }