use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.
the class ServerConfigInheritViewBean method populatePropertyNameTableModel.
private void populatePropertyNameTableModel(Collection propertyNames) {
if (!submitCycle && (propertyNames != null)) {
tblPropertyNamesModel.clearAll();
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
String serverName = (String) getPageSessionAttribute(ServerEditViewBeanBase.PG_ATTR_SERVER_NAME);
ServerSiteModel model = (ServerSiteModel) getModel();
Map defaultValues = model.getServerDefaults();
ArrayList cache = new ArrayList();
try {
Map serverProperties = model.getServerConfiguration(serverName);
int counter = 0;
boolean first = false;
for (Iterator iter = propertyNames.iterator(); iter.hasNext(); counter++) {
if (counter > 0) {
tblPropertyNamesModel.appendRow();
}
String name = (String) iter.next();
String displayName = name.substring(3);
displayName = "amconfig." + displayName.replaceAll("-", ".");
String actualPropertyName = ServerEditViewBeanBase.getActualPropertyName(name);
tblPropertyNamesModel.setValue(TBL_DATA_PROPERTY_NAME, displayName);
tblPropertyNamesModel.setValue(TBL_DATA_VALUE, (String) defaultValues.get(actualPropertyName));
tblPropertyNamesModel.setSelectionVisible(counter, true);
tblPropertyNamesModel.setRowSelected(!serverProperties.containsKey(actualPropertyName));
cache.add(name);
}
szCache.setValue(cache);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
}
use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.
the class ServerConfigInheritViewBean method handleButton1Request.
/**
* Handles save profile request.
*
* @param event Request invocation event
*/
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
submitCycle = true;
CCActionTable table = (CCActionTable) getChild(TBL_PROPERTY_NAMES);
table.restoreStateData();
Integer[] selected = tblPropertyNamesModel.getSelectedRows();
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
List list = (List) szCache.getSerializedObj();
Set toInherit = new HashSet(selected.length * 2);
for (int i = 0; i < selected.length; i++) {
String name = (String) list.get(selected[i].intValue());
toInherit.add(ServerEditViewBeanBase.getActualPropertyName(name));
}
Set notToInherit = new HashSet(list.size() * 2);
for (Iterator i = list.iterator(); i.hasNext(); ) {
String name = (String) i.next();
notToInherit.add(ServerEditViewBeanBase.getActualPropertyName(name));
}
notToInherit.removeAll(toInherit);
try {
ServerSiteModel model = (ServerSiteModel) getModel();
String serverName = (String) getPageSessionAttribute(ServerEditViewBeanBase.PG_ATTR_SERVER_NAME);
model.updateServerConfigInheritance(serverName, toInherit, notToInherit);
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "servercfg.inheritance.updated");
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.
the class ServerConfigInheritViewBean method createChild.
protected View createChild(String name) {
View view = null;
if (name.equals(TBL_PROPERTY_NAMES)) {
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
populatePropertyNameTableModel((List) szCache.getSerializedObj());
view = new CCActionTable(this, tblPropertyNamesModel, name);
} else if (name.equals(PGTITLE_THREE_BTNS)) {
view = new CCPageTitle(this, ptModel, name);
} else if (tblPropertyNamesModel.isChildSupported(name)) {
view = tblPropertyNamesModel.createChild(this, name);
} else if (ptModel.isChildSupported(name)) {
view = ptModel.createChild(this, name);
} else if (name.equals(CHILD_STATICTEXT)) {
view = new CCStaticTextField(this, name, null);
} else {
view = super.createChild(name);
}
return view;
}
use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.
the class ServerSiteViewBean method populateSiteTableModel.
private void populateSiteTableModel(Map siteToURL) {
tblSiteModel.clearAll();
SerializedField szCache = (SerializedField) getChild(SZ_CACHE_1);
SerializedField szCacheSite = (SerializedField) getChild(SZ_CACHE_SITE);
ServerSiteModel model = (ServerSiteModel) getModel();
tblServerModel.setMaxRows(model.getPageSize());
HashMap cacheSite = new HashMap();
ArrayList cache = new ArrayList();
if ((siteToURL != null) && !siteToURL.isEmpty()) {
int counter = 0;
for (Iterator iter = siteToURL.keySet().iterator(); iter.hasNext(); counter++) {
if (counter > 0) {
tblSiteModel.appendRow();
}
String name = (String) iter.next();
String[] params = (String[]) siteToURL.get(name);
String url = params[0];
String assigned = params[1];
tblSiteModel.setValue(TBL_DATA_SITE_ACTION_HREF, stringToHex(name));
tblSiteModel.setValue(TBL_DATA_SITE_NAME, name);
tblSiteModel.setValue(TBL_DATA_SITE_URL, url);
tblSiteModel.setValue(TBL_DATA_SITE_SERVERS, assigned);
tblSiteModel.setSelectionVisible(counter, true);
cacheSite.put(name, params);
cache.add(name);
}
szCacheSite.setValue(cacheSite);
szCache.setValue(cache);
} else {
szCache.setValue(null);
szCacheSite.setValue(null);
}
}
use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.
the class STSHomeViewBean method populateRestSTSTableModel.
private void populateRestSTSTableModel(Set<String> publishedInstances) {
tblModelRestSTSInstances.clearAll();
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
Map<String, Set<String>> cacheMap = (Map<String, Set<String>>) szCache.getSerializedObj();
if (cacheMap == null) {
cacheMap = new HashMap<>();
}
if ((publishedInstances != null) && !publishedInstances.isEmpty()) {
boolean firstEntry = true;
for (String instanceName : publishedInstances) {
if (firstEntry) {
firstEntry = false;
} else {
tblModelRestSTSInstances.appendRow();
}
tblModelRestSTSInstances.setValue(TBL_REST_STS_INSTANCES_DATA_NAME, instanceName);
tblModelRestSTSInstances.setValue(TBL_REST_STS_INSTANCES_DATA_ACTION_HREF, instanceName);
}
cacheMap.put(REST_STS_PUBLISHED_INSTANCES_CACHE_KEY, publishedInstances);
szCache.setValue(cacheMap);
} else {
szCache.setValue(null);
}
}
Aggregations