Search in sources :

Example 11 with DiscoveryDataCache

use of com.sun.identity.console.service.model.DiscoveryDataCache in project OpenAM by OpenRock.

the class EntityResourceOfferingViewBean method populateTableModel.

private void populateTableModel(SMDiscoveryServiceData data) {
    tblModel.clearAll();
    if (data != null) {
        int counter = 0;
        EntityResourceOfferingModel model = (EntityResourceOfferingModel) 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) EntityResourceOfferingModel(com.sun.identity.console.idm.model.EntityResourceOfferingModel) DiscoveryDataCache(com.sun.identity.console.service.model.DiscoveryDataCache)

Example 12 with DiscoveryDataCache

use of com.sun.identity.console.service.model.DiscoveryDataCache 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 13 with DiscoveryDataCache

use of com.sun.identity.console.service.model.DiscoveryDataCache 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)

Example 14 with DiscoveryDataCache

use of com.sun.identity.console.service.model.DiscoveryDataCache in project OpenAM by OpenRock.

the class UMUserResourceOfferingEditViewBean method getCurrentServiceData.

protected SMDiscoEntryData getCurrentServiceData() {
    int currentIdx = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
    DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
    String cacheID = (String) getPageSessionAttribute(UMUserResourceOfferingViewBean.DATA_ID);
    SMDiscoveryServiceData smEntry = cache.getData(getModel().getUserSSOToken(), cacheID);
    List resourceData = smEntry.getResourceData();
    SMDiscoEntryData smDisco = (SMDiscoEntryData) resourceData.get(currentIdx);
    if (getPageSessionAttribute(PGATTR_ORIG_MECH_ID) == null) {
        ArrayList list = new ArrayList();
        for (Iterator i = smDisco.descData.iterator(); i.hasNext(); ) {
            list.add(new SMDescriptionData((SMDescriptionData) i.next()));
        }
        setPageSessionAttribute(PGATTR_ORIG_MECH_ID, list);
    }
    return smDisco;
}
Also used : SMDiscoveryServiceData(com.sun.identity.console.service.model.SMDiscoveryServiceData) SMDiscoEntryData(com.sun.identity.console.service.model.SMDiscoEntryData) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) SMDescriptionData(com.sun.identity.console.service.model.SMDescriptionData) DiscoveryDataCache(com.sun.identity.console.service.model.DiscoveryDataCache)

Example 15 with DiscoveryDataCache

use of com.sun.identity.console.service.model.DiscoveryDataCache in project OpenAM by OpenRock.

the class UMUserResourceOfferingViewBean method populateTableModel.

private void populateTableModel(SMDiscoveryServiceData data) {
    tblModel.clearAll();
    if (data != null) {
        int counter = 0;
        UMUserResourceOfferingModel model = (UMUserResourceOfferingModel) 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) UMUserResourceOfferingModel(com.sun.identity.console.user.model.UMUserResourceOfferingModel) DiscoveryDataCache(com.sun.identity.console.service.model.DiscoveryDataCache)

Aggregations

DiscoveryDataCache (com.sun.identity.console.service.model.DiscoveryDataCache)16 SMDiscoveryServiceData (com.sun.identity.console.service.model.SMDiscoveryServiceData)13 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)10 SMDiscoEntryData (com.sun.identity.console.service.model.SMDiscoEntryData)6 UMUserResourceOfferingModel (com.sun.identity.console.user.model.UMUserResourceOfferingModel)5 EntityResourceOfferingModel (com.sun.identity.console.idm.model.EntityResourceOfferingModel)4 RealmResourceOfferingModel (com.sun.identity.console.realm.model.RealmResourceOfferingModel)4 Iterator (java.util.Iterator)4 CCActionTable (com.sun.web.ui.view.table.CCActionTable)3 List (java.util.List)3 SMDescriptionData (com.sun.identity.console.service.model.SMDescriptionData)1 ArrayList (java.util.ArrayList)1