Search in sources :

Example 21 with EntitiesModel

use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.

the class EntityAddViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    EntitiesModel model = (EntitiesModel) getModel();
    String type = (String) getPageSessionAttribute(ENTITY_TYPE);
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    Map types = model.getSupportedEntityTypes(realmName);
    String i18nName = (String) types.get(type);
    String title = model.getLocalizedString("page.title.entities.create");
    Object[] param = { i18nName };
    ptModel.setPageTitleText(MessageFormat.format(title, param));
    if (hasNoAttributeToDisplay) {
        disableButton("button1", true);
    }
}
Also used : Map(java.util.Map) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 22 with EntitiesModel

use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.

the class EntityAddViewBean method handleButton1Request.

/**
     * Handles create realm request.
     *
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    submitCycle = true;
    EntitiesModel model = (EntitiesModel) getModel();
    AMPropertySheet prop = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
    String entityType = (String) getPageSessionAttribute(ENTITY_TYPE);
    String entityName = (String) propertySheetModel.getValue(ENTITY_NAME);
    entityName = entityName.trim();
    try {
        // null for agent type
        Map defaultValues = model.getDefaultAttributeValues(entityType, null, true);
        Map values = prop.getAttributeValues(defaultValues.keySet());
        String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        model.createEntity(realmName, entityName, entityType, values);
        forwardToEntitiesViewBean();
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
Also used : AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 23 with EntitiesModel

use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.

the class HomeViewBean method forwardTo.

public void forwardTo(RequestContext reqContext) throws NavigationException {
    EntitiesModel model = (EntitiesModel) getModel();
    AMViewConfig config = AMViewConfig.getInstance();
    List supported = config.getSupportedAgentTypes(model);
    if (supported.isEmpty()) {
        super.forwardTo(reqContext);
    } else {
        AgentsViewBean vb = (AgentsViewBean) getViewBean(AgentsViewBean.class);
        setPageSessionAttribute(AgentsViewBean.PG_SESSION_AGENT_TYPE, (String) supported.iterator().next());
        passPgSessionMap(vb);
        vb.forwardTo(reqContext);
    }
}
Also used : AMViewConfig(com.sun.identity.console.base.AMViewConfig) List(java.util.List) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 24 with EntitiesModel

use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.

the class EndUserViewBean method forwardTo.

public void forwardTo(RequestContext rc) {
    String userId = (String) getPageSessionAttribute(UNIVERSAL_ID);
    if (userId == null) {
        EntitiesModel model = (EntitiesModel) getModel();
        try {
            userId = model.getUserName();
            AMIdentity amid = IdUtils.getIdentity(model.getUserSSOToken(), userId);
            setPageSessionAttribute(UNIVERSAL_ID, userId);
            setPageSessionAttribute(EntityOpViewBeanBase.ENTITY_NAME, amid.getName());
            setPageSessionAttribute(EntityOpViewBeanBase.ENTITY_TYPE, amid.getType().getName());
            Set agentTypes = amid.getAttribute("AgentType");
            if ((agentTypes != null) && !agentTypes.isEmpty()) {
                setPageSessionAttribute(EntityOpViewBeanBase.ENTITY_AGENT_TYPE, (String) agentTypes.iterator().next());
            }
            super.forwardTo(rc);
        } catch (IdRepoException e) {
            AuthenticatedViewBean vb = (AuthenticatedViewBean) getViewBean(AuthenticatedViewBean.class);
            passPgSessionMap(vb);
            vb.forwardTo(rc);
        } catch (SSOException e) {
            AuthenticatedViewBean vb = (AuthenticatedViewBean) getViewBean(AuthenticatedViewBean.class);
            passPgSessionMap(vb);
            vb.forwardTo(rc);
        }
    } else {
        super.forwardTo(rc);
    }
}
Also used : AuthenticatedViewBean(com.sun.identity.console.base.AuthenticatedViewBean) Set(java.util.Set) AMIdentity(com.sun.identity.idm.AMIdentity) IdRepoException(com.sun.identity.idm.IdRepoException) SSOException(com.iplanet.sso.SSOException) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 25 with EntitiesModel

use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.

the class EndUserViewBean method getModelInternal.

protected AMModel getModelInternal() {
    HttpServletRequest req = RequestManager.getRequestContext().getRequest();
    EntitiesModel model = new EntitiesModelImpl(req, getPageSessionAttributes());
    model.setEndUser(true);
    return model;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) EntitiesModelImpl(com.sun.identity.console.idm.model.EntitiesModelImpl) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Aggregations

EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)55 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)23 Map (java.util.Map)15 Set (java.util.Set)13 HashSet (java.util.HashSet)10 Iterator (java.util.Iterator)10 List (java.util.List)9 OptionList (com.iplanet.jato.view.html.OptionList)7 AMIdentity (com.sun.identity.idm.AMIdentity)7 IdRepoException (com.sun.identity.idm.IdRepoException)7 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)5 SerializedField (com.sun.identity.console.components.view.html.SerializedField)5 CCAddRemoveModel (com.sun.web.ui.model.CCAddRemoveModel)4 CCAddRemove (com.sun.web.ui.view.addremove.CCAddRemove)4 AMViewConfig (com.sun.identity.console.base.AMViewConfig)3 IdSearchResults (com.sun.identity.idm.IdSearchResults)3 IdType (com.sun.identity.idm.IdType)3 AMPropertySheetModel (com.sun.identity.console.base.model.AMPropertySheetModel)2