1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.fatwire.gst.foundation.taglib;
17
18 import java.io.IOException;
19 import java.util.Arrays;
20 import javax.servlet.jsp.JspException;
21
22 import COM.FutureTense.Interfaces.ICS;
23
24 import com.fatwire.assetapi.data.AssetId;
25 import com.fatwire.gst.foundation.facade.assetapi.asset.ScatteredAssetAccessTemplate;
26
27 import org.apache.commons.lang.StringUtils;
28
29
30
31
32
33
34 public final class GetTagsTag extends GsfSimpleTag {
35
36 private String c;
37 private long cid;
38 private String name;
39
40
41
42
43
44
45 @Override
46 public void doTag() throws JspException, IOException {
47
48 final ICS ics = getICS();
49 final ScatteredAssetAccessTemplate t = new ScatteredAssetAccessTemplate(ics);
50
51
52
53
54 if (StringUtils.isBlank(c) || cid == 0) {
55 String tag = (String) t.readCurrent("gsttag").get("gsttag");
56 if (tag != null) {
57 getJspContext().setAttribute(name, Arrays.asList(tag.split(",")));
58 }
59 } else {
60 final AssetId id = t.createAssetId(c, cid);
61 String tag = (String) t.read(id, "gsttag").get("gsttag");
62 if (tag != null) {
63 getJspContext().setAttribute(name, Arrays.asList(tag.split(",")));
64 }
65 }
66
67 super.doTag();
68 }
69
70
71
72
73 public void setC(final String c) {
74 this.c = c;
75 }
76
77
78
79
80 public void setCid(final String cid) {
81 this.cid = Long.parseLong(cid);
82 }
83
84
85
86
87 public void setCid(final long cid) {
88 this.cid = cid;
89 }
90
91
92
93
94 public void setName(final String name) {
95 this.name = name;
96 }
97 }