}
@Override
public Attribute<?> getAttribute(String attrName, boolean mustExist) throws T2DBException {
Attribute<?> attribute = null;
Schema esch = getSchema(true);
if (esch == null) {
if (mustExist)
throw T2DBMsg.exception(D.D40114, getName(true));
} else {
AttributeDefinition<?> def = esch.getAttributeDefinition(attrName, mustExist);
if (def != null) {
attribute = def.getAttribute();
List<Chronicle> chronicles = new ArrayList<Chronicle>();
Chronicle chronicle = this;
int lastChronicleWithSchema = 0;
while (chronicle != null && !chronicle.isTopChronicle()) {
// if chronicle has schema and schema does not have the attribute then break
Schema sch = chronicle.getSchema(false);
if (sch != null) {
if (sch.getAttributeDefinition(def.getNumber(), false) == null)
break;
lastChronicleWithSchema = chronicles.size();
}
chronicles.add(chronicle);
chronicle = chronicle.getCollection();