View Javadoc

1   /*
2    * Copyright 2008 FatWire Corporation. All Rights Reserved.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *    http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package com.fatwire.gst.foundation.facade.runtag.render;
17  
18  import com.fatwire.gst.foundation.facade.runtag.AbstractTagRunner;
19  
20  /**
21   * <RENDER.LOOKUP KEY="name of lookup key" VARNAME="output variable name"
22   * SITE="site name" [TID="id of template or cselement"]
23   * [TTYPE="CSElement|Template"] [MATCH="x|x:|:x"] />
24   * 
25   * @author Dolf Dijkstra
26   * @since Apr 13, 2011
27   */
28  public class Lookup extends AbstractTagRunner {
29      public enum Match {
30          X("x"), XCOLON("x:"), COLONX(":x");
31          private final String pattern;
32  
33          Match(String pattern) {
34              this.pattern = pattern;
35          }
36      }
37  
38     
39  
40      public Lookup() {
41          super("RENDER.LOOKUP");
42      }
43  
44      public void setKey(String key) {
45          set("KEY", key);
46      }
47  
48      public void setVarname(String name) {
49          set("VARNAME", name);
50      }
51  
52      public void setSite(String site) {
53          set("SITE", site);
54      }
55  
56      public void setTid(String tid) {
57          set("TID", tid);
58      }
59  
60      public void setTtype(CallTemplate.Type ttype) {
61          set("TTYPE", ttype.name());
62      }
63  
64      public void setMatch(Match match) {
65          set("MATCH", match.pattern);
66      }
67  
68  }