View Javadoc

1   package org.kuali.ole.deliver;
2   
3   import org.kuali.ole.ingest.FileUtil;
4   import org.kuali.ole.ingest.KrmsBuilder;
5   import org.kuali.ole.ingest.krms.builder.OleKrmsBuilder;
6   
7   import java.io.File;
8   import java.net.URL;
9   import java.util.List;
10  
11  /**
12   * Created with IntelliJ IDEA.
13   * User: peris
14   * Date: 10/31/12
15   * Time: 3:39 PM
16   * To change this template use File | Settings | File Templates.
17   */
18  public class LoadDefaultCirculationPoliciesBean {
19      private String fileName;
20      private OleKrmsBuilder circPolicyBuilder;
21  
22      public List<String> loadDefaultCircPolicies() throws Exception {
23          URL resource = getClass().getResource(fileName);
24          File file = new File(resource.toURI());
25          String fileContent = new FileUtil().readFile(file);
26          List<String> policies = circPolicyBuilder.persistKrmsFromFileContent(fileContent);
27          return policies;
28      }
29  
30      public String getFileName() {
31          return fileName;
32      }
33  
34      public void setFileName(String fileName) {
35          this.fileName = fileName;
36      }
37  
38      public OleKrmsBuilder getCircPolicyBuilder() {
39          return circPolicyBuilder;
40      }
41  
42      public void setCircPolicyBuilder(OleKrmsBuilder circPolicyBuilder) {
43          this.circPolicyBuilder = circPolicyBuilder;
44      }
45  }