Пример #1
0
  /**
   * Deletes sub configuration.
   *
   * @param event Request Invocation Event.
   * @throws ModelControlException if table model cannot be restored.
   */
  public void handleTblSubConfigButtonDeleteRequest(RequestInvocationEvent event)
      throws ModelControlException {
    submitCycle = true;
    CCActionTable tbl = (CCActionTable) getChild(AMPropertySheetModel.TBL_SUB_CONFIG);
    tbl.restoreStateData();
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    Integer[] selected = tblModel.getSelectedRows();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List list = (List) szCache.getSerializedObj();
    Set names = new HashSet(selected.length * 2);

    for (int i = 0; i < selected.length; i++) {
      SMSubConfig sc = (SMSubConfig) list.get(selected[i].intValue());
      names.add(sc.getName());
    }

    try {
      SubSchemaModel model = (SubSchemaModel) getModel();
      model.deleteSubConfigurations(names);

      if (selected.length == 1) {
        setInlineAlertMessage(
            CCAlert.TYPE_INFO, "message.information", "subconfig.message.deleted");
      } else {
        setInlineAlertMessage(
            CCAlert.TYPE_INFO, "message.information", "subconfig.message.deleted.pural");
      }
    } catch (AMConsoleException e) {
      setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }

    submitCycle = false;
    forwardTo();
  }
  /**
   * Handles remove request handlers request.
   *
   * @param event Request Invocation Event.
   */
  public void handleTblRequestHandlerListButtonDeleteRequest(RequestInvocationEvent event)
      throws ModelControlException {
    setSubmitCycle(true);
    CCActionTable table =
        (CCActionTable) getChild(SCSAML2SOAPBindingModelImpl.ATTRIBUTE_NAME_REQUEST_HANDLER_LIST);
    table.restoreStateData();
    CCActionTableModel tblModel =
        (CCActionTableModel)
            propertySheetModel.getModel(
                SCSAML2SOAPBindingModelImpl.ATTRIBUTE_NAME_REQUEST_HANDLER_LIST);
    Integer[] selected = tblModel.getSelectedRows();

    if ((selected != null) && (selected.length > 0)) {
      OrderedSet tblValues =
          (OrderedSet)
              getPageSessionAttribute(
                  SCSAML2SOAPBindingModelImpl.ATTRIBUTE_NAME_REQUEST_HANDLER_LIST);
      tblValues.removeAll(selected);
      setPageSessionAttribute(
          SCSAML2SOAPBindingModelImpl.ATTRIBUTE_NAME_REQUEST_HANDLER_LIST, tblValues);
      populateRequestHandlerListTable(tblValues);
      setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "message.profile.modified");
      setPageSessionAttribute(PAGE_MODIFIED, "1");
    }

    forwardTo();
  }
  /**
   * Called on request from the UI to delete an event handler.
   *
   * @param event Request Invocation Event.
   */
  @SuppressWarnings("unused")
  public void handleTblSubConfigButtonDeleteRequest(RequestInvocationEvent event)
      throws ModelControlException {
    submitCycle = true;
    CCActionTable tbl = (CCActionTable) getChild(TBL_SUB_CONFIG);
    tbl.restoreStateData();
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    Integer[] selected = tblModel.getSelectedRows();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List list = szCache.getSerializedObj();
    Set<String> names = new HashSet<>(selected.length * 2);

    for (Integer index : selected) {
      SMSubConfig sc = (SMSubConfig) list.get(index);
      names.add(sc.getName());
    }

    try {
      AbstractAuditModel model = (AbstractAuditModel) getModel();
      model.deleteEventHandles(names);

      if (selected.length == 1) {
        setInlineAlertMessage(TYPE_INFO, INFORMATION_MESSAGE, "event.handler.message.deleted");
      } else {
        setInlineAlertMessage(
            TYPE_INFO, INFORMATION_MESSAGE, "event.handler.message.deleted.plural");
      }
    } catch (AMConsoleException e) {
      setInlineAlertMessage(TYPE_ERROR, ERROR_MESSAGE, e.getMessage());
    }

    submitCycle = false;
    forwardTo();
  }
  private void populateTableModel(List<SMSubConfig> subConfigs) {
    CCActionTable tbl = (CCActionTable) getChild(TBL_SUB_CONFIG);
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    tblModel.clearAll();

    if (CollectionUtils.isEmpty(subConfigs)) {
      return;
    }
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List<SMSubConfig> cache = new ArrayList<>(subConfigs.size());
    boolean firstEntry = true;

    for (SMSubConfig conf : subConfigs) {
      if (firstEntry) {
        firstEntry = false;
      } else {
        tblModel.appendRow();
      }
      tblModel.setValue(TBL_SUB_CONFIG_DATA_NAME, conf.getName());
      tblModel.setValue(TBL_SUB_CONFIG_HREF_NAME, conf.getName());
      tblModel.setValue(TBL_SUB_CONFIG_DATA_TYPE, conf.getType());
      cache.add(conf);
    }
    szCache.setValue(cache);
  }
 /**
  * Instantiate each child view.
  *
  * @param table model
  * @param child component name
  */
 protected View createChild(CCActionTableModel tableModel, String name) {
   if (name.equals(CHILD_ACTION_TABLE)) {
     // Action table.
     CCActionTable child = new CCActionTable(this, tableModel, name);
     tableModel.setShowSelectionSortIcon(false);
     return child;
   } else if (tableModel.isChildSupported(name)) {
     // Create child from action table model.
     return tableModel.createChild(this, name);
   } else {
     throw new IllegalArgumentException("Invalid child name [" + name + "]");
   }
 }
 private void createTableModel() {
   tblModel =
       new CCActionTableModel(
           getClass()
               .getClassLoader()
               .getResourceAsStream("com/sun/identity/console/tblServerConfigAdvanced.xml"));
   tblModel.setTitleLabel("label.items");
   tblModel.setActionValue(TBL_BUTTON_ADD, "table.serverconfig.advanced.properties.button.new");
   tblModel.setActionValue(
       TBL_BUTTON_DELETE, "table.serverconfig.advanced.properties.button.delete");
   tblModel.setActionValue(
       TBL_COL_NAME, "table.serverconfig.advanced.properties.name.column.name");
   tblModel.setActionValue(
       TBL_COL_VALUE, "table.serverconfig.advanced.properties.value.column.name");
 }
  public View createChild(String name) {
    TraceUtil.trace3(new NonSyncStringBuffer("Entering: name is ").append(name).toString());

    if (name.equals(TILED_VIEW)) {
      return new VersionHighlightTiledView(this, getTableModel(VERSION_TABLE), name);
    } else if (name.equals(VERSION_TABLE)) {
      return createTable(name, TILED_VIEW);
    } else {
      CCActionTableModel model = super.isChildSupported(name);
      if (model != null) return model.createChild(this, name);
    }

    // child with no known parent
    throw new IllegalArgumentException("invalid child '" + name + "'");
  }
 protected void registerChildren() {
   super.registerChildren();
   ptModel.registerChildren(this);
   registerChild(PROPERTIES, CCTextField.class);
   registerChild(PGTITLE_THREE_BTNS, CCPageTitle.class);
   registerChild(TBL_PROPERTIES, CCActionTable.class);
   tblModel.registerChildren(this);
 }
  /**
   * Instantiate each child view.
   *
   * @param table model
   * @param child component name
   * @param tiled view name
   */
  protected View createChild(CCActionTableModel tableModel, String name, String tiledViewName) {

    // e.g. tileViewName can be "FileSystemSummaryView.CHILD_TILED_VIEW"

    if (name.equals(CHILD_ACTION_TABLE)) {
      // Action table.
      CCActionTable child = new CCActionTable(this, tableModel, name);
      tableModel.setShowSelectionSortIcon(false);
      child.setTiledView((ContainerView) getChild(tiledViewName));
      return child;
    } else if (tableModel.isChildSupported(name)) {
      // Create child from action table model.
      return tableModel.createChild(this, name);
    } else {
      throw new IllegalArgumentException("Invalid child name [" + name + "]");
    }
  }
  protected View createChild(String name) {
    View view = null;

    if (name.equals(PGTITLE_THREE_BTNS)) {
      view = new CCPageTitle(this, ptModel, name);
    } else if (name.equals(PROPERTIES)) {
      view = new CCTextField(this, name, "");
    } else if (ptModel.isChildSupported(name)) {
      view = ptModel.createChild(this, name);
    } else if (tblModel.isChildSupported(name)) {
      view = tblModel.createChild(this, name);
    } else if (name.equals(TBL_PROPERTIES)) {
      view = new CCActionTable(this, tblModel, name);
    } else {
      view = super.createChild(name);
    }
    return view;
  }
  /**
   * Handles remove handler request.
   *
   * @param event Request Invocation Event.
   */
  public void handleTblHandlersButtonDeleteRequest(RequestInvocationEvent event)
      throws ModelControlException {
    setSubmitCycle(true);
    CCActionTable table =
        (CCActionTable) getChild(WSAuthNServicesModelImpl.ATTRIBUTE_NAME_HANDLERS);
    table.restoreStateData();
    CCActionTableModel tblModel =
        (CCActionTableModel)
            propertySheetModel.getModel(WSAuthNServicesModelImpl.ATTRIBUTE_NAME_HANDLERS);
    Integer[] selected = tblModel.getSelectedRows();

    if ((selected != null) && (selected.length > 0)) {
      OrderedSet tblValues =
          (OrderedSet) getPageSessionAttribute(WSAuthNServicesModelImpl.ATTRIBUTE_NAME_HANDLERS);
      tblValues.removeAll(selected);
      setPageSessionAttribute(WSAuthNServicesModelImpl.ATTRIBUTE_NAME_HANDLERS, tblValues);
      populateHandlersTable(tblValues);
    }

    forwardTo();
  }
  private void initializeTableHeaders() {
    CCActionTableModel model = getTableModel(VERSION_TABLE);
    model.setRowSelected(false);

    model.setActionValue("NameColumn", "VersionHighlight.heading1");
    model.setActionValue("FirstColumn", "VersionHighlight.heading2");
    model.setActionValue("SecondColumn", "VersionHighlight.heading3");
    model.setActionValue("ThirdColumn", "VersionHighlight.heading4");
    model.setActionValue("SupportColumn", "VersionHighlight.heading5");
  }
  private void populateHandlersTable(Set handlers) {
    tablePopulated = true;
    CCActionTableModel tblModel =
        (CCActionTableModel)
            propertySheetModel.getModel(WSAuthNServicesModelImpl.ATTRIBUTE_NAME_HANDLERS);
    tblModel.clearAll();
    boolean firstEntry = true;
    int counter = 0;

    for (Iterator iter = handlers.iterator(); iter.hasNext(); ) {
      String c = (String) iter.next();
      WSAuthHandlerEntry entry = new WSAuthHandlerEntry(c);

      if (entry.isValid()) {
        if (!firstEntry) {
          tblModel.appendRow();
        } else {
          firstEntry = false;
        }

        tblModel.setValue(TBL_HANDLERS_DATA_KEY, entry.strKey);
        tblModel.setValue(TBL_HANDLERS_DATA_CLASS, entry.strClass);
        tblModel.setValue(TBL_HANDLERS_HREF_ACTION, Integer.toString(counter));
      }
      counter++;
    }

    setPageSessionAttribute(
        WSAuthNServicesModelImpl.ATTRIBUTE_NAME_HANDLERS, (OrderedSet) handlers);
  }
