class AccountCodePurposeController {

	@PostMapping("_update")
	@ResponseStatus(HttpStatus.OK)
	public AccountCodePurposeContractResponse updateAll(
			@RequestBody @Valid AccountCodePurposeContractRequest accountCodePurposeContractRequest,
			BindingResult errors) {
		accountCodePurposeService.validate(accountCodePurposeContractRequest, "updateAll", errors);
		if (errors.hasErrors()) {
			throw new CustomBindException(errors);
		}
		accountCodePurposeContractRequest.getRequestInfo().setAction("updateAll");
		accountCodePurposeService.fetchRelatedContracts(accountCodePurposeContractRequest);
		accountCodePurposeService.push(accountCodePurposeContractRequest);
		AccountCodePurposeContractResponse accountCodePurposeContractResponse = new AccountCodePurposeContractResponse();
		accountCodePurposeContractResponse.setAccountCodePurposes(new ArrayList<AccountCodePurposeContract>());
		for (AccountCodePurposeContract accountCodePurposeContract : accountCodePurposeContractRequest
				.getAccountCodePurposes()) {
			accountCodePurposeContractResponse.getAccountCodePurposes().add(accountCodePurposeContract);
		}

		accountCodePurposeContractResponse
				.setResponseInfo(getResponseInfo(accountCodePurposeContractRequest.getRequestInfo()));
		accountCodePurposeContractResponse.getResponseInfo().setStatus(HttpStatus.OK.toString());

		return accountCodePurposeContractResponse;
	}

}