galovics commented on code in PR #4364:
URL: https://github.com/apache/fineract/pull/4364#discussion_r1967949188


##########
fineract-core/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/CustomDataSerializer.java:
##########
@@ -0,0 +1,30 @@
+/**
+ * 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.infrastructure.event.external.service.serialization.serializer;
+
+import java.nio.ByteBuffer;
+import java.util.Map;
+
+public interface CustomDataSerializer {

Review Comment:
   Also, I'd rename this to correspond more to the External Event framework.



##########
fineract-core/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/CustomDataSerializer.java:
##########
@@ -0,0 +1,30 @@
+/**
+ * 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.infrastructure.event.external.service.serialization.serializer;
+
+import java.nio.ByteBuffer;
+import java.util.Map;
+
+public interface CustomDataSerializer {
+
+    Map<String, ByteBuffer> serializeLoanCustomData(Long loanId);

Review Comment:
   Is it necessary to have these methods here specifically for Loans? The 
classname suggests a much more generic way of handling things.
   
   Based on the Avro schema, a serializer like this should have two methods 
with this signature:
   ```
   ByteBuffer serialize(BusinessEvent ...);
   
   String key();
   ```
   
   Where the first one serializes some data into a byte buffer and the second 
one just returns the key used for placing the byte buffer into the map.



##########
fineract-core/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/DefaultCustomDataSerializer.java:
##########
@@ -0,0 +1,36 @@
+/**
+ * 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.infrastructure.event.external.service.serialization.serializer;
+
+import java.nio.ByteBuffer;
+import java.util.Map;
+
+public class DefaultCustomDataSerializer implements CustomDataSerializer {

Review Comment:
   I really don't like this approach. This implementation doesn't do anything 
so why is it here even? 



##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanBusinessEventSerializer.java:
##########
@@ -56,6 +59,7 @@ public class LoanBusinessEventSerializer implements 
BusinessEventSerializer {
     private final LoanSummaryBalancesRepository loanSummaryBalancesRepository;
     @Lazy
     private final LoanSummaryProviderDelegate loanSummaryProviderDelegate;
+    private final CustomDataSerializer customDataSerializer;

Review Comment:
   No need for the "no implementations" case. Just refer to them as a 
List<CustomDataSerializer> and if there are no implementations, the list will 
just be empty.



-- 
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]

Reply via email to