Example #1
0
 /**
  * @param type
  * @return
  */
 private Collection<String> getCorrectList(String type) {
   if (type.equals("prop")) {
     return propsList.keySet();
   } else if (type.equals("set")) {
     return setsList.keySet();
   } else {
     return charList.keySet();
   }
 }
Example #2
0
  /** @return A Box for selecting an asset type, the old asset and its replacement asset. */
  private Box assetChoiceBox() {
    TreeSet<String> types = new TreeSet<String>();

    types.add(AssetType.CHARACTER.toString());
    types.add(AssetType.PROP.toString());
    types.add(AssetType.SET.toString());

    // JDrawer toReturn;
    Box hbox = new Box(BoxLayout.X_AXIS);
    {
      JCollectionField assetType = UIFactory.createCollectionField(types, diag, sTSize);
      assetType.setActionCommand("type");
      assetType.addActionListener(this);

      JCollectionField oldAsset = UIFactory.createCollectionField(charList.keySet(), diag, sVSize);
      JCollectionField newAsset = UIFactory.createCollectionField(charList.keySet(), diag, sVSize);
      hbox.add(assetType);
      hbox.add(Box.createHorizontalStrut(10));
      hbox.add(oldAsset);
      hbox.add(Box.createHorizontalStrut(5));
      hbox.add(newAsset);

      // pPotentials.put(oldAsset, newAsset);
    }
    list.add(Box.createVerticalStrut(5));

    return hbox; // toReturn;
  } // return assetChoiceBox
Example #3
0
 /**
  * Returns a key similar to the specified string, or {@code null}.
  *
  * @param key key to be found
  * @return similar key
  */
 public final synchronized String similar(final String key) {
   final byte[] name = token(key);
   final Levenshtein ls = new Levenshtein();
   for (final String prop : props.keySet()) {
     if (ls.similar(name, token(prop), 0)) return prop;
   }
   return null;
 }
Example #4
0
 // -------------------------------------------
 // check lifetime and remove expired entries
 // -------------------------------------------
 public synchronized void rmExpiredEntry() {
   long currtime = System.currentTimeMillis();
   Iterator keys = table.keySet().iterator();
   while (keys.hasNext()) {
     String k = (String) keys.next();
     Entry e = (Entry) table.get(k);
     if (currtime > (e.getArrivalTS() + e.getLifetime() * 1000)) {
       keys.remove();
     }
   }
 }
Example #5
0
 public static void sortAndPrintMap(Map<String, Double> map) throws FileNotFoundException {
   // pr = new PrintStream(new FileOutputStream("/semplest/lluis/keywordExp/wordmap.txt"));
   pr = System.out;
   ValueComparator bvc = new ValueComparator(map);
   TreeMap<String, Double> sorted = new TreeMap<String, Double>(bvc);
   sorted.putAll(map);
   for (String key : sorted.keySet()) {
     pr.println(key + " : " + map.get(key));
   }
   System.out.println("Number of words : " + map.size());
 }
  public void save(String filename) {
    if (propertiesMap == null) {

      // nothing to save, initialisation not complete

      return;
    }

    /**
     * Note - propertiesMap isn't synchronised! We'll clone the map now, because we need to modify
     * it. The BEncoding code will create a new map object (TreeMap) because it needs to be sorted,
     * so we might as well do it here too.
     */
    TreeMap<String, Object> properties_clone = propertiesMap.toTreeMap();

    // Remove any transient parameters.
    if (!this.transient_properties.isEmpty()) {
      properties_clone.keySet().removeAll(this.transient_properties);
    }

    FileUtil.writeResilientConfigFile(filename, properties_clone);

    List<COConfigurationListener> listeners_copy;

    synchronized (listenerz) {
      listeners_copy = new ArrayList<COConfigurationListener>(listenerz);
    }

    for (int i = 0; i < listeners_copy.size(); i++) {

      COConfigurationListener l = (COConfigurationListener) listeners_copy.get(i);

      if (l != null) {

        try {
          l.configurationSaved();

        } catch (Throwable e) {

          Debug.printStackTrace(e);
        }
      } else {

        Debug.out("COConfigurationListener is null");
      }
    }

    if (exported_parameters_dirty) {

      exportParameters();
    }
  }
Example #7
0
    /**
     * Returns the lo res shots that matched the lo-res shot passed in.
     *
     * @param hiResName The name of the lo-res shot
     * @return The name of the matching hi-res scene
     */
    public String getMatchingLoResShot(String hiResName) {
      String shortHiRes = hiResName.replaceAll(".*/production/.*/(anim|lgt)/", "");
      shortHiRes = shortHiRes.replaceAll("switch.*", "");

      for (String loResName : loHiResShots.keySet()) {
        String shortLoRes = loResName.replaceAll(".*/production/.*/(anim|lgt)/", "");
        if (shortLoRes.startsWith(shortHiRes)) {
          // System.err.println("Matched: "+hiResName+ " with "+loResName );
          return loResName;
        } // end if
      } // end for
      return null;
    } // end getMatchingLoResShot
Example #8
0
  private TreeMap<String, TreeSet<String>> convertListToShotBased() {
    TreeMap<String, TreeSet<String>> toReturn = new TreeMap<String, TreeSet<String>>();
    for (String asset : pAssetManager.keySet()) {
      TreeMap<String, String> shots = pAssetManager.get(asset).getLoHiResShots();
      System.err.println(shots);
      for (String loResShot : shots.keySet()) {
        if (!toReturn.containsKey(loResShot)) toReturn.put(loResShot, new TreeSet<String>());
        toReturn.get(loResShot).add(asset);

        if (shots.get(loResShot) == null) {
          logLine("There is no hi-res node for the anim node: " + loResShot);
          continue;
        }

        if (!toReturn.containsKey(shots.get(loResShot)))
          toReturn.put(shots.get(loResShot), new TreeSet<String>());
        String hrAsset = asset.replace(lr, "");
        toReturn.get(shots.get(loResShot)).add(hrAsset);
      } // end for
    } // end for
    return toReturn;
  } // end convertListToShotBased()
