001/* 002 * Copyright 2015 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.plugins.contentio.export.sql; 017 018import java.util.HashMap; 019import java.util.Map; 020 021/** 022 * Configuration object for the export 023 */ 024public class ExportConfiguration 025{ 026 private String _tablePrefix; 027 private Map<String, Map<String, String>> _mappingSql; 028 private Map<String, Map<String, String>> _reservedWords; 029 private Map<String, String> _contentTypesToExport; 030 private String _mappingPolicy; /** FULL, CAMELCASE or FIRSTCHAR*/ 031 private boolean _exportOnlyValidatedContent; 032 private boolean _exportNoMultiValuedTable; 033 private String _separator; 034 035 /** 036 * Constructor 037 */ 038 public ExportConfiguration() 039 { 040 setMappingSql(new HashMap<>()); 041 setContentTypesToExport(new HashMap<>()); 042 _mappingPolicy = "FULL"; 043 } 044 045 /** 046 * Get the table prefix 047 * @return table prefix 048 */ 049 public String getTablePrefix() 050 { 051 return _tablePrefix; 052 } 053 054 /** 055 * Set the table prefix 056 * @param tablePrefix the table name prefix 057 */ 058 public void setTablePrefix(String tablePrefix) 059 { 060 this._tablePrefix = tablePrefix; 061 } 062 063 064 /** 065 * Get the sql mapping 066 * @return the sql mapping 067 */ 068 public Map<String, Map<String, String>> getMappingSql() 069 { 070 return _mappingSql; 071 } 072 073 /** 074 * Set the sql mapping 075 * @param mappingSql the sql mapping 076 */ 077 public void setMappingSql(Map<String, Map<String, String>> mappingSql) 078 { 079 this._mappingSql = mappingSql; 080 } 081 082 /** 083 * Get the content type to export 084 * @return the content type to export 085 */ 086 public Map<String, String> getContentTypesToExport() 087 { 088 return _contentTypesToExport; 089 } 090 091 /** 092 * Set the content type to export 093 * @param contentTypesToExport the map of content type to export 094 */ 095 public void setContentTypesToExport(Map<String, String> contentTypesToExport) 096 { 097 this._contentTypesToExport = contentTypesToExport; 098 } 099 100 /** 101 * Get the mapping policy 102 * @return the mapping policy 103 */ 104 public String getMappingPolicy() 105 { 106 return _mappingPolicy; 107 108 } 109 110 /** 111 * Set the mapping policy 112 * @param mappingPolicy the mapping policy 113 */ 114 public void setMappingPolicy(String mappingPolicy) 115 { 116 this._mappingPolicy = mappingPolicy; 117 } 118 119 /** 120 * Return true if we export only validated content 121 * @return true if we export only validated content 122 */ 123 public boolean exportOnlyValidatedContent() 124 { 125 return _exportOnlyValidatedContent; 126 } 127 128 /** 129 * Set the parameter to export only validated content 130 * @param onlyValidatedContent true if you want to export only validated content 131 */ 132 public void setExportOnlyValidatedContent(boolean onlyValidatedContent) 133 { 134 this._exportOnlyValidatedContent = onlyValidatedContent; 135 } 136 137 /** 138 * Return true if we export no multivalued table 139 * @return true if we export no multivalued table 140 */ 141 public boolean exportNoMultiValuedTable() 142 { 143 return _exportNoMultiValuedTable; 144 } 145 146 /** 147 * Set the parameter to export no multivalued table 148 * @param exportNoMultiValuedTable true if you want to export no multivalued table 149 */ 150 public void setExportNoMultiValuedTable(boolean exportNoMultiValuedTable) 151 { 152 this._exportNoMultiValuedTable = exportNoMultiValuedTable; 153 } 154 155 /** 156 * Get the separator for multivalued data 157 * @return the separator 158 */ 159 public String getSeparator() 160 { 161 return _separator; 162 } 163 164 /** 165 * Set the separator for multivalued data 166 * @param separator the separator 167 */ 168 public void setSeparator(String separator) 169 { 170 this._separator = separator; 171 } 172 173 /** 174 * Get the map of reserved words 175 * @return the map of reserved words 176 */ 177 public Map<String, Map<String, String>> getReservedWords() 178 { 179 return _reservedWords; 180 181 } 182 183 /** 184 * Set the map of reserved words 185 * @param reservedWords the map of reserved words 186 */ 187 public void setReservedWords(Map<String, Map<String, String>> reservedWords) 188 { 189 this._reservedWords = reservedWords; 190 } 191 192}