1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.fatwire.gst.foundation.include;
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 import org.springframework.util.Assert;
22
23 import COM.FutureTense.Interfaces.ICS;
24
25 import com.fatwire.assetapi.data.AssetId;
26 import com.fatwire.gst.foundation.facade.runtag.render.CallTemplate.Style;
27
28
29
30
31
32 public class DefaultIncludeService implements IncludeService {
33
34 private final ICS ics;
35 private final Map<String, Include> map = new HashMap<String, Include>();
36
37 public DefaultIncludeService(final ICS ics) {
38 this.ics = ics;
39 }
40
41 public IncludeElement element(final String name, final String elementname) {
42 Assert.hasText(name);
43 Assert.hasText(elementname);
44 final IncludeElement i = new IncludeElement(ics, elementname);
45 map.put(name, i);
46 return i;
47 }
48
49 public IncludePage page(final String name, final String pagename, final Style style) {
50 Assert.hasText(name);
51 Assert.hasText(pagename);
52
53
54
55 final IncludePage i = new IncludePage(ics, pagename, style == null ? Style.pagelet : style);
56 map.put(name, i);
57 return i;
58
59 }
60
61 public IncludeTemplate template(final String name, final AssetId asset, final String tname) {
62 Assert.hasText(name);
63 Assert.hasText(tname);
64 Assert.notNull(asset);
65 final IncludeTemplate i = new IncludeTemplate(ics, asset, tname);
66 map.put(name, i);
67 return i;
68
69 }
70
71 public Include find(final String name) {
72 return map.get(name);
73 }
74
75 }