Search in sources :

Example 1 with DiscoveryDataCache

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

the class RealmResourceOfferingEditViewBean method handleButton1Request.

protected void handleButton1Request(SMDiscoEntryData smData) throws AMConsoleException {
    RealmResourceOfferingModel model = (RealmResourceOfferingModel) getModel();
    RealmResourceOfferingViewBean vb = (RealmResourceOfferingViewBean) getViewBean(RealmResourceOfferingViewBean.class);
    DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
    String cacheID = (String) getPageSessionAttribute(RealmResourceOfferingViewBean.DATA_ID);
    SMDiscoveryServiceData smEntry = cache.getData(model.getUserSSOToken(), cacheID);
    int index = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
    smEntry.replaceResourceData(index, smData);
    String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    try {
        model.setRealmDiscoEntry(realm, smEntry);
        removePageSessionAttribute(RealmResourceOfferingViewBean.DATA_ID);
        removePageSessionAttribute(PGATTR_INDEX);
        passPgSessionMap(vb);
        vb.forwardTo(getRequestContext());
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
Also used : SMDiscoveryServiceData(com.sun.identity.console.service.model.SMDiscoveryServiceData) 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 2 with DiscoveryDataCache

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

the class RealmResourceOfferingAddViewBean method handleButton1Request.

protected void handleButton1Request(SMDiscoEntryData smData) {
    RealmResourceOfferingViewBean vb = (RealmResourceOfferingViewBean) getViewBean(RealmResourceOfferingViewBean.class);
    RealmResourceOfferingModel model = (RealmResourceOfferingModel) getModel();
    DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
    String cacheID = (String) getPageSessionAttribute(RealmResourceOfferingViewBean.DATA_ID);
    SMDiscoveryServiceData data = (SMDiscoveryServiceData) cache.getData(model.getUserSSOToken(), cacheID);
    data.addResourceData(smData);
    String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    try {
        model.setRealmDiscoEntry(realm, data);
        removePageSessionAttribute(RealmResourceOfferingViewBean.DATA_ID);
        passPgSessionMap(vb);
        vb.forwardTo(getRequestContext());
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
Also used : SMDiscoveryServiceData(com.sun.identity.console.service.model.SMDiscoveryServiceData) 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 3 with DiscoveryDataCache

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

the class RealmResourceOfferingEditViewBean method getCurrentServiceData.

protected SMDiscoEntryData getCurrentServiceData() {
    int currentIdx = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
    DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
    String cacheID = (String) getPageSessionAttribute(RealmResourceOfferingViewBean.DATA_ID);
    SMDiscoveryServiceData smEntry = cache.getData(getModel().getUserSSOToken(), cacheID);
    List resourceData = smEntry.getResourceData();
    return (SMDiscoEntryData) resourceData.get(currentIdx);
}
Also used : SMDiscoveryServiceData(com.sun.identity.console.service.model.SMDiscoveryServiceData) SMDiscoEntryData(com.sun.identity.console.service.model.SMDiscoEntryData) List(java.util.List) DiscoveryDataCache(com.sun.identity.console.service.model.DiscoveryDataCache)

Example 4 with DiscoveryDataCache

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

the class EntityResourceOfferingEditViewBean method getCurrentServiceData.

protected SMDiscoEntryData getCurrentServiceData() {
    int currentIdx = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
    DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
    String cacheID = (String) getPageSessionAttribute(EntityResourceOfferingViewBean.DATA_ID);
    SMDiscoveryServiceData smEntry = cache.getData(getModel().getUserSSOToken(), cacheID);
    List resourceData = smEntry.getResourceData();
    return (SMDiscoEntryData) resourceData.get(currentIdx);
}
Also used : SMDiscoveryServiceData(com.sun.identity.console.service.model.SMDiscoveryServiceData) SMDiscoEntryData(com.sun.identity.console.service.model.SMDiscoEntryData) List(java.util.List) DiscoveryDataCache(com.sun.identity.console.service.model.DiscoveryDataCache)

Example 5 with DiscoveryDataCache

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

the class UMUserResourceOfferingAddViewBean method handleButton1Request.

protected void handleButton1Request(SMDiscoEntryData smData) {
    UMUserResourceOfferingViewBean vb = (UMUserResourceOfferingViewBean) getViewBean(UMUserResourceOfferingViewBean.class);
    UMUserResourceOfferingModel model = (UMUserResourceOfferingModel) getModel();
    DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
    String cacheID = (String) getPageSessionAttribute(UMUserResourceOfferingViewBean.DATA_ID);
    SMDiscoveryServiceData data = (SMDiscoveryServiceData) cache.getData(model.getUserSSOToken(), cacheID);
    data.addResourceData(smData);
    String userId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
    try {
        model.setUserDiscoEntry(userId, data);
        removePageSessionAttribute(UMUserResourceOfferingViewBean.DATA_ID);
        passPgSessionMap(vb);
        vb.forwardTo(getRequestContext());
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
Also used : SMDiscoveryServiceData(com.sun.identity.console.service.model.SMDiscoveryServiceData) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) 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