private QueryEntity(Context context, Element element,
QueryEntity linkedEntity, ContextGroup coreContextGroup) throws ReportException {
super(loadClass(XML.getStringAttribute(element, ATTR_CLASS)),
XML.getStringAttribute(element, ATTR_IDENT, null, false));
if(!element.getName().equals(TAG)) {
throw new ReportException("Имя тега не соответствует " + TAG);
}
this.coreContextGroup = coreContextGroup;
atom = new Atom(element, context);
this.parent = linkedEntity;
String linkageEl = XML.getStringAttribute(element, LINKAGE, null, false);
if(linkageEl == null) {
linkage = LinkageMode.backward;
} else {
try {
linkage = LinkageMode.valueOf(linkageEl);
} catch (IllegalArgumentException ex) {
throw new ReportException("Неизвестное значение аттрибута " + LINKAGE);
}
}
Element subentitiesRoot = element.getChild(SUBENTITY);
if(subentitiesRoot != null) {
List subentities = subentitiesRoot.getChildren();
for(int i=0; i<subentities.size(); i++) {
Element subentity = (Element) subentities.get(i);
if(!subentity.getName().equals(TAG)) {
continue;
}
QueryEntity subren = new QueryEntity(context, subentity, this, coreContextGroup);
if(subren.getLinkage() == null) {
throw new ReportException("Отсутствует аттрибут " + LINKAGE);
}
children.add(subren);
}
}
}