001
014
015 package com.liferay.portlet.dynamicdatalists.util;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018
019 import java.util.HashMap;
020 import java.util.Map;
021
022
025 public class DDLExporterFactory {
026
027 public static DDLExporter getDDLExporter(DDLExportFormat exportFormat)
028 throws PortalException {
029
030 DDLExporter exporter = _exporters.get(exportFormat);
031
032 if (exporter == null) {
033 throw new PortalException("Invalid format type " + exportFormat);
034 }
035
036 return exporter;
037 }
038
039 public void setDDLExporters(Map<String, DDLExporter> exporters) {
040 _exporters = new HashMap<DDLExportFormat, DDLExporter>();
041
042 for (Map.Entry<String, DDLExporter> entry : exporters.entrySet()) {
043 DDLExportFormat exportFormat = DDLExportFormat.parse(
044 entry.getKey());
045
046 _exporters.put(exportFormat, entry.getValue());
047 }
048 }
049
050 private static Map<DDLExportFormat, DDLExporter> _exporters;
051
052 }