vidakovic commented on code in PR #6085:
URL: https://github.com/apache/fineract/pull/6085#discussion_r3537929326
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/address/service/AddressWritePlatformServiceImpl.java:
##########
@@ -29,51 +28,23 @@
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import
org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
import org.apache.fineract.infrastructure.core.service.DateUtils;
-import
org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.address.domain.Address;
import org.apache.fineract.portfolio.address.domain.AddressRepository;
-import
org.apache.fineract.portfolio.address.exception.AddressNotFoundException;
import
org.apache.fineract.portfolio.address.serialization.AddressCommandFromApiJsonDeserializer;
import org.apache.fineract.portfolio.client.domain.Client;
import org.apache.fineract.portfolio.client.domain.ClientAddress;
import org.apache.fineract.portfolio.client.domain.ClientAddressRepository;
-import
org.apache.fineract.portfolio.client.domain.ClientAddressRepositoryWrapper;
-import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class AddressWritePlatformServiceImpl implements
AddressWritePlatformService {
- private final PlatformSecurityContext context;
private final CodeValueRepository codeValueRepository;
private final ClientAddressRepository clientAddressRepository;
- private final ClientRepositoryWrapper clientRepositoryWrapper;
private final AddressRepository addressRepository;
- private final ClientAddressRepositoryWrapper
clientAddressRepositoryWrapper;
private final AddressCommandFromApiJsonDeserializer
fromApiJsonDeserializer;
- @Override
- public CommandProcessingResult addClientAddress(final Long clientId, final
Long addressTypeId, final JsonCommand command) {
- JsonObject jsonObject = command.parsedJson().getAsJsonObject();
- context.authenticatedUser();
- fromApiJsonDeserializer.validateForCreate(jsonObject.toString(),
false);
-
- final CodeValue addressTypeIdCodeValue =
codeValueRepository.getReferenceById(addressTypeId);
- final Client client =
clientRepositoryWrapper.findOneWithNotFoundDetection(clientId);
-
- final Address address = createAddress(jsonObject);
- addressRepository.save(address);
-
- final ClientAddress clientAddress = createClientAddress(client,
jsonObject, addressTypeIdCodeValue, address);
- clientAddressRepository.saveAndFlush(clientAddress);
-
- return new CommandProcessingResultBuilder() //
- .withCommandId(command.commandId()) //
- .withEntityId(clientAddress.getId()) //
- .build();
- }
-
@Override
public CommandProcessingResult addNewClientAddress(final Client client,
final JsonCommand command) {
Review Comment:
`CommandProcessingResult` belongs to the legacy command processing. Why is
this still here when we migrate things to new command processing? In other
words: a proper `XXXResponse` or `XXXData` POJO would be expected here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]