コード例 #1
0
  @Override
  public ObjectId createThesisDefence(Date date, List<ObjectId> commissionParticipantIds) {
    ObjectId objectId = new ObjectId();
    ThesisDefence thesisDefence = new ThesisDefence(objectId, date);
    thesisDefence.setCommissionParticipantIds(commissionParticipantIds);
    mongoTemplate.save(thesisDefence);

    return objectId;
  }
コード例 #2
0
 @Override
 public boolean assignTeacherToCommissionForThesisDefence(
     Teacher teacher, ObjectId thesisDefenceId) {
   ThesisDefence defence = getThesisDefenceById(thesisDefenceId);
   if (defence != null) {
     List<ObjectId> commission = defence.getCommissionParticipantIds();
     if (commission == null) {
       commission = new ArrayList<ObjectId>();
     }
     if (!commission.contains(teacher)) {
       commission.add(teacher.getId());
       mongoTemplate.save(defence);
       return true;
     }
   }
   return false;
 }