@RequestMapping(method = RequestMethod.PUT, consumes = "application/json") @ResponseStatus(HttpStatus.OK) public AgreementRuleDTO update(@RequestBody AgreementRuleDTO dto) { AgreementRule rule = service.update( dto.getDestinationCode(), dto.getGoodsCode(), dto.isAllowed(), createVisasForService(dto), TEMP_USER_UID); return AgreementRuleDTO.build(rule); }
@RequestMapping( value = "/{destinationCode}/{goodsCode}", method = RequestMethod.GET, produces = "application/json") @ResponseStatus(HttpStatus.OK) public AgreementRuleDTO findByDestinationCodeAndGoodsCode( @PathVariable String destinationCode, @PathVariable String goodsCode) { AgreementRule rule = repository.findByDestinationCodeAndGoodsCode( destinationCode.trim().toUpperCase(), goodsCode.trim().toUpperCase()); if (rule == null) { throw SpTranspBizError.AGR_RULE_DOESNT_EXIST.exception(destinationCode, goodsCode); } return AgreementRuleDTO.build(rule); }
private List<AgreementRuleDTO> findByDestinationCode(String destinationCode) { List<AgreementRule> rules = repository.findByDestinationCode(destinationCode.trim().toUpperCase()); return AgreementRuleDTO.build(rules); }
private List<AgreementRuleDTO> findByGoodsCode(String goodsCode) { List<AgreementRule> rules = repository.findByGoodsCode(goodsCode.trim().toUpperCase()); return AgreementRuleDTO.build(rules); }
private List<AgreementRuleDTO> findAll() { List<AgreementRule> rules = repository.findAll(); return AgreementRuleDTO.build(rules); }