Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
WidgetURIResolver |
|
| 3.0;3 |
1 | /* | |
2 | * Copyright 2005-2008 The Kuali Foundation | |
3 | * | |
4 | * | |
5 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
6 | * you may not use this file except in compliance with the License. | |
7 | * You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.opensource.org/licenses/ecl2.php | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
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 | * Imported into client style sheets to import other style sheets in our database into their stylesheet. | |
33 | * | |
34 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
35 | * | |
36 | */ | |
37 | 0 | public class WidgetURIResolver implements URIResolver { |
38 | ||
39 | 0 | private static final Logger LOG = Logger.getLogger(WidgetURIResolver.class); |
40 | ||
41 | public Source resolve(String href, String base) { | |
42 | ||
43 | try { | |
44 | 0 | EDocLiteService eDocSvc = KEWServiceLocator.getEDocLiteService(); |
45 | 0 | EDocLiteStyle widgetStyle = eDocSvc.getEDocLiteStyle(href); |
46 | 0 | return new StreamSource(new StringReader(widgetStyle.getXmlContent())); |
47 | ||
48 | 0 | } catch (Exception e) { |
49 | 0 | LOG.error("Error ocurred getting style " + href, e); |
50 | } | |
51 | 0 | return null; |
52 | } | |
53 | ||
54 | } |