Search in sources :

Example 1 with SMDiscoveryServiceData

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

the class EntityResourceOfferingModelImpl method getEntityDiscoEntry.

/**
     * Returns resource offering entry stored for an entity.
     *
     * @param universalId Universal ID of the entity.
     * @return resource offering entry stored.
     * @throws AMConsoleException if entry cannot be determined.
     */
public SMDiscoveryServiceData getEntityDiscoEntry(String universalId) throws AMConsoleException {
    SMDiscoveryServiceData resourceOffering = null;
    String[] params = { universalId, AMAdminConstants.DISCOVERY_SERVICE };
    logEvent("ATTEMPT_IDENTITY_READ_SERVICE_ATTRIBUTE_VALUES", params);
    try {
        AMIdentity amid = IdUtils.getIdentity(getUserSSOToken(), universalId);
        Map map = new CaseInsensitiveHashMap();
        map.putAll(amid.getServiceAttributes(AMAdminConstants.DISCOVERY_SERVICE));
        logEvent("SUCCEED_IDENTITY_READ_SERVICE_ATTRIBUTE_VALUES", params);
        resourceOffering = SMDiscoveryServiceData.getEntries((Set) map.get(AMAdminConstants.DISCOVERY_SERVICE_NAME_DYNAMIC_DISCO_ENTRIES));
    } catch (SSOException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { universalId, AMAdminConstants.DISCOVERY_SERVICE, strError };
        logEvent("SSO_EXCEPTION_IDENTITY_READ_SERVICE_ATTRIBUTE_VALUES", paramsEx);
        debug.error("EntityResourceOfferingModelImpl.getAttributeValues", e);
    } catch (IdRepoException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { universalId, AMAdminConstants.DISCOVERY_SERVICE, strError };
        logEvent("IDM_EXCEPTION_IDENTITY_READ_SERVICE_ATTRIBUTE_VALUES", paramsEx);
        debug.error("EntityResourceOfferingModelImpl.getAttributeValues", e);
    }
    return resourceOffering;
}
Also used : SMDiscoveryServiceData(com.sun.identity.console.service.model.SMDiscoveryServiceData) Set(java.util.Set) AMIdentity(com.sun.identity.idm.AMIdentity) IdRepoException(com.sun.identity.idm.IdRepoException) SSOException(com.iplanet.sso.SSOException) HashMap(java.util.HashMap) CaseInsensitiveHashMap(com.sun.identity.common.CaseInsensitiveHashMap) Map(java.util.Map) CaseInsensitiveHashMap(com.sun.identity.common.CaseInsensitiveHashMap)

Example 2 with SMDiscoveryServiceData

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

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

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

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

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