for (Document d : oLst) {
String q = d.parents().get(0).id();
if (p.equals(q) && !d.id().equals(getId()) &&
d.attribute(aAttrs[a].name).toString().equals(get(aAttrs[a].name))) {
Log.out.debug(getTypeName()+" attribute "+aAttrs[a].name+" unique constraint violation for value "+get(aAttrs[a].name)+" parent document id. is "+p+" previous document id. is "+d.id()+" current document id. is "+getId());
throw new DmsException(getTypeName()+" attribute "+aAttrs[a].name+" unique constraint violation for value "+get(aAttrs[a].name));
} // fi
}
} // fi
}
} // fi (unique)
if (aAttrs[a].fk!=null && !isNull(aAttrs[a].name)) {
try {
BaseModelObject oObj = aAttrs[a].fk.doctype.newInstance();
if (null==oObj.exists(oAdm, aAttrs[a].fk.attrib, get(aAttrs[a].name).toString())) {
throw new DmsException(getTypeName()+" attribute "+aAttrs[a].name+" foreign key violation "+get(aAttrs[a].name).toString()+" referencing "+oObj.getTypeName()+"."+aAttrs[a].fk.attrib);
}
} catch (InstantiationException e) {
Log.out.error("BaseModelObject.save() InstantiationException "+e.getMessage());
} catch (IllegalAccessException e) {
Log.out.error("BaseModelObject.save() IllegalAccessException "+e.getMessage());
}
} // fi (foreign key)
if (aAttrs[a].cc!=null) {
if (!aAttrs[a].cc.check(oAdm, oIdx, this))
throw new DmsException(getTypeName()+" attribute "+aAttrs[a].name+" constraint violation "+aAttrs[a].cc.getClass().getName());
}
} // next
} finally {
if (oAdm!=null) {
if (oAdm.isConnected()) oAdm.disconnect();