// relations list
List<Map<String, Object>> relationsList = FastList.newInstance();
for (int r = 0; r < entity.getRelationsSize(); r++) {
Map<String, Object> relationMap = FastMap.newInstance();
ModelRelation relation = entity.getRelation(r);
List<Map<String, Object>> keysList = FastList.newInstance();
for (int km = 0; km < relation.getKeyMapsSize(); km++) {
Map<String, Object> keysMap = FastMap.newInstance();
ModelKeyMap keyMap = relation.getKeyMap(km);
String fieldName = null;
String relFieldName = null;
if (keyMap.getFieldName().equals(keyMap.getRelFieldName())) {
fieldName = keyMap.getFieldName();
relFieldName = "aa";
} else {
fieldName = keyMap.getFieldName();
relFieldName = keyMap.getRelFieldName();
}
keysMap.put("row", km + 1);
keysMap.put("fieldName", fieldName);
keysMap.put("relFieldName", relFieldName);
keysList.add(keysMap);
}
relationMap.put("title", relation.getTitle());
relationMap.put("description", relation.getDescription());
relationMap.put("relEntity", relation.getRelEntityName());
relationMap.put("fkName", relation.getFkName());
relationMap.put("type", relation.getType());
relationMap.put("length", relation.getType().length());
relationMap.put("keysList", keysList);
relationsList.add(relationMap);
}
// index list