Search in sources :

Example 26 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.

the class UMUserPasswordResetOptionsViewBean method beginQuestionsDisplay.

public boolean beginQuestionsDisplay(ChildDisplayEvent event) {
    boolean display = false;
    UMUserPasswordResetOptionsModel model = (UMUserPasswordResetOptionsModel) getModel();
    String userId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
    if (model.isLoggedInUser(userId)) {
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
        List data = (List) szCache.getSerializedObj();
        display = (data != null) && !data.isEmpty();
    }
    return display;
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) List(java.util.List) UMUserPasswordResetOptionsModel(com.sun.identity.console.user.model.UMUserPasswordResetOptionsModel)

Example 27 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.

the class UMUserPasswordResetOptionsViewBean method restoreOptionsData.

private List restoreOptionsData() throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_SEARCH);
    table.restoreStateData();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List optionData = (List) szCache.getSerializedObj();
    int sz = optionData.size();
    for (int i = 0; i < sz; i++) {
        UMUserPasswordResetOptionsData data = (UMUserPasswordResetOptionsData) optionData.get(i);
        tblModel.setRowIndex(i);
        data.setSelected(tblModel.isRowSelected());
        data.setAnswer((String) tblModel.getValue(TBL_DATA_ANSWER));
        if (data.isPersonalQuestion()) {
            data.setQuestion((String) tblModel.getValue(TBL_DATA_PERSONAL_QUESTION));
        }
    }
    return optionData;
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) List(java.util.List) CCActionTable(com.sun.web.ui.view.table.CCActionTable) UMUserPasswordResetOptionsData(com.sun.identity.console.user.model.UMUserPasswordResetOptionsData)

Example 28 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.

the class AgentConfigInheritViewBean method populatePropertyNameTableModel.

private void populatePropertyNameTableModel(Collection propertyNames) {
    if (!submitCycle && (propertyNames != null)) {
        tblPropertyNamesModel.clearAll();
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
        String universalId = (String) getPageSessionAttribute(AgentProfileViewBean.UNIVERSAL_ID);
        String agentType = getAgentType();
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        AgentsModel model = (AgentsModel) getModel();
        Set inheritedPropertyNames = model.getInheritedPropertyNames(curRealm, universalId);
        Map nameToSchemas = model.getAttributeSchemas(agentType, propertyNames);
        removeNonInheritable(nameToSchemas, propertyNames);
        try {
            ResourceBundle rb = AgentConfiguration.getServiceResourceBundle(model.getUserLocale());
            String groupName = model.getAgentGroup(curRealm, universalId);
            Map groupValues = model.getGroupAttributeValues(curRealm, groupName);
            ArrayList cache = new ArrayList();
            int counter = 0;
            for (Iterator i = propertyNames.iterator(); i.hasNext(); counter++) {
                if (counter > 0) {
                    tblPropertyNamesModel.appendRow();
                }
                String name = (String) i.next();
                AttributeSchema as = (AttributeSchema) nameToSchemas.get(name);
                if (as != null) {
                    String displayName = rb.getString(as.getI18NKey());
                    tblPropertyNamesModel.setValue(TBL_DATA_PROPERTY_NAME, displayName);
                    try {
                        String help = rb.getString(as.getI18NKey() + ".help");
                        tblPropertyNamesModel.setValue(TBL_DATA_PROPERTY_HELP, help);
                    } catch (MissingResourceException e) {
                        // need to clear the help value
                        tblPropertyNamesModel.setValue(TBL_DATA_PROPERTY_HELP, "");
                    }
                    Object oValue = groupValues.get(name);
                    String value = "";
                    if (oValue != null) {
                        value = oValue.toString();
                        if (value.length() >= 2) {
                            value = value.substring(1, value.length() - 1);
                        }
                    }
                    tblPropertyNamesModel.setValue(TBL_DATA_VALUE, value);
                    tblPropertyNamesModel.setSelectionVisible(counter, true);
                    tblPropertyNamesModel.setRowSelected(inheritedPropertyNames.contains(name));
                    cache.add(name);
                }
            }
            szCache.setValue(cache);
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        } catch (SMSException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        } catch (SSOException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
    }
}
Also used : Set(java.util.Set) SMSException(com.sun.identity.sm.SMSException) MissingResourceException(java.util.MissingResourceException) ArrayList(java.util.ArrayList) SSOException(com.iplanet.sso.SSOException) SerializedField(com.sun.identity.console.components.view.html.SerializedField) Iterator(java.util.Iterator) AttributeSchema(com.sun.identity.sm.AttributeSchema) ResourceBundle(java.util.ResourceBundle) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 29 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField 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 30 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.

the class SCServiceProfileViewBean method createChild.

protected View createChild(String name) {
    if (!populatedSubConfigTable && name.equals(AMPropertySheetModel.TBL_SUB_CONFIG)) {
        populatedSubConfigTable = true;
        SubSchemaModel model = (SubSchemaModel) getModel();
        if (model.hasGlobalSubSchema()) {
            SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
            populateTableModel(szCache.<List<SMSubConfig>>getSerializedObj());
        }
    }
    return super.createChild(name);
}
Also used : SubSchemaModel(com.sun.identity.console.service.model.SubSchemaModel) SerializedField(com.sun.identity.console.components.view.html.SerializedField) SMSubConfig(com.sun.identity.console.base.model.SMSubConfig)

Aggregations

SerializedField (com.sun.identity.console.components.view.html.SerializedField)57 ArrayList (java.util.ArrayList)33 List (java.util.List)31 CCActionTable (com.sun.web.ui.view.table.CCActionTable)28 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)19 Iterator (java.util.Iterator)19 HashSet (java.util.HashSet)17 Set (java.util.Set)17 Map (java.util.Map)15 HashMap (java.util.HashMap)14 View (com.iplanet.jato.view.View)10 SMSubConfig (com.sun.identity.console.base.model.SMSubConfig)9 CCPageTitle (com.sun.web.ui.view.pagetitle.CCPageTitle)9 CCActionTableModel (com.sun.web.ui.model.CCActionTableModel)8 AgentsModel (com.sun.identity.console.agentconfig.model.AgentsModel)6 ServerSiteModel (com.sun.identity.console.service.model.ServerSiteModel)6 EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)5 IdRepoException (com.sun.identity.idm.IdRepoException)4 SSOToken (com.iplanet.sso.SSOToken)3 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)3