Search in sources :

Example 6 with SMDiscoveryServiceData

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

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

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

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

the class SMDiscoveryBootstrapRefOffEditViewBean method getCurrentServiceData.

protected SMDiscoEntryData getCurrentServiceData() {
    SMDiscoEntryData curData = null;
    int currentIdx = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
    Map mapAttrs = (Map) getPageSessionAttribute(SMDiscoveryServiceViewBean.PROPERTY_ATTRIBUTE);
    OrderedSet set = (OrderedSet) mapAttrs.get(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
    try {
        SMDiscoveryServiceData smEntry = SMDiscoveryServiceData.getEntries(set);
        List resourceData = smEntry.getResourceData();
        curData = (SMDiscoEntryData) resourceData.get(currentIdx);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    return curData;
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) SMDiscoEntryData(com.sun.identity.console.service.model.SMDiscoEntryData) SMDiscoveryServiceData(com.sun.identity.console.service.model.SMDiscoveryServiceData) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 10 with SMDiscoveryServiceData

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

the class SMDiscoveryServiceViewBean method handleTblBootstrapResOffButtonDeleteRequest.

/**
     * Handles remove resource offerings request.
     *
     * @param event Request Invocation Event.
     */
public void handleTblBootstrapResOffButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    setSubmitCycle(true);
    CCActionTable table = (CCActionTable) getChild(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
    table.restoreStateData();
    CCActionTableModel tblModel = (CCActionTableModel) propertySheetModel.getModel(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
    Integer[] selected = tblModel.getSelectedRows();
    if ((selected != null) && (selected.length > 0)) {
        try {
            OrderedSet tblValues = (OrderedSet) getPageSessionAttribute(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
            SMDiscoveryServiceData smEntry = SMDiscoveryServiceData.getEntries(tblValues);
            smEntry.deleteDiscoEntries(selected);
            tblValues = (OrderedSet) smEntry.getDiscoveryEntries();
            setPageSessionAttribute(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF, tblValues);
            populateBootstrapResOffTable(tblValues);
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
    }
    forwardTo();
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) SMDiscoveryServiceData(com.sun.identity.console.service.model.SMDiscoveryServiceData) CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Aggregations

SMDiscoveryServiceData (com.sun.identity.console.service.model.SMDiscoveryServiceData)21 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)15 DiscoveryDataCache (com.sun.identity.console.service.model.DiscoveryDataCache)13 SMDiscoEntryData (com.sun.identity.console.service.model.SMDiscoEntryData)5 List (java.util.List)5 Map (java.util.Map)5 UMUserResourceOfferingModel (com.sun.identity.console.user.model.UMUserResourceOfferingModel)4 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)4 CCActionTable (com.sun.web.ui.view.table.CCActionTable)4 HashMap (java.util.HashMap)4 SSOException (com.iplanet.sso.SSOException)3 EntityResourceOfferingModel (com.sun.identity.console.idm.model.EntityResourceOfferingModel)3 RealmResourceOfferingModel (com.sun.identity.console.realm.model.RealmResourceOfferingModel)3 AMIdentity (com.sun.identity.idm.AMIdentity)3 IdRepoException (com.sun.identity.idm.IdRepoException)3 Set (java.util.Set)3 CCActionTableModel (com.sun.web.ui.model.CCActionTableModel)2 Iterator (java.util.Iterator)2 CaseInsensitiveHashMap (com.sun.identity.common.CaseInsensitiveHashMap)1 SMDescriptionData (com.sun.identity.console.service.model.SMDescriptionData)1