Example #9
0
 private static void deleteCache(Configuration conf, MRAsyncDiskService asyncDiskService)
     throws IOException {
   List<CacheStatus> deleteSet = new LinkedList<CacheStatus>();
   // try deleting cache Status with refcount of zero
   synchronized (cachedArchives) {
     for (Iterator<String> it = cachedArchives.keySet().iterator(); it.hasNext(); ) {
       String cacheId = (String) it.next();
       CacheStatus lcacheStatus = cachedArchives.get(cacheId);
       if (lcacheStatus.refcount == 0) {
         // delete this cache entry from the global list
         // and mark the localized file for deletion
         deleteSet.add(lcacheStatus);
         it.remove();
       }
     }
   }
   // do the deletion asynchronously, after releasing the global lock
   Thread cacheFileCleaner =
       new Thread(new CacheFileCleanTask(asyncDiskService, FileSystem.getLocal(conf), deleteSet));
   cacheFileCleaner.start();
 }
  /** Save the bundle to a file. Returns false if save was not successful. */
  public boolean saveBundleToFile(final String localeName) {
    try {
      final File externalBundleDir = new File(EXTERNAL_BUNDLE_DIR);
      if (!externalBundleDir.isDirectory()) {
        externalBundleDir.mkdirs();
      }
      final String filename = EXTERNAL_BUNDLE_DIR + "langres_" + localeName + ".properties";
      final PrintWriter out =
          new PrintWriter(
              new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")));

      final TreeMap<String, String> sorter = new TreeMap<String, String>(bundle);

      for (final String string : sorter.keySet()) {
        String key = string;
        String val = getString(key);
        key = key.trim();
        val = val.trim();
        // change newlines in val into \n
        final StringBuilder sbTmp = new StringBuilder();
        for (int x = 0; x < val.length(); x++) {
          final char c = val.charAt(x);
          if (c == '\n') {
            sbTmp.append("\\n");
          } else {
            sbTmp.append(c);
          }
        }
        val = sbTmp.toString();

        out.println(key + "=" + val);
      }

      out.close();
      return true;
    } catch (final Throwable t) {
      logger.log(Level.SEVERE, "Error saving bundle.", t);
      return false;
    }
  }
  /**
   * Construct a {@link SubProcessHeavy SubProcessHeavy} instance which when executed will fulfill
   * the given action agenda.
   *
   * <p>
   *
   * @param agenda The agenda to be accomplished by the action.
   * @param outFile The file to which all STDOUT output is redirected.
   * @param errFile The file to which all STDERR output is redirected.
   * @return The SubProcess which will fulfill the agenda.
   * @throws PipelineException If unable to prepare a SubProcess due to illegal, missing or
   *     imcompatable information in the action agenda or a general failure of the prep method code.
   */
  public SubProcessHeavy prep(ActionAgenda agenda, File outFile, File errFile)
      throws PipelineException {
    /* model filenames */
    TreeMap<String, Path> modelPaths = new TreeMap<String, Path>();
    TreeMap<String, Path> animPaths = new TreeMap<String, Path>();

    TreeMap<String, String> nameSpaces = new TreeMap<String, String>();
    TreeMap<String, String> reverseNameSpaces = new TreeMap<String, String>();
    TreeMap<String, Boolean> usesNameSpace = new TreeMap<String, Boolean>();
    TreeMap<String, String> buildTypes = new TreeMap<String, String>();

    for (String sname : agenda.getSourceNames()) {
      if (hasSourceParams(sname)) {
        FileSeq fseq = agenda.getPrimarySource(sname);
        String suffix = fseq.getFilePattern().getSuffix();
        if (fseq.isSingle() && (suffix != null)) {
          if (suffix.equals("ma") || suffix.equals("mb")) {
            Path npath = new Path(sname);
            String type = getSourceStringParamValue(sname, aSceneType);
            String nspace = getSourceStringParamValue(sname, aPrefixName);
            if (nspace == null) {
              nspace = npath.getName();
            }
            if (type.equals(aModel))
              modelPaths.put(sname, new Path(npath.getParentPath(), fseq.getPath(0)));
            else {
              animPaths.put(sname, new Path(npath.getParentPath(), fseq.getPath(0)));
              nspace += "_a";
            }

            boolean useNSpace = false;
            {
              Boolean tf = (Boolean) getSourceParamValue(sname, aNameSpace);
              useNSpace = ((tf != null) && tf);
            }

            String buildType = getSourceStringParamValue(sname, aBuildType);
            if (buildType == null)
              throw new PipelineException(
                  "The value of the "
                      + aBuildType
                      + " source parameter for node "
                      + "("
                      + sname
                      + ") was not set!");

            buildTypes.put(sname, buildType);
            nameSpaces.put(sname, nspace);
            reverseNameSpaces.put(nspace, sname);
            usesNameSpace.put(sname, useNSpace);
          }
        }
      }
    }

    /* the target Maya scene */
    Path targetScene = getMayaSceneTargetPath(agenda);
    String sceneType = getMayaSceneType(agenda);

    /* create a temporary MEL script file */
    File script = createTemp(agenda, "mel");
    try {
      FileWriter out = new FileWriter(script);

      /* provide parameters as MEL variables */
      out.write(genFrameRangeVarsMEL());

      /* rename the current scene as the output scene */
      out.write(
          "// SCENE SETUP\n"
              + "file -rename \""
              + targetScene
              + "\";\n"
              + "file -type \""
              + sceneType
              + "\";\n\n");

      out.write(genUnitsMEL());

      writeInitialMEL(agenda, out);

      /* the model file reference imports */
      TreeMap<String, Path> all = new TreeMap<String, Path>(modelPaths);
      all.putAll(animPaths);
      for (String sname : all.keySet()) {
        Path mpath = all.get(sname);

        String buildType = buildTypes.get(sname);

        out.write(
            "// MODEL: "
                + sname
                + "\n"
                + "print \""
                + buildType
                + " Model: "
                + mpath
                + "\\n\";\n"
                + "file\n");

        String nspace = nameSpaces.get(sname);

        boolean useNSpace = usesNameSpace.get(sname);

        if (buildType.equals(aImport)) {
          out.write("  -import\n");

          if (useNSpace) out.write("  -namespace \"" + nspace + "\"\n");
        } else if (buildType.equals(aReference)) {
          out.write("  -reference\n");

          if (useNSpace) out.write("  -namespace \"" + nspace + "\"\n");
          else out.write("  -renamingPrefix \"" + nspace + "\"\n");
        } else {
          throw new PipelineException(
              "Unknown value for the "
                  + aBuildType
                  + " source parameter for node "
                  + "("
                  + sname
                  + ") encountered!");
        }

        {
          String fname = mpath.getName();
          if (fname.endsWith("ma")) out.write("  -type \"mayaAscii\"\n");
          else if (fname.endsWith("mb")) out.write("  -type \"mayaBinary\"\n");
          else
            throw new PipelineException(
                "Unknown Maya scene format for source file (" + mpath + ")!");
        }

        out.write("  -options \"v=0\"\n" + "  \"$WORKING" + mpath + "\";\n\n");
      }

      writeModelMEL(agenda, out);

      out.write(
          "global proc string removePrefix(string $name)\n"
              + "{\n"
              + "  string $toReturn;\n"
              + "  string $buffer[];\n"
              + "  tokenize($name, \"|\", $buffer);\n"
              + "  string $part;\n"
              + "  for ($part in $buffer) {\n"
              + "    string $buffer2[];\n"
              + "    tokenize($part, \":\", $buffer2);\n"
              + "    if ($toReturn == \"\")\n"
              + "      $toReturn += $buffer2[(size($buffer2) -1)];\n"
              + "    else\n"
              + "      $toReturn += \"|\" + $buffer2[(size($buffer2) -1)];\n"
              + "  }\n"
              + "  return $toReturn;    \n"
              + "}\n");

      out.write(
          "global proc string addPrefix(string $name, string $prefix)\n"
              + "{\n"
              + "  string $toReturn;\n"
              + "  string $buffer[];\n"
              + "  tokenize($name, \"|\", $buffer);\n"
              + "  string $part;\n"
              + "  for ($part in $buffer) {\n"
              + "    if ($toReturn == \"\")\n"
              + "      $toReturn += $prefix + $buffer[(size($buffer) -1)];\n"
              + "    else\n"
              + "      $toReturn += \"|\" + $prefix + $buffer[(size($buffer) -1)];\n"
              + "  }\n"
              + "  return $toReturn;\n"
              + "}\n");

      for (String sname : animPaths.keySet()) {
        String nspace = nameSpaces.get(sname);
        String otherNspace = nspace.substring(0, nspace.length() - 2);

        String modelName = reverseNameSpaces.get(otherNspace);

        if (modelName != null) {
          boolean useNSpace = usesNameSpace.get(sname);
          boolean otherUseNSpace = usesNameSpace.get(modelName);

          String buildType = buildTypes.get(sname);
          String otherBuildType = buildTypes.get(modelName);
          String prefix = generatePrefix(nspace, useNSpace, buildType);
          String otherPrefix = generatePrefix(otherNspace, otherUseNSpace, otherBuildType);

          out.write(
              "{\n"
                  + "  string $crvPrefix = \""
                  + prefix
                  + "\";\n"
                  + "  string $objPrefix = \""
                  + otherPrefix
                  + "\";\n"
                  + "  string $obj = $crvPrefix + \"curveInfo\";\n"
                  + "  if (`objExists $obj`) {\n"
                  + "    int $size = `getAttr -s ($obj + \".cn\")`;\n"
                  + "    int $i = 0;\n"
                  + "    for ($i = 0; $i < $size; $i++) {\n"
                  + "      string $curve = `getAttr  ($obj + \".cn[\" + $i + \"]\")`;\n"
                  + "      string $attr = `getAttr  ($obj + \".an[\" + $i + \"]\")`;\n"
                  + "      $curve =  addPrefixToName($crvPrefix, $curve);\n"
                  + "      $attr  =  addPrefixToName($objPrefix, $attr);\n"
                  + "      print(\"connectAttr -f \" + $curve + \" \" + $attr + \"\\n\");\n"
                  + "      connectAttr -f $curve $attr;   \n"
                  + "    }\n"
                  + "  }\n"
                  + "  else {\n"
                  + "    string $curves[] = `ls -type animCurve ($crvPrefix + \"*\")`;\n"
                  + "    string $curve;\n"
                  + "    for ($curve in $curves) {\n"
                  + "      string $shortName = removePrefix($curve);\n"
                  + "      string $buffer[];\n"
                  + "      tokenize($shortName, \"_\", $buffer);\n"
                  + "      string $attr = $buffer[(size($buffer) -1)];\n"
                  + "      string $name = \"\";\n"
                  + "      int $length = (size($buffer) -1);\n"
                  + "      int $i;\n"
                  + "      for ($i = 0; $i < $length; $i++) {\n"
                  + "        $name += $buffer[$i];\n"
                  + "        if ($i != ($length - 1) )\n"
                  + "          $name += \"_\";\n"
                  + "      }\n"
                  + "      string $channel = addPrefix($name, $objPrefix) + \".\" + $attr;\n"
                  + "      print ($curve + \"\\t\" + $channel + \"\\n\");\n"
                  + "      if (!`getAttr -l $channel`)\n"
                  + "        connectAttr -f ($curve + \".output\") $channel;\n"
                  + "    }\n"
                  + "  }\n"
                  + "}\n");
        }
      }

      /* set the time options */
      out.write(genPlaybackOptionsMEL());

      writeAnimMEL(agenda, out);

      /* save the file */
      out.write(
          "// SAVE\n"
              + "print \"Saving Generated Scene: "
              + targetScene
              + "\\n\";\n"
              + "file -save;\n\n");

      writeFinalMEL(agenda, out);

      out.close();
    } catch (IOException ex) {
      throw new PipelineException(
          "Unable to write temporary MEL script file ("
              + script
              + ") for Job "
              + "("
              + agenda.getJobID()
              + ")!\n"
              + ex.getMessage());
    }

    /* create the process to run the action */
    return createMayaSubProcess(null, script, true, agenda, outFile, errFile);
  }
Example #12
0
  /**
   * Get list of each asset to be replaced, and the shots it's in.
   *
   * @return
   * @throws PipelineException
   */
  private boolean getShotsUsingAssets() throws PipelineException {
    ArrayList<ArchiveInfo> archive = mclient.archiveQuery(shotPattern, null);

    logLine("Looking for shots using lo-res assets.");
    for (ArchiveInfo curArc : archive) {
      String name = curArc.getName();
      VersionID vid = curArc.getVersionID();
      TreeSet<VersionID> allVers = mclient.getCheckedInVersionIDs(name);
      if (!vid.equals(allVers.last())) continue;

      NodeVersion ver = mclient.getCheckedInVersion(name, vid);
      Set<String> srcs = ver.getSourceNames();

      for (String loResAsset : pAssetManager.keySet()) {
        if (srcs.contains(loResAsset)) {
          // TODO chec if latest.

          logLine("\t" + getShortName(loResAsset) + ": " + getShortName(name));

          AssetInfo tempInfo = pAssetManager.get(loResAsset);

          if (!tempInfo.getLoHiResShots().containsKey(name))
            tempInfo.getLoHiResShots().put(name, null);
        } // end if
      } // end for
    } // end for

    logLine("Looking for shots using hi-res assets");
    /* - Populate lo-res */
    for (ArchiveInfo curArc : archive) {
      String name = curArc.getName();
      VersionID vid = curArc.getVersionID();
      TreeSet<VersionID> allVers = mclient.getCheckedInVersionIDs(name);
      if (!vid.equals(allVers.last())) continue;

      NodeVersion ver = mclient.getCheckedInVersion(name, vid);
      Set<String> srcs = ver.getSourceNames();

      for (String updateAsset : pAssetManager.keySet()) {
        String hiResAsset = updateAsset.replace(lr, "");
        if (srcs.contains(hiResAsset)) {
          logLine("\t" + getShortName(hiResAsset) + ": " + getShortName(name));
          AssetInfo tempInfo = pAssetManager.get(updateAsset);

          String loRes = tempInfo.getMatchingLoResShot(name);
          if (loRes == null) {
            logLine(
                "!!!\nWARNING:"
                    + getShortName(hiResAsset)
                    + " is used in the "
                    + getShortName(name)
                    + " node which has no matching lo-res model in an anim node."
                    + " So it will not be changed\n!!!");
            continue;
          }

          tempInfo.getLoHiResShots().put(loRes, name);
        } // end if
      } // end for
    } // end for(ArchiveInfo)

    logLine("");

    for (String updateAsset : potentialUpdates) {
      TreeMap<String, String> shots = pAssetManager.get(updateAsset).getLoHiResShots();
      if (shots.isEmpty()) {
        logLine(getShortName(updateAsset) + " is not used in any shots");
        pAssetManager.remove(updateAsset);
      }
      for (String loRes : shots.keySet()) {
        if (shots.get(loRes) == null)
          logLine(
              getShortName(updateAsset)
                  + " is in a hi-res shot, "
                  + getShortName(loRes)
                  + ", but doesn't have a matching hi-res"
                  + "model in the lgt node.");
      }
    }

    if (pAssetManager.isEmpty()) return false;

    return true;
  } // end getShotsUsingAssets
Example #13
0
  /**
   * Present a GUI allowing the user to select shots in which each previously selected asset should
   * be updated.
   *
   * @return
   * @throws PipelineException
   */
  private String confirmShotsToUpdate() throws PipelineException {

    /* DO GUI DRAWING STUFF*/
    JScrollPane scroll = null;
    {
      Box ibox = new Box(BoxLayout.Y_AXIS);
      if (pAssetManager.isEmpty()) {
        Component comps[] = UIFactory.createTitledPanels();
        JPanel tpanel = (JPanel) comps[0];
        JPanel vpanel = (JPanel) comps[1];

        tpanel.add(Box.createRigidArea(new Dimension(sTSize - 7, 0)));
        vpanel.add(Box.createHorizontalGlue());

        ibox.add(comps[2]);
      } else {

        for (String assetName : pAssetManager.keySet()) {
          String name = getShortName(assetName);
          AssetInfo info = pAssetManager.get(assetName);

          Component comps[] = UIFactory.createTitledPanels();
          JPanel tpanel = (JPanel) comps[0];
          JPanel vpanel = (JPanel) comps[1];
          String title = "Replace " + name + " with ";
          title += getShortName(info.getNewAsset());

          JDrawer shotList = new JDrawer(title, (JComponent) comps[2], true);
          ibox.add(shotList);

          for (String shot : info.getLoHiResShots().keySet()) {

            String shortShot = getShortName(shot);
            JBooleanField field =
                UIFactory.createTitledBooleanField(
                    tpanel,
                    shortShot,
                    sVSize,
                    vpanel,
                    sTSize,
                    "Whether to replace this asset source for the node.");
            field.setName(shot);
            field.setValue(true);

            if (!pSubstituteFields.containsKey(assetName))
              pSubstituteFields.put(assetName, new LinkedList<JBooleanField>());

            pSubstituteFields.get(assetName).add(field);
            UIFactory.addVerticalSpacer(tpanel, vpanel, 3);
          }
        }
      }

      {
        JPanel spanel = new JPanel();
        spanel.setName("Spacer");

        spanel.setMinimumSize(new Dimension(sTSize + sVSize, 7));
        spanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
        spanel.setPreferredSize(new Dimension(sTSize + sVSize, 7));

        ibox.add(spanel);
      }

      {
        scroll = new JScrollPane(ibox);
        scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        Dimension size = new Dimension(sTSize + sVSize + 52, 300);
        scroll.setMinimumSize(size);
        scroll.setPreferredSize(size);

        scroll.getViewport().setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE);
      }
    }

    /* query the user */
    JToolDialog diag = new JToolDialog("Update Assets Per Shot", scroll, "Confirm");
    diag.setVisible(true);

    /* Process User Input */
    if (diag.wasConfirmed()) {

      for (String asset : pSubstituteFields.keySet()) {
        for (JBooleanField field : pSubstituteFields.get(asset)) {
          Boolean bUpdate = field.getValue();
          if ((bUpdate == null) || !bUpdate) {
            pAssetManager.get(asset).getLoHiResShots().remove(field.getName());

            // logLine("\tRemoving: "+ getShortName(field.getName())
            // TODO		+" from list for "+ getShortName(asset));
          }
        }
      }
      return ": Modifying Nodes...";
    }
    return null;
  } // end confirmShotsToUpdate
