001    package org.kuali.ole.deliver;
002    
003    import org.kuali.ole.ingest.FileUtil;
004    import org.kuali.ole.ingest.KrmsBuilder;
005    import org.kuali.ole.ingest.krms.builder.OleKrmsBuilder;
006    
007    import java.io.File;
008    import java.net.URL;
009    import java.util.List;
010    
011    /**
012     * Created with IntelliJ IDEA.
013     * User: peris
014     * Date: 10/31/12
015     * Time: 3:39 PM
016     * To change this template use File | Settings | File Templates.
017     */
018    public class LoadDefaultCirculationPoliciesBean {
019        private String fileName;
020        private OleKrmsBuilder circPolicyBuilder;
021    
022        public List<String> loadDefaultCircPolicies() throws Exception {
023            URL resource = getClass().getResource(fileName);
024            File file = new File(resource.toURI());
025            String fileContent = new FileUtil().readFile(file);
026            List<String> policies = circPolicyBuilder.persistKrmsFromFileContent(fileContent);
027            return policies;
028        }
029    
030        public String getFileName() {
031            return fileName;
032        }
033    
034        public void setFileName(String fileName) {
035            this.fileName = fileName;
036        }
037    
038        public OleKrmsBuilder getCircPolicyBuilder() {
039            return circPolicyBuilder;
040        }
041    
042        public void setCircPolicyBuilder(OleKrmsBuilder circPolicyBuilder) {
043            this.circPolicyBuilder = circPolicyBuilder;
044        }
045    }