コード例 #1
0
 public LearningElementDto getSpecificLearningElement(String id) throws UnknownHostException {
   LearningElement leModel = dao.getSpecificLearningElement(id);
   LearningElementDto dto = new LearningElementDto();
   if (leModel != null) {
     dto.setId(leModel.getId());
     dto.setTitle(leModel.getTitle());
     dto.setDescription(leModel.getDescription());
     dto.setSubject(leModel.getSubject());
     dto.setUploadDate(leModel.getUploadDate());
     dto.setDownloads(leModel.getDownloads());
     dto.setRating(leModel.getRating());
     dto.setRev(leModel.getRev());
     dto.setStatus(leModel.getStatus());
     dto.setComments(leModel.getComments());
     dto.setUploadedBy(leModel.getUploadedBy());
     dto.setFilePath(leModel.getFilePath());
   }
   return dto;
 }
コード例 #2
0
 public List<LearningElementDto> getLearningElements() throws UnknownHostException {
   List<LearningElement> LOList = dao.getList();
   List<LearningElementDto> objects = new ArrayList<>();
   for (LearningElement model : LOList) {
     LearningElementDto dto = new LearningElementDto();
     dto.setId(model.getId());
     dto.setRating(model.getRating());
     dto.setTitle(model.getTitle());
     dto.setDescription(model.getDescription());
     dto.setSubject(model.getSubject());
     dto.setDownloads(model.getDownloads());
     dto.setUploadDate(model.getUploadDate());
     dto.setUploadedBy(model.getUploadedBy());
     dto.setComments(model.getComments());
     dto.setRev(model.getRev());
     dto.setStatus(model.getStatus());
     objects.add(dto);
   }
   return objects;
 }