コード例 #1
0
  /**
   * Throughout the hierarchy, certain data elements are used to tag the
   * inclusion/exclusion/ordering of tasks within task lists. These data names contain task list
   * names and could contain task names, so they must be renamed.
   */
  private boolean maybeRenameLocalTsElement(DataFileEntry e) {
    String dataName = e.getKey();
    int[] tsPrefixPos = getTsPrefixPos(dataName);
    if (tsPrefixPos == null) return false;

    String path = dataName.substring(0, tsPrefixPos[0]);
    String tsPrefix = dataName.substring(tsPrefixPos[0], tsPrefixPos[1]);
    String taskListName = dataName.substring(tsPrefixPos[1]);
    String newName =
        pathMapper.getString(path) + tsPrefix + taskListMapper.hashTaskListName(taskListName);
    e.setKey(newName);
    return true;
  }
コード例 #2
0
  /**
   * Certain elements are commonly written by dashboard logic relative to hierarchy paths. If this
   * entry represents one of those well-known items, remap the name.
   */
  private boolean maybeRenameCommonTaskNameBasedElements(DataFileEntry e) {
    String dataName = e.getKey();
    int suffixPos = getTaskNameSuffixPos(dataName);
    if (suffixPos == -1) return false;

    String origPath = dataName.substring(0, suffixPos);
    if (origPath.contains(" /") || origPath.contains("/ "))
      // the presence of a space next to a slash indicates that this is a
      // process-namespaced data element.
      return false;

    String suffix = dataName.substring(suffixPos);
    String newPath = pathMapper.getString(origPath);
    String newName = newPath + suffix;
    e.setKey(newName);
    return true;
  }