Example #14
0
  /**
   * Using a list of shots and the assets to be changed per shot, gets each shot node and modifies
   * the references as needed.
   */
  private void processNodes() throws PipelineException {
    /*each asset, its replacement and the lo-res versions*/
    for (String asset : pAssetManager.keySet()) {
      String newAsset = pAssetManager.get(asset).getNewAsset();
      String hrAsset = asset.replace(lr, "");
      String newHrAsset = newAsset.replace(lr, "");
      logLine(
          "Checking out nodes:\n\t"
              + asset
              + "\n\t"
              + hrAsset
              + "\n\t"
              + newAsset
              + "\n\t"
              + newHrAsset);

      mclient.checkOut(w.user, w.view, asset, null, over, froz);
      mclient.checkOut(w.user, w.view, newAsset, null, over, froz);
      mclient.checkOut(w.user, w.view, hrAsset, null, over, froz);
      mclient.checkOut(w.user, w.view, newHrAsset, null, over, froz);
    } // end for

    TreeMap<String, TreeSet<String>> shotBased = convertListToShotBased();
    TreeMap<String, String> nameMap = SonyConstants.getCustomNamespaces(project);
    TreeSet<String> oldRef = new TreeSet<String>();
    TreeSet<String> newRef = new TreeSet<String>();

    for (String shot : shotBased.keySet()) {
      // check out the shot

      if (shot.endsWith("anim")) mclient.checkOut(w.user, w.view, shot, null, keep, frozU);
      else {
        continue;
        // mclient.checkOut(w.user, w.view, shot, null, keep, pFroz);
      }
      logLine("Checking out: " + shot);

      NodeMod targetMod = mclient.getWorkingVersion(w.user, w.view, shot);
      if (!shot.matches(lgtPattern)) {

        if (targetMod.isActionEnabled()) {
          System.err.println("Anim node with action enabled");
          FileSeq fseq = targetMod.getPrimarySequence();
          VersionID targetID = targetMod.getWorkingID();
          TreeMap<String, VersionID> files = new TreeMap<String, VersionID>();
          files.put(fseq.getFile(0).getPath(), targetID);
          mclient.revertFiles(w.user, w.view, shot, files);
          targetMod.setActionEnabled(false);
        }

        w.mclient.modifyProperties(w.user, w.view, targetMod);
      }

      /*--checking the shot to be modified---*/

      for (String assetToReplace : shotBased.get(shot)) {
        if (assetToReplace.endsWith(lr)) {
          AssetInfo temp = pAssetManager.get(assetToReplace);
          oldRef.add(assetToReplace);
          newRef.add(temp.getNewAsset());
        } else {
          String hiRes = assetToReplace.replace(lr, "");
          AssetInfo temp = pAssetManager.get(hiRes);
          if (temp == null) continue;
          oldRef.add(assetToReplace);
          newRef.add(temp.getNewAsset() + lr);
        } // end else
      } // end for

      if (oldRef.isEmpty() || newRef.isEmpty()) {
        logLine("Shot " + shot + " somehow does not need any changes.");
        continue;
      } // end if

      editShotReferences(shot, targetMod, oldRef, newRef, nameMap);
    } // end for

    /*for(String shot: shotBased.keySet()){
    	//TODO: Check in nodes
    	String msg = "Checked in with UpdateAssetGUI. Removed:\n\t";
    	for(String asset: oldRef)
    		msg+= (asset + " ");

    	msg+="\nAdded:\n\t";
    	for(String asset: newRef)
    		msg+= (asset + " ");

    	mclient.checkIn(w.user, w.view,shot, msg, VersionID.Level.Major);
    }*/

  } // end processShots
  public static void contactBookOperations(String contactBookName)
      throws IOException, ParseException {
    FileWriter fr = new FileWriter(contactBookName, true);
    BufferedReader fileReader = new BufferedReader(new FileReader(contactBookName));
    BufferedWriter fileWriter = new BufferedWriter(fr);
    String address = "";
    String name = "";
    boolean validName = false;
    String dateOfBirth = "";
    boolean dateValid = false;
    String petName = "";
    int tag = 0;
    String contactType = "";
    boolean invalidTag = false;
    boolean moreEmail = false;
    String email = "";
    String emailChoice = "";
    boolean morePhone = true;
    String phoneChoice = "";
    String phoneList = "";
    String contactAdded = "";
    long phoneNum = 0;
    int choice = 0;
    ArrayList<String> nameList =
        new ArrayList<String>(); // arrayList to hold names of contacts in the file...
    Scanner sc = new Scanner(System.in);
    String searchString = "";
    Scanner stringReader = new Scanner(System.in);
    String line = "";
    String totalDetails = "";
    // System.out.println(fileReader);
    while (choice != 6) {
      System.out.println("\nTO ADD CONTACT->PRESS 1 ");
      System.out.println("TO EDIT CONTACT->PRESS 2 ");
      System.out.println("TO REMOVE CONTACT->PRESS 3 ");
      System.out.println("TO LIST CONTACTS->PRESS 4 ");
      System.out.println("TO SEARCH CONTACT->PRESS 5 ");
      System.out.println("TO GO BACK TO PREVIOUS MENU->PRESS 6 ");
      while (!sc.hasNextInt()) {
        System.out.println("\nENTER ONLY NUMBERS RANGED FROM 0 - 6");
        sc.next();
      }

      choice = sc.nextInt();
      switch (choice) {
          // ADD A NEW CONTACT........
        case 1: // add contact option.............
          // add name
          dateValid = false;
          invalidTag = true;
          moreEmail = true;
          morePhone = true;
          email = "";
          phoneList = "";
          nameList.clear();
          System.out.println("\nENTER NAME OF THE PERSON(Ex: Aditya Dey)");
          validName = false;
          fileReader = new BufferedReader(new FileReader(contactBookName));
          while (!validName) {
            name = stringReader.nextLine(); // read contact name from user
            name = name.trim();
            if (name.equals("")) {
              System.out.println(
                  "\nNAME OF THE PERSON CANNOT BE BLANK\nENTER NAME OF THE PERSON(Ex: Aditya Dey)");
              continue;
            }
            while (((line = fileReader.readLine()) != null)) // read till end of file
            {
              String s =
                  line.substring(0, line.indexOf('=')); // add each name that exists in the file
              if (!nameList.contains(s)) {
                nameList.add(s);
              }
            }
            // System.out.println(nameList);
            if (nameList.contains(name)) // if name already exists, print error message
            {
              System.out.println("\nA CONTACT NAMED " + name + " ALREADY EXISTS.");
              System.out.println("\nPLEASE ADD ANOTHER NAME(Ex: Aditya Dey)");

            } else {
              validName = true;
              nameList.add(name);
            }
          }
          // date of birth
          System.out.println(
              "\nENTER DOB OF THE PERSON IN DD/MM/YYYY FORMAT Ex: 12/05/1992 OR PRESS ENTER TO SKIP");
          while (!dateValid) {
            dateOfBirth = stringReader.nextLine();
            if (dateOfBirth.trim().compareTo("") == 0) dateValid = true;
            else // doubt? next() skips next scan...
            dateValid = isValidDate(dateOfBirth);
            if (!dateValid) {
              System.out.println(
                  "\nINVALID DATE...\nENTER DOB OF THE PERSON IN DD/MM/YYYY FORMAT Ex: 12/05/1992");
            }
          }

          //	System.out.println(dateOfBirth);
          // add contact type
          System.out.println("\nENTER PET NAME OF THE PERSON OR ENTER TO SKIP");
          petName = stringReader.nextLine();

          System.out.println("\nCHOOSE CONTACT TYPE...");
          System.out.println("\nFOR FAMILY->PRESS 1 ");
          System.out.println("FOR FRIENDS->PRESS 2 ");
          System.out.println("FOR ASSOCIATES->PRESS 3 ");
          System.out.println("FOR OTHERS->PRESS 4 ");

          while (!sc.hasNextInt()) {
            System.out.println("\nENTER ONLY NUMBERS RANGED FROM 1 - 4");
            sc.nextLine();
          }
          tag = sc.nextInt();

          while (invalidTag) {
            switch (tag) {
              case 1:
                contactType = "Family";
                invalidTag = false;
                break;
              case 2:
                contactType = "Friend";
                invalidTag = false;
                break;
              case 3:
                contactType = "Associate";
                invalidTag = false;
                break;
              case 4:
                contactType = "Others";
                invalidTag = false;
                break;
              default:
                System.out.println("\nENTER ONLY NUMBERS RANGED FROM 1-4");
                invalidTag = true;
                break;
            }
          }
          // System.out.println(contactType);
          System.out.println("\nENTER ADDRESS IN ONE LINE OR PRESS ENTER TO SKIP");
          address = stringReader.nextLine();
          // System.out.println(address);
          while (moreEmail) {
            System.out.println("\nENTER EMAIL ADDRESS OR PRESS ENTER TO SKIP");
            email = email + "," + stringReader.nextLine();
            // System.out.println(email);
            if (!(email.trim()).equals(",")) {
              System.out.println(
                  "\nTO ADD EMAIL ADRESS->PRESS 'Y' OR 'y'..TO STOP ADDING EMAIL PRESS ANY OTHER KEY");
              emailChoice = stringReader.nextLine();
              if (emailChoice.equals("y") || emailChoice.equals("Y")) {
                moreEmail = true;
              } else {
                moreEmail = false;
              }
            } else {
              moreEmail = false;
            }
          }
          email = email.substring(1, email.length());
          // System.out.println(email);

          while (morePhone) {
            System.out.println("\nENTER CONTACT NUMBER");

            while (!sc.hasNextLong()) {
              System.out.println("\nINVALID CONTACT NUMBER.\nENTER A VALID CONTACT NUMBER");
              sc.next();
            }
            phoneNum = sc.nextLong();
            phoneList = phoneList + "," + phoneNum;
            sc.nextLine(); // doubt? not included: doesnt read phonechoice.....

            System.out.println(
                "\nTO ADD MORE PHONE NUMBERS->PRESS 'Y' OR 'y' \nOTHERWISE PRESS ANY OTHER KEY");
            phoneChoice = sc.nextLine();

            if (phoneChoice.equals("y") || phoneChoice.equals("Y")) {
              morePhone = true;
            } else {
              morePhone = false;
            }
          }
          phoneList = phoneList.substring(1, phoneList.length());
          System.out.println("FOLLOWING DETAILS HAS BEEN SAVED IN THE PHONEBOOK");
          System.out.println("---------------------------------------------------");
          System.out.println(
              "["
                  + name
                  + ","
                  + petName
                  + ","
                  + contactType
                  + ","
                  + address
                  + ","
                  + dateOfBirth
                  + ","
                  + email
                  + ","
                  + phoneList
                  + "]");
          totalDetails =
              name
                  + "="
                  + dateOfBirth
                  + ":"
                  + petName
                  + ":"
                  + contactType
                  + ":"
                  + address
                  + ":"
                  + email
                  + ":"
                  + phoneList
                  + ":"
                  + new Date();
          fileWriter.write(totalDetails);
          fileWriter.newLine();
          fileWriter.flush();
          break;
          // EDITING A CONTACT
        case 2:
          String editName = "";
          String details = "";
          String line3 = "";
          String[] detailParts;
          String newDob = "";
          String newPetName = "";
          String newAddress = "";
          String newContactType = "";
          String newEmail = "";
          String newPhone = "";
          String newString = "";
          String name3 = "";
          choice = 0;
          nameList.clear();
          String[] parts;
          fileReader = new BufferedReader(new FileReader(contactBookName));
          while (((line = fileReader.readLine()) != null)) // read till end of file
          {
            String s =
                line.substring(0, line.indexOf('=')); // add each name that exists in the file
            if (!nameList.contains(s)) {
              nameList.add(s);
            }
          }
          BufferedReader editReader = new BufferedReader(new FileReader(contactBookName));
          dateValid = false;
          invalidTag = true;
          String editContact = "";
          System.out.println("\nENTER THE CONTACT TO BE EDITED");
          editName = stringReader.nextLine();
          if (!nameList.contains(editName)) {
            System.out.println("\nA CONTACT NAMED " + editName + " DOES NOT EXIST");
          } else {
            while ((line3 = editReader.readLine()) != null) {
              // System.out.println(line3);
              name3 = line3.substring(0, line3.indexOf("="));
              if (!name3.equals(editName)) {
                newString = newString + line3 + System.getProperty("line.separator");
              } else {
                editContact = line3;
              }
            }
            details = editContact.substring(editContact.indexOf("=") + 1, editContact.length());
            detailParts = details.split(":");
            newDob = detailParts[0];
            newPetName = detailParts[1];
            newContactType = detailParts[2];
            newAddress = detailParts[3];
            newEmail = detailParts[4];
            newPhone = detailParts[5];
            while (choice != 7) {
              System.out.println("\nTO EDIT DATE OF BIRTH->PRESS 1");
              System.out.println("TO EDIT PET NAME->PRESS 2 ");
              System.out.println("TO EDIT CONTACT TYPE->PRESS 3 ");
              System.out.println("TO EDIT ADDRESS->PRESS 4 ");
              System.out.println("TO ADD EMAIL->PRESS 5 ");
              System.out.println("TO ADD PHONE NUMBER->PRESS 6 ");
              System.out.println("TO GO BACK TO THE PREVIOUS MENU->PRESS 7 ");
              System.out.print("ENTER YOUR CHOICE::\t");
              while (!sc.hasNextInt()) {
                System.out.println("ENTER ONLY INTEGERS IN THE RANGE 1-7");
                sc.nextLine();
              }

              choice = sc.nextInt();
              switch (choice) {
                case 1:
                  System.out.println(
                      "\nENTER DOB OF THE PERSON IN DD/MM/YYYY FORMAT EG: 12/05/1992");
                  while (!dateValid) {
                    newDob = stringReader.nextLine(); // doubt? next() skips next scan...		
                    dateValid = isValidDate(newDob);
                    if (!dateValid) {
                      System.out.println(
                          "\nINVALID DATE...ENTER DOB OF THE PERSON IN DD/MM/YYYY FORMAT EG: 12/05/1992");
                    }
                  }
                  break;
                case 2:
                  System.out.println("\nENTER NEW PET NAME OF THE PERSON OR ENTER TO SKIP");
                  newPetName = stringReader.nextLine();
                  break;

                case 3:
                  System.out.println("\nCHOOSE CONTACT TYPE...");
                  System.out.println("\nFOR FAMILY->PRESS 1 ");
                  System.out.println("FOR FRIENDS->PRESS 2 ");
                  System.out.println("FOR ASSOCIATES->PRESS 3 ");
                  System.out.println("FOR OTHERS->PRESS 4 ");
                  while (!sc.hasNextInt()) {
                    System.out.println("\nENTER ONLY NUMBERS IN THE RANGE 1 - 3");
                    sc.nextLine();
                  }
                  tag = sc.nextInt();
                  while (invalidTag) {
                    switch (tag) {
                      case 1:
                        newContactType = "Family";
                        invalidTag = false;
                        break;

                      case 2:
                        newContactType = "Friend";
                        invalidTag = false;
                        break;

                      case 3:
                        newContactType = "Associate";
                        invalidTag = false;
                        break;

                      case 4:
                        newContactType = "Others";
                        invalidTag = false;
                        break;

                      default:
                        System.out.println("\nENTER ONLY NUMBERS RANGED FROM 1-4");
                        invalidTag = true;
                        break;
                    }
                  }
                  break;
                case 4:
                  System.out.println("\nENTER NEW ADDRESS IN ONE LINE");
                  newAddress = stringReader.nextLine();
                  break;

                case 5:
                  moreEmail = true;
                  while (moreEmail) {
                    System.out.println("\nENTER EMAIL ADDRESS OR PRESS ENTER TO SKIP");
                    newEmail = newEmail + "," + stringReader.nextLine();
                    // System.out.println(email);
                    if (!(newEmail.trim()).equals(",")) {
                      System.out.println(
                          "TO ADD EMAIL->PRESS 'Y' OR 'y'..TO STOP ADDING EMAIL PRESS ANY OTHER KEY");
                      emailChoice = stringReader.nextLine();
                      if (emailChoice.equals("y") || emailChoice.equals("Y")) {
                        moreEmail = true;
                      } else {
                        moreEmail = false;
                      }
                    } else {
                      moreEmail = false;
                    }
                  }
                  break;

                case 6:
                  morePhone = true;
                  while (morePhone) {
                    System.out.println("\nENTER PHONE NUMBER");
                    while (!sc.hasNextLong()) {
                      System.out.println("\nONLY VALID PHONE NUMBERS ALLOWED");
                      sc.next();
                    }
                    phoneNum = sc.nextLong();
                    newPhone = phoneNum + ",";
                    sc.nextLine(); // doubt? not included: doesnt read phonechoice.....
                    System.out.println(
                        "\nTO ADD MORE PHONE NUMBERS->PRESS 'y' or 'Y'\nOTHERWISE PRESS ANY OTHER KEY");
                    phoneChoice = sc.nextLine();
                    if (phoneChoice.equals("y") || phoneChoice.equals("Y")) {
                      morePhone = true;
                    } else {
                      morePhone = false;
                    }
                  }
                  phoneList = newPhone;
                  phoneList = phoneList.substring(1, phoneList.length());
                  break;

                case 7:
                  System.out.println(
                      "["
                          + editName
                          + ","
                          + newPetName
                          + ","
                          + newContactType
                          + ","
                          + newAddress
                          + ","
                          + newDob
                          + ","
                          + newEmail
                          + ","
                          + newPhone
                          + "]");
                  String newDetails =
                      editName
                          + "="
                          + newDob
                          + ":"
                          + newPetName
                          + ":"
                          + newContactType
                          + ":"
                          + newAddress
                          + ":"
                          + newEmail
                          + ":"
                          + newPhone
                          + ":"
                          + new Date();
                  newString = newString + newDetails + System.getProperty("line.separator");
                  BufferedWriter editWriter = new BufferedWriter(new FileWriter(contactBookName));
                  editWriter.write(newString);
                  editWriter.close();
                  break;

                default:
                  System.out.println("\nENTER ONLY NUMBERS RANGED FROM 1-7");
                  break;
              }
            }
          }
          // dob:petname:tag:address:email1,email2,email3..:ph1,ph2,...:crtdate
          break;

        case 3: // REMOVING A CONTACT
          BufferedReader removalReader = new BufferedReader(new FileReader(contactBookName));
          String name2 = "";
          String line2 = "";
          String nameRemoved = "";
          String finalString = "";
          System.out.println("\nENTER THE NAME TO BE REMOVED");
          nameRemoved = stringReader.nextLine();
          if (!nameList.contains(nameRemoved)) {
            System.out.println("\nA CONTACT WITH NAME " + nameRemoved + " DOES NOT EXIST\n");
          } else {
            while ((line2 = removalReader.readLine()) != null) {
              name2 = line2.substring(0, line2.indexOf("="));
              if (!name2.equals(nameRemoved)) {
                finalString = finalString + line2 + System.getProperty("line.separator");
              }
            }
            BufferedWriter removalWriter = new BufferedWriter(new FileWriter(contactBookName));
            removalWriter.write(finalString);
            removalWriter.close();
            System.out.println("CONTACT " + nameRemoved + " REMOVED ");
          }
          break;
          // LISTING ELEMENTS
        case 4:
          int listChoice = 0;
          BufferedReader listReader = new BufferedReader(new FileReader(contactBookName));
          parts = null;
          TreeMap<String, String> nameDetailMap = new TreeMap<String, String>();
          String line4 = "";

          while (listChoice != 4) {
            System.out.println("\nTO DISPLAY CONTACTS BY ALPHABETICAL ORDERING OF NAMES->PRESS 1 ");
            System.out.println("TO DISPLAY CONTACTS BY CREATED DATE->PRESS 2 ");
            System.out.println("TO DISPLAY CONTACTS BY TAG->PRESS 3 ");
            System.out.println("TO GO BACK TO PREVIOUS MENU->PRESS 4 ");
            System.out.print("ENTER CHOICE::\t");

            while (!sc.hasNextInt()) {
              System.out.println("ENTER ONLY INTEGERS IN THE RANGE 1-4");
              sc.next();
            }

            listChoice = sc.nextInt();

            switch (listChoice) {
                // ORDERING CONTACTS BY ALPHABETICAL ORDERING OF NAMES..............
              case 1:
                listReader = new BufferedReader(new FileReader(contactBookName));

                line4 = "";
                parts = null;
                while ((line4 = listReader.readLine()) != null) {
                  parts = line4.split("=");
                  nameDetailMap.put(parts[0], parts[1]);
                }

                Collection<String> c = nameDetailMap.keySet();
                Iterator<String> it = c.iterator();
                if (it.hasNext()) {
                  System.out.println(
                      "\nCONTACTS BELOW ARE LISTED IN ALPHABETICAL ORDERING OF NAMES");
                  System.out.println("-----------------------------------------------------------");
                } else {
                  System.out.println("NO CONTACTS AVAILABLE");
                }
                while (it.hasNext()) {
                  String s = (String) it.next();
                  System.out.println("\n\n" + s);
                  System.out.println("---------------------------------");
                  String[] contactDetail = nameDetailMap.get(s).split(":");
                  for (int i = 0; i < contactDetail.length; i++) {
                    if (contactDetail[i].trim().compareTo("") == 0) {
                      contactDetail[i] = "Unavailable";
                    }
                  }
                  System.out.println("Date of Birth::\t" + contactDetail[0]);
                  System.out.println("Pet name::\t" + contactDetail[1]);
                  System.out.println("Contact Type::\t" + contactDetail[2]);
                  System.out.println("Address::\t" + contactDetail[3]);
                  System.out.println("Email Address::\t" + contactDetail[4]);
                  System.out.println("Phone No::\t" + contactDetail[5]);
                  System.out.println("Contact added::\t" + contactDetail[6]);
                }
                break;

                // ORDERING CONTACTS BY CREATED DATE..............
              case 2:
                BufferedReader br = new BufferedReader(new FileReader(contactBookName));
                line4 = "";
                String date = "";
                String[] part;
                TreeMap<Date, String> tm = new TreeMap<Date, String>();
                while ((line4 = br.readLine()) != null) {
                  part = line4.split(":");
                  SimpleDateFormat formatter = new SimpleDateFormat("E MMM dd H:m");
                  String h = (part[6] + ":" + part[7]);
                  Date d = formatter.parse(h);
                  tm.put(d, line4);
                }
                Collection<Date> c1 = tm.keySet();
                // System.out.println(c1);
                Iterator<Date> it1 = c1.iterator();
                if (it1.hasNext()) {
                  System.out.println("\nCONTACTS BELOW ARE LISTED IN ORDER OF CREATED DATES");
                  System.out.println("--------------------------------------------------------");

                } else {
                  System.out.println("NO CONTACTS AVAILABLE");
                }
                while (it1.hasNext()) {
                  String s = it1.next().toString() + "";
                  // System.out.println(s);
                  System.out.println("\n\n" + s);
                  SimpleDateFormat formatter = new SimpleDateFormat("E MMM dd H:m");
                  Date d = formatter.parse(s);
                  System.out.println("---------------------------------");
                  String[] nameContact = tm.get(d).split("=");
                  System.out.println(nameContact[0]);
                  String[] contactDetail = nameContact[1].split(":");
                  for (int i = 0; i < contactDetail.length; i++) {
                    if (contactDetail[i].trim().compareTo("") == 0) {
                      contactDetail[i] = "Unavailable";
                    }
                  }
                  System.out.println("Date of Birth::\t" + contactDetail[0]);
                  System.out.println("Pet name::\t" + contactDetail[1]);
                  System.out.println("Contact Type::\t" + contactDetail[2]);
                  System.out.println("Address::\t" + contactDetail[3]);
                  System.out.println("Email Address::\t" + contactDetail[4]);
                  System.out.println("Phone No::\t" + contactDetail[5]);
                }
                break;

                //// ORDERING CONTACTS BY TAG..............
                // dob:petname:tag:address:email1,email2,email3..:ph1,ph2,...:crtdate
              case 3:
                ArrayList<String> familyList = new ArrayList<String>();
                ArrayList<String> friendsList = new ArrayList<String>();
                ArrayList<String> colleaguesList = new ArrayList<String>();
                ArrayList<String> othersList = new ArrayList<String>();
                line4 = "";
                parts = null;
                br = new BufferedReader(new FileReader(contactBookName));
                while ((line4 = br.readLine()) != null) {
                  parts = line4.split(":");
                  String relation = parts[2];

                  if (relation.equals("Family")) {
                    familyList.add(line4);
                  } else if (relation.equals("Friend")) {
                    friendsList.add(line4);
                  } else if (relation.equals("Associate")) {
                    colleaguesList.add(line4);
                  } else {
                    othersList.add(line4);
                  }
                }
                if (familyList.isEmpty()
                    && friendsList.isEmpty()
                    && colleaguesList.isEmpty()
                    && othersList.isEmpty()) {
                  System.out.println("NO CONTACTS AVAILABLE.");
                } else {
                  System.out.println("\nCONTACTS BELOW ARE LISTED ACCORDING TO TAGS");
                  System.out.println("--------------------------------------------------------");
                }
                if (!familyList.isEmpty()) {
                  System.out.println("\nFAMILY CONTACTS\n----------------------------");
                  for (Object s : familyList) {
                    String[] nameContact = s.toString().split("=");
                    System.out.println(nameContact[0] + "\n");
                    String[] contactDetail = nameContact[1].split(":");
                    for (int i = 0; i < contactDetail.length; i++) {
                      if (contactDetail[i].trim().compareTo("") == 0) {
                        contactDetail[i] = "Unavailable";
                      }
                    }
                    System.out.println("   Date of Birth::\t" + contactDetail[0]);
                    System.out.println("   Pet name::\t\t" + contactDetail[1]);
                    System.out.println("   Address::\t\t" + contactDetail[3]);
                    System.out.println("   Email Address::\t" + contactDetail[4]);
                    System.out.println("   Phone No::\t\t" + contactDetail[5]);
                    System.out.println("   Contact added::\t" + contactDetail[6]);
                  }
                }

                if (!friendsList.isEmpty()) {
                  System.out.println("\nFRIEND CONTACTS\n----------------------------");
                  for (Object s : friendsList) {
                    String[] nameContact = s.toString().split("=");
                    System.out.println(nameContact[0] + "\n");
                    String[] contactDetail = nameContact[1].split(":");
                    for (int i = 0; i < contactDetail.length; i++) {
                      if (contactDetail[i].trim().compareTo("") == 0) {
                        contactDetail[i] = "Unavailable";
                      }
                    }
                    System.out.println("   Date of Birth::\t" + contactDetail[0]);
                    System.out.println("   Pet name::\t\t" + contactDetail[1]);
                    System.out.println("   Address::\t\t" + contactDetail[3]);
                    System.out.println("   Email Address::\t" + contactDetail[4]);
                    System.out.println("   Phone No::\t\t" + contactDetail[5]);
                    System.out.println("   Contact added::\t" + contactDetail[6]);
                  }
                }
                if (!colleaguesList.isEmpty()) {
                  System.out.println("\nASSOCIATE CONTACTS\n----------------------------");
                  for (Object s : colleaguesList) {
                    String[] nameContact = s.toString().split("=");
                    System.out.println(nameContact[0] + "\n");
                    String[] contactDetail = nameContact[1].split(":");
                    for (int i = 0; i < contactDetail.length; i++) {
                      if (contactDetail[i].trim().compareTo("") == 0) {
                        contactDetail[i] = "Unavailable";
                      }
                    }
                    System.out.println("   Date of Birth::\t" + contactDetail[0]);
                    System.out.println("   Pet name::\t\t" + contactDetail[1]);
                    System.out.println("   Address::\t\t" + contactDetail[3]);
                    System.out.println("   Email Address::\t" + contactDetail[4]);
                    System.out.println("   Phone No::\t\t" + contactDetail[5]);
                    System.out.println("   Contact added::\t" + contactDetail[6]);
                  }
                }

                if (!othersList.isEmpty()) {
                  System.out.println("\nOTHER CONTACTS\n----------------------------");
                  for (Object s : othersList) {
                    String[] nameContact = s.toString().split("=");
                    System.out.println(nameContact[0] + "\n");
                    String[] contactDetail = nameContact[1].split(":");
                    for (int i = 0; i < contactDetail.length; i++) {
                      if (contactDetail[i].trim().compareTo("") == 0) {
                        contactDetail[i] = "Unavailable";
                      }
                    }
                    System.out.println("   Date of Birth::\t" + contactDetail[0]);
                    System.out.println("   Pet name::\t\t" + contactDetail[1]);
                    System.out.println("   Address::\t\t" + contactDetail[3]);
                    System.out.println("   Email Address::\t" + contactDetail[4]);
                    System.out.println("   Phone No::\t\t" + contactDetail[5]);
                    System.out.println("   Contact added::\t" + contactDetail[6]);
                  }
                }
                break;

              case 4:
                break;
              default:
                System.out.println("\nENTER ONLY INTEGERS IN THE RANGE 1-5");
                break;
            }
          }
          break;
          // SEARCH CONTACTS BOOK...
        case 5:
          String[] details1 = null;
          line4 = "";
          searchString = "";
          parts = null;
          String addedDetails = "";
          fileReader = new BufferedReader(new FileReader(contactBookName));
          System.out.println("ENTER THE STRING TO BE SERCHED FOR IN THE CONTACTS BOOK");
          searchString = stringReader.nextLine();
          ArrayList<String> nameMatchList = new ArrayList<String>();
          ArrayList<String> emailMatchList = new ArrayList<String>();
          ArrayList<String> tagMatchList = new ArrayList<String>();
          ArrayList<String> addressMatchList = new ArrayList<String>();
          ArrayList<String> dobMatchList = new ArrayList<String>();
          ArrayList<String> phoneMatchList = new ArrayList<String>();
          ArrayList<String> petNameMatchList = new ArrayList<String>();
          String addedString = "";
          while ((line4 = fileReader.readLine()) != null) {
            parts = line4.split("=");
            name = parts[0];
            details1 = parts[1].split(":");
            dateOfBirth = details1[0];
            petName = details1[1];
            contactType = details1[2];
            address = details1[3];
            email = details1[4];
            phoneList = details1[5];
            contactAdded = details1[6];

            addedString = "";
            // System.out.println("name = "+name+" dateOfbirth = "+dateOfBirth+" petName
            // ="+petName+" contactType ="+contactType+"address ="+address+"email
            // ="+email+"phoneList ="+phoneList);

            if (name.contains(searchString)) {
              addedString =
                  name
                      + "="
                      + dateOfBirth
                      + ":"
                      + petName
                      + ":"
                      + contactType
                      + ":"
                      + address
                      + ":"
                      + email
                      + ":"
                      + phoneList
                      + ":"
                      + contactAdded;
              nameMatchList.add(addedString);
            }

            if (dateOfBirth.contains(searchString)) {
              addedString =
                  name
                      + "="
                      + dateOfBirth
                      + ":"
                      + petName
                      + ":"
                      + contactType
                      + ":"
                      + address
                      + ":"
                      + email
                      + ":"
                      + phoneList
                      + ":"
                      + contactAdded;
              dobMatchList.add(addedString);
            }

            if (petName.contains(searchString)) {
              addedString =
                  name
                      + "="
                      + dateOfBirth
                      + ":"
                      + petName
                      + ":"
                      + contactType
                      + ":"
                      + address
                      + ":"
                      + email
                      + ":"
                      + phoneList
                      + ":"
                      + contactAdded;
              petNameMatchList.add(addedString);
            }

            if (contactType.contains(searchString)) {
              addedString =
                  name
                      + "="
                      + dateOfBirth
                      + ":"
                      + petName
                      + ":"
                      + contactType
                      + ":"
                      + address
                      + ":"
                      + email
                      + ":"
                      + phoneList
                      + ":"
                      + contactAdded;
              tagMatchList.add(addedString);
            }

            if (address.contains(searchString)) {
              addedString =
                  name
                      + "="
                      + dateOfBirth
                      + ":"
                      + petName
                      + ":"
                      + contactType
                      + ":"
                      + address
                      + ":"
                      + email
                      + ":"
                      + phoneList
                      + ":"
                      + contactAdded;
              addressMatchList.add(addedString);
            }

            if (email.contains(searchString)) {
              addedString =
                  name
                      + "="
                      + dateOfBirth
                      + ":"
                      + petName
                      + ":"
                      + contactType
                      + ":"
                      + address
                      + ":"
                      + email
                      + ":"
                      + phoneList
                      + ":"
                      + contactAdded;
              emailMatchList.add(addedString);
            }

            if (phoneList.contains(searchString)) {
              addedString =
                  name
                      + "="
                      + dateOfBirth
                      + ":"
                      + petName
                      + ":"
                      + contactType
                      + ":"
                      + address
                      + ":"
                      + email
                      + ":"
                      + phoneList
                      + ":"
                      + contactAdded;
              phoneMatchList.add(addedString);
            }
          }
          System.out.println(
              "\nTOTAL NUMBER OF MATCHES = "
                  + (nameMatchList.size()
                      + dobMatchList.size()
                      + petNameMatchList.size()
                      + tagMatchList.size()
                      + addressMatchList.size()
                      + emailMatchList.size()
                      + phoneMatchList.size()));
          if (!nameMatchList.isEmpty()) {
            System.out.println(
                "\nTOTAL " + nameMatchList.size() + " NAMES MATCH WITh " + searchString + "\n");
            System.out.println(
                "\nTHE NAMES OF THE FOLLOWING CONTACTS MATCHES WITH THE SEARCH STRING ");
            System.out.println(
                "--------------------------------------------------------------------------------\n");

            for (Object s : nameMatchList) {
              showContactByType(s, 2);
            }
          }
          if (!dobMatchList.isEmpty()) {
            System.out.println(
                "\nTOTAL " + dobMatchList.size() + " DOBS' MATCH WITH " + searchString + "\n");
            System.out.println(
                "\nTHE DOB'S OF THE FOLLOWING CONTACTS MATCHES WITH THE SEARCH STRING ");
            System.out.println(
                "--------------------------------------------------------------------------------\n");

            for (Object s : dobMatchList) {
              showContactByType(s, 2);
            }
          }
          if (!petNameMatchList.isEmpty()) {
            System.out.println(
                "\nTOTAL "
                    + petNameMatchList.size()
                    + " PET NAMES MATCH WITH  "
                    + searchString
                    + "\n");
            System.out.println(
                "\nTHE PET NAMES OF THE FOLLOWING CONTACTS MATCHES WITH THE SEARCH STRING ");
            System.out.println(
                "--------------------------------------------------------------------------------\n");

            for (Object s : petNameMatchList) {
              showContactByType(s, 2);
            }
          }
          if (!tagMatchList.isEmpty()) {
            System.out.println(
                "\nTOTAL "
                    + tagMatchList.size()
                    + " CONTACT TYPES MATCH WITH THE "
                    + searchString
                    + "\n");
            System.out.println(
                "\nTHE TAGS OF THE FOLLOWING CONTACTS MATCHES WITH THE SEARCH STRING ");
            System.out.println(
                "--------------------------------------------------------------------------------\n");

            for (Object s : tagMatchList) {
              showContactByType(s, 2);
            }
          }
          if (!addressMatchList.isEmpty()) {
            System.out.println(
                "\nTOTAL "
                    + addressMatchList.size()
                    + " ADDRESSES MATCH WITH "
                    + searchString
                    + "\n");
            System.out.println(
                "\nTHE ADDRESSES OF THE FOLLOWING CONTACTS MATCHES WITH THE SEARCH STRING ");
            System.out.println(
                "--------------------------------------------------------------------------------\n");

            for (Object s : addressMatchList) {
              showContactByType(s, 2);
            }
          }
          if (!emailMatchList.isEmpty()) {
            System.out.println(
                "\nTOTAL " + emailMatchList.size() + " EMAILS MATCH WITH " + searchString + "\n");
            System.out.println(
                "\nTHE EMAIL'S OF THE FOLLOWING CONTACTS MATCHES WITH THE SEARCH STRING ");
            System.out.println(
                "--------------------------------------------------------------------------------\n");

            for (Object s : emailMatchList) {
              showContactByType(s, 2);
            }
          }
          if (!phoneMatchList.isEmpty()) {
            System.out.println(
                "\nTOTAL "
                    + phoneMatchList.size()
                    + " CONTACT NUMBERS MATCH WITH "
                    + searchString
                    + "\n");
            System.out.println(
                "\nTHE PHONE NUMBERS OF THE FOLLOWING CONTACTS MATCHES WITH THE SEARCH STRING ");
            System.out.println(
                "--------------------------------------------------------------------------------\n");

            for (Object s : phoneMatchList) {
              showContactByType(s, 2);
            }
          }

          break;
        case 6:
          break;

        default:
          System.out.println("\nENTER ONLY NUMBERS  RANGED FROM 1-6");
          break;
      }
    }
    // fileReader.close();
    // fileWriter.close();
    // stringReader.close();
    // sc.close();
  }
