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 javax.servlet.jsp.JspException;
20
21 import COM.FutureTense.Interfaces.ICS;
22
23 import com.fatwire.gst.foundation.properties.AssetApiPropertyDao;
24 import com.fatwire.gst.foundation.properties.Property;
25 import com.fatwire.gst.foundation.properties.PropertyDao;
26
27 import org.apache.commons.logging.Log;
28 import org.apache.commons.logging.LogFactory;
29
30
31
32
33
34
35
36 public final class GetPropertyAssetIdTag extends GsfSimpleTag {
37 private static final Log LOG = LogFactory.getLog("com.fatwire.gst.foundation.properties");
38 private String name;
39 private String property;
40
41
42
43
44
45
46 @Override
47 public void doTag() throws JspException, IOException {
48 final ICS ics = getICS();
49 PropertyDao propertyDao = AssetApiPropertyDao.getInstance(ics);
50 Property p = propertyDao.getProperty(property);
51 if (p != null) {
52 getJspContext().setAttribute(name, p.asAssetId());
53 } else {
54 LOG.info("Cannot find property: " + property + "'.");
55 }
56 super.doTag();
57 }
58
59
60
61
62 public void setName(final String name) {
63 this.name = name;
64 }
65
66
67
68
69 public void setProperty(final String property) {
70 this.property = property;
71 }
72 }