use of com.cubrid.cubridmanager.core.common.xml.XMLMemento in project cubrid-manager by CUBRID.
the class NodeFilterManager method saveFilterSetting.
/**
* Save filter setting to plug-in preference
*/
@SuppressWarnings("deprecation")
public void saveFilterSetting() {
synchronized (this) {
try {
XMLMemento memento = XMLMemento.createWriteRoot("filters");
if (memento == null) {
LOGGER.error("XMLMemento.createWriteRoot('filters') is a null.");
return;
}
Iterator<String> iterator = idFilterList.iterator();
while (iterator.hasNext()) {
String pattern = (String) iterator.next();
IXMLMemento child = memento.createChild("idFilter");
child.putString("id", pattern);
}
iterator = idGrayFilterList.iterator();
while (iterator.hasNext()) {
String pattern = (String) iterator.next();
IXMLMemento child = memento.createChild("idGrayFilter");
child.putString("id", pattern);
}
iterator = nameFilterList.iterator();
while (iterator.hasNext()) {
String pattern = (String) iterator.next();
IXMLMemento child = memento.createChild("nameFilter");
child.putString("pattern", pattern);
}
String xmlString = memento.saveToString();
IEclipsePreferences preference = new InstanceScope().getNode(CommonUIPlugin.PLUGIN_ID);
preference.put(FILTER_XML_CONTENT, xmlString);
preference.flush();
} catch (Exception e) {
LOGGER.error("saveFilterSetting", e);
}
}
}
use of com.cubrid.cubridmanager.core.common.xml.XMLMemento in project cubrid-manager by CUBRID.
the class ImportConfigManager method saveConfigs.
/**
*
* Save the import configs to plug-in preference
*
*/
public void saveConfigs() {
synchronized (this) {
XMLMemento memento = XMLMemento.createWriteRoot("databases");
Iterator<ImportConfig> iterator = importConfigList.iterator();
while (iterator.hasNext()) {
ImportConfig model = (ImportConfig) iterator.next();
model.setHistory(true);
IXMLMemento configMemento = memento.createChild("config");
configMemento.putString("name", model.getName());
configMemento.putString("id", model.getId());
configMemento.putInteger("importType", model.getImportType());
configMemento.putInteger("errorHandle", model.getErrorHandle());
configMemento.putString("fileCharset", model.getFilesCharset());
configMemento.putBoolean("isCreateTable", model.isCreateTableAccordingData());
configMemento.putInteger("threadCount", model.getThreadCount());
configMemento.putInteger("commitCount", model.getCommitLine());
configMemento.putString("rowDelimiter", model.getRowDelimiter());
configMemento.putString("columnDelimiter", model.getColumnDelimiter());
configMemento.putBoolean("isHaMode", model.isHaMode());
IXMLMemento nullValuesMemento = configMemento.createChild("nullValues");
for (String nullValue : model.getNullValueList()) {
IXMLMemento nullValueMemento = nullValuesMemento.createChild("nullValue");
nullValueMemento.putTextData(nullValue);
}
IXMLMemento tableConfigsMemento = configMemento.createChild("tableConfigs");
for (TableConfig tableConfig : model.getSelectedMap().values()) {
IXMLMemento tableConfigMemento = tableConfigsMemento.createChild("tableConfig");
for (PstmtParameter pstm : tableConfig.getPstmList()) {
IXMLMemento pstmMemento = tableConfigMemento.createChild("pstm");
pstmMemento.putString("paramName", pstm.getParamName());
pstmMemento.putString("paramType", pstm.getDataType());
pstmMemento.putString("paramValue", pstm.getStringParamValue());
pstmMemento.putInteger("paramIndex", pstm.getParamIndex());
pstmMemento.putString("fileColumnName", pstm.getFileColumnName());
}
tableConfigMemento.putString("name", tableConfig.getName());
tableConfigMemento.putString("filePath", tableConfig.getFilePath());
tableConfigMemento.putString("fileType", tableConfig.getFileType() == null ? "" : tableConfig.getFileType());
tableConfigMemento.putInteger("lineCount", tableConfig.getLineCount());
tableConfigMemento.putString("createDDL", tableConfig.getCreateDDL() == null ? "" : tableConfig.getCreateDDL());
tableConfigMemento.putString("insertDML", tableConfig.getInsertDML() == null ? "" : tableConfig.getInsertDML());
tableConfigMemento.putBoolean("isFirstRowAsColumn", tableConfig.isFirstRowAsColumn());
}
}
PersistUtils.saveXMLMemento(CommonUIPlugin.PLUGIN_ID, COM_CUBRID_IMPORT_SETTING, memento);
}
}
use of com.cubrid.cubridmanager.core.common.xml.XMLMemento in project cubrid-manager by CUBRID.
the class ExportConfigManager method saveConfigs.
/**
*
* Save the export configs to plug-in preference
*
*/
public void saveConfigs() {
synchronized (this) {
XMLMemento memento = XMLMemento.createWriteRoot("databases");
Iterator<ExportConfig> iterator = exportConfigList.iterator();
while (iterator.hasNext()) {
ExportConfig model = (ExportConfig) iterator.next();
IXMLMemento configMemento = memento.createChild("config");
configMemento.putString("name", model.getName());
configMemento.putInteger("exportType", model.getExportType());
configMemento.putInteger("fileType", model.getExportFileType());
configMemento.putBoolean("exportData", model.isExportData());
configMemento.putBoolean("exportIndex", model.isExportIndex());
configMemento.putBoolean("exportSchema", model.isExportSchema());
configMemento.putBoolean("exportSerial", model.isExportSerial());
configMemento.putBoolean("exportView", model.isExportView());
configMemento.putBoolean("exportStartValue", model.isExportSerialStartValue());
configMemento.putBoolean("exportLob", model.isExportLob());
configMemento.putString("schemaFile", model.getSchemaFilePath());
configMemento.putString("indexFile", model.getIndexFilePath());
configMemento.putString("dataFile", model.getDataFileFolder());
configMemento.putString("fileCharset", model.getFileCharset());
configMemento.putInteger("threadCount", model.getThreadCount());
configMemento.putBoolean("useFirstAsColumn", model.isFirstRowAsColumnName());
configMemento.putString("nullValue", model.getNULLValueTranslation());
configMemento.putString("rowDelimiter", model.getRowDelimeter());
configMemento.putString("colDelimiter", model.getColumnDelimeter());
List<String> tableList = model.getTableNameList();
for (String tableName : tableList) {
IXMLMemento tableMemento = configMemento.createChild("table");
tableMemento.putString("name", tableName);
String whereCondition = model.getWhereCondition(tableName);
if (StringUtil.isNotEmpty(whereCondition)) {
tableMemento.putString("where", whereCondition);
}
}
}
PersistUtils.saveXMLMemento(CommonUIPlugin.PLUGIN_ID, COM_CUBRID_EXPORT_SETTING, memento);
}
}
use of com.cubrid.cubridmanager.core.common.xml.XMLMemento in project cubrid-manager by CUBRID.
the class RecentlyUsedSQLDetailPersistUtils method saveToXML.
/**
* save the sql to preference
*
* @param id
* @param recentlyUsedSQLContentList
*/
private static void saveToXML(String id, LinkedList<SQLHistoryDetail> sqlHistories) {
if (sqlHistories == null) {
return;
}
XMLMemento memento = XMLMemento.createWriteRoot("SQLHistoryDetails");
for (int i = 0, len = sqlHistories.size(); i < len; i++) {
IXMLMemento subNodes = memento.createChild("SQLHistoryDetail");
SQLHistoryDetail historyDetail = (SQLHistoryDetail) sqlHistories.get(i);
subNodes.putString("SQL", historyDetail.getSql());
subNodes.putString("elapseTime", historyDetail.getElapseTime());
subNodes.putString("executeTime", historyDetail.getExecuteTime());
subNodes.putString("LOG", historyDetail.getExecuteInfo());
}
PersistUtils.saveXMLMemento(RecentlyUsedSQLComposite.ID, id, memento);
}
use of com.cubrid.cubridmanager.core.common.xml.XMLMemento in project cubrid-manager by CUBRID.
the class ApplicationWorkbenchWindowAdvisor method saveLastVersion.
public void saveLastVersion(String version) {
XMLMemento memento = XMLMemento.createWriteRoot("settings");
memento.putString("lastVersion", version);
PersistUtils.saveXMLMemento(this.getClass().getName(), "startup", memento);
}
Aggregations