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