Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For every entity type, we have different template generators which should be implementing from the following interface. These populator services responsible for actual template excel creation and parsing and saving the template excel while user is trying to import entity data

Code Block
package org.apache.fineract.infrastructure.bulkimport.service;

import org.apache.fineract.infrastructure.bulkimport.data.Result;

import org.apache.poi.ss.usermodel.Workbook;

public interface WorkBookPopulatorService {

    public Result generateTemplate(final Workbook workbook) ;
	public Result saveTemplate(final Workbook workbook) ;
}
Code Block
package org.apache.fineract.infrastructure.bulkimport.data;

import java.util.ArrayList;
import java.util.List;

public class Result {
   private List<String> errors = new ArrayList<>();
 
   public void addError(String message) {
        errors.add(message);
    }
    public List<String> getErrors() {
        return errors;
    }
    public boolean isSuccess() {
        return errors.isEmpty();
    }
}

...