package org.hibernate.metamodel.relational;
import java.util.Collections;
import org.hibernate.dialect.Dialect;
public class InLineView extends AbstractTableSpecification {
private final Schema schema;
private final String logicalName;
private final String select;
public InLineView(Schema schema, String logicalName, String select) {
this.schema = schema;
this.logicalName = logicalName;
this.select = select;
}
public Schema getSchema() {
return schema;
}
public String getSelect() {
return select;
}
@Override
public String getLoggableValueQualifier() {
return logicalName;
}
@Override
public Iterable<Index> getIndexes() {
return Collections.emptyList();
}
@Override
public Index getOrCreateIndex(String name) {
throw new UnsupportedOperationException( "Cannot create index on inline view" );
}
@Override
public Iterable<UniqueKey> getUniqueKeys() {
return Collections.emptyList();
}
@Override
public UniqueKey getOrCreateUniqueKey(String name) {
throw new UnsupportedOperationException( "Cannot create unique-key on inline view" );
}
@Override
public Iterable<CheckConstraint> getCheckConstraints() {
return Collections.emptyList();
}
@Override
public void addCheckConstraint(String checkCondition) {
throw new UnsupportedOperationException( "Cannot create check constraint on inline view" );
}
@Override
public Iterable<String> () {
return Collections.emptyList();
}
@Override
public void (String comment) {
throw new UnsupportedOperationException( "Cannot comment on inline view" );
}
@Override
public String getQualifiedName(Dialect dialect) {
return new StringBuilder( select.length() + 4 )
.append( "( " )
.append( select )
.append( " )" )
.toString();
}
@Override
public String toLoggableString() {
return "{inline-view}";
}
}