Search in sources :

Example 1 with UMUserResourceOfferingModel

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

Example 2 with UMUserResourceOfferingModel

use of com.sun.identity.console.user.model.UMUserResourceOfferingModel in project OpenAM by OpenRock.

the class UMUserResourceOfferingEditViewBean method handleButton1Request.

protected void handleButton1Request(SMDiscoEntryData smData) throws AMConsoleException {
    UMUserResourceOfferingModel model = (UMUserResourceOfferingModel) getModel();
    DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
    String cacheID = (String) getPageSessionAttribute(UMUserResourceOfferingViewBean.DATA_ID);
    SMDiscoveryServiceData smEntry = cache.getData(model.getUserSSOToken(), cacheID);
    int index = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
    smEntry.replaceResourceData(index, smData);
    String userId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
    try {
        model.setUserDiscoEntry(userId, smEntry);
        removePageSessionAttribute(PG_SESSION_MODIFIED);
        removePageSessionAttribute(PGATTR_ORIG_MECH_ID);
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "message.updated");
    } 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)

Example 3 with UMUserResourceOfferingModel

use of com.sun.identity.console.user.model.UMUserResourceOfferingModel in project OpenAM by OpenRock.

the class UMUserResourceOfferingViewBean method handleTblButtonDeleteRequest.

public void handleTblButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_ENTRIES);
    table.restoreStateData();
    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);
    Integer[] selected = tblModel.getSelectedRows();
    smEntry.deleteDiscoEntries(selected);
    try {
        model.setUserDiscoEntry(userId, 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) 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 4 with UMUserResourceOfferingModel

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

Example 5 with UMUserResourceOfferingModel

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

Aggregations

UMUserResourceOfferingModel (com.sun.identity.console.user.model.UMUserResourceOfferingModel)6 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)5 DiscoveryDataCache (com.sun.identity.console.service.model.DiscoveryDataCache)5 SMDiscoveryServiceData (com.sun.identity.console.service.model.SMDiscoveryServiceData)4 SMDiscoEntryData (com.sun.identity.console.service.model.SMDiscoEntryData)1 CCActionTable (com.sun.web.ui.view.table.CCActionTable)1 Iterator (java.util.Iterator)1