use of com.sun.identity.console.service.model.SMDiscoveryServiceData in project OpenAM by OpenRock.
the class UMUserResourceOfferingModelImpl method getUserDiscoEntry.
/**
* Returns resource offering entry stored for a given Universal ID of user.
*
* @param userId Universal ID of user.
* @return resource offering entry stored for a given user.
* @throws AMConsoleException if entry cannot be determined.
*/
public SMDiscoveryServiceData getUserDiscoEntry(String userId) throws AMConsoleException {
SMDiscoveryServiceData resourceOffering = null;
String[] params = { userId, AMAdminConstants.ATTR_USER_RESOURCE_OFFERING };
try {
logEvent("ATTEMPT_READ_IDENTITY_ATTRIBUTE_VALUE", params);
AMIdentity amid = IdUtils.getIdentity(getUserSSOToken(), userId);
resourceOffering = SMDiscoveryServiceData.getEntries(amid.getAttribute(AMAdminConstants.ATTR_USER_RESOURCE_OFFERING), SMDiscoveryServiceData.USER_RESOURCE_OFFERING_ENTRY);
resourceOffering.setEntryType(SMDiscoveryServiceData.USER_RESOURCE_OFFERING_ENTRY);
logEvent("SUCCEED_READ_IDENTITY_ATTRIBUTE_VALUE", params);
} catch (SSOException e) {
String strError = getErrorString(e);
String[] paramsEx = { userId, AMAdminConstants.ATTR_USER_RESOURCE_OFFERING, strError };
logEvent("SSO_EXCEPTION_READ_IDENTITY_ATTRIBUTE_VALUE", paramsEx);
throw new AMConsoleException(strError);
} catch (IdRepoException e) {
String strError = getErrorString(e);
String[] paramsEx = { userId, AMAdminConstants.ATTR_USER_RESOURCE_OFFERING, strError };
logEvent("IDM_EXCEPTION_READ_IDENTITY_ATTRIBUTE_VALUE", paramsEx);
throw new AMConsoleException(strError);
}
return resourceOffering;
}
use of com.sun.identity.console.service.model.SMDiscoveryServiceData in project OpenAM by OpenRock.
the class RealmResourceOfferingViewBean method handleTblButtonDeleteRequest.
public void handleTblButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
CCActionTable table = (CCActionTable) getChild(TBL_ENTRIES);
table.restoreStateData();
RealmResourceOfferingModel model = (RealmResourceOfferingModel) getModel();
String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
String cacheID = (String) getPageSessionAttribute(RealmResourceOfferingViewBean.DATA_ID);
SMDiscoveryServiceData smEntry = cache.getData(model.getUserSSOToken(), cacheID);
Integer[] selected = tblModel.getSelectedRows();
smEntry.deleteDiscoEntries(selected);
try {
model.setRealmDiscoEntry(realm, 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();
}
use of com.sun.identity.console.service.model.SMDiscoveryServiceData in project OpenAM by OpenRock.
the class RealmResourceOfferingModelImpl method getRealmDiscoEntry.
/**
* Returns resource offering entry stored for a realm name.
*
* @param realm Realm Name.
* @return resource offering entry stored for a given user.
* @throws AMConsoleException if entry cannot be determined.
*/
public SMDiscoveryServiceData getRealmDiscoEntry(String realm) throws AMConsoleException {
SMDiscoveryServiceData resourceOffering = null;
String[] params = { realm, AMAdminConstants.DISCOVERY_SERVICE, AMAdminConstants.DISCOVERY_SERVICE_NAME_DYNAMIC_DISCO_ENTRIES };
logEvent("ATTEMPT_GET_ATTR_VALUE_OF_SERVICE_UNDER_REALM", params);
try {
AMIdentityRepository repo = new AMIdentityRepository(getUserSSOToken(), realm);
AMIdentity realmIdentity = repo.getRealmIdentity();
Set servicesFromIdRepo = realmIdentity.getAssignedServices();
Map map = null;
if (servicesFromIdRepo.contains(AMAdminConstants.DISCOVERY_SERVICE)) {
map = realmIdentity.getServiceAttributes(AMAdminConstants.DISCOVERY_SERVICE);
} else {
OrganizationConfigManager orgCfgMgr = new OrganizationConfigManager(getUserSSOToken(), realm);
map = orgCfgMgr.getServiceAttributes(AMAdminConstants.DISCOVERY_SERVICE);
}
logEvent("SUCCEED_GET_ATTR_VALUE_OF_SERVICE_UNDER_REALM", params);
resourceOffering = SMDiscoveryServiceData.getEntries((Set) map.get(AMAdminConstants.DISCOVERY_SERVICE_NAME_DYNAMIC_DISCO_ENTRIES));
} catch (SSOException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, AMAdminConstants.DISCOVERY_SERVICE, strError };
logEvent("SSO_EXCEPTION_GET_ATTR_VALUE_OF_SERVICE_UNDER_REALM", paramsEx);
debug.error("RealmResourceOfferingModelImpl.getAttributeValues", e);
} catch (IdRepoException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, AMAdminConstants.DISCOVERY_SERVICE, strError };
logEvent("IDREPO_EXCEPTION_GET_ATTR_VALUE_OF_SERVICE_UNDER_REALM", paramsEx);
debug.error("RealmResourceOfferingModelImpl.getAttributeValues", e);
} catch (SMSException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, AMAdminConstants.DISCOVERY_SERVICE, strError };
logEvent("SMS_EXCEPTION_GET_ATTR_VALUE_OF_SERVICE_UNDER_REALM", paramsEx);
debug.error("RealmResourceOfferingModelImpl.getAttributeValues", e);
}
return resourceOffering;
}
use of com.sun.identity.console.service.model.SMDiscoveryServiceData in project OpenAM by OpenRock.
the class SMDiscoveryServiceViewBean method populateBootstrapResOffTable.
private void populateBootstrapResOffTable(Set resoff) {
tablePopulated = true;
if (resoff != null) {
CCActionTableModel tblModel = (CCActionTableModel) propertySheetModel.getModel(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
tblModel.clearAll();
boolean firstEntry = true;
int counter = 0;
try {
SMDiscoveryServiceData smEntry = SMDiscoveryServiceData.getEntries(resoff);
List resourceList = smEntry.getResourceData();
if ((resourceList != null) && !resourceList.isEmpty()) {
for (Iterator i = resourceList.iterator(); i.hasNext(); ) {
SMDiscoEntryData smDisco = (SMDiscoEntryData) i.next();
if (!firstEntry) {
tblModel.appendRow();
} else {
firstEntry = false;
}
tblModel.setValue(TBL_BOOTSTRAP_RES_OFF_DATA_SERVICE_TYPE, smDisco.serviceType);
tblModel.setValue(TBL_BOOTSTRAP_RES_OFF_DATA_ABSTRACT, smDisco.abstractValue);
tblModel.setValue(TBL_BOOTSTRAP_RES_OFF_HREF_ACTION, Integer.toString(counter));
counter++;
}
disableButton(TBL_BOOTSTRAP_RES_OFF_ADD_BTN, true);
} else {
disableButton(TBL_BOOTSTRAP_RES_OFF_ADD_BTN, false);
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
setPageSessionAttribute(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF, (OrderedSet) resoff);
}
use of com.sun.identity.console.service.model.SMDiscoveryServiceData in project OpenAM by OpenRock.
the class SMDiscoveryBootstrapRefOffEditViewBean method handleButton1Request.
protected void handleButton1Request(SMDiscoEntryData smData) throws AMConsoleException {
SMDiscoveryServiceViewBean vb = (SMDiscoveryServiceViewBean) getViewBean(SMDiscoveryServiceViewBean.class);
Map mapAttrs = (Map) getPageSessionAttribute(SMDiscoveryServiceViewBean.PROPERTY_ATTRIBUTE);
OrderedSet resoff = (OrderedSet) mapAttrs.get(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
SMDiscoveryServiceData smEntry = SMDiscoveryServiceData.getEntries(resoff);
int index = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
smEntry.replaceResourceData(index, smData);
mapAttrs.put(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF, (OrderedSet) smEntry.getDiscoveryEntries());
setPageSessionAttribute(SMDiscoveryServiceViewBean.PROPERTY_ATTRIBUTE, (HashMap) mapAttrs);
setPageSessionAttribute(SMDiscoveryServiceViewBean.PAGE_MODIFIED, "1");
backTrail();
unlockPageTrailForSwapping();
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
}
Aggregations