コード例 #1
0
  /**
   * Edits an entry to the cache value in page session.
   *
   * @param values Map of attribute name to value.
   * @throws AMConsoleException if there are duplicate entries.
   */
  protected void editEntry(Map values) throws AMConsoleException {
    List list = (List) getPageSessionAttribute("samlPropertyAttributes");
    int index = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));

    String value = AMPipeDelimitAttrTokenizer.getInstance().deTokenizes(values);
    int count = 0;

    for (Iterator i = list.iterator(); i.hasNext(); ) {
      String v = (String) i.next();
      if ((count != index) && v.equals(value)) {
        throw new AMConsoleException("saml.profile.trustedPartner.already.exists");
      }
      count++;
    }
    list.set(index, value);
    Set set = new HashSet(list);
    try {
      FSSAMLServiceModel model = (FSSAMLServiceModel) getModel();
      model.modifyTrustPartners(set);
      setInlineAlertMessage(
          CCAlert.TYPE_INFO, "message.information", "saml.message.trusted.partner.updated");
    } catch (AMConsoleException e) {
      setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
  }
コード例 #2
0
  public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    if (populateValues) {
      int index = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
      List list = (List) getPageSessionAttribute("samlPropertyAttributes");
      setValues(AMPipeDelimitAttrTokenizer.getInstance().tokenizes((String) list.get(index)));
    }

    Set attributeNames = getAttributeNames();
    if (attributeNames.contains(SAMLConstants.VERSION)) {
      CCDropDownMenu menu = (CCDropDownMenu) getChild(SAMLConstants.VERSION);
      String version = (String) menu.getValue();
      if ((version == null) || (version.length() == 0)) {
        menu.setValue("1.1");
      }
    }
  }
コード例 #3
0
 /**
  * Set value of a entry from the cache value in page session.
  *
  * @param idx Index of the entry in the cache Set.
  */
 protected void setValues(int idx) {
   Map mapAttrs = (Map) getPageSessionAttribute(FSSAMLServiceViewBean.PROPERTY_ATTRIBUTE);
   OrderedSet set = (OrderedSet) mapAttrs.get(FederationViewBean.TABLE_TRUSTED_PARTNERS);
   setValues(AMPipeDelimitAttrTokenizer.getInstance().tokenizes((String) set.get(idx)));
 }