use of com.sun.identity.console.service.model.SMDiscoveryServiceData in project OpenAM by OpenRock.
the class RealmResourceOfferingEditViewBean method handleButton1Request.
protected void handleButton1Request(SMDiscoEntryData smData) throws AMConsoleException {
RealmResourceOfferingModel model = (RealmResourceOfferingModel) getModel();
RealmResourceOfferingViewBean vb = (RealmResourceOfferingViewBean) getViewBean(RealmResourceOfferingViewBean.class);
DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
String cacheID = (String) getPageSessionAttribute(RealmResourceOfferingViewBean.DATA_ID);
SMDiscoveryServiceData smEntry = cache.getData(model.getUserSSOToken(), cacheID);
int index = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
smEntry.replaceResourceData(index, smData);
String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
try {
model.setRealmDiscoEntry(realm, smEntry);
removePageSessionAttribute(RealmResourceOfferingViewBean.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.SMDiscoveryServiceData 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.SMDiscoveryServiceData 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.SMDiscoveryServiceData in project OpenAM by OpenRock.
the class SMDiscoveryBootstrapRefOffEditViewBean method getCurrentServiceData.
protected SMDiscoEntryData getCurrentServiceData() {
SMDiscoEntryData curData = null;
int currentIdx = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
Map mapAttrs = (Map) getPageSessionAttribute(SMDiscoveryServiceViewBean.PROPERTY_ATTRIBUTE);
OrderedSet set = (OrderedSet) mapAttrs.get(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
try {
SMDiscoveryServiceData smEntry = SMDiscoveryServiceData.getEntries(set);
List resourceData = smEntry.getResourceData();
curData = (SMDiscoEntryData) resourceData.get(currentIdx);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
return curData;
}
use of com.sun.identity.console.service.model.SMDiscoveryServiceData in project OpenAM by OpenRock.
the class SMDiscoveryServiceViewBean method handleTblBootstrapResOffButtonDeleteRequest.
/**
* Handles remove resource offerings request.
*
* @param event Request Invocation Event.
*/
public void handleTblBootstrapResOffButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
setSubmitCycle(true);
CCActionTable table = (CCActionTable) getChild(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
table.restoreStateData();
CCActionTableModel tblModel = (CCActionTableModel) propertySheetModel.getModel(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
Integer[] selected = tblModel.getSelectedRows();
if ((selected != null) && (selected.length > 0)) {
try {
OrderedSet tblValues = (OrderedSet) getPageSessionAttribute(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
SMDiscoveryServiceData smEntry = SMDiscoveryServiceData.getEntries(tblValues);
smEntry.deleteDiscoEntries(selected);
tblValues = (OrderedSet) smEntry.getDiscoveryEntries();
setPageSessionAttribute(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF, tblValues);
populateBootstrapResOffTable(tblValues);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
forwardTo();
}
Aggregations