Search in sources :

Example 16 with SerializedField

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

the class ServerSiteViewBean method populateServerTableModel.

private void populateServerTableModel(Map serverToSite) {
    tblServerModel.clearAll();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    SerializedField szCacheServer = (SerializedField) getChild(SZ_CACHE_SERVER);
    ServerSiteModel model = (ServerSiteModel) getModel();
    tblServerModel.setMaxRows(model.getPageSize());
    int counter = 0;
    HashMap cacheServer = new HashMap();
    ArrayList cache = new ArrayList();
    if ((serverToSite != null) && !serverToSite.isEmpty()) {
        for (Iterator iter = serverToSite.keySet().iterator(); iter.hasNext(); counter++) {
            if (counter > 0) {
                tblServerModel.appendRow();
            }
            String name = (String) iter.next();
            String siteName = (String) serverToSite.get(name);
            tblServerModel.setValue(TBL_DATA_SERVER_ACTION_HREF, name);
            tblServerModel.setValue(TBL_DATA_SERVER_NAME, name);
            tblServerModel.setValue(TBL_DATA_SITE, siteName);
            tblServerModel.setSelectionVisible(counter, true);
            cacheServer.put(name, siteName);
            cache.add(name);
        }
        szCache.setValue(cache);
        szCacheServer.setValue(cacheServer);
    } else {
        szCache.setValue(null);
    }
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ServerSiteModel(com.sun.identity.console.service.model.ServerSiteModel)

Example 17 with SerializedField

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

the class FSAuthDomainsEditViewBean method handleButton1Request.

/**
     * Handles create authentication domains view bean.
     *
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    FSAuthDomainsModel model = (FSAuthDomainsModel) getModel();
    String name = (String) getDisplayFieldValue(model.TF_NAME);
    AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
    try {
        String realm = model.getRealm(name);
        Map values = ps.getAttributeValues(model.getDataMap(), false, model);
        model.setAttributeValues(realm, name, values);
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
        FederationViewBean vb = (FederationViewBean) getViewBean(FederationViewBean.class);
        CCAddRemove addRemoveList = (CCAddRemove) getChild(ADD_REMOVE_PROVIDERS);
        addRemoveList.restoreStateData();
        CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) addRemoveList.getModel();
        List list = new ArrayList(getSelectedValues(addRemoveModel));
        model.addProviders(realm, name, list);
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "authentication.domain.updated");
        forwardTo();
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) SerializedField(com.sun.identity.console.components.view.html.SerializedField) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) ArrayList(java.util.ArrayList) FSAuthDomainsModel(com.sun.identity.console.federation.model.FSAuthDomainsModel) ArrayList(java.util.ArrayList) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove)

Example 18 with SerializedField

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

the class RMRealmViewBean method handleTblButtonDeleteRequest.

/**
     * Deletes realms.
     *
     * @param event Request Invocation Event.
     * @throws ModelControlException if table model cannot be restored.
     */
public void handleTblButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_SEARCH);
    table.restoreStateData();
    String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    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++) {
        String name = (String) list.get(selected[i].intValue());
        /* 
             * make sure the realm name starts with / to give it a
             * fully qualified look. This value will be set in the log file
             */
        if (!name.startsWith("/")) {
            name = "/" + name;
        }
        names.add(name);
    }
    try {
        RMRealmModel model = (RMRealmModel) getModel();
        model.deleteSubRealms(curRealm, names);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "realm.message.deleted");
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "realm.message.deleted.pural");
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) SerializedField(com.sun.identity.console.components.view.html.SerializedField) ArrayList(java.util.ArrayList) List(java.util.List) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) RMRealmModel(com.sun.identity.console.realm.model.RMRealmModel) HashSet(java.util.HashSet)

Example 19 with SerializedField

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

the class RMRealmViewBean method populateTableModel.

private void populateTableModel(Collection realmNames) {
    tblModel.clearAll();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    RMRealmModel model = (RMRealmModel) getModel();
    tblModel.setMaxRows(model.getPageSize());
    if ((realmNames != null) && !realmNames.isEmpty()) {
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        List cache = new ArrayList(realmNames.size());
        boolean firstEntry = true;
        String startDN = model.getStartDN();
        int counter = 0;
        for (Iterator iter = realmNames.iterator(); iter.hasNext(); counter++) {
            if (firstEntry) {
                firstEntry = false;
            } else {
                tblModel.appendRow();
            }
            String name = (String) iter.next();
            String fqName = null;
            String displayName = null;
            if (name.equals(startDN)) {
                tblModel.setSelectionVisible(counter, false);
                fqName = name;
                displayName = AMFormatUtils.DNToName(model, model.getStartDSDN());
            } else {
                int idx = name.lastIndexOf('/');
                displayName = (idx == -1) ? name : name.substring(idx + 1);
                tblModel.setSelectionVisible(counter, true);
                fqName = name;
            }
            /*
                 * Set name column info. Need to unescape the value as it
                 * may contain a '/' character.
                 */
            tblModel.setValue(TBL_DATA_ACTION_HREF, stringToHex(fqName));
            tblModel.setValue(TBL_DATA_NAME, SMSSchema.unescapeName(displayName));
            // set location column info
            tblModel.setValue(TBL_DATA_PATH, getPath(name));
            cache.add(name);
        }
        szCache.setValue((ArrayList) cache);
    } else {
        szCache.setValue(null);
    }
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) RMRealmModel(com.sun.identity.console.realm.model.RMRealmModel)

Example 20 with SerializedField

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

the class STSHomeViewBean method populateSoapSTSTableModel.

private void populateSoapSTSTableModel(Set<String> publishedInstances) {
    tblModelSoapSTSInstances.clearAll();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    Map<String, Set<String>> cacheMap = (Map<String, Set<String>>) szCache.getSerializedObj();
    if (cacheMap == null) {
        cacheMap = new HashMap<>();
    }
    if ((publishedInstances != null) && !publishedInstances.isEmpty()) {
        boolean firstEntry = true;
        for (String instanceName : publishedInstances) {
            if (firstEntry) {
                firstEntry = false;
            } else {
                tblModelSoapSTSInstances.appendRow();
            }
            tblModelSoapSTSInstances.setValue(TBL_SOAP_STS_INSTANCES_DATA_NAME, instanceName);
            tblModelSoapSTSInstances.setValue(TBL_SOAP_STS_INSTANCES_DATA_ACTION_HREF, instanceName);
        }
        cacheMap.put(SOAP_STS_PUBLISHED_INSTANCES_CACHE_KEY, publishedInstances);
        szCache.setValue(cacheMap);
    } else {
        szCache.setValue(null);
    }
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) SerializedField(com.sun.identity.console.components.view.html.SerializedField) HashMap(java.util.HashMap) Map(java.util.Map)

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