Search in sources :

Example 66 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.

the class SCServiceProfileViewBean method handleTblSubConfigButtonDeleteRequest.

/**
     * 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();
}
Also used : SubSchemaModel(com.sun.identity.console.service.model.SubSchemaModel) HashSet(java.util.HashSet) Set(java.util.Set) CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) SerializedField(com.sun.identity.console.components.view.html.SerializedField) SMSubConfig(com.sun.identity.console.base.model.SMSubConfig) ArrayList(java.util.ArrayList) List(java.util.List) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashSet(java.util.HashSet)

Example 67 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.

the class SCSOAPBindingRequestHandlerListEditViewBean method handleButton1Request.

protected void handleButton1Request(Map values) throws AMConsoleException {
    SCSOAPBindingViewBean vb = (SCSOAPBindingViewBean) getViewBean(SCSOAPBindingViewBean.class);
    Map mapAttrs = (Map) getPageSessionAttribute(SCSOAPBindingViewBean.PROPERTY_ATTRIBUTE);
    OrderedSet serverList = (OrderedSet) mapAttrs.get(SCSOAPBindingModelImpl.ATTRIBUTE_NAME_REQUEST_HANDLER_LIST);
    int index = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
    String val = SOAPBindingRequestHandler.toString((String) values.get(ATTR_KEY), (String) values.get(ATTR_CLASS), (String) values.get(ATTR_ACTION));
    int count = 0;
    for (Iterator i = serverList.iterator(); i.hasNext(); ) {
        String v = (String) i.next();
        if ((count != index) && v.equals(val)) {
            throw new AMConsoleException("soapBinding.service.requestHandlerList.already.exist");
        }
        count++;
    }
    serverList.set(index, val);
    setPageSessionAttribute(SCSOAPBindingViewBean.PAGE_MODIFIED, "1");
    backTrail();
    unlockPageTrailForSwapping();
    passPgSessionMap(vb);
    vb.forwardTo(getRequestContext());
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) Iterator(java.util.Iterator) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Example 68 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.

the class SCSAML2SOAPBindingViewBean method handleTblRequestHandlerListHrefEditActionRequest.

/**
     * Handles edit request handler request.
     *
     * @param event Request Invocation Event.
     */
public void handleTblRequestHandlerListHrefEditActionRequest(RequestInvocationEvent event) throws ModelControlException {
    try {
        Map values = getValues();
        onBeforeSaveProfile(values);
        setPageSessionAttribute(PROPERTY_ATTRIBUTE, (HashMap) values);
        SCSAML2SOAPBindingRequestHandlerListEditViewBean vb = (SCSAML2SOAPBindingRequestHandlerListEditViewBean) getViewBean(SCSAML2SOAPBindingRequestHandlerListEditViewBean.class);
        unlockPageTrail();
        passPgSessionMap(vb);
        vb.populateValues((String) getDisplayFieldValue(TBL_REQUEST_HANDLER_LIST_HREF_EDIT_ACTION));
        vb.forwardTo(getRequestContext());
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 69 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.

the class SCSOAPBindingViewBean method handleTblRequestHandlerListButtonAddRequest.

/**
     * Handles add request handler request.
     *
     * @param event Request Invocation Event.
     */
public void handleTblRequestHandlerListButtonAddRequest(RequestInvocationEvent event) throws ModelControlException {
    try {
        Map values = getValues();
        onBeforeSaveProfile(values);
        setPageSessionAttribute(PROPERTY_ATTRIBUTE, (HashMap) values);
        SCSOAPBindingRequestHandlerListAddViewBean vb = (SCSOAPBindingRequestHandlerListAddViewBean) getViewBean(SCSOAPBindingRequestHandlerListAddViewBean.class);
        unlockPageTrail();
        passPgSessionMap(vb);
        vb.forwardTo(getRequestContext());
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 70 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.

the class TaskModelImpl method getEntities.

private Set getEntities(String realm, String cotName, boolean bIDP, boolean hosted) throws AMConsoleException {
    try {
        SAML2MetaManager mgr = new SAML2MetaManager();
        Set entities = getEntities(realm, cotName);
        Set results = new HashSet();
        for (Iterator i = entities.iterator(); i.hasNext(); ) {
            String entityId = (String) i.next();
            EntityConfigElement elm = mgr.getEntityConfig(realm, entityId);
            // elm could be null due to OPENAM-269
            if (elm != null && elm.isHosted() == hosted) {
                EntityDescriptorElement desc = mgr.getEntityDescriptor(realm, entityId);
                if (bIDP) {
                    if (SAML2MetaUtils.getIDPSSODescriptor(desc) != null) {
                        results.add(entityId);
                    }
                } else {
                    if (SAML2MetaUtils.getSPSSODescriptor(desc) != null) {
                        results.add(entityId);
                    }
                }
            }
        }
        return results;
    } catch (SAML2MetaException ex) {
        throw new AMConsoleException(ex.getMessage());
    }
}
Also used : TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Set(java.util.Set) Iterator(java.util.Iterator) SAML2MetaManager(com.sun.identity.saml2.meta.SAML2MetaManager) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) EntityDescriptorElement(com.sun.identity.saml2.jaxb.metadata.EntityDescriptorElement) SAML2MetaException(com.sun.identity.saml2.meta.SAML2MetaException) HashSet(java.util.HashSet) EntityConfigElement(com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement)

Aggregations

AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)701 Map (java.util.Map)255 Set (java.util.Set)206 HashMap (java.util.HashMap)193 HashSet (java.util.HashSet)148 SSOException (com.iplanet.sso.SSOException)126 Iterator (java.util.Iterator)122 List (java.util.List)97 SMSException (com.sun.identity.sm.SMSException)83 ArrayList (java.util.ArrayList)78 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)76 IdRepoException (com.sun.identity.idm.IdRepoException)58 SAML2MetaException (com.sun.identity.saml2.meta.SAML2MetaException)47 SAML2MetaManager (com.sun.identity.saml2.meta.SAML2MetaManager)46 AMIdentity (com.sun.identity.idm.AMIdentity)44 SAMLv2Model (com.sun.identity.console.federation.model.SAMLv2Model)41 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)41 CCActionTable (com.sun.web.ui.view.table.CCActionTable)40 TreeSet (java.util.TreeSet)39 CachedPolicy (com.sun.identity.console.policy.model.CachedPolicy)38