use of com.sun.identity.console.service.model.ServerSiteModel in project OpenAM by OpenRock.
the class ServerConfigXMLViewBean method handleTblServerConfigXMLUserButtonDeleteRequest.
/**
* Handles remove server group entry request.
*
* @param event Request invocation event
*/
public void handleTblServerConfigXMLUserButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
String serverName = (String) getPageSessionAttribute(ServerEditViewBeanBase.PG_ATTR_SERVER_NAME);
ServerSiteModel model = (ServerSiteModel) getModel();
try {
ServerConfigXML xmlObj = model.getServerConfigObject(serverName);
ServerConfigXML.ServerGroup defaultServerGroup = xmlObj.getDefaultServerGroup();
CCActionTable table = (CCActionTable) getChild(TBL_USERS);
table.restoreStateData();
Integer[] selected = tblUserModel.getSelectedRows();
if (selected.length >= defaultServerGroup.hosts.size()) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getLocalizedString("exception.cannot,delete.all.servers"));
} else {
for (int i = selected.length - 1; i >= 0; --i) {
defaultServerGroup.hosts.remove(selected[i].intValue());
}
model.setServerConfigXML(serverName, xmlObj.toXML());
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "serverconfig.updated");
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
use of com.sun.identity.console.service.model.ServerSiteModel in project OpenAM by OpenRock.
the class ServerEditViewBeanBase method createPropertyModel.
private void createPropertyModel(String serverName) {
String xml = AMAdminUtils.getStringFromInputStream(getClass().getClassLoader().getResourceAsStream(getPropertyXML()));
Set uiNames = getAllConfigUINames(xml);
ServerSiteModel model = (ServerSiteModel) getModel();
try {
Map attrValues = model.getServerConfiguration(serverName);
Map defaultValues = model.getServerDefaults();
Map textValues = new HashMap();
for (Iterator i = uiNames.iterator(); i.hasNext(); ) {
String uiName = (String) i.next();
String propertyName = getActualPropertyName(uiName);
if (!attrValues.containsKey(propertyName)) {
textValues.put(uiName, defaultValues.get(propertyName));
} else {
activePropertyNames.add(uiName);
i.remove();
}
allPropertyNames.add(uiName);
}
if (!textValues.isEmpty()) {
xml = textifyXML(xml, uiNames, textValues);
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
// this is because default server configuration does not have
// parent site.
xml = removeParentSiteBlob(xml);
propertySheetModel = new AMPropertySheetModel(xml);
propertySheetModel.clear();
}
use of com.sun.identity.console.service.model.ServerSiteModel in project OpenAM by OpenRock.
the class ServerSiteViewBean method handleTblSiteButtonDeleteRequest.
/**
* Deletes site.
*
* @param event Request Invocation Event.
* @throws ModelControlException if table model cannot be restored.
*/
public void handleTblSiteButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
CCActionTable table = (CCActionTable) getChild(TBL_SITES);
table.restoreStateData();
Integer[] selected = tblSiteModel.getSelectedRows();
SerializedField szCache = (SerializedField) getChild(SZ_CACHE_1);
List list = (List) szCache.getSerializedObj();
Set names = new HashSet(selected.length * 2);
for (int i = 0; i < selected.length; i++) {
String name = (String) list.get(selected[i].intValue());
names.add(name);
}
try {
ServerSiteModel model = (ServerSiteModel) getModel();
model.deleteSites(names);
if (selected.length == 1) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "siteconfig.message.deleted");
} else {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "siteconfig.message.deleted.pural");
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
Aggregations