G2A Many GEOs
SHARE
TWEET

Untitled

a guest Apr 9th, 2020 138 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public UupPotentialPrevention create(@NonNull Case admCase) {
  2.         checkArgument(admCase.getCitizen() != null, "Can't create UupPotentialPrevention, citizen is null, caseId = %s", admCase.getCaseId());
  3.         log.info("Creating UupPotentialPrevention, caseId = {}", admCase.getCaseId());
  4.         UupPrevention prevention = uupPreventionService.findByCitizenId(admCase.getCitizen().getCitizenId());
  5.         House house = houseService.findHouseByAddressId(admCase.getCommitAddress().getAddressId());
  6.         AdmDistrict district = house != null ? house.getDistrict() : null;
  7.  
  8.         if (prevention != null) {
  9.             if (uupPreventionService.hasActiveMonitoringWithCategory(prevention, UUP_PREVENTIVE_CATEGORY_OFFENSE_IN_FAMILY_RELATIONS)) {
  10.                 return null;
  11.             }
  12.             if (district == null || uupPreventionService.hasActiveMonitoring(admCase.getCitizen().getCitizenId())) {
  13.                 district = prevention.getDistrict();
  14.             }
  15.         }
  16.         UupPotentialPrevention entity = new UupPotentialPrevention();
  17.         entity.setAdmDistrict(district);
  18.         entity.setDepartment(district != null && district.getDepartment() != null ? district.getDepartment() : admCase.getDepartment());
  19.         entity.setAdmCase(admCase);
  20.         entity.setPreventiveCategory(listService.findElement(ListEntityItem.PREVENTIVE_CATEGORY, UUP_PREVENTIVE_CATEGORY_OFFENSE_IN_FAMILY_RELATIONS));
  21.  
  22.         if (admCase.getResolutions() != null) {
  23.             admCase.getResolutions().stream()
  24.                     .filter(r -> isAdmPunishmentResolutionType(r.getResolutionType().getReferenceId()))
  25.                     .findFirst()
  26.                     .map(Resolution::getMainPunishment)
  27.                     .map(Punishment::getPunishmentTypeElm)
  28.                     .ifPresent(entity::setMainPunishmentType);
  29.         }
  30.  
  31.         repository.save(entity);
  32.         log.info("created UupPotentialPrevention with id = {}", entity.getPotentialPreventionId());
  33.         return entity;
  34.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top