Example #16
0
 @Override
 public final synchronized Iterator<String> iterator() {
   return props.keySet().iterator();
 }
Example #17
0
  /**
   * Update the UI components to reflect the current per-file status.
   *
   * @param status The current node status.
   * @param novelty The per-file novelty flags.
   * @param offline The revision numbers of the offline checked-in versions.
   */
  protected synchronized void updateNodeStatus(
      NodeStatus status,
      TreeMap<VersionID, TreeMap<FileSeq, boolean[]>> novelty,
      TreeSet<VersionID> offline) {
    super.updateNodeStatus(status, false);

    pNovelty = novelty;
    pOffline = offline;

    NodeDetailsLight details = null;
    if (pStatus != null) details = pStatus.getLightDetails();

    /* files */
    {
      pFileSeqsTab.removeAll();
      pFileSeqsBox.removeAll();
      pFileSeqPanels.clear();

      if ((pNovelty != null) && (details != null)) {
        NodeMod mod = details.getWorkingVersion();
        NodeVersion vsn = details.getLatestVersion();

        NodeCommon com = null;
        if (mod != null) com = mod;
        else if (vsn != null) com = vsn;
        else assert (false);

        /* get the primary and unique secondary file sequences */
        FileSeq primary = com.getPrimarySequence();
        TreeSet<FileSeq> secondary = new TreeSet<FileSeq>();
        {
          secondary.addAll(com.getSecondarySequences());

          TreeSet<FileSeq> unique = new TreeSet<FileSeq>();
          for (TreeMap<FileSeq, boolean[]> table : pNovelty.values()) unique.addAll(table.keySet());

          for (FileSeq ufseq : unique) {
            boolean found = false;

            if (ufseq.similarTo(primary)) found = true;
            else {
              for (FileSeq fseq : secondary) {
                if (ufseq.similarTo(fseq)) {
                  found = true;
                  break;
                }
              }
            }

            if (!found) secondary.add(ufseq);
          }
        }

        /* add the file sequence UI components */
        addFileSeqPanel(primary);
        for (FileSeq fseq : secondary) addFileSeqPanel(fseq);

        if (pIsListLayout) pFileSeqsBox.add(UIFactory.createFiller(sSize));
      }
    }

    pFileSeqsTab.setVisible(!pIsListLayout);
    pFileSeqsScroll.setVisible(pIsListLayout);

    if (pIsListLayout) pFileSeqsScroll.revalidate();
    else pFileSeqsTab.revalidate();
  }
