Search in sources :

Example 16 with SMDiscoveryServiceData

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

the class SMDiscoveryBootstrapRefOffAddViewBean method handleButton1Request.

protected void handleButton1Request(SMDiscoEntryData smData) {
    SMDiscoveryServiceViewBean vb = (SMDiscoveryServiceViewBean) getViewBean(SMDiscoveryServiceViewBean.class);
    Map attrValues = (Map) getPageSessionAttribute(SMDiscoveryServiceViewBean.PROPERTY_ATTRIBUTE);
    Set resoff = (Set) attrValues.get(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
    try {
        SMDiscoveryServiceData smEntry = ((resoff == null) || resoff.isEmpty()) ? new SMDiscoveryServiceData() : SMDiscoveryServiceData.getEntries(resoff);
        smEntry.addResourceData(smData);
        attrValues.put(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF, (OrderedSet) smEntry.getDiscoveryEntries());
        setPageSessionAttribute(SMDiscoveryServiceViewBean.PAGE_MODIFIED, "1");
        backTrail();
        unlockPageTrailForSwapping();
        passPgSessionMap(vb);
        vb.forwardTo(getRequestContext());
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
Also used : Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) SMDiscoveryServiceData(com.sun.identity.console.service.model.SMDiscoveryServiceData) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Example 17 with SMDiscoveryServiceData

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

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

the class UMUserResourceOfferingViewBean method handleButton1Request.

/**
     * Handles finish service request.
     *
     * @param event Request invocation event.
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    submitCycle = true;
    UMUserResourceOfferingModel model = (UMUserResourceOfferingModel) getModel();
    String userId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
    DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
    String cacheID = (String) getPageSessionAttribute(UMUserResourceOfferingViewBean.DATA_ID);
    SMDiscoveryServiceData smEntry = cache.getData(model.getUserSSOToken(), cacheID);
    try {
        model.setUserDiscoEntry(userId, smEntry);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardToServicesViewBean();
}
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)

Example 19 with SMDiscoveryServiceData

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

the class EntityResourceOfferingAddViewBean method handleButton1Request.

protected void handleButton1Request(SMDiscoEntryData smData) {
    EntityResourceOfferingViewBean vb = (EntityResourceOfferingViewBean) getViewBean(EntityResourceOfferingViewBean.class);
    EntityResourceOfferingModel model = (EntityResourceOfferingModel) getModel();
    DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
    String cacheID = (String) getPageSessionAttribute(EntityResourceOfferingViewBean.DATA_ID);
    SMDiscoveryServiceData data = (SMDiscoveryServiceData) cache.getData(model.getUserSSOToken(), cacheID);
    data.addResourceData(smData);
    String univId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
    try {
        model.setEntityDiscoEntry(univId, data);
        removePageSessionAttribute(EntityResourceOfferingViewBean.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) EntityResourceOfferingModel(com.sun.identity.console.idm.model.EntityResourceOfferingModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) DiscoveryDataCache(com.sun.identity.console.service.model.DiscoveryDataCache)

Example 20 with SMDiscoveryServiceData

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

the class EntityResourceOfferingEditViewBean method handleButton1Request.

protected void handleButton1Request(SMDiscoEntryData smData) throws AMConsoleException {
    EntityResourceOfferingModel model = (EntityResourceOfferingModel) getModel();
    EntityResourceOfferingViewBean vb = (EntityResourceOfferingViewBean) getViewBean(EntityResourceOfferingViewBean.class);
    DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
    String cacheID = (String) getPageSessionAttribute(EntityResourceOfferingViewBean.DATA_ID);
    SMDiscoveryServiceData smEntry = cache.getData(model.getUserSSOToken(), cacheID);
    int index = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
    smEntry.replaceResourceData(index, smData);
    String univId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
    try {
        model.setEntityDiscoEntry(univId, smEntry);
        removePageSessionAttribute(EntityResourceOfferingViewBean.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) EntityResourceOfferingModel(com.sun.identity.console.idm.model.EntityResourceOfferingModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) DiscoveryDataCache(com.sun.identity.console.service.model.DiscoveryDataCache)

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