mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-07 11:32:16 +00:00
Bug 5085: fixed an issue regarding storing and loading associated roles
to the mongodb
This commit is contained in:
1 parent
b2c9db1524
commit
577aeb9308
2 files changed
+19
-15
No files matched your search
+16
-14
@@ -1885,23 +1885,25 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
|
||||
// load associated roles
|
||||
final ArrayList<?> markList = dbObject.get(FieldNames.RACE_LOG_COURSE_ASSOCIATED_ROLES.name(), ArrayList.class);
|
||||
for (final Object entry : markList) {
|
||||
if (entry instanceof Document) {
|
||||
final Document entryObject = (Document) entry;
|
||||
final UUID markUUID = UUID
|
||||
.fromString(entryObject.getString(FieldNames.RACE_LOG_COURSE_ASSOCIATED_ROLES_MARK_ID.name()));
|
||||
final Mark mark = baseDomainFactory.getExistingMarkById(markUUID);
|
||||
if (mark != null) {
|
||||
final String roleOrNull = entryObject
|
||||
.getString(FieldNames.RACE_LOG_COURSE_ASSOCIATED_ROLES_ROLE.name());
|
||||
if (roleOrNull != null) {
|
||||
courseData.getA().addRoleMapping(mark, roleOrNull);
|
||||
if (markList != null) {
|
||||
for (final Object entry : markList) {
|
||||
if (entry instanceof Document) {
|
||||
final Document entryObject = (Document) entry;
|
||||
final UUID markUUID = UUID.fromString(
|
||||
entryObject.getString(FieldNames.RACE_LOG_COURSE_ASSOCIATED_ROLES_MARK_ID.name()));
|
||||
final Mark mark = baseDomainFactory.getExistingMarkById(markUUID);
|
||||
if (mark != null) {
|
||||
final String roleOrNull = entryObject
|
||||
.getString(FieldNames.RACE_LOG_COURSE_ASSOCIATED_ROLES_ROLE.name());
|
||||
if (roleOrNull != null) {
|
||||
courseData.getA().addRoleMapping(mark, roleOrNull);
|
||||
}
|
||||
} else {
|
||||
logger.warning(String.format("Could not resolve mark with id %s for course %s.", markUUID, id));
|
||||
}
|
||||
} else {
|
||||
logger.warning(String.format("Could not resolve mark with id %s for course %s.", markUUID, id));
|
||||
logger.warning(String.format("Unexpected mark entry found for course %s.", id));
|
||||
}
|
||||
} else {
|
||||
logger.warning(String.format("Unexpected mark entry found for course %s.", id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -1240,7 +1240,9 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
|
||||
roleMap.add(mapping);
|
||||
});
|
||||
|
||||
result.put(FieldNames.RACE_LOG_COURSE_ASSOCIATED_ROLES.name(), roleMap);
|
||||
if (!roleMap.isEmpty()) {
|
||||
result.put(FieldNames.RACE_LOG_COURSE_ASSOCIATED_ROLES.name(), roleMap);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user