Search in sources :

Example 26 with EntitiesModel

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

the class EntitiesViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event, false);
    resetButtonState(TBL_BUTTON_DELETE);
    EntitiesModel model = (EntitiesModel) getModel();
    CCButton b = (CCButton) getChild(TBL_BUTTON_ADD);
    String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    if (model.repoExists(curRealm)) {
        b.setDisabled(false);
    } else {
        b.setDisabled(true);
    }
    String[] param = { getDisplayIDType() };
    ptModel.setPageTitleText(MessageFormat.format(model.getLocalizedString("page.title.entities"), (Object[]) param));
    tblModel.setTitle(MessageFormat.format(model.getLocalizedString("table.entities.title.name"), (Object[]) param));
    tblModel.setTitleLabel(MessageFormat.format(model.getLocalizedString("table.entities.title.name"), (Object[]) param));
    tblModel.setSummary(MessageFormat.format(model.getLocalizedString("table.entities.summary"), (Object[]) param));
    getEntityNames();
    addEntitiesTab();
    tabModel.setSelectedNode(7);
}
Also used : CCButton(com.sun.web.ui.view.html.CCButton) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 27 with EntitiesModel

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

the class EntitiesViewBean method populateTableModelEx.

private void populateTableModelEx() {
    if (!tblModelPopulated) {
        tblModelPopulated = true;
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
        List cache = (List) szCache.getSerializedObj();
        if ((cache != null) && !cache.isEmpty()) {
            EntitiesModel model = (EntitiesModel) getModel();
            SSOToken ssoToken = model.getUserSSOToken();
            List list = new ArrayList(cache.size());
            for (Iterator iter = cache.iterator(); iter.hasNext(); ) {
                String id = (String) iter.next();
                try {
                    list.add(IdUtils.getIdentity(ssoToken, id));
                } catch (IdRepoException e) {
                //ignore since ID is not found.
                }
            }
            populateTableModel(list);
        }
    }
}
Also used : SSOToken(com.iplanet.sso.SSOToken) SerializedField(com.sun.identity.console.components.view.html.SerializedField) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) IdRepoException(com.sun.identity.idm.IdRepoException) ArrayList(java.util.ArrayList) List(java.util.List) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 28 with EntitiesModel

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

the class EntityEditViewBean 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 universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
    try {
        Map oldValues = model.getAttributeValues(universalId, false);
        Map values = prop.getAttributeValues(oldValues, true, model);
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        model.modifyEntity(curRealm, universalId, values);
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "message.updated");
    } 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) HashMap(java.util.HashMap) Map(java.util.Map) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 29 with EntitiesModel

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

the class EntityEditViewBean method nodeClicked.

/**
     * Handles tab selected event.
     *
     * @param event Request Invocation Event.
     * @param nodeID Selected Node ID.
     */
public void nodeClicked(RequestInvocationEvent event, int nodeID) {
    EntityEditViewBean vb = null;
    IdType idType = null;
    EntitiesModel model = (EntitiesModel) getModel();
    unlockPageTrailForSwapping();
    setPageSessionAttribute(getTrackingTabIDName(), Integer.toString(nodeID));
    if (nodeID == TAB_PROFILE) {
        vb = (EntityEditViewBean) getViewBean(EntityEditViewBean.class);
        forwardToOtherEntityViewBean(vb, idType);
    } else if (nodeID == TAB_SERVICES) {
        vb = (EntityServicesViewBean) getViewBean(EntityServicesViewBean.class);
        forwardToOtherEntityViewBean(vb, idType);
    } else {
        handleMembersViewForwarding(nodeID, model);
    }
}
Also used : IdType(com.sun.identity.idm.IdType) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 30 with EntitiesModel

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

the class EntityMembersViewBean method getMemberNames.

private void getMemberNames() {
    if (!submitCycle) {
        try {
            String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
            String type = (String) getPageSessionAttribute(PG_SESSION_MEMBER_TYPE);
            String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
            if (cacheAssigned != null) {
                assignedMembers = AMAdminUtils.toList(cacheAssigned);
            } else {
                EntitiesModel model = (EntitiesModel) getModel();
                assignedMembers = new ArrayList();
                assignedMembers.addAll(model.getMembers(curRealm, universalId, type));
            }
            if (canModify) {
                CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) propertySheetModel.getModel(ADD_REMOVE_MEMBERS);
                addRemoveModel.clear();
                if (cacheAssigned != null) {
                    addRemoveModel.setSelectedOptionList(cacheAssigned);
                } else {
                    addRemoveModel.setSelectedOptionList(getOptionListForEntities(assignedMembers));
                }
                addRemoveModel.setAvailableOptionList(getAssignableMembers());
            } else {
                propertySheetModel.setValue(ADD_REMOVE_MEMBERS, AMAdminUtils.getString(getEntityDisplayNames(assignedMembers), ",", false));
            }
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
        if (canModify) {
            CCAddRemove addRemove = (CCAddRemove) getChild(ADD_REMOVE_MEMBERS);
            addRemove.resetStateData();
        }
    }
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) ArrayList(java.util.ArrayList) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove) 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