public ProfileExporter getProfileExporter(String exporterKey) { for (ProfileExporter exporter : exporters) { if (StringUtils.equals(exporterKey, exporter.getKey())) { return exporter; } } return null; }
public List<ProfileExporter> getProfileExportersForLanguage(String language) { List<ProfileExporter> result = new ArrayList<ProfileExporter>(); for (ProfileExporter exporter : exporters) { if (exporter.getSupportedLanguages() == null || exporter.getSupportedLanguages().length == 0 || ArrayUtils.contains(exporter.getSupportedLanguages(), language)) { result.add(exporter); } } return result; }
public String exportProfile(int profileId, String exporterKey) { DatabaseSession session = sessionFactory.getSession(); RulesProfile profile = loadProfile(session, profileId); if (profile != null) { ProfileExporter exporter = getProfileExporter(exporterKey); Writer writer = new StringWriter(); exporter.exportProfile(profile, writer); return writer.toString(); } return null; }