use of java.util.ResourceBundle in project OpenAM by OpenRock.
the class AgentConfigInheritViewBean method populatePropertyNameTableModel.
private void populatePropertyNameTableModel(Collection propertyNames) {
if (!submitCycle && (propertyNames != null)) {
tblPropertyNamesModel.clearAll();
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
String universalId = (String) getPageSessionAttribute(AgentProfileViewBean.UNIVERSAL_ID);
String agentType = getAgentType();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
AgentsModel model = (AgentsModel) getModel();
Set inheritedPropertyNames = model.getInheritedPropertyNames(curRealm, universalId);
Map nameToSchemas = model.getAttributeSchemas(agentType, propertyNames);
removeNonInheritable(nameToSchemas, propertyNames);
try {
ResourceBundle rb = AgentConfiguration.getServiceResourceBundle(model.getUserLocale());
String groupName = model.getAgentGroup(curRealm, universalId);
Map groupValues = model.getGroupAttributeValues(curRealm, groupName);
ArrayList cache = new ArrayList();
int counter = 0;
for (Iterator i = propertyNames.iterator(); i.hasNext(); counter++) {
if (counter > 0) {
tblPropertyNamesModel.appendRow();
}
String name = (String) i.next();
AttributeSchema as = (AttributeSchema) nameToSchemas.get(name);
if (as != null) {
String displayName = rb.getString(as.getI18NKey());
tblPropertyNamesModel.setValue(TBL_DATA_PROPERTY_NAME, displayName);
try {
String help = rb.getString(as.getI18NKey() + ".help");
tblPropertyNamesModel.setValue(TBL_DATA_PROPERTY_HELP, help);
} catch (MissingResourceException e) {
// need to clear the help value
tblPropertyNamesModel.setValue(TBL_DATA_PROPERTY_HELP, "");
}
Object oValue = groupValues.get(name);
String value = "";
if (oValue != null) {
value = oValue.toString();
if (value.length() >= 2) {
value = value.substring(1, value.length() - 1);
}
}
tblPropertyNamesModel.setValue(TBL_DATA_VALUE, value);
tblPropertyNamesModel.setSelectionVisible(counter, true);
tblPropertyNamesModel.setRowSelected(inheritedPropertyNames.contains(name));
cache.add(name);
}
}
szCache.setValue(cache);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
} catch (SMSException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
} catch (SSOException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
}
use of java.util.ResourceBundle in project OpenAM by OpenRock.
the class SmsSingletonProvider method createSchema.
@Override
protected JsonValue createSchema(Context context) {
JsonValue result = super.createSchema(context);
if (dynamicSchema != null) {
Map<String, String> attributeSectionMap = getAttributeNameToSection(dynamicSchema);
ResourceBundle console = ResourceBundle.getBundle("amConsole");
String serviceType = dynamicSchema.getServiceType().getType();
String sectionOrder = getConsoleString(console, "sections." + serviceName + "." + serviceType);
List<String> sections = new ArrayList<String>();
if (StringUtils.isNotEmpty(sectionOrder)) {
sections.addAll(Arrays.asList(sectionOrder.split("\\s+")));
}
addAttributeSchema(result, "/properties/dynamic/", dynamicSchema, sections, attributeSectionMap, console, serviceType, context);
}
return result;
}
use of java.util.ResourceBundle in project OpenAM by OpenRock.
the class UsageFormatter method formatSubcmds.
private void formatSubcmds(CommandManager mgr, StringBuffer buff) throws CLIException {
ResourceBundle rb = mgr.getResourceBundle();
buff.append(rb.getString("USAGE_SUBCOMMAND_TITLE"));
buff.append("\n");
List defObjects = mgr.getDefinitionObjects();
Map mapCmds = new HashMap();
Set orderCmds = new TreeSet();
for (Iterator i = defObjects.iterator(); i.hasNext(); ) {
IDefinition def = (IDefinition) i.next();
for (Iterator j = def.getSubCommands().iterator(); j.hasNext(); ) {
SubCommand cmd = (SubCommand) j.next();
if ((cmd != null) && (!mgr.webEnabled() || cmd.webEnabled())) {
String name = cmd.getName();
orderCmds.add(name);
mapCmds.put(name, cmd.getDescription());
}
}
}
StringBuilder buffCmd = new StringBuilder();
boolean started = false;
String webEnabledURL = mgr.getWebEnabledURL();
for (Iterator i = orderCmds.iterator(); i.hasNext(); ) {
String cmdName = (String) i.next();
buffCmd.append(formAbstractCmdUsage(webEnabledURL, cmdName, (String) mapCmds.get(cmdName)));
}
buff.append(buffCmd.toString());
}
use of java.util.ResourceBundle in project OpenAM by OpenRock.
the class UsageFormatter method formatGlobalOptions.
private void formatGlobalOptions(CommandManager mgr, StringBuffer buff) throws CLIException {
ResourceBundle rb = mgr.getResourceBundle();
buff.append(rb.getString("USAGE_GLOBAL_OPTIONS_TITLE"));
buff.append("\n");
for (Iterator i = globalOptions.iterator(); i.hasNext(); ) {
try {
String option = (String) i.next();
Field fldLong = CLIConstants.class.getField(CLIConstants.PREFIX_ARGUMENT + option);
Field fldShort = CLIConstants.class.getField(CLIConstants.PREFIX_SHORT_ARGUMENT + option);
Object[] params = { fldLong.get(null), fldShort.get(null), rb.getString(CLIConstants.PREFIX_ARGUMENT + option) };
buff.append(MessageFormat.format(CLIConstants.USAGE_OPTIONAL_OPTION_FORMAT, params));
buff.append("\n");
} catch (Exception e) {
throw new CLIException(e.getMessage(), ExitCodes.USAGE_FORMAT_ERROR);
}
}
buff.append("\n");
}
use of java.util.ResourceBundle in project OpenAM by OpenRock.
the class UsageFormatter method formatOptions.
private void formatOptions(CommandManager mgr, StringBuffer buff, SubCommand cmd) throws CLIException {
ResourceBundle rb = mgr.getResourceBundle();
buff.append(rb.getString("USAGE_OPTIONS_TITLE"));
buff.append("\n");
formatOption(cmd.getMandatoryOptions(), cmd, buff);
formatOption(cmd.getOptionalOptions(), cmd, buff);
buff.append("\n");
}
Aggregations