private int getMaxLen(String rule, DBIdentifier name, int maxLen) { IdentifierConfiguration config = getIdentifierConfiguration(); if (maxLen < 1) { IdentifierRule nrule = config.getIdentifierRule(rule); maxLen = nrule.getMaxLength(); } // Subtract delimiter length if name is delimited or will be delimited if (config.delimitAll() || name.isDelimited()) { maxLen = maxLen - (config.getLeadingDelimiter().length() + config.getTrailingDelimiter().length()); } return maxLen; }
protected boolean needsConversion(IdentifierConfiguration config) { return (config != getIdentifierConfiguration()) && !(config.getConversionKey().equals(getIdentifierConfiguration().getConversionKey())); }
public boolean isDelimited(IdentifierConfiguration config, IdentifierRule rule, String name) { if (name == null || name.length() < 3) { return false; } return name.startsWith(config.getLeadingDelimiter()) && name.endsWith(config.getTrailingDelimiter()); }
return DBIdentifier.NULL; if (!getIdentifierConfiguration().getSupportsDelimitedIdentifiers()) { return DBIdentifier.newIdentifier(name, id); String delimCase = getIdentifierConfiguration().getDelimitedCase(); String nonDelimCase = getIdentifierConfiguration().getSchemaCase(); String caseName = name; boolean delimit = !caseName.equals(name) || getIdentifierConfiguration().delimitAll(); return DBIdentifier.newIdentifier((delimit ? name : caseName), id, false, delimit, !delimCase.equals(CASE_PRESERVE));
public String convert(IdentifierConfiguration config, String rule, String name) { // Already using same delimiter, no need to convert if (!needsConversion(config)) { return name; } // Otherwise, remove delimiters and add appropriate delimiters IdentifierRule orule = getIdentifierConfiguration().getIdentifierRule(rule); IdentifierRule nrule = config.getIdentifierRule(rule); boolean delimit = isDelimited(config, orule, name); if (delimit) { name = removeDelimiters(config, orule, name, config.getLeadingDelimiter(), config.getTrailingDelimiter()); return delimit(getIdentifierConfiguration(), nrule, name, delimit); } return name; }
String delimCase = getIdentifierConfiguration().getDelimitedCase(); if (/* getNamingConfiguration().delimitAll() || */ name.isDelimited()) { if (CASE_UPPER.equals(delimCase)) { if (!getIdentifierConfiguration().delimitAll()) { String schemaCase = getIdentifierConfiguration().getSchemaCase(); if (CASE_LOWER.equals(schemaCase)) return DBIdentifier.toLower(sName);
/** * Converts the identifier to a format appropriate for the configuration using * the specified naming rule. * @param delimit If false, do not delimit. Otherwise, delimit if necessary. */ private String toDBName(String rule, String name, boolean delimit) { if (name == null) { return null; } if (getIdentifierConfiguration().getSupportsDelimitedIdentifiers() && delimit && getIdentifierConfiguration().delimitAll() && !Normalizer.isDelimited(name)) { return delimit(rule, name, true); } return convert(Normalizer.getNamingConfiguration(), rule, name); }
public String combineFull(IdentifierConfiguration config, String rule, String fullName) { if (!needsConversion(config)) { return fullName; } // Split String[] names = splitName(config, rule, fullName); // Convert for (int i = 0; i < names.length; i++) { names[i] = convert(config, rule, names[i]); } // Join return joinNames(config, config.getIdentifierRule(rule), names, config.getIdentifierDelimiter()); }
private IdentifierRule[] getNamingRules(String[] rules) { IdentifierRule[] nrules = new IdentifierRule[rules.length]; for (int i = 0; i < rules.length; i++) { nrules[i] = _config.getIdentifierRule(rules[i]); } return nrules; }
/** * Converts the identifier to a format appropriate for the configuration using * the default naming rule. * @param delimit If false, do not delimit. Otherwise, delimit if necessary. */ public String toDBName(String name, boolean delimit) { return toDBName(getIdentifierConfiguration().getDefaultIdentifierRule().getName(), name, delimit); }
public String combineNames(IdentifierConfiguration config, IdentifierRule rule, IdentifierRule[] rules, String[] names) { boolean delimited = false; String combined = null; for (int i = 0; i < names.length; i++) { String name = names[i]; if (isDelimited(rules[i], name)) { delimited = true; name = removeDelimiters(config, rules[i], name); } if (i == 0) { combined = name; } else { combined = combined + config.getIdentifierConcatenator() + name; } } if (delimited) { combined = delimit(config, rule, combined); } return combined; }
String delimCase = getIdentifierConfiguration().getDelimitedCase(); if (delimCase.equals(CASE_LOWER)) { return DBIdentifier.toLower(validName,true);
public boolean isDelimited(IdentifierConfiguration config, IdentifierRule rule, String name) { if (name == null || name.length() < 3) { return false; } return name.startsWith(config.getLeadingDelimiter()) && name.endsWith(config.getTrailingDelimiter()); }
return DBIdentifier.NULL; if (!getIdentifierConfiguration().getSupportsDelimitedIdentifiers()) { return DBIdentifier.newIdentifier(name, id); String delimCase = getIdentifierConfiguration().getDelimitedCase(); String nonDelimCase = getIdentifierConfiguration().getSchemaCase(); String caseName = name; boolean delimit = !caseName.equals(name) || getIdentifierConfiguration().delimitAll(); return DBIdentifier.newIdentifier((delimit ? name : caseName), id, false, delimit, !delimCase.equals(CASE_PRESERVE));
public String convert(IdentifierConfiguration config, String rule, String name) { // Already using same delimiter, no need to convert if (!needsConversion(config)) { return name; } // Otherwise, remove delimiters and add appropriate delimiters IdentifierRule orule = getIdentifierConfiguration().getIdentifierRule(rule); IdentifierRule nrule = config.getIdentifierRule(rule); boolean delimit = isDelimited(config, orule, name); if (delimit) { name = removeDelimiters(config, orule, name, config.getLeadingDelimiter(), config.getTrailingDelimiter()); return delimit(getIdentifierConfiguration(), nrule, name, delimit); } return name; }
String delimCase = getIdentifierConfiguration().getDelimitedCase(); if (/* getNamingConfiguration().delimitAll() || */ name.isDelimited()) { if (CASE_UPPER.equals(delimCase)) { if (!getIdentifierConfiguration().delimitAll()) { String schemaCase = getIdentifierConfiguration().getSchemaCase(); if (CASE_LOWER.equals(schemaCase)) return DBIdentifier.toLower(sName);
/** * Converts the identifier to a format appropriate for the configuration using * the specified naming rule. * @param delimit If false, do not delimit. Otherwise, delimit if necessary. */ private String toDBName(String rule, String name, boolean delimit) { if (name == null) { return null; } if (getIdentifierConfiguration().getSupportsDelimitedIdentifiers() && delimit && getIdentifierConfiguration().delimitAll() && !Normalizer.isDelimited(name)) { return delimit(rule, name, true); } return convert(Normalizer.getNamingConfiguration(), rule, name); }
public String combineFull(IdentifierConfiguration config, String rule, String fullName) { if (!needsConversion(config)) { return fullName; } // Split String[] names = splitName(config, rule, fullName); // Convert for (int i = 0; i < names.length; i++) { names[i] = convert(config, rule, names[i]); } // Join return joinNames(config, config.getIdentifierRule(rule), names, config.getIdentifierDelimiter()); }
private IdentifierRule[] getNamingRules(String[] rules) { IdentifierRule[] nrules = new IdentifierRule[rules.length]; for (int i = 0; i < rules.length; i++) { nrules[i] = _config.getIdentifierRule(rules[i]); } return nrules; }
/** * Converts the identifier to a format appropriate for the configuration using * the default naming rule. * @param delimit If false, do not delimit. Otherwise, delimit if necessary. */ public String toDBName(String name, boolean delimit) { return toDBName(getIdentifierConfiguration().getDefaultIdentifierRule().getName(), name, delimit); }