use of fish.payara.appserver.zendesk.config.ZendeskSupportConfiguration in project Payara by payara.
the class GetZendeskSupportConfigurationCommand method execute.
@Override
public void execute(AdminCommandContext acc) {
Config configNode = targetUtil.getConfig(config);
ZendeskSupportConfiguration zendeskSupportConfiguration = configNode.getExtensionByType(ZendeskSupportConfiguration.class);
ActionReport actionReport = acc.getActionReport();
final String[] outputHeaders = { "Enabled", "Email Address" };
ColumnFormatter columnFormatter = new ColumnFormatter(outputHeaders);
Object[] outputValues = { zendeskSupportConfiguration.getEnabled(), zendeskSupportConfiguration.getEmailAddress() };
columnFormatter.addRow(outputValues);
actionReport.appendMessage(columnFormatter.toString());
Map<String, Object> extraPropsMap = new HashMap<>();
extraPropsMap.put("enabled", zendeskSupportConfiguration.getEnabled());
extraPropsMap.put("emailAddress", zendeskSupportConfiguration.getEmailAddress());
Properties extraProps = new Properties();
extraProps.put("zendeskSupportConfiguration", extraPropsMap);
actionReport.setExtraProperties(extraProps);
}
use of fish.payara.appserver.zendesk.config.ZendeskSupportConfiguration in project Payara by payara.
the class SetZendeskSupportConfigurationCommand method execute.
@Override
public void execute(AdminCommandContext acc) {
Config config = targetUtil.getConfig(target);
ActionReport actionReport = acc.getActionReport();
ZendeskSupportConfiguration zendeskSupportConfiguration = config.getExtensionByType(ZendeskSupportConfiguration.class);
if (zendeskSupportConfiguration != null) {
try {
ConfigSupport.apply(new SingleConfigCode<ZendeskSupportConfiguration>() {
@Override
public Object run(ZendeskSupportConfiguration config) {
if (enabled != null) {
config.setEnabled(Boolean.toString(enabled));
}
if (!Strings.isNullOrEmpty(emailAddress)) {
config.setEmailAddress(emailAddress);
}
return null;
}
}, zendeskSupportConfiguration);
} catch (TransactionFailure ex) {
// Set failure
actionReport.failure(Logger.getLogger(SetZendeskSupportConfigurationCommand.class.getName()), "Failed to update configuration", ex);
}
}
}
Aggregations