use of com.sun.identity.console.service.model.DiscoveryDataCache in project OpenAM by OpenRock.
the class RealmResourceOfferingAddViewBean method handleButton1Request.
protected void handleButton1Request(SMDiscoEntryData smData) {
RealmResourceOfferingViewBean vb = (RealmResourceOfferingViewBean) getViewBean(RealmResourceOfferingViewBean.class);
RealmResourceOfferingModel model = (RealmResourceOfferingModel) getModel();
DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
String cacheID = (String) getPageSessionAttribute(RealmResourceOfferingViewBean.DATA_ID);
SMDiscoveryServiceData data = (SMDiscoveryServiceData) cache.getData(model.getUserSSOToken(), cacheID);
data.addResourceData(smData);
String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
try {
model.setRealmDiscoEntry(realm, data);
removePageSessionAttribute(RealmResourceOfferingViewBean.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.DiscoveryDataCache in project OpenAM by OpenRock.
the class RealmResourceOfferingEditViewBean method getCurrentServiceData.
protected SMDiscoEntryData getCurrentServiceData() {
int currentIdx = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
String cacheID = (String) getPageSessionAttribute(RealmResourceOfferingViewBean.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.DiscoveryDataCache 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();
}
}
use of com.sun.identity.console.service.model.DiscoveryDataCache 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();
}
}
use of com.sun.identity.console.service.model.DiscoveryDataCache 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();
}
Aggregations