1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.fatwire.gst.foundation.facade.runtag.render;
18
19 import org.apache.commons.lang.StringUtils;
20
21 import COM.FutureTense.Cache.CacheManager;
22 import COM.FutureTense.Interfaces.ICS;
23
24 import com.fatwire.assetapi.data.AssetId;
25 import com.fatwire.gst.foundation.facade.runtag.AbstractTagRunner;
26 import com.openmarket.xcelerate.publish.PubConstants;
27
28
29
30
31
32
33
34 public final class LogDep extends AbstractTagRunner {
35 public LogDep() {
36 super("RENDER.LOGDEP");
37 }
38
39 public static enum DependencyType {
40 exact, exists, greater, none
41 }
42
43 public void setAsset(String s) {
44 set("ASSET", s);
45 }
46
47 public void setDeptype(DependencyType deptype) {
48 switch (deptype) {
49 case exact:
50 set("DEPTYPE", "exact");
51 break;
52 case exists:
53 set("DEPTYPE", "exists");
54 break;
55 case greater:
56 set("DEPTYPE", "greater");
57 break;
58 case none:
59 set("DEPTYPE", "none");
60 break;
61 }
62 }
63
64 public void setC(String s) {
65 set("c", s);
66 }
67
68 public void setCid(String s) {
69 set("cid", s);
70 }
71
72 public static void logDep(ICS ics, String c, String cid) {
73
74 String rm = StringUtils.defaultString(ics.GetVar(PubConstants.RENDERMODE), PubConstants.LIVE);
75 if (rm.startsWith(PubConstants.DEPS) || rm.startsWith(PubConstants.EXPORT)) {
76 LogDep ld = new LogDep();
77 ld.setC(c);
78 ld.setCid(cid);
79 ld.execute(ics);
80 } else {
81 CacheManager.RecordItem(ics, PubConstants.CACHE_PREFIX + cid + PubConstants.SEPARATOR + c);
82 }
83 }
84
85 public static void logDep(ICS ics, AssetId id) {
86 if (ics == null)
87 throw new IllegalArgumentException("ics must not be null");
88 if (id == null)
89 throw new IllegalArgumentException("id must not be null");
90 logDep(ics, id.getType(), Long.toString(id.getId()));
91 }
92 }