private ObjectNameFilter getFilter(WbProperties props, String key, String prop) { String filterList = props.getProperty(PROP_PREFIX + key + prop); if (StringUtil.isBlank(filterList)) return null; boolean inclusion = props.getBoolProperty(PROP_PREFIX + key + prop + ".include", false); ObjectNameFilter filter = new ObjectNameFilter(); filter.setExpressionList(filterList); filter.setInclusionFilter(inclusion); return filter; }
private void storeProfile(String key, ConnectionProfile profile, WbProperties props) { ConnectionProfile defaultValues = new ConnectionProfile(); key = "." + key; props.setProperty(PROP_PREFIX + key + PROP_URL, profile.getUrl()); props.setProperty(PROP_PREFIX + key + PROP_NAME, profile.getName()); props.setProperty(PROP_PREFIX + key + PROP_DRIVERNAME, profile.getDriverName()); props.setProperty(PROP_PREFIX + key + PROP_DRIVERCLASS, profile.getDriverclass()); props.setProperty(PROP_PREFIX + key + PROP_USERNAME, profile.getUsername()); props.setProperty(PROP_PREFIX + key + PROP_AUTOCOMMMIT, profile.getAutocommit()); props.setProperty(PROP_PREFIX + key + PROP_TAGS, profile.getTagList()); props.setProperty(PROP_PREFIX + key + PROP_STORE_PWD, profile.getStorePassword()); if (profile.getStorePassword()) { props.setProperty(PROP_PREFIX + key + PROP_PWD, profile.getPassword()); } props.setProperty(PROP_PREFIX + key + PROP_ICON, profile.getIcon()); props.setProperty(PROP_PREFIX + key + PROP_WORKSPACE, profile.getWorkspaceFile()); props.setProperty( PROP_PREFIX + key + PROP_ALT_DELIMITER, profile.getAlternateDelimiterString()); props.setProperty(PROP_PREFIX + key + PROP_MACROFILE, profile.getMacroFilename()); props.setProperty(PROP_PREFIX + key + PROP_SCRIPT_CONNECT, profile.getPostConnectScript()); props.setProperty(PROP_PREFIX + key + PROP_SCRIPT_DISCONNECT, profile.getPreDisconnectScript()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_STORECACHE, profile.getStoreCacheLocally(), defaultValues.getStoreCacheLocally()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_ROLLBACK_DISCONNECT, profile.getRollbackBeforeDisconnect(), defaultValues.getRollbackBeforeDisconnect()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_SEPARATECONNECTION, profile.getUseSeparateConnectionPerTab(), defaultValues.getUseSeparateConnectionPerTab()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_IGNOREDROPERRORS, profile.getIgnoreDropErrors(), defaultValues.getIgnoreDropErrors()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_TRIMCHARDATA, profile.getTrimCharData(), defaultValues.getTrimCharData()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_ORACLESYSDBA, profile.getOracleSysDBA(), defaultValues.getOracleSysDBA()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_DETECTOPENTRANSACTION, profile.getDetectOpenTransaction(), defaultValues.getDetectOpenTransaction()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_READONLY, profile.isReadOnly(), defaultValues.isReadOnly()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_PREVENT_NO_WHERE, profile.getPreventDMLWithoutWhere(), defaultValues.getPreventDMLWithoutWhere()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_CONFIRM_UPDATES, profile.getConfirmUpdates(), defaultValues.getConfirmUpdates()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_PROMPTUSERNAME, profile.getPromptForUsername(), defaultValues.getPromptForUsername()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_EMPTY_STRING_IS_NULL, profile.getEmptyStringIsNull(), defaultValues.getEmptyStringIsNull()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_INCLUDE_NULL_ON_INSERT, profile.getIncludeNullInInsert(), defaultValues.getIncludeNullInInsert()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_REMOVE_COMMENTS, profile.getRemoveComments(), defaultValues.getRemoveComments()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_REMEMEMBER_SCHEMA, profile.getStoreExplorerSchema(), defaultValues.getStoreExplorerSchema()); setNonDefaultProperty( props, PROP_PREFIX + key + PROP_HIDE_WARNINGS, profile.isHideWarnings(), defaultValues.isHideWarnings()); if (StringUtil.stringsAreNotEqual(profile.getGroup(), defaultValues.getGroup())) { props.setProperty(PROP_PREFIX + key + PROP_GROUP, profile.getGroup()); } props.setProperty(PROP_PREFIX + key + PROP_SCRIPT_IDLE, profile.getIdleScript()); if (profile.getIdleTime() != defaultValues.getIdleTime()) { props.setProperty(PROP_PREFIX + key + PROP_IDLE_TIME, Long.toString(profile.getIdleTime())); } props.setProperty( PROP_PREFIX + key + PROP_INFO_COLOR, Settings.colorToString(profile.getInfoDisplayColor())); Integer fetchSize = profile.getDefaultFetchSize(); if (fetchSize != null) { props.setProperty(PROP_PREFIX + key + PROP_FETCHSIZE, fetchSize.intValue()); } Integer timeout = profile.getConnectionTimeout(); if (timeout != null) { props.setProperty(PROP_PREFIX + key + PROP_CONNECTION_TIMEOUT, timeout.intValue()); } ObjectNameFilter filter = profile.getSchemaFilter(); String expr = (filter != null ? filter.getFilterString() : null); if (expr != null && filter != null) { props.setProperty(PROP_PREFIX + key + PROP_SCHEMA_FILTER, expr); props.setProperty( PROP_PREFIX + key + PROP_SCHEMA_FILTER + ".include", filter.isInclusionFilter()); } filter = profile.getCatalogFilter(); expr = (filter != null ? filter.getFilterString() : null); if (expr != null && filter != null) { props.setProperty(PROP_PREFIX + key + PROP_CATALOG_FILTER, expr); props.setProperty( PROP_PREFIX + key + PROP_CATALOG_FILTER + ".include", filter.isInclusionFilter()); } String xml = toXML(profile.getConnectionProperties()); props.setProperty(PROP_PREFIX + key + PROP_CONN_PROPS, xml); }