1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.util.spring;
17
18 import java.util.ArrayList;
19 import java.util.Arrays;
20 import java.util.List;
21
22 import org.kuali.common.util.Project;
23 import org.kuali.common.util.ProjectContext;
24 import org.kuali.common.util.ProjectUtils;
25 import org.kuali.common.util.property.ProjectProperties;
26 import org.kuali.common.util.property.PropertiesContext;
27
28 public class ConfigUtils {
29
30 public static List<ProjectProperties> getProjectProperties(List<ProjectContext> contexts) {
31 List<ProjectProperties> list = new ArrayList<ProjectProperties>();
32 for (ProjectContext context : contexts) {
33 Project project = ProjectUtils.loadProject(context);
34 ProjectProperties pp = getProjectProperties(project, context.getPropertyLocations());
35 list.add(pp);
36 }
37 return list;
38 }
39
40 public static List<ProjectProperties> getProjectProperties(ProjectContext... contexts) {
41 return getProjectProperties(Arrays.asList(contexts));
42 }
43
44 public static ProjectProperties getProjectProperties(ProjectContext context) {
45 Project project = ProjectUtils.loadProject(context);
46 return getProjectProperties(project, context.getPropertyLocations());
47 }
48
49 public static ProjectProperties getProjectProperties(Project project, List<String> locations) {
50 PropertiesContext pc = new PropertiesContext();
51 pc.setEncoding(project.getEncoding());
52 pc.setLocations(locations);
53 return new ProjectProperties(project, pc);
54 }
55 }