Search in sources :

Example 6 with SerializedField

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

the class UMUserPasswordResetOptionsViewBean method populateTableModel.

private void populateTableModel(List questionAnswers) {
    tblModel.clearAll();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    szCache.setValue(questionAnswers);
    if ((questionAnswers != null) && !questionAnswers.isEmpty()) {
        boolean firstEntry = true;
        for (Iterator iter = questionAnswers.iterator(); iter.hasNext(); ) {
            if (firstEntry) {
                firstEntry = false;
            } else {
                tblModel.appendRow();
            }
            UMUserPasswordResetOptionsData data = (UMUserPasswordResetOptionsData) iter.next();
            String question = data.getQuestionLocalizedName();
            if (data.isPersonalQuestion()) {
                tblModel.setValue(TBL_DATA_QUESTION, null);
                tblModel.setValue(TBL_DATA_PERSONAL_QUESTION, question);
            } else {
                tblModel.setValue(TBL_DATA_QUESTION, question);
                tblModel.setValue(TBL_DATA_PERSONAL_QUESTION, null);
            }
            tblModel.setRowSelected(data.isSelected());
            tblModel.setValue(TBL_DATA_ANSWER, data.getAnswer());
        }
    }
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) Iterator(java.util.Iterator) UMUserPasswordResetOptionsData(com.sun.identity.console.user.model.UMUserPasswordResetOptionsData)

Example 7 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 8 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 9 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 10 with SerializedField

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

the class EntitiesViewBean method resetView.

public void resetView() {
    super.resetView();
    tblModelPopulated = false;
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    szCache.setValue(null);
    tblModel.clearAll();
    setDisplayFieldValue(TF_FILTER, "*");
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField)

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