1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.kew.edl;
18
19 import java.io.StringReader;
20
21 import javax.xml.transform.Source;
22 import javax.xml.transform.URIResolver;
23 import javax.xml.transform.stream.StreamSource;
24
25 import org.apache.log4j.Logger;
26 import org.kuali.rice.kew.edl.bo.EDocLiteStyle;
27 import org.kuali.rice.kew.edl.service.EDocLiteService;
28 import org.kuali.rice.kew.service.KEWServiceLocator;
29
30
31
32
33
34
35
36
37 public class WidgetURIResolver implements URIResolver {
38
39 private static final Logger LOG = Logger.getLogger(WidgetURIResolver.class);
40
41 public Source resolve(String href, String base) {
42
43 try {
44 EDocLiteService eDocSvc = KEWServiceLocator.getEDocLiteService();
45 EDocLiteStyle widgetStyle = eDocSvc.getEDocLiteStyle(href);
46 return new StreamSource(new StringReader(widgetStyle.getXmlContent()));
47
48 } catch (Exception e) {
49 LOG.error("Error ocurred getting style " + href, e);
50 }
51 return null;
52 }
53
54 }