Example #18
0
  /** Add the UI components for the given file sequence to the panel. */
  private void addFileSeqPanel(FileSeq fseq) {
    boolean isPresentInWorking = false;
    if ((pStatus != null) && pStatus.hasLightDetails()) {
      NodeDetailsLight details = pStatus.getLightDetails();
      NodeMod mod = details.getWorkingVersion();
      if (mod != null) {
        if (mod.getPrimarySequence().equals(fseq)) isPresentInWorking = true;
        else {
          for (FileSeq sfseq : mod.getSecondarySequences()) {
            if (sfseq.equals(fseq)) {
              isPresentInWorking = true;
              break;
            }
          }
        }
      }
    }

    /* collate the row information */
    ArrayList<VersionID> vids = new ArrayList<VersionID>();
    ArrayList<FileSeq> singles = new ArrayList<FileSeq>();
    TreeSet<FileSeq> enabled = new TreeSet<FileSeq>();
    TreeMap<FileSeq, FileState> fstates = new TreeMap<FileSeq, FileState>();
    TreeMap<FileSeq, NativeFileInfo> finfos = new TreeMap<FileSeq, NativeFileInfo>();
    TreeMap<FileSeq, QueueState> qstates = new TreeMap<FileSeq, QueueState>();
    TreeMap<FileSeq, Boolean[]> novel = new TreeMap<FileSeq, Boolean[]>();
    {
      TreeMap<FileSeq, Integer> wsingles = new TreeMap<FileSeq, Integer>();
      if ((pStatus != null) && pStatus.hasLightDetails()) {
        if (isPresentInWorking) {
          if (pStatus.hasHeavyDetails()) {
            NodeDetailsHeavy details = pStatus.getHeavyDetails();

            FileState[] fs = details.getFileStates(fseq);
            QueueState[] qs = details.getQueueStates();
            NativeFileInfo[] infos = details.getFileInfos(fseq);
            if ((fs != null) && (qs != null) && (infos != null)) {
              int wk;
              for (wk = 0; wk < fs.length; wk++) {
                FileSeq sfseq = new FileSeq(fseq, wk);
                wsingles.put(sfseq, wk);

                fstates.put(sfseq, fs[wk]);
                finfos.put(sfseq, infos[wk]);
                qstates.put(sfseq, qs[wk]);

                if (fs[wk] != FileState.CheckedIn) enabled.add(sfseq);
              }
            }
          } else {
            NodeDetailsLight details = pStatus.getLightDetails();

            int wk;
            for (wk = 0; wk < fseq.numFrames(); wk++) {
              FileSeq sfseq = new FileSeq(fseq, wk);
              wsingles.put(sfseq, wk);

              if (details.getVersionState() == VersionState.CheckedIn) {
                fstates.put(sfseq, FileState.CheckedIn);
                qstates.put(sfseq, QueueState.Undefined);
              } else {
                enabled.add(sfseq);
              }
            }
          }
        }

        {
          vids.addAll(pNovelty.keySet());
          Collections.reverse(vids);

          int idx = 0;
          for (VersionID vid : vids) {
            TreeMap<FileSeq, boolean[]> table = pNovelty.get(vid);
            for (FileSeq nfseq : table.keySet()) {
              if (fseq.similarTo(nfseq)) {
                boolean[] flags = table.get(nfseq);

                int wk;
                for (wk = 0; wk < flags.length; wk++) {
                  FileSeq sfseq = new FileSeq(nfseq, wk);
                  if (!wsingles.containsKey(sfseq)) wsingles.put(sfseq, null);

                  Boolean[] rflags = novel.get(sfseq);
                  if (rflags == null) {
                    rflags = new Boolean[pNovelty.size()];
                    novel.put(sfseq, rflags);
                  }

                  rflags[idx] = new Boolean(flags[wk]);
                }

                break;
              }
            }

            idx++;
          }
        }
      }

      TreeMap<Integer, FileSeq> order = new TreeMap<Integer, FileSeq>();
      for (FileSeq sfseq : wsingles.keySet()) {
        int frame = -1;
        if (sfseq.hasFrameNumbers()) frame = sfseq.getFrameRange().getStart();

        order.put(frame, sfseq);
      }

      singles.addAll(order.values());
    }

    /* add the panel */
    {
      JFileSeqPanel panel =
          new JFileSeqPanel(
              this,
              pManagerPanel,
              pStatus,
              pPrivilegeDetails,
              fseq,
              vids,
              pOffline,
              singles,
              fstates,
              finfos,
              qstates,
              enabled,
              novel,
              pIsListLayout);

      if (pIsListLayout) pFileSeqsBox.add(panel);
      else pFileSeqsTab.addTab(fseq.getFilePattern().toString(), sTabIcon, panel);

      pFileSeqPanels.put(fseq, panel);
    }
  }