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;
}
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);
}
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();
}
}
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();
}
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();
}
Aggregations