josehernandezfintecheandomx commented on code in PR #3350: URL: https://github.com/apache/fineract/pull/3350#discussion_r1283637891
########## fineract-investor/src/main/java/org/apache/fineract/investor/domain/search/SearchedExternalAssetOwner.java: ########## @@ -0,0 +1,47 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.domain.search; + +import java.math.BigDecimal; +import java.time.LocalDate; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.apache.fineract.infrastructure.core.domain.ExternalId; +import org.apache.fineract.investor.data.ExternalTransferStatus; + +@Getter +@RequiredArgsConstructor +public class SearchedExternalAssetOwner { Review Comment: Done! data object updated and generated using a Mapper, here is a sample of this: <img width="1329" alt="Screenshot 2023-08-03 at 21 14 55" src="https://github.com/apache/fineract/assets/44206706/e94356ef-ade0-4059-89e2-24582b7621c8"> ########## fineract-investor/src/main/java/org/apache/fineract/investor/api/search/ExternalAssetOwnersSearchApiResource.java: ########## @@ -0,0 +1,54 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.api.search; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import lombok.RequiredArgsConstructor; +import org.apache.fineract.infrastructure.core.service.PagedRequest; +import org.apache.fineract.investor.service.search.domain.ExternalAssetOwnerSearchData; +import org.apache.fineract.investor.service.search.domain.ExternalAssetOwnerSearchRequest; +import org.springframework.data.domain.Page; +import org.springframework.stereotype.Component; + +@Path("/v1/external-asset-owner") +@Component +@Tag(name = "ExternalAssetOwnerSearchV1") +@RequiredArgsConstructor +public class ExternalAssetOwnersSearchApiResource implements ExternalAssetOwnersSearchApi { Review Comment: Done! Added in the `ExternalAssetOwnersApiResource` class and removed the `ExternalAssetOwnersSearchApiResource` ########## fineract-investor/src/main/java/org/apache/fineract/investor/service/search/ExternalAssetOwnerSearchService.java: ########## @@ -0,0 +1,77 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.service.search; + +import java.time.LocalDate; +import java.util.Objects; +import java.util.Optional; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.apache.fineract.infrastructure.core.service.PagedRequest; +import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; +import org.apache.fineract.investor.domain.search.SearchingExternalAssetOwnerRepository; +import org.apache.fineract.investor.service.search.domain.ExternalAssetOwnerSearchData; +import org.apache.fineract.investor.service.search.domain.ExternalAssetOwnerSearchRequest; +import org.apache.fineract.investor.service.search.mapper.ExternalAssetOwnerSearchDataMapper; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Component +@Transactional(readOnly = true) +@RequiredArgsConstructor +public class ExternalAssetOwnerSearchService { + + private final PlatformSecurityContext context; + private final SearchingExternalAssetOwnerRepository externalAssetOwnerRepository; + private final ExternalAssetOwnerSearchDataMapper externalAssetOwnerSearchDataMapper; + + public Page<ExternalAssetOwnerSearchData> searchInvestorData(PagedRequest<ExternalAssetOwnerSearchRequest> searchRequest) { + validateTextSearchRequest(searchRequest); + return executeSearch(searchRequest); + } + + private void validateTextSearchRequest(PagedRequest<ExternalAssetOwnerSearchRequest> searchRequest) { + Objects.requireNonNull(searchRequest, "searchRequest must not be null"); Review Comment: As we talked, we keep this, considering to be present the first items loaded without any parameter ########## fineract-investor/src/main/java/org/apache/fineract/investor/service/search/ExternalAssetOwnerSearchService.java: ########## @@ -0,0 +1,77 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.service.search; + +import java.time.LocalDate; +import java.util.Objects; +import java.util.Optional; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.apache.fineract.infrastructure.core.service.PagedRequest; +import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; +import org.apache.fineract.investor.domain.search.SearchingExternalAssetOwnerRepository; +import org.apache.fineract.investor.service.search.domain.ExternalAssetOwnerSearchData; +import org.apache.fineract.investor.service.search.domain.ExternalAssetOwnerSearchRequest; +import org.apache.fineract.investor.service.search.mapper.ExternalAssetOwnerSearchDataMapper; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Component +@Transactional(readOnly = true) +@RequiredArgsConstructor +public class ExternalAssetOwnerSearchService { + + private final PlatformSecurityContext context; + private final SearchingExternalAssetOwnerRepository externalAssetOwnerRepository; + private final ExternalAssetOwnerSearchDataMapper externalAssetOwnerSearchDataMapper; + + public Page<ExternalAssetOwnerSearchData> searchInvestorData(PagedRequest<ExternalAssetOwnerSearchRequest> searchRequest) { + validateTextSearchRequest(searchRequest); + return executeSearch(searchRequest); + } + + private void validateTextSearchRequest(PagedRequest<ExternalAssetOwnerSearchRequest> searchRequest) { + Objects.requireNonNull(searchRequest, "searchRequest must not be null"); + + context.isAuthenticated(); Review Comment: Done! Using platformUserRightsContext ########## fineract-investor/src/main/java/org/apache/fineract/investor/service/search/ExternalAssetOwnerSearchService.java: ########## @@ -0,0 +1,77 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.service.search; + +import java.time.LocalDate; +import java.util.Objects; +import java.util.Optional; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.apache.fineract.infrastructure.core.service.PagedRequest; +import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; +import org.apache.fineract.investor.domain.search.SearchingExternalAssetOwnerRepository; +import org.apache.fineract.investor.service.search.domain.ExternalAssetOwnerSearchData; +import org.apache.fineract.investor.service.search.domain.ExternalAssetOwnerSearchRequest; +import org.apache.fineract.investor.service.search.mapper.ExternalAssetOwnerSearchDataMapper; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Component +@Transactional(readOnly = true) +@RequiredArgsConstructor +public class ExternalAssetOwnerSearchService { + + private final PlatformSecurityContext context; + private final SearchingExternalAssetOwnerRepository externalAssetOwnerRepository; + private final ExternalAssetOwnerSearchDataMapper externalAssetOwnerSearchDataMapper; + + public Page<ExternalAssetOwnerSearchData> searchInvestorData(PagedRequest<ExternalAssetOwnerSearchRequest> searchRequest) { + validateTextSearchRequest(searchRequest); + return executeSearch(searchRequest); + } + + private void validateTextSearchRequest(PagedRequest<ExternalAssetOwnerSearchRequest> searchRequest) { + Objects.requireNonNull(searchRequest, "searchRequest must not be null"); + + context.isAuthenticated(); + } + + private Page<ExternalAssetOwnerSearchData> executeSearch(PagedRequest<ExternalAssetOwnerSearchRequest> searchRequest) { + Optional<ExternalAssetOwnerSearchRequest> request = searchRequest.getRequest(); Review Comment: Done! ########## fineract-investor/src/main/java/org/apache/fineract/investor/service/search/domain/ExternalAssetOwnerSearchData.java: ########## @@ -0,0 +1,45 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.service.search.domain; + +import java.math.BigDecimal; +import java.time.LocalDate; +import lombok.Data; +import org.apache.fineract.infrastructure.core.domain.ExternalId; +import org.apache.fineract.investor.data.ExternalTransferStatus; + +@Data +public class ExternalAssetOwnerSearchData { Review Comment: Done! data object updated and generated using a Mapper -- 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]