Пример #14
0
  private void populateTableModel(List subconfig) {
    CCActionTable tbl = (CCActionTable) getChild(AMPropertySheetModel.TBL_SUB_CONFIG);
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    tblModel.clearAll();

    if (subconfig != null) {
      SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
      List cache = new ArrayList(subconfig.size());

      if (!subconfig.isEmpty()) {
        tblModel.clearAll();
        boolean firstEntry = true;

        for (Iterator iter = subconfig.iterator(); iter.hasNext(); ) {
          if (firstEntry) {
            firstEntry = false;
          } else {
            tblModel.appendRow();
          }
          SMSubConfig conf = (SMSubConfig) iter.next();
          tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_DATA_NAME, conf.getName());
          tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_HREF_NAME, conf.getName());
          tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_DATA_TYPE, conf.getType());
          cache.add(conf);
        }
      }
      szCache.setValue((ArrayList) cache);
    }
  }
  private void populateTableModel(Set properties) {
    tblModel.clearAll();
    ServerSiteModel model = (ServerSiteModel) getModel();

    if ((properties == null) || properties.isEmpty()) {
      properties = new HashSet(2);
      properties.add("=");
    }

    int counter = 0;
    for (Iterator iter = properties.iterator(); iter.hasNext(); counter++) {
      if (counter > 0) {
        tblModel.appendRow();
      }
      String t = (String) iter.next();
      int idx = t.indexOf('=');
      String name = t.substring(0, idx).trim();
      String value = t.substring(idx + 1).trim();

      tblModel.setValue(TBL_DATA_NAME, name);
      tblModel.setValue(TBL_DATA_VALUE, value);
      tblModel.setSelectionVisible(counter, true);
    }
  }
  private void populateRequestHandlerListTable(Set handlers) {
    tablePopulated = true;
    CCActionTableModel tblModel =
        (CCActionTableModel)
            propertySheetModel.getModel(
                SCSAML2SOAPBindingModelImpl.ATTRIBUTE_NAME_REQUEST_HANDLER_LIST);

    tblModel.clearAll();
    boolean firstEntry = true;
    int counter = 0;

    for (Iterator iter = handlers.iterator(); iter.hasNext(); ) {
      String c = (String) iter.next();
      SAML2SOAPBindingRequestHandler entry = new SAML2SOAPBindingRequestHandler(c);

      if (entry.isValid()) {
        if (!firstEntry) {
          tblModel.appendRow();
        } else {
          firstEntry = false;
        }

        tblModel.setValue(TBL_REQUEST_HANDLER_LIST_DATA_KEY, entry.strKey);
        tblModel.setValue(TBL_REQUEST_HANDLER_LIST_DATA_CLASS, entry.strClass);
        tblModel.setValue(TBL_REQUEST_HANDLER_LIST_HREF_EDIT_ACTION, Integer.toString(counter));
        tblModel.setValue(
            TBL_REQUEST_HANDLER_LIST_LABEL_EDIT_ACTION,
            "soapBinding.service.table.requestHandlerList.action.edit.label");
        tblModel.setValue(TBL_REQUEST_HANDLER_LIST_HREF_DUP_ACTION, Integer.toString(counter));
        tblModel.setValue(
            TBL_REQUEST_HANDLER_LIST_LABEL_DUP_ACTION,
            "soapBinding.service.table.requestHandlerList.action.dup.label");
      }
      counter++;
    }

    setPageSessionAttribute(
        SCSAML2SOAPBindingModelImpl.ATTRIBUTE_NAME_REQUEST_HANDLER_LIST, (OrderedSet) handlers);
  }
 private void createHandlersTableModel() {
   CCActionTableModel tblModel =
       new CCActionTableModel(
           getClass()
               .getClassLoader()
               .getResourceAsStream("com/sun/identity/console/tblWSAuthentication.xml"));
   tblModel.setTitleLabel("label.items");
   tblModel.setActionValue(
       TBL_HANDLERS_COL_KEY, "webservices.authentication.service.table.handlers.key");
   tblModel.setActionValue(
       TBL_HANDLERS_COL_CLASS, "webservices.authentication.service.table.handlers.class");
   tblModel.setActionValue(
       TBL_HANDLERS_ADD_BTN, "webservices.authentication.service.table.handlers.add.button");
   tblModel.setActionValue(
       TBL_HANDLERS_DELETE_BTN, "webservices.authentication.service.table.handlers.delete.button");
   propertySheetModel.setModel(WSAuthNServicesModelImpl.ATTRIBUTE_NAME_HANDLERS, tblModel);
 }
  private void createRequestHandlerListTableModel() {
    CCActionTableModel tblModel =
        new CCActionTableModel(
            getClass()
                .getClassLoader()
                .getResourceAsStream(
                    "com/sun/identity/console/tblSAML2SOAPBindingRequestHandlerList.xml"));

    tblModel.setTitleLabel("label.items");
    tblModel.setActionValue(
        TBL_REQUEST_HANDLER_LIST_COL_KEY, "soapBinding.service.table.requestHandlerList.key");
    tblModel.setActionValue(
        TBL_REQUEST_HANDLER_LIST_COL_CLASS, "soapBinding.service.table.requestHandlerList.class");
    tblModel.setActionValue(
        TBL_REQUEST_HANDLER_LIST_COL_ACTION, "soapBinding.service.table.requestHandlerList.action");
    tblModel.setActionValue(
        TBL_REQUEST_HANDLER_LIST_ADD_BTN,
        "soapBinding.service.table.requestHandlerList.add.button");
    tblModel.setActionValue(
        TBL_REQUEST_HANDLER_LIST_DELETE_BTN,
        "soapBinding.service.table.requestHandlerList.delete.button");
    propertySheetModel.setModel(
        SCSAML2SOAPBindingModelImpl.ATTRIBUTE_NAME_REQUEST_HANDLER_LIST, tblModel);
  }
 /**
  * Register each child view.
  *
  * @param table model
  */
 protected void registerChildren(CCActionTableModel tableModel) {
   registerChild(CHILD_ACTION_TABLE, CCActionTable.class);
   tableModel.registerChildren(this);
 }
  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);
          }
        }
      }
    }
  }