Search in sources :

Example 1 with EntityResourceOfferingModel

use of com.sun.identity.console.idm.model.EntityResourceOfferingModel in project OpenAM by OpenRock.

the class SMDiscoveryServiceViewBean method handleEntityOperationRequest.

private void handleEntityOperationRequest(String realm, String univId, RequestContext rc) {
    HttpServletRequest req = rc.getRequest();
    String op = req.getParameter("Op");
    if (op.equals(AMAdminConstants.OPERATION_EDIT)) {
        setPageSessionAttribute(PG_SESSION_PAGE_TRAIL_ID, req.getParameter(PG_SESSION_PAGE_TRAIL_ID));
        setPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID, univId);
        setPageSessionAttribute(AMAdminConstants.CURRENT_REALM, realm);
        unlockPageTrail();
        EntityResourceOfferingViewBean vb = (EntityResourceOfferingViewBean) getViewBean(EntityResourceOfferingViewBean.class);
        passPgSessionMap(vb);
        vb.forwardTo(rc);
    } else {
        setPageSessionAttribute(PG_SESSION_PAGE_TRAIL_ID, req.getParameter(PG_SESSION_PAGE_TRAIL_ID));
        setPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID, univId);
        setPageSessionAttribute(AMAdminConstants.CURRENT_REALM, realm);
        setPageSessionAttribute(EntityEditViewBean.ENTITY_TYPE, rc.getRequest().getParameter("type"));
        EntityResourceOfferingModel entityModel = new EntityResourceOfferingModelImpl(req, getPageSessionAttributes());
        try {
            entityModel.assignService(univId);
        } catch (AMConsoleException e) {
            debug.error("SMDiscoveryServiceViewBean.handleEntityOperationRequest", e);
        }
        backTrail();
        AMPostViewBean vb = (AMPostViewBean) getViewBean(AMPostViewBean.class);
        passPgSessionMap(vb);
        vb.setTargetViewBeanURL("../idm/EntityServices");
        vb.forwardTo(rc);
    }
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) EntityResourceOfferingViewBean(com.sun.identity.console.idm.EntityResourceOfferingViewBean) EntityResourceOfferingModel(com.sun.identity.console.idm.model.EntityResourceOfferingModel) EntityResourceOfferingModelImpl(com.sun.identity.console.idm.model.EntityResourceOfferingModelImpl) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) AMPostViewBean(com.sun.identity.console.base.AMPostViewBean)

Example 2 with EntityResourceOfferingModel

use of com.sun.identity.console.idm.model.EntityResourceOfferingModel 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 3 with EntityResourceOfferingModel

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

Example 4 with EntityResourceOfferingModel

use of com.sun.identity.console.idm.model.EntityResourceOfferingModel in project OpenAM by OpenRock.

the class EntityResourceOfferingViewBean method handleTblButtonDeleteRequest.

public void handleTblButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_ENTRIES);
    table.restoreStateData();
    EntityResourceOfferingModel model = (EntityResourceOfferingModel) getModel();
    String univId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
    DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
    String cacheID = (String) getPageSessionAttribute(EntityResourceOfferingViewBean.DATA_ID);
    SMDiscoveryServiceData smEntry = cache.getData(model.getUserSSOToken(), cacheID);
    Integer[] selected = tblModel.getSelectedRows();
    smEntry.deleteDiscoEntries(selected);
    try {
        model.setEntityDiscoEntry(univId, 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) EntityResourceOfferingModel(com.sun.identity.console.idm.model.EntityResourceOfferingModel) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) DiscoveryDataCache(com.sun.identity.console.service.model.DiscoveryDataCache)

Example 5 with EntityResourceOfferingModel

use of com.sun.identity.console.idm.model.EntityResourceOfferingModel in project OpenAM by OpenRock.

the class EntityResourceOfferingViewBean method getBreadCrumbDisplayName.

protected String getBreadCrumbDisplayName() {
    EntityResourceOfferingModel model = (EntityResourceOfferingModel) getModel();
    String[] arg = { model.getLocalizedServiceName(AMAdminConstants.DISCOVERY_SERVICE) };
    return MessageFormat.format(model.getLocalizedString("breadcrumbs.idm.services.editService"), arg);
}
Also used : EntityResourceOfferingModel(com.sun.identity.console.idm.model.EntityResourceOfferingModel)

Aggregations

EntityResourceOfferingModel (com.sun.identity.console.idm.model.EntityResourceOfferingModel)7 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)5 DiscoveryDataCache (com.sun.identity.console.service.model.DiscoveryDataCache)4 SMDiscoveryServiceData (com.sun.identity.console.service.model.SMDiscoveryServiceData)3 AMPostViewBean (com.sun.identity.console.base.AMPostViewBean)1 EntityResourceOfferingViewBean (com.sun.identity.console.idm.EntityResourceOfferingViewBean)1 EntityResourceOfferingModelImpl (com.sun.identity.console.idm.model.EntityResourceOfferingModelImpl)1 SMDiscoEntryData (com.sun.identity.console.service.model.SMDiscoEntryData)1 CCActionTable (com.sun.web.ui.view.table.CCActionTable)1 Iterator (java.util.Iterator)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1