/** To construct the copy information string in the summary page */
  private void constructCopyInfoString(SamWizardModel wizardModel) {
    int totalCopies = ((Integer) wizardModel.getValue(ISPolicyWizardImpl.TOTAL_COPIES)).intValue();
    if (totalCopies == 0) {
      return;
    }
    // Grab the HashMap that contains copy information from wizardModel
    HashMap copyNumberHashMap = (HashMap) wizardModel.getValue(ISPolicyWizardImpl.COPY_HASHMAP);

    NonSyncStringBuffer buf = new NonSyncStringBuffer();

    for (int i = 0; i < totalCopies; i++) {
      // Retrieve the CopyInfo data structure from the HashMap
      CopyInfo info = (CopyInfo) copyNumberHashMap.get(new Integer(i + 1));
      if (info == null) {
        // won't happen
        continue;
      }
      ArchiveCopyGUIWrapper myWrapper = info.getCopyWrapper();
      if (myWrapper == null) {
        // won't happen
        continue;
      }
      ArchivePolCriteriaCopy copy = myWrapper.getArchivePolCriteriaCopy();
      ArchiveCopy archiveCopy = myWrapper.getArchiveCopy();
      ArchiveVSNMap vsnMap = archiveCopy.getArchiveVSNMap();

      buf.append("<b>")
          .append(SamUtil.getResourceString("archiving.copynumber", Integer.toString(i + 1)))
          .append(": </b>")
          .append(copy.getArchiveAge())
          .append(" ")
          .append(SamUtil.getTimeUnitL10NString(copy.getArchiveAgeUnit()));

      // Comma and Media Type
      buf.append(", ");

      int mediaType = vsnMap != null ? vsnMap.getArchiveMediaType() : -1;
      String mediaTypeString;
      if (mediaType < 0) {
        mediaTypeString = SamUtil.getResourceString("common.mediatype.unknown");
      } else if (mediaType == BaseDevice.MTYPE_DISK) {
        mediaTypeString = SamUtil.getResourceString("common.mediatype.disk");
      } else {
        mediaTypeString = SamUtil.getMediaTypeString(mediaType);
      }

      buf.append(mediaTypeString);
      if (i % 2 == 1) {
        buf.append("<br>");
      } else {
        buf.append("&nbsp;&nbsp;&nbsp;");
      }
    }
    ((CCStaticTextField) getChild(COPY_INFO)).setValue(buf.toString());
  }
  private void showPreviousError(SamWizardModel wizardModel) {
    String error = (String) wizardModel.getValue(Constants.Wizard.WIZARD_ERROR);
    if (error != null) {
      if (error.equals(Constants.Wizard.WIZARD_ERROR_YES)) {
        previousError = true;

        String msgs = (String) wizardModel.getValue(Constants.Wizard.ERROR_MESSAGE);
        int code = Integer.parseInt((String) wizardModel.getValue(Constants.Wizard.ERROR_CODE));
        SamUtil.setErrorAlert(
            this,
            ISPolicyWizardSummaryView.ALERT,
            "NewArchivePolWizard.error.carryover",
            code,
            msgs,
            getServerName());
      }
    }
  }
  public void beginDisplay(DisplayEvent event) throws ModelControlException {
    TraceUtil.trace3("Entering");
    super.beginDisplay(event);
    SamWizardModel wizardModel = (SamWizardModel) getDefaultModel();
    showPreviousError(wizardModel);

    // Set the data class name of which will apply to the new policy
    ((CCStaticTextField) getChild(DATA_CLASS_NAME))
        .setValue((String) wizardModel.getValue(ISPolicyWizardImpl.SELECTED_DATA_CLASS));

    constructCopyInfoString(wizardModel);
    TraceUtil.trace3("Exiting");
  }
 private String getServerName() {
   SamWizardModel wizardModel = (SamWizardModel) getDefaultModel();
   String serverName =
       (String) wizardModel.getValue(Constants.PageSessionAttributes.SAMFS_SERVER_NAME);
   return serverName == null ? "" : serverName;
 }