Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.51 KB | None | 0 0
  1.     @Transactional
  2.     private void copyAllCategoryFromClinicTab(Hospital hospital, Department department) {
  3.         List<CompanyDefault> companyDefaults = companyDefaultRepository.findAllByEquipmentId(hospital.getEquipmentId());
  4.         if (Objects.nonNull(companyDefaults) && companyDefaults.size() > 0 && Objects.nonNull(companyDefaults.get(0))) {
  5.             SectionDefault clinical = companyDefaults.get(0).getSectionDefaults().stream().filter(sectionDefault -> sectionDefault.getName().equals("Clinical")).collect(Collectors.toList()).get(0);
  6.             if (Objects.nonNull(clinical)) {
  7.                 clinical.getCategories().stream().forEach(category -> {
  8.                     Category depCategory = new Category(category.getName(), StatusTabEnum.RED_STATUS, null, departmentRepository.findOne(department.getId()), null, category.getId(), category.getPosition());
  9.                     categoryRepository.save(depCategory);
  10.                     category.getOptionDefaults().stream().forEach(option -> {
  11.                         Option depOption = new Option(option.getName(), depCategory, StatusTabEnum.RED_STATUS, option.getId(), option.getPosition());
  12.                         optionRepository.save(depOption);
  13.                         option.getFeatureDefaults().stream().map(feature -> featureRepository.save(new Feature(feature.getDescription(), feature.isRfp(), depOption, true, feature.getId())))
  14.                                 .collect(Collectors.toList());
  15.                     });
  16.                 });
  17.             }
  18.         }
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement