1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.contract.writer.service;
17
18 import java.util.List;
19
20 import org.kuali.student.contract.model.ServiceContractModel;
21 import org.kuali.student.contract.model.ServiceMethod;
22 import org.kuali.student.contract.model.impl.ServiceContractModelPescXsdLoader;
23 import org.kuali.student.contract.model.util.ModelFinder;
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
26
27
28
29
30
31 public class EachMethodServiceWriterForOneService {
32
33 private static Logger log = LoggerFactory.getLogger(EachMethodServiceWriterForOneService.class);
34
35 private ServiceContractModel model;
36 private ModelFinder finder;
37 private String directory;
38 private String rootPackage;
39 private String servKey;
40
41 public EachMethodServiceWriterForOneService(ServiceContractModel model,
42 String directory,
43 String rootPackage,
44 String servKey) {
45 this.model = model;
46 this.finder = new ModelFinder(model);
47 this.directory = directory;
48 this.rootPackage = rootPackage;
49 this.servKey = servKey;
50 }
51
52
53
54
55
56 public void write() {
57 List<ServiceMethod> methods = finder.getServiceMethodsInService(servKey);
58 if (methods.isEmpty()) {
59 log.warn("No methods defined for servKey: " + servKey);
60 return;
61 }
62
63
64 log.info("Generating info interfaces");
65 for (ServiceMethod method : methods) {
66 log.info("Generating method for service " + method.getService() + "." + method.getName());
67 new EachMethodServiceWriterForOneMethod(model, directory, rootPackage, servKey, method).write();
68 }
69
70 }
71
72 }