protected String getRelationMethodNameFor(Role role, boolean direct) { // when the two roles of a relation are played by the same class, // we need to give different names to the relation slots because both // will be in the same class return "getRelation" + role.getRelation().getName() + "()" + (direct ? "" : ".getInverseRelation()"); }
private static void generateManyToManyCollectionDescriptor(CollectionDescriptor collectionDescriptor, Role role) { String indirectionTableName = DbUtil.convertToDBStyle(role.getRelation().getName()); String fkToItemClass = DbUtil.getFkName(role.getType().getName()); String fkToThisClass = DbUtil.getFkName(role.getOtherRole().getType().getName()); if (fkToItemClass.equals(fkToThisClass)) { fkToItemClass = fkToItemClass + "_" + DbUtil.convertToDBStyle(role.getName()); fkToThisClass = fkToThisClass + "_" + DbUtil.convertToDBStyle(role.getOtherRole().getName()); } collectionDescriptor.setIndirectionTable(indirectionTableName); collectionDescriptor.addFkToItemClass(fkToItemClass); collectionDescriptor.addFkToThisClass(fkToThisClass); collectionDescriptor.setCascadingDelete(ObjectReferenceDescriptor.CASCADE_NONE); }
protected void generateRelationRegisterCall(String regMethodName, Role r0, Role r1, PrintWriter out) { String r0name = r0.getName(); String r1name = r1.getName(); print(out, TRANSACTION_SUPPORT_CLASS); print(out, "."); print(out, regMethodName); print(out, "(\""); print(out, getEntityFullName(r0.getRelation())); print(out, "\", arg1, \""); print(out, r1name == null ? "" : r1name); print(out, "\", arg0, \""); print(out, r0name == null ? "" : r0name); print(out, "\");"); }
String relationSlotName = role.getRelation().getName(); String directRelationType = getDirectRelationType(); String methodName = "getRelation" + role.getRelation().getName(); print(out, getRoleHandlerName(role, false)); print(out, ", \""); print(out, role.getRelation().getName()); print(out, "\""); generateDefaultRelationListeners(role, out);
String relationName = role.getRelation().getName(); print(out, getTypeFullName(role.getOtherRole().getType())); print(out, "."); print(out, role.getRelation().getName()); print(out, "\");");