Ejemplo n.º 1
0
 @Override
 public List<IContainer> findAllOccurrences(IKey key) throws NoResultException {
   String pathStr = findDictionary().getPath(key).toString();
   Path path = new Path(NxsFactory.getInstance(), pathStr);
   path.removeUnsetParameters();
   return findAllContainerByPath(path.getValue());
 }
Ejemplo n.º 2
0
  @Override
  public IPathParameter resolvePathParameter(IContainer item) {
    IPathParameter result = null;
    String[] groupParts = item.getName().split(Pattern.quote(mPathSeparator));
    String[] pathParts = mPath.getValue().split(Pattern.quote(mPathSeparator));
    String part, param, buff;

    // Parse the path
    for (int depth = 0; depth < groupParts.length; depth++) {
      if (depth < pathParts.length) {
        part = groupParts[depth];
        param = pathParts[depth];

        // If a parameter is defined
        if (param.matches(".*(" + mPath.PARAM_PATTERN + ")+.*")) {
          // Try to determine the parameter result
          buff = param.replaceFirst("^(.*)(" + mPath.PARAM_PATTERN + ".*)$", "$1");
          part = part.substring(buff.length());
          buff = param.replaceAll(".*" + mPath.PARAM_PATTERN, "");
          part = part.replaceFirst(Pattern.quote(buff), "");
          buff = param.replaceAll(".*" + mPath.PARAM_PATTERN + ".*", "$1");
          result =
              new PathParameter(
                  Factory.getFactory(getFactoryName()), ParameterType.SUBSTITUTION, buff, part);
          break;
        }
      }
    }
    return result;
  }