Search in sources :

Example 36 with EntitiesModel

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

the class EntityEditViewBean method setDefaultValues.

protected void setDefaultValues(String type) throws AMConsoleException {
    if (propertySheetModel != null) {
        EntitiesModel model = (EntitiesModel) getModel();
        String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
        if (!submitCycle) {
            propertySheetModel.clear();
            try {
                Map attrValues = model.getAttributeValues(universalId, false);
                AMPropertySheet prop = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
                prop.setAttributeValues(attrValues, model);
            } catch (AMConsoleException e) {
                setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
            }
        }
        String[] uuid = { universalId };
        propertySheetModel.setValues(PROPERTY_UUID, uuid, model);
    }
}
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 37 with EntitiesModel

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

the class EntityEditViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    EntitiesModel model = (EntitiesModel) getModel();
    String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    Map localized = model.getSupportedEntityTypes(curRealm);
    String type = (String) getPageSessionAttribute(ENTITY_TYPE);
    String i18nName = (String) localized.get(type);
    String title = model.getLocalizedString("page.title.entities.edit");
    String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
    propertySheetModel.setValue(PROPERTY_UUID, universalId);
    // identityDisplayName also used be EndUserViewBean
    identityDisplayName = AMFormatUtils.getIdentityDisplayName(model, universalId);
    Object[] param = { i18nName, identityDisplayName };
    ptModel.setPageTitleText(MessageFormat.format(title, param));
    checkForAttributesToDisplay(type);
    if (hasNoAttributeToDisplay) {
        disableSaveAndResetButton();
    }
}
Also used : HashMap(java.util.HashMap) Map(java.util.Map) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 38 with EntitiesModel

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

the class EntityEditViewBean method getBreadCrumbDisplayName.

protected String getBreadCrumbDisplayName() {
    EntitiesModel model = (EntitiesModel) getModel();
    String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
    String[] arg = { AMFormatUtils.getIdentityDisplayName(model, universalId) };
    return MessageFormat.format(model.getLocalizedString("breadcrumbs.editentities"), (Object[]) arg);
}
Also used : EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 39 with EntitiesModel

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

the class EntityEditViewBean method createPropertyModel.

protected boolean createPropertyModel() {
    boolean created = super.createPropertyModel();
    if (created) {
        String type = (String) getPageSessionAttribute(ENTITY_TYPE);
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        EntitiesModel model = (EntitiesModel) getModel();
        tabModel = new CCTabsModel();
        tabModel.addNode(new CCNavNode(TAB_PROFILE, "profile.tab", "", ""));
        if (model.canAssignService(curRealm, type)) {
            tabModel.addNode(new CCNavNode(TAB_SERVICES, "services.tab", "", ""));
        }
        try {
            Set memberOfs = model.getIdTypeMemberOf(curRealm, type);
            for (Iterator iter = memberOfs.iterator(); iter.hasNext(); ) {
                IdType t = (IdType) iter.next();
                tabModel.addNode(new CCNavNode(t.hashCode(), t.getName(), "", ""));
            }
            Set beMemberOfs = model.getIdTypeBeMemberOf(curRealm, type);
            if ((beMemberOfs != null) && !beMemberOfs.isEmpty()) {
                for (Iterator i = beMemberOfs.iterator(); i.hasNext(); ) {
                    IdType t = (IdType) i.next();
                    tabModel.addNode(new CCNavNode(t.hashCode(), t.getName(), "", ""));
                }
            }
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
        tabModel.setSelectedNode(TAB_PROFILE);
    }
    return created;
}
Also used : CCTabsModel(com.sun.web.ui.model.CCTabsModel) CCNavNode(com.sun.web.ui.model.CCNavNode) HashSet(java.util.HashSet) Set(java.util.Set) Iterator(java.util.Iterator) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel) IdType(com.sun.identity.idm.IdType)

Example 40 with EntitiesModel

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

the class EntityAddViewBean method setDefaultValues.

protected void setDefaultValues(String type) throws AMConsoleException {
    if (!submitCycle && (propertySheetModel != null)) {
        EntitiesModel model = (EntitiesModel) getModel();
        // null for agent type
        Map defaultValues = model.getDefaultAttributeValues(type, null, true);
        for (Iterator i = defaultValues.keySet().iterator(); i.hasNext(); ) {
            String name = (String) i.next();
            Set values = (Set) defaultValues.get(name);
            if ((values != null) && !values.isEmpty()) {
                propertySheetModel.setValues(name, values.toArray(), model);
            }
        }
    }
}
Also used : Set(java.util.Set) Iterator(java.util.Iterator) Map(java.util.Map) 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