package uk.ac.ebi.spot.goci.service;

import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Service;

import java.io.IOException;

/**
 * Created by emma on 13/04/2016.
 *
 * @author emma
 *         <p>
 *         Create sheet from file, this is then used to read through each row
 */
@Service
public class SheetCreationService {

    public XSSFSheet createSheet(String fileName) throws InvalidFormatException, IOException {
        // Open file
        OPCPackage pkg = OPCPackage.open(fileName);
        XSSFWorkbook current = new XSSFWorkbook(pkg);
        pkg.close();
        return current.getSheetAt(0);
    }
}
@@ -98,16 +98,86 @@
 eption;%0A
+import org.apache.poi.openxml4j.exceptions.InvalidOperationException;%0A
 import o
@@ -216,16 +216,16 @@
 ackage;%0A
-
 import o
@@ -315,16 +315,68 @@
 rkbook;%0A
+import org.springframework.context.annotation.Lazy;%0A
 import o
@@ -598,16 +598,22 @@
 row%0A */%0A
+@Lazy%0A
 @Service
@@ -650,16 +650,16 @@
 vice %7B%0A%0A
-
     publ
@@ -742,16 +742,100 @@
 xception
+,%0A                                                         InvalidOperationException
  %7B%0A     

Add exception to method signature, and add additional annotation