use of ch.interlis.ili2c.metamodel.RoleDef in project ili2db by claeis.
the class TransferFromXtf method getAssociationId.
private String getAssociationId(IomObject iomObj, AssociationDef modelele) {
String tag = modelele.getScopedName(null);
String tid;
Iterator<ViewableTransferElement> rolei = modelele.getAttributesAndRoles2();
String sep = "";
tid = "";
while (rolei.hasNext()) {
ViewableTransferElement prop = rolei.next();
if (prop.obj instanceof RoleDef && !prop.embedded) {
String roleName = ((RoleDef) prop.obj).getName();
IomObject refObj = iomObj.getattrobj(roleName, 0);
String ref = null;
if (refObj != null) {
ref = refObj.getobjectrefoid();
}
if (ref != null) {
tid = tid + sep + ref;
sep = ":";
} else {
throw new IllegalStateException("REF required (" + tag + "/" + roleName + ")");
}
}
}
return tid;
}
use of ch.interlis.ili2c.metamodel.RoleDef in project ili2db by claeis.
the class Viewable2TableMapper method isReferenced.
private static boolean isReferenced(Viewable viewable) {
if (viewable instanceof AbstractClassDef) {
AbstractClassDef aclass = (AbstractClassDef) viewable;
Iterator<RoleDef> rolei = aclass.getDefinedTargetForRoles();
while (rolei.hasNext()) {
RoleDef role = rolei.next();
AssociationDef assoc = (AssociationDef) role.getContainer();
if (!assoc.isLightweight()) {
return true;
}
if (!role.isAssociationEmbedded()) {
// opposide role is embedded into opposide class, so opposide class references this viewable
return true;
}
}
}
return false;
}
Aggregations