Search in sources :

Example 6 with RealmResourceOfferingModel

use of com.sun.identity.console.realm.model.RealmResourceOfferingModel in project OpenAM by OpenRock.

the class RealmResourceOfferingViewBean method populateTableModel.

private void populateTableModel(SMDiscoveryServiceData data) {
    tblModel.clearAll();
    if (data != null) {
        int counter = 0;
        RealmResourceOfferingModel model = (RealmResourceOfferingModel) getModel();
        for (Iterator i = data.getResourceData().iterator(); i.hasNext(); counter++) {
            if (counter > 0) {
                tblModel.appendRow();
            }
            SMDiscoEntryData entry = (SMDiscoEntryData) i.next();
            tblModel.setValue(TBL_DATA_SERVICE_TYPE, entry.serviceType);
            tblModel.setValue(TBL_DATA_ABSTRACT, entry.abstractValue);
            tblModel.setValue(TBL_DATA_ACTION_HREF, Integer.toString(counter));
        }
        DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
        String id = cache.cacheData(model.getUserSSOToken(), data);
        setPageSessionAttribute(DATA_ID, id);
    }
}
Also used : SMDiscoEntryData(com.sun.identity.console.service.model.SMDiscoEntryData) Iterator(java.util.Iterator) RealmResourceOfferingModel(com.sun.identity.console.realm.model.RealmResourceOfferingModel) DiscoveryDataCache(com.sun.identity.console.service.model.DiscoveryDataCache)

Example 7 with RealmResourceOfferingModel

use of com.sun.identity.console.realm.model.RealmResourceOfferingModel in project OpenAM by OpenRock.

the class RealmResourceOfferingViewBean method handleTblButtonDeleteRequest.

public void handleTblButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_ENTRIES);
    table.restoreStateData();
    RealmResourceOfferingModel model = (RealmResourceOfferingModel) getModel();
    String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
    String cacheID = (String) getPageSessionAttribute(RealmResourceOfferingViewBean.DATA_ID);
    SMDiscoveryServiceData smEntry = cache.getData(model.getUserSSOToken(), cacheID);
    Integer[] selected = tblModel.getSelectedRows();
    smEntry.deleteDiscoEntries(selected);
    try {
        model.setRealmDiscoEntry(realm, smEntry);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "discovery.service.table.entry.deleted");
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "discovery.service.table.entry.deleted.pural");
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : SMDiscoveryServiceData(com.sun.identity.console.service.model.SMDiscoveryServiceData) CCActionTable(com.sun.web.ui.view.table.CCActionTable) RealmResourceOfferingModel(com.sun.identity.console.realm.model.RealmResourceOfferingModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) DiscoveryDataCache(com.sun.identity.console.service.model.DiscoveryDataCache)

Aggregations

RealmResourceOfferingModel (com.sun.identity.console.realm.model.RealmResourceOfferingModel)7 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)5 DiscoveryDataCache (com.sun.identity.console.service.model.DiscoveryDataCache)4 SMDiscoveryServiceData (com.sun.identity.console.service.model.SMDiscoveryServiceData)3 AMPostViewBean (com.sun.identity.console.base.AMPostViewBean)1 RealmResourceOfferingViewBean (com.sun.identity.console.realm.RealmResourceOfferingViewBean)1 RealmResourceOfferingModelImpl (com.sun.identity.console.realm.model.RealmResourceOfferingModelImpl)1 SMDiscoEntryData (com.sun.identity.console.service.model.SMDiscoEntryData)1 CCActionTable (com.sun.web.ui.view.table.CCActionTable)1 Iterator (java.util.Iterator)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1