use of com.sun.identity.console.agentconfig.AgentTabManager in project OpenAM by OpenRock.
the class AgentPropertyXMLBuilder method getAttributeSchemas.
private void getAttributeSchemas(String serviceName, boolean localized) throws SMSException, SSOException {
mapTypeToAttributeSchema = new HashMap();
Set localProperty = null;
if (localized && !bGroup) {
localProperty = AgentConfiguration.getLocalPropertyNames(agentType);
}
Set attrSchemas = AgentConfiguration.getAgentAttributeSchemas(agentType);
for (Iterator i = attrSchemas.iterator(); i.hasNext(); ) {
AttributeSchema as = (AttributeSchema) i.next();
String i18nKey = as.getI18NKey();
if ((i18nKey == null) || (i18nKey.trim().length() == 0)) {
i.remove();
} else if (bGroup) {
if (as.getName().equals(ATTR_NAME_PWD) || as.getName().equals(ATTR_LOC_CONFIG)) {
i.remove();
}
} else if ((localProperty != null) && !localProperty.contains(as.getName())) {
i.remove();
}
}
AgentTabManager mgr = AgentTabManager.getInstance();
Map secToAttrNames = null;
if (!localized) {
secToAttrNames = (tabName == null) ? mgr.getAttributeNames(agentType, -1) : mgr.getAttributeNames(agentType, mgr.getTabId(agentType, tabName));
}
if ((secToAttrNames == null) || secToAttrNames.isEmpty()) {
mapTypeToAttributeSchema.put(DUMMY_SECTION, attrSchemas);
} else {
for (Iterator i = secToAttrNames.keySet().iterator(); i.hasNext(); ) {
String sectionName = (String) i.next();
Set attrNames = (Set) secToAttrNames.get(sectionName);
Set set = getAttributeSchemas(attrSchemas, attrNames);
if ((set != null) && !set.isEmpty()) {
mapTypeToAttributeSchema.put(sectionName, set);
}
}
}
}
use of com.sun.identity.console.agentconfig.AgentTabManager in project OpenAM by OpenRock.
the class AgentPropertyXMLBuilder method getXML.
/**
* Returns a XML for displaying attribute in property sheet.
*
* @param readonly Set of readonly attribute names.
* @param choice Choice of type of configuration.
* @throws SMSException if attribute schema cannot obtained.
* @throws SSOException if single sign on token is invalid.
* @throws AMConsoleException if there are no attribute to display.
* @return XML for displaying attribute in property sheet.
*/
public String getXML(Set readonly, String choice) throws SMSException, SSOException, AMConsoleException {
StringBuffer xml = new StringBuffer(1000);
xml.append(getXMLDefinitionHeader()).append(START_TAG);
AgentTabManager tabMgr = AgentTabManager.getInstance();
List order = tabMgr.getSectionOrder(agentType, tabName);
boolean bLocal = (choice != null) && choice.equals("local");
if (bLocal || (order == null) || order.isEmpty()) {
Set attrSchemas = (Set) mapTypeToAttributeSchema.get(DUMMY_SECTION);
if (bLocal) {
for (Iterator i = attrSchemas.iterator(); i.hasNext(); ) {
AttributeSchema as = (AttributeSchema) i.next();
if ((as.getName().equals(AgentsViewBean.DESCRIPTION))) {
i.remove();
}
}
}
String display = model.getLocalizedString("blank.header");
buildSchemaTypeXML(display, attrSchemas, xml, model, serviceBundle, readonly);
} else {
for (Iterator i = order.iterator(); i.hasNext(); ) {
String sectionName = (String) i.next();
Set attributeSchema = (Set) mapTypeToAttributeSchema.get(sectionName);
String display = model.getLocalizedString("section.label." + agentType + "." + tabName + "." + sectionName);
buildSchemaTypeXML(display, attributeSchema, xml, model, serviceBundle, readonly);
}
}
xml.append(END_TAG);
if (!bGroup && !olderAgentType && tabMgr.isFirstTab(agentType, tabName)) {
String buff = xml.toString();
int idx = buff.indexOf("<property ");
return buff.substring(0, idx) + GROUP_XML + buff.substring(idx);
} else {
return xml.toString();
}
}
Aggregations