protected AMModel getModelInternal() {
   HttpServletRequest req = RequestManager.getRequestContext().getRequest();
   try {
     return new WSAuthNServicesModelImpl(req, serviceName, getPageSessionAttributes());
   } catch (AMConsoleException e) {
     setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
   }
   return null;
 }
 @Override
 protected void initialize(String serviceName) {
   HttpServletRequest req = RequestManager.getRequestContext().getRequest();
   String location = req.getParameter("Location");
   if (isNotBlank(location)) {
     setPageSessionAttribute(CURRENT_REALM, hexToString(location));
   }
   super.initialize(serviceName);
 }
 private SubConfigModel getSubConfigModel() {
   HttpServletRequest req = RequestManager.getRequestContext().getRequest();
   try {
     return new SubConfigModelImpl(req, serviceName, "/", getPageSessionAttributes());
   } catch (AMConsoleException e) {
     setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
   }
   return null;
 }
 @Override
 protected AMModel getModelInternal() {
   HttpServletRequest req = RequestManager.getRequestContext().getRequest();
   try {
     return new GlobalAuditConfigModel(req, getPageSessionAttributes());
   } catch (AMConsoleException e) {
     setInlineAlertMessage(CCAlert.TYPE_ERROR, ERROR_MESSAGE, e.getMessage());
   }
   return null;
 }
Esempio n. 5
0
 protected AMModel getModelInternal() {
   RequestContext rc = RequestManager.getRequestContext();
   HttpServletRequest req = rc.getRequest();
   try {
     return new RestSTSModelImpl(req, getPageSessionAttributes());
   } catch (AMConsoleException e) {
     setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
     throw new IllegalStateException(
         "Exception getting model in RestSTSAddViewBean: " + e.getMessage(), e);
   }
 }
  protected AMModel getModelInternal() {
    AMModel model = null;
    HttpServletRequest req = RequestManager.getRequestContext().getRequest();
    String serviceName = (String) getPageSessionAttribute(AMServiceProfile.SERVICE_NAME);
    List parentIds = (List) getPageSessionAttribute(AMServiceProfile.PG_SESSION_SUB_CONFIG_IDS);
    String parentId = AMAdminUtils.getString(parentIds, "/", true);

    try {
      model = new SubConfigModelImpl(req, serviceName, parentId, getPageSessionAttributes());
    } catch (AMConsoleException e) {
      debug.error("SubConfigAddViewBean.getModelInternal", e);
    }

    return model;
  }
 protected void redirectToHome() {
   if (XuiRedirectHelper.isXuiAdminConsoleEnabled()) {
     RequestContext rc = RequestManager.getRequestContext();
     try {
       String realm = URLEncoder.encode(rc.getRequest().getParameter("realm"), "UTF-8");
       rc.getResponse().sendRedirect("../XUI#realms/" + realm + "/dashboard");
     } catch (UnsupportedEncodingException e) {
       throw new IllegalStateException("UTF-8 not supported", e);
     } catch (IOException e) {
       debug.message("Unexpected IOException during redirect", e);
     }
   } else {
     HomeViewBean vb = (HomeViewBean) getViewBean(HomeViewBean.class);
     backTrail();
     passPgSessionMap(vb);
     vb.forwardTo(getRequestContext());
   }
 }
  /** 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;
  }
 protected AMModel getModelInternal() {
   HttpServletRequest req = RequestManager.getRequestContext().getRequest();
   return new FSSAMLServiceModelImpl(req, getPageSessionAttributes());
 }
  public void populateVersionTable() throws SamFSException {
    CCActionTableModel model = getTableModel(VERSION_TABLE);
    model.clear();

    HttpSession session = RequestManager.getRequestContext().getRequest().getSession();
    HashMap myHashMap =
        (HashMap) session.getAttribute(Constants.SessionAttributes.VERSION_HIGHLIGHT);

    if (myHashMap == null) {
      // Start parsing the XML file

      try {
        SAXHandler.parseIt();
      } catch (SamFSException ex) {
        // Failed to parse version highlight XML file
        SamUtil.setErrorAlert(
            getParentViewBean(),
            ServerCommonViewBeanBase.CHILD_COMMON_ALERT,
            "VersionHighlight.error",
            ex.getSAMerrno(),
            ex.getMessage(),
            "");
        return;
      }

      // Retrieve the HashMap after parsing the XML file
      myHashMap = SAXHandler.getHashMap();

      // Save hashMap into Session
      session.setAttribute(Constants.SessionAttributes.VERSION_HIGHLIGHT, myHashMap);
    }

    for (int i = 0; i < myHashMap.size(); i++) {
      if (i > 0) {
        model.appendRow();
      }

      HighlightInfo highlightInfo = (HighlightInfo) myHashMap.get(new Integer(i));

      String featureType = highlightInfo.getFeatureType();
      featureType = featureType == null ? "" : featureType;

      // pre-populate blank images into the model,
      // overwrite them later if necessary
      model.setValue("FirstImage", Constants.Image.ICON_BLANK);
      model.setValue("SecondImage", Constants.Image.ICON_BLANK);
      model.setValue("ThirdImage", Constants.Image.ICON_BLANK);
      model.setValue("SupportText", "");

      // populate the feature name
      if (featureType.equals("summary")) {
        model.setValue(
            "NameText",
            new NonSyncStringBuffer("<b>")
                .append(SamUtil.getResourceString(highlightInfo.getFeatureName()))
                .append("</b>")
                .toString());
      } else {
        String heading = "---- ";
        if (featureType.equals("detail")) {
          heading = "-- ";
        }
        model.setValue(
            "NameText",
            new NonSyncStringBuffer(heading)
                .append(SamUtil.getResourceString(highlightInfo.getFeatureName()))
                .toString());
        model.setValue("SupportText", highlightInfo.getServerVersion());

        String[] versionInfoArray = highlightInfo.getVersionInfo().split("###");

        for (int j = 0; j < versionInfoArray.length; j++) {
          String[] versionInfo = versionInfoArray[j].split(",");

          if (versionInfo[0].equals("version.highlight.versionnumber.50")) {
            model.setValue("FirstImage", getImage(versionInfo[1]));
          } else if (versionInfo[0].equals("version.highlight.versionnumber.46")) {
            model.setValue("SecondImage", getImage(versionInfo[1]));
            model.setValue("FirstImage", Constants.Image.ICON_AVAILABLE);
          } else if (versionInfo[0].equals("version.highlight.versionnumber.45")) {
            model.setValue("ThirdImage", getImage(versionInfo[1]));
            model.setValue("FirstImage", Constants.Image.ICON_AVAILABLE);
            model.setValue("SecondImage", Constants.Image.ICON_AVAILABLE);
          } else {
            model.setValue("ThirdImage", Constants.Image.ICON_AVAILABLE);
            model.setValue("FirstImage", Constants.Image.ICON_AVAILABLE);
            model.setValue("SecondImage", Constants.Image.ICON_AVAILABLE);
          }
        }
      }
    }
  }