Ejemplo n.º 1
0
  private Library getMyLibrary() throws SamFSException {
    TraceUtil.trace3("Entering");

    SamQFSSystemModel sysModel = SamUtil.getModel(serverName);

    Library myLibrary = sysModel.getSamQFSSystemMediaManager().getLibraryByName(libraryName);

    if (myLibrary == null) {
      throw new SamFSException(null, -2502);
    } else {
      TraceUtil.trace3("Exiting");
      return myLibrary;
    }
  }
  /** retrieve the criteria copy information for this criteria */
  public ArchivePolCriteriaCopy[] getCriteriaCopies() {
    HttpServletRequest request = RequestManager.getRequestContext().getRequest();
    ArchivePolCriteriaCopy[] copies =
        (ArchivePolCriteriaCopy[]) request.getAttribute(CRITERIA_COPIES);

    if (copies != null) return copies;

    // get  the policy
    CommonViewBeanBase parent = (CommonViewBeanBase) getParentViewBean();
    String serverName = parent.getServerName();
    String policyName = (String) parent.getPageSessionAttribute(Constants.Archive.POLICY_NAME);
    Integer criteriaNumber =
        (Integer) parent.getPageSessionAttribute(Constants.Archive.CRITERIA_NUMBER);

    Integer policyType = (Integer) parent.getPageSessionAttribute(Constants.Archive.POLICY_TYPE);

    if (criteriaNumber == null && (policyType.shortValue()) == ArSet.AR_SET_TYPE_DEFAULT) {

      // default to the only criteria of this policy
      criteriaNumber = new Integer(0);
      parent.setPageSessionAttribute(Constants.Archive.CRITERIA_NUMBER, criteriaNumber);
    }

    // get the criteria
    try {
      SamQFSSystemModel sysModel = SamUtil.getModel(serverName);

      ArchivePolicy thePolicy =
          sysModel.getSamQFSSystemArchiveManager().getArchivePolicy(policyName);
      ArchivePolCriteria criteria = thePolicy.getArchivePolCriteria(criteriaNumber.intValue());
      copies = criteria.getArchivePolCriteriaCopies();
      request.setAttribute(CRITERIA_COPIES, copies);
    } catch (SamFSException sfe) {
      SamUtil.processException(
          sfe,
          this.getClass(),
          "getCriteriaCopies",
          "Unable to load policy criteria copies",
          serverName);
    }

    // return the criteria copies
    return copies;
  }