View Javadoc

1   /*
2    * Copyright 2010 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.taglib;
17  
18  import java.io.IOException;
19  
20  import javax.servlet.jsp.JspException;
21  
22  import COM.FutureTense.Interfaces.ICS;
23  
24  import com.fatwire.gst.foundation.tagging.AssetTaggingService;
25  import com.fatwire.gst.foundation.tagging.TagUtils;
26  import com.fatwire.gst.foundation.tagging.db.TableTaggingServiceImpl;
27  
28  /**
29   * Tagged list tag support This JSP tag retrieves a list of assets that are
30   * 'tagged' with the same name.
31   * 
32   * @author Dolf Dijkstra
33   * @since Feb 14, 2011
34   * @see AssetTaggingService
35   */
36  public final class TaggedAssetsTag extends GsfSimpleTag {
37      private String tag = null;
38      private String list = null;
39  
40      /*
41       * (non-Javadoc)
42       * 
43       * @see javax.servlet.jsp.tagext.SimpleTagSupport#doTag()
44       */
45      @Override
46      public void doTag() throws JspException, IOException {
47  
48          final ICS ics = getICS();
49          final AssetTaggingService svc = new TableTaggingServiceImpl(ics);
50          getJspContext().setAttribute(list, svc.lookupTaggedAssets(TagUtils.asTag(tag)));
51          super.doTag();
52      }
53  
54      /**
55       * @param list the list to set
56       */
57      public void setList(final String list) {
58          this.list = list;
59      }
60  
61      public void setTag(final String tag) {
62          this.tag = tag;
63      }
64  
65  }