vidakovic commented on code in PR #3994: URL: https://github.com/apache/fineract/pull/3994#discussion_r1721374235
########## custom/v3/note/service/src/main/java/org/apache/fineract/v3/note/service/NoteWritePlatformServiceImpl.java: ########## @@ -0,0 +1,227 @@ +/** + * 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.v3.note.service; + +import java.util.HashMap; +import java.util.Map; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.fineract.portfolio.client.domain.Client; +import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper; +import org.apache.fineract.portfolio.group.domain.Group; +import org.apache.fineract.portfolio.group.domain.GroupRepositoryWrapper; +import org.apache.fineract.portfolio.loanaccount.domain.Loan; +import org.apache.fineract.portfolio.loanaccount.domain.LoanRepositoryWrapper; +import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; +import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepository; +import org.apache.fineract.portfolio.loanaccount.exception.LoanTransactionNotFoundException; +import org.apache.fineract.portfolio.note.domain.Note; +import org.apache.fineract.portfolio.note.domain.NoteRepository; +import org.apache.fineract.portfolio.note.exception.NoteNotFoundException; +import org.apache.fineract.portfolio.note.exception.NoteResourceNotSupportedException; +import org.apache.fineract.portfolio.savings.domain.SavingsAccount; +import org.apache.fineract.portfolio.savings.domain.SavingsAccountRepositoryWrapper; +import org.apache.fineract.v3.note.data.NoteCreateRequest; +import org.apache.fineract.v3.note.data.NoteCreateResponse; +import org.apache.fineract.v3.note.data.NoteDeleteRequest; +import org.apache.fineract.v3.note.data.NoteDeleteResponse; +import org.apache.fineract.v3.note.data.NoteResponseData; +import org.apache.fineract.v3.note.data.NoteUpdateRequest; +import org.apache.fineract.v3.note.data.NoteUpdateResponse; +import org.springframework.stereotype.Service; + +@Slf4j +@Service +@RequiredArgsConstructor +public class NoteWritePlatformServiceImpl implements NoteWritePlatformService { + + private static final String NOTE = "note"; + + private final ClientRepositoryWrapper clientRepository; + private final GroupRepositoryWrapper groupRepository; + private final LoanRepositoryWrapper loanRepository; + private final SavingsAccountRepositoryWrapper savingsAccountRepository; + private final LoanTransactionRepository loanTransactionRepository; + private final NoteRepository noteRepository; + + // =========================================== Create Note =========================================== + + @Override + public NoteCreateResponse createNote(NoteCreateRequest createRequest) { Review Comment: Order of function scopes.... first PUBLIC then PRIVATE... these additional comments for create, update, delete blocks are not necessary if people can clearly read where the public functions are (on top of the class). Note: sometimes private functions make the code more readable, but if you look at the details you'll see that this is a lot of repetitive code... I would argue that the private functions are not helping the readability here and you might consider inlining that code in the public functions. My bet would be that the overall length of this class will be also shorter and people don't have to jump back and forth to understand what happens 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]
