use of org.dbflute.properties.DfDocumentProperties in project dbflute-core by dbflute.
the class Column method getForeignTableNameCommaStringWithHtmlHref.
public String getForeignTableNameCommaStringWithHtmlHref() {
// mainly for SchemaHTML
final StringBuilder sb = new StringBuilder();
final DfDocumentProperties prop = getProperties().getDocumentProperties();
final DfSchemaHtmlBuilder schemaHtmlBuilder = new DfSchemaHtmlBuilder(prop);
final String delimiter = ",<br>";
final List<ForeignKey> foreignKeyList = getForeignKeyList();
final int size = foreignKeyList.size();
if (size == 0) {
return " ";
}
for (int i = 0; i < size; i++) {
final ForeignKey fk = foreignKeyList.get(i);
final Table foreignTable = fk.getForeignTable();
sb.append(schemaHtmlBuilder.buildRelatedTableLink(fk, foreignTable, delimiter));
}
sb.delete(0, delimiter.length());
return sb.toString();
}
use of org.dbflute.properties.DfDocumentProperties in project dbflute-core by dbflute.
the class Column method getPrimaryKeyTitleForSchemaHtml.
public String getPrimaryKeyTitleForSchemaHtml() {
final DfDocumentProperties prop = getProperties().getDocumentProperties();
final String value = prop.resolveAttributeForSchemaHtml(_primaryKeyName);
if (value == null) {
return "";
}
final Table table = getTable();
final String title;
if (table.isUseSequence()) {
final String sequenceName = table.getDefinedSequenceName();
final BigDecimal minimumValue = table.getSequenceMinimumValue();
final StringBuilder optionSb = new StringBuilder();
if (minimumValue != null) {
if (optionSb.length() > 0) {
optionSb.append(",");
}
optionSb.append("minimum(" + minimumValue + ")");
}
final BigDecimal maximumValue = table.getSequenceMaximumValue();
if (maximumValue != null) {
if (optionSb.length() > 0) {
optionSb.append(",");
}
optionSb.append("maximum(" + maximumValue + ")");
}
final Integer incrementSize = table.getSequenceIncrementSize();
if (incrementSize != null) {
if (optionSb.length() > 0) {
optionSb.append(",");
}
optionSb.append("increment(" + incrementSize + ")");
}
final Integer cacheSize = table.getSequenceCacheSize();
if (cacheSize != null) {
if (optionSb.length() > 0) {
optionSb.append(",");
}
optionSb.append("dfcache(" + cacheSize + ")");
}
if (optionSb.length() > 0) {
optionSb.insert(0, ":");
}
title = _primaryKeyName + " :: sequence=" + sequenceName + optionSb;
} else {
title = _primaryKeyName;
}
return " title=\"" + prop.resolveAttributeForSchemaHtml(title) + "\"";
}
use of org.dbflute.properties.DfDocumentProperties in project dbflute-core by dbflute.
the class Column method getUniqueKeyTitleForSchemaHtml.
public String getUniqueKeyTitleForSchemaHtml() {
if (!isUnique()) {
return "";
}
final StringBuilder sb = new StringBuilder();
final List<Unique> uniqueList = getTable().getUniqueList();
for (Unique unique : uniqueList) {
if (!unique.hasSameColumn(this)) {
continue;
}
final String uniqueKeyName = unique.getName();
sb.append(sb.length() > 0 ? ", " : "");
if (uniqueKeyName != null && uniqueKeyName.trim().length() > 0) {
sb.append(uniqueKeyName).append("(");
} else {
sb.append("(");
}
final Map<Integer, String> indexColumnMap = unique.getIndexColumnMap();
final Set<Entry<Integer, String>> entrySet = indexColumnMap.entrySet();
final StringBuilder oneUniqueSb = new StringBuilder();
for (Entry<Integer, String> entry : entrySet) {
final String columnName = entry.getValue();
if (oneUniqueSb.length() > 0) {
oneUniqueSb.append(", ");
}
oneUniqueSb.append(columnName);
}
sb.append(oneUniqueSb);
sb.append(")");
}
final DfDocumentProperties prop = getProperties().getDocumentProperties();
final String title = prop.resolveAttributeForSchemaHtml(sb.toString());
return title != null ? " title=\"" + title + "\"" : "";
}
use of org.dbflute.properties.DfDocumentProperties in project dbflute-core by dbflute.
the class Column method getAlias.
/**
* Get the alias of the column.
* @return The column alias as String. (NotNull, EmptyAllowed: when no alias)
*/
public String getAlias() {
final DfDocumentProperties prop = getProperties().getDocumentProperties();
final String comment = _plainComment;
if (comment != null) {
final String alias = prop.extractAliasFromDbComment(comment);
if (alias != null) {
return alias;
}
}
return "";
}
Aggregations